rockchip: hw_output: Support to set overscan directly

Signed-off-by: hmz007 <hmz007@gmail.com>
master
hmz007 5 years ago
parent a330c7247a
commit 01d53c55c9

@ -841,7 +841,7 @@ static int hw_output_set_screen_scale(struct hw_output_device* dev, int dpy, int
std::string propertyStr;
char property[PROPERTY_VALUE_MAX];
char overscan[128];
int left,top,right,bottom;
int left, top, right, bottom;
propertyStr = getPropertySuffix(priv, "persist.vendor.overscan.", dpy);
property_get(propertyStr.c_str(), property, "overscan 100,100,100,100");
@ -870,6 +870,14 @@ static int hw_output_set_screen_scale(struct hw_output_device* dev, int dpy, int
mBaseParameter->set_overscan_info(conn->get_type(), conn->id(), &overscan);
}
DrmConnector* mCurConnector = getValidDrmConnector(priv, dpy);
if (mCurConnector != NULL) {
DrmCrtc *crtc = priv->drm_->GetCrtcFromConnector(mCurConnector);
ALOGD("crtc %d: overscan %d,%d,%d,%d", crtc->id(), left, top, right, bottom);
if (mCurConnector->SetTvMargins(crtc, direction, value))
return -1;
}
return 0;
}

@ -190,6 +190,32 @@ void DrmConnector::SetDpmsMode(uint32_t dpms_mode) {
}
}
int DrmConnector::SetTvMargins(DrmCrtc *crtc, int direction, int value)
{
uint32_t obj_id = crtc->id();
uint32_t obj_type = DRM_MODE_OBJECT_CRTC;
uint32_t prop_id;
int ret;
if (direction == 0)
prop_id = crtc->left_margin_property().id();
else if (direction == 1)
prop_id = crtc->top_margin_property().id();
else if (direction == 2)
prop_id = crtc->right_margin_property().id();
else if (direction == 3)
prop_id = crtc->bottom_margin_property().id();
else
return -1;
ret = drmModeObjectSetProperty(drm_->fd(), obj_id, obj_type, prop_id, value);
if (ret < 0) {
ALOGE("Failed to set margin prop %d to %d, ret = %d", prop_id, value, ret);
}
return ret;
}
void DrmConnector::set_best_mode(const DrmMode &mode) {
best_mode_ = mode;
}

@ -60,6 +60,7 @@ class DrmConnector {
void set_active_mode(const DrmMode &mode);
void set_current_mode(const DrmMode &mode);
void SetDpmsMode(uint32_t dpms_mode);
int SetTvMargins(DrmCrtc *crtc, int direction, int value);
const DrmProperty &dpms_property() const;
const DrmProperty &crtc_id_property() const;
@ -94,8 +95,6 @@ class DrmConnector {
DrmEncoder *encoder_;
int display_;
uint32_t type_;
uint32_t type_id_;
drmModeConnection state_;

@ -257,6 +257,13 @@ int DrmResources::Init() {
break;
}
if (c->connection == DRM_MODE_DISCONNECTED &&
c->connector_type == DRM_MODE_CONNECTOR_eDP) {
drmModeFreeConnector(c);
ALOGD("Skip disconnected eDP (%d)", res->connectors[i]);
continue;
}
std::vector<DrmEncoder *> possible_encoders;
DrmEncoder *current_encoder = NULL;
for (int j = 0; j < c->count_encoders; ++j) {
@ -293,7 +300,7 @@ int DrmResources::Init() {
for (auto &conn : connectors_) {
if (!(conn->possible_displays() & HWC_DISPLAY_PRIMARY_BIT))
continue;
if (conn->built_in())
if (!conn->built_in())
continue;
if (conn->state() != DRM_MODE_CONNECTED)
continue;

Loading…
Cancel
Save