egl/x11: Remove __DRI_IMAGE_FORMAT remnants

These are now immediately converted to a FourCC.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30245>
This commit is contained in:
Daniel Stone
2024-06-05 19:13:28 +01:00
committed by Marge Bot
parent 361f362258
commit 084cedb522
3 changed files with 19 additions and 20 deletions
+11 -11
View File
@@ -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) {
+1 -1
View File
@@ -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,
+7 -8
View File
@@ -32,6 +32,7 @@
#include <xcb/xfixes.h>
#include <xf86drm.h>
#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) {