1
0
Fork 0

rockchip: hw_output: Support to set overscan directly

Signed-off-by: hmz007 <hmz007@gmail.com>
master
hmz007 4 years ago
parent 30030c3779
commit 309aa8334c

@ -696,7 +696,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");
@ -725,6 +725,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;
}

@ -217,6 +217,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;
@ -95,8 +96,6 @@ class DrmConnector {
DrmEncoder *encoder_;
int display_;
uint32_t type_;
drmModeConnection state_;
bool force_disconnect_;

@ -244,6 +244,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) {
@ -280,7 +287,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