vo_dmabuf_wayland: drop support for linux-dmabuf-v2

The only real reason this was ever supported is because it was
dramatically simpler than v4, so it was put in as an initial
implementation. Later, v4 support was added and we left v2 for
compatibility, but let's just drop it. Compositors all use v4 nowadays,
and v2 is significantly limited (no modifier support for example). It's
better to just remove this dead code for simplicity.
This commit is contained in:
Dudemanguy 2023-01-11 16:39:59 -06:00
parent 865a159244
commit a5b9d529ee
3 changed files with 2 additions and 35 deletions

View File

@ -354,8 +354,8 @@ static int preinit(struct vo *vo)
goto err;
assert(p->ctx->ra);
if (!vo->wl->dmabuf) {
MP_FATAL(vo->wl, "Compositor doesn't support the %s protocol!\n",
if (!vo->wl->dmabuf || !vo->wl->dmabuf_feedback) {
MP_FATAL(vo->wl, "Compositor doesn't support the %s (ver. 4) protocol!\n",
zwp_linux_dmabuf_v1_interface.name);
goto err;
}

View File

@ -1082,24 +1082,6 @@ static const struct wl_callback_listener frame_listener = {
frame_callback,
};
static void dmabuf_format(void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf,
uint32_t format)
{
struct vo_wayland_state *wl = data;
if (wl->drm_format_ct == wl->drm_format_ct_max) {
wl->drm_format_ct_max *= 2;
wl->drm_formats = talloc_realloc(wl, wl->drm_formats, int, wl->drm_format_ct_max);
}
wl->drm_formats[wl->drm_format_ct++] = format;
MP_VERBOSE(wl, "%s is supported by the compositor.\n", mp_tag_str(format));
}
static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {
dmabuf_format
};
#if HAVE_WAYLAND_PROTOCOLS_1_24
static void done(void *data,
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)
@ -1190,11 +1172,6 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id
wl->dmabuf_feedback = zwp_linux_dmabuf_v1_get_default_feedback(wl->dmabuf);
zwp_linux_dmabuf_feedback_v1_add_listener(wl->dmabuf_feedback, &dmabuf_feedback_listener, wl);
#endif
} else if (!strcmp (interface, zwp_linux_dmabuf_v1_interface.name) && (ver >= 2) && found++) {
wl->dmabuf = wl_registry_bind(reg, id, &zwp_linux_dmabuf_v1_interface, 2);
zwp_linux_dmabuf_v1_add_listener(wl->dmabuf, &dmabuf_listener, wl);
wl->drm_format_ct_max = 64;
wl->drm_formats = talloc_array(wl, int, wl->drm_format_ct_max);
}
if (!strcmp (interface, wp_viewporter_interface.name) && (ver >= 1) && found++) {
@ -2138,12 +2115,6 @@ bool vo_wayland_supported_format(struct vo *vo, uint32_t drm_format, uint64_t mo
return true;
}
/* TODO: remove these once zwp_linux_dmabuf_v1 version 2 support is removed. */
for (int i = 0; i < wl->drm_format_ct; ++i) {
if (drm_format == wl->drm_formats[i])
return true;
}
return false;
}

View File

@ -94,10 +94,6 @@ struct vo_wayland_state {
void *dmabuf_feedback;
void *format_map;
uint32_t format_size;
/* TODO: remove these once zwp_linux_dmabuf_v1 version 2 support is removed. */
int *drm_formats;
int drm_format_ct;
int drm_format_ct_max;
/* presentation-time */
struct wp_presentation *presentation;