From 6fd8923a96d990f10833b40125bf6148c913f5e6 Mon Sep 17 00:00:00 2001 From: Paras Morabia Date: Tue, 31 Jan 2012 12:26:42 +0530 Subject: [PATCH] QCommUI/HWComposer: Allow application to set 3D format This change allows the application to set the S3D format for the surface. With this change application would be specifying 3D format and that would be handled by hwcomposer would handle it appropriately. Change-Id: I6b7b33712ab85b8a94231bd65a19709b3c2cd606 Conflicts: libqcomui/qcom_ui.cpp --- libhwcomposer/hwcomposer.cpp | 36 ++++++++++++++++++++++++++++++++++++ libqcomui/qcom_ui.h | 9 +++++++++ 2 files changed, 45 insertions(+) diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index 86b4dfc..0e20ad9 100644 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -741,6 +741,28 @@ static int getS3DVideoFormat (const hwc_layer_list_t* list) { return s3dFormat; } +static int getS3DFormat (const hwc_layer_list_t* list) { + int s3dFormat = 0; + if (list) { + for (size_t i=0; inumHwLayers; i++) { + private_handle_t *hnd = (private_handle_t *)list->hwLayers[i].handle; + if (hnd) + s3dFormat = FORMAT_3D_INPUT(hnd->format); + if (s3dFormat) + break; + } + } + return s3dFormat; +} + + +static int getLayerS3DFormat (hwc_layer_t &layer) { + int s3dFormat = 0; + private_handle_t *hnd = (private_handle_t *)layer.handle; + if (hnd) + s3dFormat = FORMAT_3D_INPUT(hnd->format); + return s3dFormat; +} static bool isS3DCompositionRequired() { #ifdef HDMI_AS_PRIMARY return overlay::is3DTV(); @@ -820,6 +842,9 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) { s3dVideoFormat = getS3DVideoFormat(list); if (s3dVideoFormat) isS3DCompositionNeeded = isS3DCompositionRequired(); + } else if((s3dVideoFormat = getS3DFormat(list))){ + if (s3dVideoFormat) + isS3DCompositionNeeded = isS3DCompositionRequired(); } else { unlockPreviousOverlayBuffer(ctx); } @@ -885,6 +910,17 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list) { unlockPreviousOverlayBuffer(ctx); skipComposition = false; } + } else if (getLayerS3DFormat(list->hwLayers[i])) { + int flags = WAIT_FOR_VSYNC; + flags |= (1 == list->numHwLayers) ? DISABLE_FRAMEBUFFER_FETCH : 0; +#ifdef USE_OVERLAY + if(prepareOverlay(ctx, &(list->hwLayers[i]), flags) == 0) { + list->hwLayers[i].compositionType = HWC_USE_OVERLAY; + list->hwLayers[i].hints |= HWC_HINT_CLEAR_FB; + // We've opened the channel. Set the state to open. + ctx->hwcOverlayStatus = HWC_OVERLAY_OPEN; + } +#endif } else if (isS3DCompositionNeeded) { markUILayerForS3DComposition(list->hwLayers[i], s3dVideoFormat); } else if (list->hwLayers[i].flags & HWC_USE_ORIGINAL_RESOLUTION) { diff --git a/libqcomui/qcom_ui.h b/libqcomui/qcom_ui.h index 8d90f7b..410ef70 100644 --- a/libqcomui/qcom_ui.h +++ b/libqcomui/qcom_ui.h @@ -47,6 +47,7 @@ using android::GraphicBuffer; enum { NATIVE_WINDOW_SET_BUFFERS_SIZE = 0x10000000, NATIVE_WINDOW_UPDATE_BUFFERS_GEOMETRY = 0x20000000, + NATIVE_WINDOW_SET_S3D_FORMAT = 0x40000000, }; // Enum containing the supported composition types @@ -249,6 +250,14 @@ bool needNewBuffer(const qBufGeometry currentGeometry, */ int updateBufferGeometry(sp buffer, const qBufGeometry bufGeometry); +/* + * Update the S3D format of this buffer. + * + * @param: buffer whosei S3D format needs to be updated. + * @param: Updated buffer S3D format + */ +int updateBufferS3DFormat(sp buffer, const int s3dFormat); + /* * Updates the flags for the layer *