diff options
author | Arne Coucheron <arco68@gmail.com> | 2020-01-08 14:58:01 +0100 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2020-01-13 17:31:10 +0100 |
commit | 8b5b438e398c030ec99fea19ab02f8c223b60e6a (patch) | |
tree | f99e28e723bed32a2e9ed33c5542119100ba86c5 | |
parent | 9614d2aa3e8b4ce5465cfacdc3b318c7f481ad2e (diff) | |
download | hardware_qcom_display-8b5b438e398c030ec99fea19ab02f8c223b60e6a.tar.gz hardware_qcom_display-8b5b438e398c030ec99fea19ab02f8c223b60e6a.tar.bz2 hardware_qcom_display-8b5b438e398c030ec99fea19ab02f8c223b60e6a.zip |
hwc: Put some bits in the right places
Fixup "hwc: Validate display ID in hwc interfaces"
Change-Id: I5e06b968e47683788317cdd9675242450f6cb28d
-rw-r--r-- | libhwcomposer/hwc.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index 5438962cf..9f06a51e1 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -305,13 +305,13 @@ static int hwc_eventControl(struct hwc_composer_device_1* dev, int dpy, int ret = 0; hwc_context_t* ctx = (hwc_context_t*)(dev); - if(!ctx->dpyAttr[dpy].isActive) { - ALOGE("Display is blanked - Cannot %s vsync", - enable ? "enable" : "disable"); + if(!validDisplay(dpy)) { return -EINVAL; } - if(!validDisplay(dpy)) { + if(!ctx->dpyAttr[dpy].isActive) { + ALOGE("Display is blanked - Cannot %s vsync", + enable ? "enable" : "disable"); return -EINVAL; } @@ -348,6 +348,10 @@ static int hwc_setPowerMode(struct hwc_composer_device_1* dev, int dpy, int ret = 0, value = 0; Locker::Autolock _l(ctx->mDrawLock); + if(!validDisplay(dpy)) { + return -EINVAL; + } + /* In case of non-hybrid WFD session, we are fooling SF by * piggybacking on HDMI display ID for virtual. * TODO: Not needed once we have WFD client working on top @@ -355,10 +359,6 @@ static int hwc_setPowerMode(struct hwc_composer_device_1* dev, int dpy, */ dpy = getDpyforExternalDisplay(ctx,dpy); - if(!validDisplay(dpy)) { - return -EINVAL; - } - ALOGD_IF(POWER_MODE_DEBUG, "%s: Setting mode %d on display: %d", __FUNCTION__, mode, dpy); @@ -729,13 +729,14 @@ int hwc_getDisplayConfigs(struct hwc_composer_device_1* dev, int disp, uint32_t* configs, size_t* numConfigs) { int ret = 0; hwc_context_t* ctx = (hwc_context_t*)(dev); - disp = getDpyforExternalDisplay(ctx, disp); Locker::Autolock _l(ctx->mDrawLock); if(!validDisplay(disp)) { return -EINVAL; } + disp = getDpyforExternalDisplay(ctx, disp); + //Currently we allow only 1 config, reported as config id # 0 //This config is passed in to getDisplayAttributes. Ignored for now. switch(disp) { @@ -765,13 +766,14 @@ int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp, uint32_t config, const uint32_t* attributes, int32_t* values) { hwc_context_t* ctx = (hwc_context_t*)(dev); - disp = getDpyforExternalDisplay(ctx, disp); Locker::Autolock _l(ctx->mDrawLock); if(!validDisplay(disp)) { return -EINVAL; } + disp = getDpyforExternalDisplay(ctx, disp); + //If hotpluggable displays(i.e, HDMI, WFD) are inactive return error if( (disp != HWC_DISPLAY_PRIMARY) && !ctx->dpyAttr[disp].connected) { return -1; |