egl/android: clean up u_gralloc_get_buffer_color_info handling

No longer need the defaults, and can properly bail on real errors. The
behavior change of chroma sitting has been mentioned in the prior
commit, and doesn't affect gallium side.

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:51:52 -07:00 committed by Marge Bot
parent 4b68ed990b
commit 072223c11d

View file

@ -74,12 +74,7 @@ droid_create_image_from_native_buffer(_EGLDisplay *disp,
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct u_gralloc_buffer_basic_info buf_info;
struct u_gralloc_buffer_color_info color_info = {
.yuv_color_space = __DRI_YUV_COLOR_SPACE_ITU_REC601,
.sample_range = __DRI_YUV_NARROW_RANGE,
.horizontal_siting = __DRI_YUV_CHROMA_SITING_0,
.vertical_siting = __DRI_YUV_CHROMA_SITING_0,
};
struct u_gralloc_buffer_color_info color_info;
struct u_gralloc_buffer_handle gr_handle = {
.handle = buf->handle,
.hal_format = buf->format,
@ -89,10 +84,11 @@ droid_create_image_from_native_buffer(_EGLDisplay *disp,
if (u_gralloc_get_buffer_basic_info(dri2_dpy->gralloc, &gr_handle,
&buf_info))
return 0;
return NULL;
/* May fail in some cases, defaults will be used in that case */
u_gralloc_get_buffer_color_info(dri2_dpy->gralloc, &gr_handle, &color_info);
if (u_gralloc_get_buffer_color_info(dri2_dpy->gralloc, &gr_handle,
&color_info))
return NULL;
img = droid_create_image_from_buffer_info(dri2_dpy, buf->width, buf->height,
&buf_info, &color_info, priv);