u_gralloc: assign default u_gralloc_buffer_color_info

Gralloc is the central piece to align defaults and expectations across
different APIs. Doing so simplifies client side handling. To be noted,
midpoint chroma location is preferred as the default to skip the chroma
lowering pass. The same has been suggested by all Vulkan drivers with
AHB implemented and practiced for years under venus.

Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35613>
This commit is contained in:
Yiwei Zhang 2025-06-18 12:13:20 -07:00 committed by Marge Bot
parent 64d18f84b0
commit 4b68ed990b

View file

@ -126,18 +126,15 @@ u_gralloc_get_buffer_color_info(struct u_gralloc *gralloc,
struct u_gralloc_buffer_handle *hnd,
struct u_gralloc_buffer_color_info *out)
{
struct u_gralloc_buffer_color_info info = {0};
int ret;
if (gralloc->ops.get_buffer_color_info)
return gralloc->ops.get_buffer_color_info(gralloc, hnd, out);
if (!gralloc->ops.get_buffer_color_info)
return -ENOTSUP;
ret = gralloc->ops.get_buffer_color_info(gralloc, hnd, &info);
if (ret)
return ret;
*out = info;
*out = (struct u_gralloc_buffer_color_info){
.yuv_color_space = __DRI_YUV_COLOR_SPACE_ITU_REC601,
.sample_range = __DRI_YUV_NARROW_RANGE,
.horizontal_siting = __DRI_YUV_CHROMA_SITING_0_5,
.vertical_siting = __DRI_YUV_CHROMA_SITING_0_5,
};
return 0;
}