Skip to content

gralloc: Add support for IMPLEMENTATION_DEFINED #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: lineage-18.1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gralloc/gralloc_gbm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ static uint32_t get_gbm_format(int format)
fmt = GBM_FORMAT_ARGB8888;
break;
case HAL_PIXEL_FORMAT_YV12:
case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
/* YV12 is planar, but must be a single buffer so ask for GR88 */
fmt = GBM_FORMAT_GR88;
break;
Expand Down Expand Up @@ -144,6 +145,7 @@ static int gralloc_gbm_get_bpp(int format)
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
case HAL_PIXEL_FORMAT_YCbCr_420_888:
case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
bpp = 1;
break;
default:
Expand Down Expand Up @@ -192,7 +194,7 @@ static struct gbm_bo *gbm_import(struct gbm_device *gbm,
data.height = handle->height;
data.format = format;
/* Adjust the width and height for a GBM GR88 buffer */
if (handle->format == HAL_PIXEL_FORMAT_YV12) {
if (handle->format == HAL_PIXEL_FORMAT_YV12 || handle->format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
data.width /= 2;
data.height += handle->height / 2;
}
Expand Down Expand Up @@ -518,6 +520,7 @@ int gralloc_gbm_bo_lock_ycbcr(buffer_handle_t handle,
ycbcr->chroma_step = 2;
break;
case HAL_PIXEL_FORMAT_YV12:
case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
ystride = hnd->width;
cstride = GRALLOC_ALIGN(ystride / 2, 16);
ycbcr->y = addr;
Expand Down