Skip to content

Commit

Permalink
Add legacy dataspace value supporting
Browse files Browse the repository at this point in the history
In case of legacy dataspace value is passed down by
framework/av/media code.

Tracked-On: OAM-122156
Signed-off-by: ZhuChenyanX <[email protected]>
  • Loading branch information
ZhuChenyanX authored and chenyanxzhu committed Jul 11, 2024
1 parent f167e1d commit 128daca
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/util/u_gralloc/u_gralloc_imapper4_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,34 @@ mapper4_get_buffer_basic_info(struct u_gralloc *gralloc,
return 0;
}

static __inline__ Dataspace
_legacy_dataspace_to_v0(Dataspace ds)
{
switch((android_dataspace_t)ds) {
case HAL_DATASPACE_SRGB:
ds = Dataspace::SRGB;
break;
case HAL_DATASPACE_BT709:
ds = Dataspace::BT709;
break;
case HAL_DATASPACE_SRGB_LINEAR:
ds = Dataspace::SRGB_LINEAR;
break;
case HAL_DATASPACE_BT601_525:
ds = Dataspace::BT601_525;
break;
case HAL_DATASPACE_BT601_625:
ds = Dataspace::BT601_625;
break;
case HAL_DATASPACE_JFIF:
ds = Dataspace::JFIF;
break;
default:
break;
}
return ds;
}

static int
mapper4_get_buffer_color_info(struct u_gralloc *gralloc,
struct u_gralloc_buffer_handle *hnd,
Expand Down Expand Up @@ -261,6 +289,8 @@ mapper4_get_buffer_color_info(struct u_gralloc *gralloc,
android::gralloc4::decodeDataspace(encoded_dataspace, &dataspace);
if (status != android::OK)
return -EINVAL;
if ((int)dataspace & 0xffff)
dataspace = _legacy_dataspace_to_v0(dataspace);

Dataspace standard =
(Dataspace)((int)dataspace & (uint32_t)Dataspace::STANDARD_MASK);
Expand Down

0 comments on commit 128daca

Please sign in to comment.