From 072223c11d6a9990e55dfd2f0dc0844beb4dc3bb Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 18 Jun 2025 12:51:52 -0700 Subject: [PATCH] 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 Part-of: --- src/egl/drivers/dri2/platform_android.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 87ae6efee1f..31127918bc0 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -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);