mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 18:20:10 +01:00
egl/wayland: Remove support for non-dmabuf wl_drm
wl_drm is the legacy protocol which is used to support EGL_WL_bind_wayland_display to exchange buffers between client and server. It's supported dmabuf for a very long time, and as a private protocol for Mesa's use, there is no need to carry around support for old codepaths, as all relevant drivers support dmabuf. Signed-off-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35885>
This commit is contained in:
parent
94b51503b3
commit
718ef151f2
8 changed files with 44 additions and 116 deletions
|
|
@ -65,3 +65,4 @@ VK_EXT_non_seamless_cube_map on panvk
|
|||
VK_ARM_shader_core_properties on panvk/v10+
|
||||
removed X11 DRI2 support
|
||||
removed EGL_MESA_drm_image
|
||||
removed pre-dmabuf wl_drm support
|
||||
|
|
|
|||
|
|
@ -2635,21 +2635,15 @@ dri2_destroy_image_khr(_EGLDisplay *disp, _EGLImage *image)
|
|||
#ifdef HAVE_WAYLAND_PLATFORM
|
||||
|
||||
static void
|
||||
dri2_wl_reference_buffer(void *user_data, uint32_t name, int fd,
|
||||
struct wl_drm_buffer *buffer)
|
||||
dri2_wl_reference_buffer(void *user_data, int fd, struct wl_drm_buffer *buffer)
|
||||
{
|
||||
_EGLDisplay *disp = user_data;
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
|
||||
if (fd == -1)
|
||||
buffer->driver_buffer = dri2_from_names(
|
||||
dri2_dpy->dri_screen_render_gpu, buffer->width, buffer->height,
|
||||
buffer->format, (int *)&name, 1, buffer->stride, buffer->offset, NULL);
|
||||
else
|
||||
buffer->driver_buffer = dri2_from_dma_bufs(
|
||||
dri2_dpy->dri_screen_render_gpu, buffer->width, buffer->height,
|
||||
buffer->format, DRM_FORMAT_MOD_INVALID, &fd, 1, buffer->stride,
|
||||
buffer->offset, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
buffer->driver_buffer = dri2_from_dma_bufs(
|
||||
dri2_dpy->dri_screen_render_gpu, buffer->width, buffer->height,
|
||||
buffer->format, DRM_FORMAT_MOD_INVALID, &fd, 1, buffer->stride,
|
||||
buffer->offset, 0, 0, 0, 0, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -2668,7 +2662,6 @@ dri2_bind_wayland_display_wl(_EGLDisplay *disp, struct wl_display *wl_dpy)
|
|||
.release_buffer = dri2_wl_release_buffer,
|
||||
.is_format_supported = dri2_wl_is_format_supported,
|
||||
};
|
||||
int flags = 0;
|
||||
char *device_name;
|
||||
|
||||
if (dri2_dpy->wl_server_drm)
|
||||
|
|
@ -2680,11 +2673,11 @@ dri2_bind_wayland_display_wl(_EGLDisplay *disp, struct wl_display *wl_dpy)
|
|||
if (!device_name)
|
||||
goto fail;
|
||||
|
||||
if (dri2_dpy->has_dmabuf_import && dri2_dpy->has_dmabuf_export)
|
||||
flags |= WAYLAND_DRM_PRIME;
|
||||
if (!dri2_dpy->has_dmabuf_import || !dri2_dpy->has_dmabuf_export)
|
||||
goto fail;
|
||||
|
||||
dri2_dpy->wl_server_drm =
|
||||
wayland_drm_init(wl_dpy, device_name, &wl_drm_callbacks, disp, flags);
|
||||
wayland_drm_init(wl_dpy, device_name, &wl_drm_callbacks, disp);
|
||||
|
||||
free(device_name);
|
||||
|
||||
|
|
|
|||
|
|
@ -595,12 +595,8 @@ dri2_set_WL_bind_wayland_display(_EGLDisplay *disp)
|
|||
#ifdef HAVE_WAYLAND_PLATFORM
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
|
||||
int capabilities;
|
||||
|
||||
capabilities =
|
||||
dri2_get_capabilities(dri2_dpy->dri_screen_render_gpu);
|
||||
disp->Extensions.WL_bind_wayland_display =
|
||||
(capabilities & __DRI_IMAGE_CAP_GLOBAL_NAMES) != 0;
|
||||
dri2_dpy->has_dmabuf_import && dri2_dpy->has_dmabuf_export;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,11 +59,31 @@ buffer_destroy(struct wl_client *client, struct wl_resource *resource)
|
|||
}
|
||||
|
||||
static void
|
||||
create_buffer(struct wl_client *client, struct wl_resource *resource,
|
||||
uint32_t id, uint32_t name, int fd, int32_t width, int32_t height,
|
||||
uint32_t format, int32_t offset0, int32_t stride0,
|
||||
int32_t offset1, int32_t stride1, int32_t offset2,
|
||||
int32_t stride2)
|
||||
drm_create_buffer(struct wl_client *client, struct wl_resource *resource,
|
||||
uint32_t id, uint32_t name, int32_t width, int32_t height,
|
||||
uint32_t stride, uint32_t format)
|
||||
{
|
||||
wl_resource_post_error(resource, WL_DRM_ERROR_INVALID_NAME,
|
||||
"global GEM names are no longer supported");
|
||||
}
|
||||
|
||||
static void
|
||||
drm_create_planar_buffer(struct wl_client *client, struct wl_resource *resource,
|
||||
uint32_t id, uint32_t name, int32_t width,
|
||||
int32_t height, uint32_t format, int32_t offset0,
|
||||
int32_t stride0, int32_t offset1, int32_t stride1,
|
||||
int32_t offset2, int32_t stride2)
|
||||
{
|
||||
wl_resource_post_error(resource, WL_DRM_ERROR_INVALID_NAME,
|
||||
"global GEM names are no longer supported");
|
||||
}
|
||||
|
||||
static void
|
||||
drm_create_prime_buffer(struct wl_client *client, struct wl_resource *resource,
|
||||
uint32_t id, int fd, int32_t width, int32_t height,
|
||||
uint32_t format, int32_t offset0, int32_t stride0,
|
||||
int32_t offset1, int32_t stride1, int32_t offset2,
|
||||
int32_t stride2)
|
||||
{
|
||||
struct wl_drm *drm = wl_resource_get_user_data(resource);
|
||||
struct wl_drm_buffer *buffer;
|
||||
|
|
@ -115,7 +135,8 @@ create_buffer(struct wl_client *client, struct wl_resource *resource,
|
|||
break;
|
||||
}
|
||||
|
||||
drm->callbacks.reference_buffer(drm->user_data, name, fd, buffer);
|
||||
drm->callbacks.reference_buffer(drm->user_data, fd, buffer);
|
||||
close(fd);
|
||||
if (buffer->driver_buffer == NULL) {
|
||||
wl_resource_post_error(resource, WL_DRM_ERROR_INVALID_NAME,
|
||||
"invalid name");
|
||||
|
|
@ -135,71 +156,6 @@ create_buffer(struct wl_client *client, struct wl_resource *resource,
|
|||
buffer, destroy_buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
drm_create_buffer(struct wl_client *client, struct wl_resource *resource,
|
||||
uint32_t id, uint32_t name, int32_t width, int32_t height,
|
||||
uint32_t stride, uint32_t format)
|
||||
{
|
||||
switch (format) {
|
||||
case WL_DRM_FORMAT_ABGR2101010:
|
||||
case WL_DRM_FORMAT_XBGR2101010:
|
||||
case WL_DRM_FORMAT_ARGB2101010:
|
||||
case WL_DRM_FORMAT_XRGB2101010:
|
||||
case WL_DRM_FORMAT_ARGB8888:
|
||||
case WL_DRM_FORMAT_XRGB8888:
|
||||
case WL_DRM_FORMAT_BGR888:
|
||||
case WL_DRM_FORMAT_RGB888:
|
||||
case WL_DRM_FORMAT_YUYV:
|
||||
case WL_DRM_FORMAT_RGB565:
|
||||
break;
|
||||
default:
|
||||
wl_resource_post_error(resource, WL_DRM_ERROR_INVALID_FORMAT,
|
||||
"invalid format");
|
||||
return;
|
||||
}
|
||||
|
||||
create_buffer(client, resource, id, name, -1, width, height, format, 0,
|
||||
stride, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
drm_create_planar_buffer(struct wl_client *client, struct wl_resource *resource,
|
||||
uint32_t id, uint32_t name, int32_t width,
|
||||
int32_t height, uint32_t format, int32_t offset0,
|
||||
int32_t stride0, int32_t offset1, int32_t stride1,
|
||||
int32_t offset2, int32_t stride2)
|
||||
{
|
||||
switch (format) {
|
||||
case WL_DRM_FORMAT_YUV410:
|
||||
case WL_DRM_FORMAT_YUV411:
|
||||
case WL_DRM_FORMAT_YUV420:
|
||||
case WL_DRM_FORMAT_YUV422:
|
||||
case WL_DRM_FORMAT_YUV444:
|
||||
case WL_DRM_FORMAT_NV12:
|
||||
case WL_DRM_FORMAT_NV16:
|
||||
break;
|
||||
default:
|
||||
wl_resource_post_error(resource, WL_DRM_ERROR_INVALID_FORMAT,
|
||||
"invalid format");
|
||||
return;
|
||||
}
|
||||
|
||||
create_buffer(client, resource, id, name, -1, width, height, format, offset0,
|
||||
stride0, offset1, stride1, offset2, stride2);
|
||||
}
|
||||
|
||||
static void
|
||||
drm_create_prime_buffer(struct wl_client *client, struct wl_resource *resource,
|
||||
uint32_t id, int fd, int32_t width, int32_t height,
|
||||
uint32_t format, int32_t offset0, int32_t stride0,
|
||||
int32_t offset1, int32_t stride1, int32_t offset2,
|
||||
int32_t stride2)
|
||||
{
|
||||
create_buffer(client, resource, id, 0, fd, width, height, format, offset0,
|
||||
stride0, offset1, stride1, offset2, stride2);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
static void
|
||||
drm_authenticate(struct wl_client *client, struct wl_resource *resource,
|
||||
uint32_t id)
|
||||
|
|
@ -226,7 +182,6 @@ bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id)
|
|||
{
|
||||
struct wl_drm *drm = data;
|
||||
struct wl_resource *resource;
|
||||
uint32_t capabilities;
|
||||
|
||||
resource =
|
||||
wl_resource_create(client, &wl_drm_interface, MIN(version, 2), id);
|
||||
|
|
@ -277,18 +232,15 @@ bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id)
|
|||
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_NV16);
|
||||
wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUYV);
|
||||
|
||||
capabilities = 0;
|
||||
if (drm->flags & WAYLAND_DRM_PRIME)
|
||||
capabilities |= WL_DRM_CAPABILITY_PRIME;
|
||||
|
||||
if (version >= 2)
|
||||
wl_resource_post_event(resource, WL_DRM_CAPABILITIES, capabilities);
|
||||
if (version >= 2) {
|
||||
wl_resource_post_event(resource, WL_DRM_CAPABILITIES,
|
||||
WL_DRM_CAPABILITY_PRIME);
|
||||
}
|
||||
}
|
||||
|
||||
struct wl_drm *
|
||||
wayland_drm_init(struct wl_display *display, char *device_name,
|
||||
const struct wayland_drm_callbacks *callbacks, void *user_data,
|
||||
uint32_t flags)
|
||||
const struct wayland_drm_callbacks *callbacks, void *user_data)
|
||||
{
|
||||
struct wl_drm *drm;
|
||||
|
||||
|
|
@ -300,7 +252,6 @@ wayland_drm_init(struct wl_display *display, char *device_name,
|
|||
drm->device_name = strdup(device_name);
|
||||
drm->callbacks = *callbacks;
|
||||
drm->user_data = user_data;
|
||||
drm->flags = flags;
|
||||
|
||||
drm->buffer_interface.destroy = buffer_destroy;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ struct wl_drm_buffer;
|
|||
struct wayland_drm_callbacks {
|
||||
int (*authenticate)(void *user_data, uint32_t id);
|
||||
|
||||
void (*reference_buffer)(void *user_data, uint32_t name, int fd,
|
||||
void (*reference_buffer)(void *user_data, int fd,
|
||||
struct wl_drm_buffer *buffer);
|
||||
|
||||
void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer);
|
||||
|
|
@ -24,7 +24,6 @@ struct wl_drm {
|
|||
|
||||
void *user_data;
|
||||
char *device_name;
|
||||
uint32_t flags;
|
||||
|
||||
struct wayland_drm_callbacks callbacks;
|
||||
|
||||
|
|
@ -42,8 +41,6 @@ struct wl_drm_buffer {
|
|||
void *driver_buffer;
|
||||
};
|
||||
|
||||
enum { WAYLAND_DRM_PRIME = 0x01 };
|
||||
|
||||
static inline struct wl_drm_buffer *
|
||||
wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource)
|
||||
{
|
||||
|
|
@ -59,8 +56,7 @@ wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource)
|
|||
|
||||
struct wl_drm *
|
||||
wayland_drm_init(struct wl_display *display, char *device_name,
|
||||
const struct wayland_drm_callbacks *callbacks, void *user_data,
|
||||
uint32_t flags);
|
||||
const struct wayland_drm_callbacks *callbacks, void *user_data);
|
||||
|
||||
void
|
||||
wayland_drm_uninit(struct wl_drm *drm);
|
||||
|
|
|
|||
|
|
@ -1817,12 +1817,6 @@ dri2_unmap_image(struct dri_context *ctx, struct dri_image *image, void *data)
|
|||
pipe_texture_unmap(pipe, (struct pipe_transfer *)data);
|
||||
}
|
||||
|
||||
int
|
||||
dri2_get_capabilities(struct dri_screen *screen)
|
||||
{
|
||||
return (screen->can_share_buffer ? __DRI_IMAGE_CAP_GLOBAL_NAMES : 0);
|
||||
}
|
||||
|
||||
int
|
||||
dri_interop_query_device_info(struct dri_context *ctx,
|
||||
struct mesa_glinterop_device_info *out)
|
||||
|
|
|
|||
|
|
@ -272,8 +272,6 @@ dri2_blit_image(struct dri_context *ctx, struct dri_image *dst, struct dri_image
|
|||
int dstx0, int dsty0, int dstwidth, int dstheight,
|
||||
int srcx0, int srcy0, int srcwidth, int srcheight,
|
||||
int flush_flag);
|
||||
PUBLIC int
|
||||
dri2_get_capabilities(struct dri_screen *_screen);
|
||||
PUBLIC void *
|
||||
dri2_map_image(struct dri_context *ctx, struct dri_image *image,
|
||||
int x0, int y0, int width, int height,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@
|
|||
dri2_from_planar;
|
||||
dri2_from_dma_bufs;
|
||||
dri2_blit_image;
|
||||
dri2_get_capabilities;
|
||||
dri2_map_image;
|
||||
dri2_unmap_image;
|
||||
dri_query_dma_buf_formats;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue