From 084cedb5226a867d54ab0c7f60d9347226f59cea Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 5 Jun 2024 19:13:28 +0100 Subject: [PATCH] egl/x11: Remove __DRI_IMAGE_FORMAT remnants These are now immediately converted to a FourCC. Signed-off-by: Daniel Stone Part-of: --- src/egl/drivers/dri2/platform_x11.c | 22 +++++++++++----------- src/egl/drivers/dri2/platform_x11.h | 2 +- src/egl/drivers/dri2/platform_x11_dri3.c | 15 +++++++-------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 3cfa6a01fb0..c66b2e3206e 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -54,6 +54,7 @@ #include "kopper_interface.h" #include "loader.h" #include "platform_x11.h" +#include "drm-uapi/drm_fourcc.h" #ifdef HAVE_DRI3 #include "platform_x11_dri3.h" @@ -1245,23 +1246,23 @@ dri2_x11_copy_buffers(_EGLDisplay *disp, _EGLSurface *surf, } uint32_t -dri2_format_for_depth(struct dri2_egl_display *dri2_dpy, uint32_t depth) +dri2_fourcc_for_depth(struct dri2_egl_display *dri2_dpy, uint32_t depth) { switch (depth) { case 16: - return __DRI_IMAGE_FORMAT_RGB565; + return DRM_FORMAT_RGB565; case 24: - return __DRI_IMAGE_FORMAT_XRGB8888; + return DRM_FORMAT_XRGB8888; case 30: /* Different preferred formats for different hw */ if (dri2_x11_get_red_mask_for_depth(dri2_dpy, 30) == 0x3ff) - return __DRI_IMAGE_FORMAT_XBGR2101010; + return DRM_FORMAT_XBGR2101010; else - return __DRI_IMAGE_FORMAT_XRGB2101010; + return DRM_FORMAT_XRGB2101010; case 32: - return __DRI_IMAGE_FORMAT_ARGB8888; + return DRM_FORMAT_ARGB8888; default: - return __DRI_IMAGE_FORMAT_NONE; + return DRM_FORMAT_INVALID; } } @@ -1279,7 +1280,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, xcb_get_geometry_cookie_t geometry_cookie; xcb_get_geometry_reply_t *geometry_reply; xcb_generic_error_t *error; - int format, fourcc; + int fourcc; (void)ctx; @@ -1310,15 +1311,14 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, return NULL; } - format = dri2_format_for_depth(dri2_dpy, geometry_reply->depth); - if (format == __DRI_IMAGE_FORMAT_NONE) { + fourcc = dri2_fourcc_for_depth(dri2_dpy, geometry_reply->depth); + if (fourcc == DRM_FORMAT_INVALID) { _eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr: unsupported pixmap depth"); free(buffers_reply); free(geometry_reply); return NULL; } - fourcc = loader_image_format_to_fourcc(format); dri2_img = malloc(sizeof *dri2_img); if (!dri2_img) { diff --git a/src/egl/drivers/dri2/platform_x11.h b/src/egl/drivers/dri2/platform_x11.h index 1882922ec7e..b1fd082bc70 100644 --- a/src/egl/drivers/dri2/platform_x11.h +++ b/src/egl/drivers/dri2/platform_x11.h @@ -10,7 +10,7 @@ #include "egl_dri2.h" uint32_t -dri2_format_for_depth(struct dri2_egl_display *dri2_dpy, uint32_t depth); +dri2_fourcc_for_depth(struct dri2_egl_display *dri2_dpy, uint32_t depth); EGLBoolean dri2_x11_get_msc_rate(_EGLDisplay *display, _EGLSurface *surface, diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index 1614512b377..6cd63362020 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -32,6 +32,7 @@ #include #include +#include "drm-uapi/drm_fourcc.h" #include "util/macros.h" #include "egl_dri2.h" @@ -293,7 +294,7 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, xcb_drawable_t drawable; xcb_dri3_buffer_from_pixmap_cookie_t bp_cookie; xcb_dri3_buffer_from_pixmap_reply_t *bp_reply; - unsigned int format, fourcc; + unsigned int fourcc; drawable = (xcb_drawable_t)(uintptr_t)buffer; bp_cookie = xcb_dri3_buffer_from_pixmap(dri2_dpy->conn, drawable); @@ -304,14 +305,13 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, return NULL; } - format = dri2_format_for_depth(dri2_dpy, bp_reply->depth); - if (format == __DRI_IMAGE_FORMAT_NONE) { + fourcc = dri2_fourcc_for_depth(dri2_dpy, bp_reply->depth); + if (fourcc == DRM_FORMAT_INVALID) { _eglError(EGL_BAD_PARAMETER, "dri3_create_image_khr: unsupported pixmap depth"); free(bp_reply); return EGL_NO_IMAGE_KHR; } - fourcc = loader_image_format_to_fourcc(format); dri2_img = malloc(sizeof *dri2_img); if (!dri2_img) { @@ -342,7 +342,7 @@ dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay *disp, _EGLContext *ctx, xcb_dri3_buffers_from_pixmap_cookie_t bp_cookie; xcb_dri3_buffers_from_pixmap_reply_t *bp_reply; xcb_drawable_t drawable; - unsigned int format, fourcc; + unsigned int fourcc; drawable = (xcb_drawable_t)(uintptr_t)buffer; bp_cookie = xcb_dri3_buffers_from_pixmap(dri2_dpy->conn, drawable); @@ -354,14 +354,13 @@ dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay *disp, _EGLContext *ctx, return EGL_NO_IMAGE_KHR; } - format = dri2_format_for_depth(dri2_dpy, bp_reply->depth); - if (format == __DRI_IMAGE_FORMAT_NONE) { + fourcc = dri2_fourcc_for_depth(dri2_dpy, bp_reply->depth); + if (fourcc == DRM_FORMAT_INVALID) { _eglError(EGL_BAD_PARAMETER, "dri3_create_image_khr: unsupported pixmap depth"); free(bp_reply); return EGL_NO_IMAGE_KHR; } - fourcc = loader_image_format_to_fourcc(format); dri2_img = malloc(sizeof *dri2_img); if (!dri2_img) {