mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
u_gralloc/mapper4: fill u_gralloc_buffer_color_info properly
Clients are expecting the color info to be fully filled when the api exists. Give proper defaults for the metadata to stay aligned with legacy backends. Also amend the missing ChromaSiting cases. Fixes:ee42e2166d("android: Introduce the Android buffer info abstraction") Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35613> (cherry picked from commit64d18f84b0)
This commit is contained in:
parent
8ce5dadcce
commit
1e63392359
2 changed files with 21 additions and 13 deletions
|
|
@ -6884,7 +6884,7 @@
|
|||
"description": "u_gralloc/mapper4: fill u_gralloc_buffer_color_info properly",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "ee42e2166d836251603b2b3e4801705d42d8f83d",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -197,26 +197,27 @@ mapper4_get_buffer_color_info(struct u_gralloc *gralloc,
|
|||
if (status != android::OK)
|
||||
return -EINVAL;
|
||||
|
||||
/* default to __DRI_YUV_COLOR_SPACE_ITU_REC601 */
|
||||
Dataspace standard =
|
||||
(Dataspace)((int)dataspace & (uint32_t)Dataspace::STANDARD_MASK);
|
||||
switch (standard) {
|
||||
case Dataspace::STANDARD_BT709:
|
||||
out->yuv_color_space = __DRI_YUV_COLOR_SPACE_ITU_REC709;
|
||||
break;
|
||||
case Dataspace::STANDARD_BT601_625:
|
||||
case Dataspace::STANDARD_BT601_625_UNADJUSTED:
|
||||
case Dataspace::STANDARD_BT601_525:
|
||||
case Dataspace::STANDARD_BT601_525_UNADJUSTED:
|
||||
out->yuv_color_space = __DRI_YUV_COLOR_SPACE_ITU_REC601;
|
||||
break;
|
||||
case Dataspace::STANDARD_BT2020:
|
||||
case Dataspace::STANDARD_BT2020_CONSTANT_LUMINANCE:
|
||||
out->yuv_color_space = __DRI_YUV_COLOR_SPACE_ITU_REC2020;
|
||||
break;
|
||||
case Dataspace::STANDARD_BT601_625:
|
||||
case Dataspace::STANDARD_BT601_625_UNADJUSTED:
|
||||
case Dataspace::STANDARD_BT601_525:
|
||||
case Dataspace::STANDARD_BT601_525_UNADJUSTED:
|
||||
default:
|
||||
out->yuv_color_space = __DRI_YUV_COLOR_SPACE_ITU_REC601;
|
||||
break;
|
||||
}
|
||||
|
||||
/* default to __DRI_YUV_NARROW_RANGE */
|
||||
Dataspace range =
|
||||
(Dataspace)((int)dataspace & (uint32_t)Dataspace::RANGE_MASK);
|
||||
switch (range) {
|
||||
|
|
@ -224,24 +225,31 @@ mapper4_get_buffer_color_info(struct u_gralloc *gralloc,
|
|||
out->sample_range = __DRI_YUV_FULL_RANGE;
|
||||
break;
|
||||
case Dataspace::RANGE_LIMITED:
|
||||
out->sample_range = __DRI_YUV_NARROW_RANGE;
|
||||
break;
|
||||
default:
|
||||
out->sample_range = __DRI_YUV_NARROW_RANGE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* default to __DRI_YUV_CHROMA_SITING_0_5 */
|
||||
if (chroma_siting) {
|
||||
switch (*chroma_siting) {
|
||||
case ChromaSiting::SITED_INTERSTITIAL:
|
||||
out->horizontal_siting = __DRI_YUV_CHROMA_SITING_0_5;
|
||||
out->vertical_siting = __DRI_YUV_CHROMA_SITING_0_5;
|
||||
break;
|
||||
case ChromaSiting::COSITED_HORIZONTAL:
|
||||
out->horizontal_siting = __DRI_YUV_CHROMA_SITING_0;
|
||||
out->vertical_siting = __DRI_YUV_CHROMA_SITING_0_5;
|
||||
break;
|
||||
case ChromaSiting::COSITED_VERTICAL:
|
||||
out->horizontal_siting = __DRI_YUV_CHROMA_SITING_0_5;
|
||||
out->vertical_siting = __DRI_YUV_CHROMA_SITING_0;
|
||||
break;
|
||||
case ChromaSiting::COSITED_BOTH:
|
||||
out->horizontal_siting = __DRI_YUV_CHROMA_SITING_0;
|
||||
out->vertical_siting = __DRI_YUV_CHROMA_SITING_0;
|
||||
break;
|
||||
case ChromaSiting::SITED_INTERSTITIAL:
|
||||
default:
|
||||
out->horizontal_siting = __DRI_YUV_CHROMA_SITING_0_5;
|
||||
out->vertical_siting = __DRI_YUV_CHROMA_SITING_0_5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue