From 1535f0a3dcf5cbe6de1bbc4de04f27e102781cc7 Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Thu, 26 Oct 2017 16:39:01 +1100 Subject: [PATCH] exynos4: libhwc: HWC 1.4 Change-Id: Ib446df60d59ddc304125d4887ac5adea8d72f9e6 --- exynos4/hal/libhwc/hwcomposer.cpp | 38 +++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/exynos4/hal/libhwc/hwcomposer.cpp b/exynos4/hal/libhwc/hwcomposer.cpp index 1433c58..9e9bfd8 100644 --- a/exynos4/hal/libhwc/hwcomposer.cpp +++ b/exynos4/hal/libhwc/hwcomposer.cpp @@ -1212,24 +1212,50 @@ static int hwc_eventControl(struct hwc_composer_device_1* dev, __unused int dpy, return -EINVAL; } -static int hwc_blank(struct hwc_composer_device_1 *dev, int dpy, int blank) +static int hwc_setPowerMode(struct hwc_composer_device_1 *dev, int dpy, int mode) { struct hwc_context_t* ctx = (struct hwc_context_t*)dev; int fence = 0; + int blank; - ALOGV("%s blank=%d", __FUNCTION__, blank); + ALOGV("%s mode=%d", __FUNCTION__, mode); fence = window_clear(ctx); if (fence != -1) close(fence); - if (ioctl(ctx->fb0_fd, FBIOBLANK, blank ? FB_BLANK_POWERDOWN : FB_BLANK_UNBLANK) < 0) { + + switch (mode) { + case HWC_POWER_MODE_OFF: + blank = FB_BLANK_POWERDOWN; + break; + case HWC_POWER_MODE_NORMAL: + blank = FB_BLANK_UNBLANK; + break; + default: + // FIXME DOZE and DOZE_SUSPEND are unsupported by the fb driver + return -EINVAL; + } + + if (ioctl(ctx->fb0_fd, FBIOBLANK, blank) < 0) { ALOGE("%s Error %s in FBIOBLANK blank=%d", __FUNCTION__, strerror(errno), blank); } return 0; } +static int hwc_getActiveConfig(struct hwc_composer_device_1 *dev, int disp) +{ + // we only support the primary display + return 0; +} + +static int hwc_setActiveConfig(struct hwc_composer_device_1 *dev, int dpy, int idx) +{ + // Only 1 config supported for the primary display + return (idx == 0) ? idx : -EINVAL; +} + static int hwc_query(struct hwc_composer_device_1* dev, int what, int* value) { @@ -1414,19 +1440,21 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name, // initialize the procs dev->device.common.tag = HARDWARE_DEVICE_TAG; - dev->device.common.version = HWC_DEVICE_API_VERSION_1_3; + dev->device.common.version = HWC_DEVICE_API_VERSION_1_4; dev->device.common.module = const_cast(module); dev->device.common.close = hwc_device_close; dev->device.prepare = hwc_prepare; dev->device.set = hwc_set; dev->device.eventControl = hwc_eventControl; - dev->device.blank = hwc_blank; + dev->device.setPowerMode = hwc_setPowerMode; dev->device.query = hwc_query; dev->device.registerProcs = hwc_registerProcs; dev->device.dump = hwc_dump; dev->device.getDisplayConfigs = hwc_getDisplayConfigs; dev->device.getDisplayAttributes = hwc_getDisplayAttributes; + dev->device.getActiveConfig = hwc_getActiveConfig; + dev->device.setActiveConfig = hwc_setActiveConfig; *device = &dev->device.common;