hwcomposer: Store device orientation in hwc context

Instead of determining the device orientation based on the
layer orientation, use the value which comes from the framework

CRs-fixed: 382796
Change-Id: I83e87534fbfc62740a411f1324b2c12e88434b41
This commit is contained in:
Arun Kumar K.R 2012-07-27 19:49:03 -07:00
parent c1e7e4861a
commit 9813cf3bdc
3 changed files with 8 additions and 30 deletions

View File

@ -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;
}

View File

@ -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<ovutils::eTransform>(transform);
static_cast<ovutils::eTransform>(ctx->deviceOrientation);
ov.setTransform(orient, dest);
ovutils::Dim dim;

View File

@ -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;