From 830f6ccd6bcd8bdffc4e2c8d8f1a3e1be25f0a1d Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 11 Mar 2024 21:13:39 +0100 Subject: [PATCH] vo_{drm,wlshm}: make query_format checks more correct We're using mp_sws here, so we should ask it for format support and not the underlying library (usually swscale) directly. --- video/out/vo_drm.c | 4 ++-- video/out/vo_wlshm.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c index 7fc75193c7..34726a3c02 100644 --- a/video/out/vo_drm.c +++ b/video/out/vo_drm.c @@ -24,7 +24,6 @@ #include #include -#include #include "common/msg.h" #include "drm_atomic.h" @@ -422,7 +421,8 @@ err: static int query_format(struct vo *vo, int format) { - return sws_isSupportedInput(imgfmt2pixfmt(format)); + struct priv *p = vo->priv; + return mp_sws_supports_formats(p->sws, p->imgfmt, format) ? 1 : 0; } static int control(struct vo *vo, uint32_t request, void *arg) diff --git a/video/out/vo_wlshm.c b/video/out/vo_wlshm.c index d2aa11d0ad..0b63426a23 100644 --- a/video/out/vo_wlshm.c +++ b/video/out/vo_wlshm.c @@ -21,8 +21,6 @@ #include #include -#include - #include "osdep/endian.h" #include "present_sync.h" #include "sub/osd.h" @@ -32,6 +30,8 @@ #include "vo.h" #include "wayland_common.h" +#define IMGFMT_WL_RGB MP_SELECT_LE_BE(IMGFMT_BGR0, IMGFMT_0RGB) + struct buffer { struct vo *vo; size_t size; @@ -164,7 +164,8 @@ err: static int query_format(struct vo *vo, int format) { - return sws_isSupportedInput(imgfmt2pixfmt(format)); + struct priv *p = vo->priv; + return mp_sws_supports_formats(p->sws, IMGFMT_WL_RGB, format) ? 1 : 0; } static int reconfig(struct vo *vo, struct mp_image_params *params) @@ -197,7 +198,7 @@ static int resize(struct vo *vo) vo_get_src_dst_rects(vo, &p->src, &p->dst, &p->osd); p->sws->dst = (struct mp_image_params) { - .imgfmt = MP_SELECT_LE_BE(IMGFMT_BGR0, IMGFMT_0RGB), + .imgfmt = IMGFMT_WL_RGB, .w = width, .h = height, .p_w = 1,