diff --git a/libgralloc-qsd8k/gpu.cpp b/libgralloc-qsd8k/gpu.cpp index 0dace4d..0a3ac33 100755 --- a/libgralloc-qsd8k/gpu.cpp +++ b/libgralloc-qsd8k/gpu.cpp @@ -280,7 +280,7 @@ void gpu_context_t::getGrallocInformationFromFormat(int inputFormat, int *colorF case (QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka ^ QOMX_3D_VIDEO_FLAG): { *colorFormat = HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED; - *halFormat = HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED | HAL_3D_IN_LR_SIDE | HAL_3D_OUT_LR_SIDE; + *halFormat = HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED | HAL_3D_IN_SIDE_BY_SIDE_HALF_L_R | HAL_3D_OUT_SIDE_BY_SIDE; } break; case QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka: { diff --git a/libgralloc-qsd8k/gralloc_priv.h b/libgralloc-qsd8k/gralloc_priv.h index 9057eff..cdb18dc 100755 --- a/libgralloc-qsd8k/gralloc_priv.h +++ b/libgralloc-qsd8k/gralloc_priv.h @@ -150,12 +150,14 @@ enum { /* possible formats for 3D content*/ enum { HAL_NO_3D = 0x00, - HAL_3D_IN_LR_SIDE = 0x10000, - HAL_3D_IN_LR_TOP = 0x20000, - HAL_3D_IN_LR_INTERLEAVE = 0x40000, - HAL_3D_OUT_LR_SIDE = 0x1000, - HAL_3D_OUT_LR_TOP = 0x2000, - HAL_3D_OUT_LR_INTERLEAVE = 0x4000 + HAL_3D_IN_SIDE_BY_SIDE_HALF_L_R = 0x10000, + HAL_3D_IN_TOP_BOTTOM = 0x20000, + HAL_3D_IN_INTERLEAVE = 0x40000, + HAL_3D_IN_SIDE_BY_SIDE_FULL = 0x80000, + HAL_3D_IN_SIDE_BY_SIDE_HALF_R_L = 0xC0000, + HAL_3D_OUT_SIDE_BY_SIDE = 0x1000, + HAL_3D_OUT_TOP_BOTTOM = 0x2000, + HAL_3D_OUT_INTERLEAVE = 0x4000, }; enum { diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp index 080705c..5a08aff 100644 --- a/liboverlay/overlay.cpp +++ b/liboverlay/overlay.cpp @@ -339,7 +339,18 @@ public: format3D |= fOut3D << SHIFT_3D; //Set the input format } if(!fOut3D) { - format3D |= fIn3D >> SHIFT_3D; //Set the output format + switch (fIn3D) { + case HAL_3D_IN_SIDE_BY_SIDE_HALF_L_R: + case HAL_3D_IN_SIDE_BY_SIDE_HALF_R_L: + case HAL_3D_IN_SIDE_BY_SIDE_FULL: + // For all side by side formats, set the output + // format as Side-by-Side i.e 0x1 + format3D |= HAL_3D_IN_SIDE_BY_SIDE_HALF_L_R >> SHIFT_3D; + break; + default: + format3D |= fIn3D >> SHIFT_3D; //Set the output format + break; + } } ctx->sharedMemBase = base; @@ -362,8 +373,14 @@ public: if (format3D) { bool res1, res2; - res1 = overlay->startControlChannel(1, false, format3D, 0); - res2 = overlay->startControlChannel(1, false, format3D, 1); + if (format3D & HAL_3D_IN_SIDE_BY_SIDE_HALF_R_L) { + // For R-L formats, set the Zorder of the second channel as 0 + res1 = overlay->startControlChannel(1, false, format3D, 1); + res2 = overlay->startControlChannel(1, false, format3D, 0); + } else { + res1 = overlay->startControlChannel(1, false, format3D, 0); + res2 = overlay->startControlChannel(1, false, format3D, 1); + } if (!res1 || !res2) { LOGE("Failed to start control channel for VG pipe 0 or 1"); overlay->closeControlChannel(0); @@ -492,7 +509,7 @@ public: if(ctx->format3D){ int wHDMI = obj->getFBWidth(1); int hHDMI = obj->getFBHeight(1); - if(ctx->format3D & HAL_3D_OUT_LR_SIDE_MASK) { + if(ctx->format3D & HAL_3D_OUT_SIDE_BY_SIDE_HALF_MASK) { ret = obj->setPosition(0, 0, wHDMI/2, hHDMI, 0); if (!ret) return -1; @@ -500,7 +517,7 @@ public: if (!ret) return -1; } - else if (ctx->format3D & HAL_3D_OUT_LR_TOP_MASK) { + else if (ctx->format3D & HAL_3D_OUT_TOP_BOTTOM_MASK) { ret = obj->setPosition(0, 0, wHDMI, hHDMI/2, 0); if (!ret) return -1; @@ -508,10 +525,11 @@ public: if (!ret) return -1; } - else if (ctx->format3D & HAL_3D_OUT_LR_INTERLEAVE_MASK) { + else if (ctx->format3D & HAL_3D_OUT_INTERLEAVE_MASK) { //TBD - } - else { + } else if (ctx->format3D & HAL_3D_OUT_SIDE_BY_SIDE_FULL_MASK) { + //TBD + } else { LOGE("%s: Unsupported 3D output format!!!", __func__); } } @@ -743,8 +761,8 @@ return 0; bool result; if (ctx->format3D) { - if ( (ctx->format3D & HAL_3D_OUT_LR_SIDE_MASK) || - (ctx->format3D & HAL_3D_OUT_LR_TOP_MASK) ) { + if ( (ctx->format3D & HAL_3D_OUT_SIDE_BY_SIDE_HALF_MASK) || + (ctx->format3D & HAL_3D_OUT_TOP_BOTTOM_MASK) ) { result = (ctx->pobjDataChannel[0] && ctx->pobjDataChannel[0]-> queueBuffer((uint32_t) buffer)); @@ -756,9 +774,11 @@ return 0; if (!result) LOGE("Queuebuffer failed for VG pipe 1"); } - else if (ctx->format3D & HAL_3D_OUT_LR_INTERLEAVE_MASK) { - } - else { + else if (ctx->format3D & HAL_3D_OUT_INTERLEAVE_MASK) { + //TBD + } else if (ctx->format3D & HAL_3D_OUT_SIDE_BY_SIDE_FULL_MASK) { + //TBD + } else { LOGE("%s:Unknown 3D Format...", __func__); } return 0; @@ -851,7 +871,8 @@ return 0; bool ret; // for the 3D usecase extract L and R channels from a frame if(ctx->format3D) { - if (ctx->format3D & HAL_3D_IN_LR_SIDE) { + if ((ctx->format3D & HAL_3D_IN_SIDE_BY_SIDE_HALF_L_R) || + (ctx->format3D & HAL_3D_IN_SIDE_BY_SIDE_HALF_R_L)) { ret = (ctx->pobjDataChannel[0] && ctx->pobjDataChannel[0]-> setCrop(0, 0, w/2, h)); @@ -867,7 +888,7 @@ return 0; return -1; } } - else if (ctx->format3D & HAL_3D_IN_LR_TOP) { + else if (ctx->format3D & HAL_3D_IN_TOP_BOTTOM) { ret = (ctx->pobjDataChannel[0] && ctx->pobjDataChannel[0]-> setCrop(0, 0, w, h/2)); @@ -883,10 +904,12 @@ return 0; return -1; } } - else if (ctx->format3D & HAL_3D_IN_LR_INTERLEAVE) { - //TBD + else if (ctx->format3D & HAL_3D_IN_INTERLEAVE) { + //TBD + } else if (ctx->format3D & HAL_3D_IN_SIDE_BY_SIDE_FULL) { + //TBD } - return 0; + return 0; } //For primary set Crop ctx->setCrop = 1; diff --git a/liboverlay/overlayLib.h b/liboverlay/overlayLib.h index 4c9675d..b5f8992 100644 --- a/liboverlay/overlayLib.h +++ b/liboverlay/overlayLib.h @@ -61,9 +61,10 @@ #define OUTPUT_MASK_3D 0x0000FFFF #define SHIFT_3D 16 // The output format is the 2MSB bytes. Shift the format by 12 to reflect this -#define HAL_3D_OUT_LR_SIDE_MASK (HAL_3D_OUT_LR_SIDE >> 12) -#define HAL_3D_OUT_LR_TOP_MASK (HAL_3D_OUT_LR_TOP >> 12) -#define HAL_3D_OUT_LR_INTERLEAVE_MASK (HAL_3D_OUT_LR_INTERLEAVE >> 12) +#define HAL_3D_OUT_SIDE_BY_SIDE_HALF_MASK ((HAL_3D_IN_SIDE_BY_SIDE_HALF_L_R|HAL_3D_IN_SIDE_BY_SIDE_HALF_R_L) >> SHIFT_3D) +#define HAL_3D_OUT_SIDE_BY_SIDE_FULL_MASK (HAL_3D_IN_SIDE_BY_SIDE_FULL >> SHIFT_3D) +#define HAL_3D_OUT_TOP_BOTTOM_MASK (HAL_3D_OUT_TOP_BOTTOM >> 12) +#define HAL_3D_OUT_INTERLEAVE_MASK (HAL_3D_OUT_INTERLEAVE >> 12) #define FORMAT_3D_FILE "/sys/class/graphics/fb1/format_3d" /* -------------------------- end 3D defines ----------------------------------------*/