diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index 1acd2cd..d02f97a 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -110,7 +110,7 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) } static int hwc_eventControl(struct hwc_composer_device* dev, - int event, int enabled) + int event, int value) { int ret = 0; hwc_context_t* ctx = (hwc_context_t*)(dev); @@ -118,13 +118,16 @@ static int hwc_eventControl(struct hwc_composer_device* dev, ctx->mFbDev->common.module); switch(event) { case HWC_EVENT_VSYNC: - if(ioctl(m->framebuffer->fd, MSMFB_OVERLAY_VSYNC_CTRL, &enabled) < 0) + if(ioctl(m->framebuffer->fd, MSMFB_OVERLAY_VSYNC_CTRL, &value) < 0) ret = -errno; if(ctx->mExtDisplay->getExternalDisplay()) { - ret = ctx->mExtDisplay->enableHDMIVsync(enabled); + ret = ctx->mExtDisplay->enableHDMIVsync(value); } break; + case HWC_EVENT_ORIENTATION: + ctx->deviceOrientation = value; + break; default: ret = -EINVAL; } diff --git a/libhwcomposer/hwc_uimirror.cpp b/libhwcomposer/hwc_uimirror.cpp index fde69d0..1508fd5 100644 --- a/libhwcomposer/hwc_uimirror.cpp +++ b/libhwcomposer/hwc_uimirror.cpp @@ -27,30 +27,6 @@ namespace qhwc { -// Function to get the primary device orientation -// Loops thru the hardware layers and returns the orientation of the max. -// number of layers -int getDeviceOrientation(hwc_context_t* ctx, hwc_layer_list_t *list) { - int orientation = list->hwLayers[0].transform; - if(!ctx) { - ALOGE("In %s: ctx is NULL!!", __FUNCTION__); - return -1; - } - for(size_t i=0; i <= list->numHwLayers;i++ ) - { - for(size_t j=i+1; j <= list->numHwLayers; j++) - { - // Should we not check for the video layer orientation as it might - // source orientation(?) - if(list->hwLayers[i].transform == list->hwLayers[j].transform) - { - orientation = list->hwLayers[i].transform; - } - } - } - return orientation; -} - //Static Members ovutils::eOverlayState UIMirrorOverlay::sState = ovutils::OV_CLOSED; bool UIMirrorOverlay::sIsUiMirroringOn = false; @@ -120,10 +96,8 @@ bool UIMirrorOverlay::configure(hwc_context_t *ctx, hwc_layer_list_t *list) // x,y,w,h ovutils::Dim dcrop(0, 0, m->info.xres, m->info.yres); ov.setCrop(dcrop, dest); - //Get the current orientation on primary panel - int transform = getDeviceOrientation(ctx, list); ovutils::eTransform orient = - static_cast(transform); + static_cast(ctx->deviceOrientation); ov.setTransform(orient, dest); ovutils::Dim dim; diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h index 71c1f73..71592c4 100644 --- a/libhwcomposer/hwc_utils.h +++ b/libhwcomposer/hwc_utils.h @@ -124,6 +124,7 @@ struct hwc_context_t { hwc_composer_device_t device; int numHwLayers; int overlayInUse; + int deviceOrientation; //Framebuffer device framebuffer_device_t *mFbDev;