summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/vo.rst4
-rw-r--r--video/out/vo_drm.c48
2 files changed, 16 insertions, 36 deletions
diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst
index ea2d3ee645..33b51f3bf9 100644
--- a/DOCS/man/vo.rst
+++ b/DOCS/man/vo.rst
@@ -548,6 +548,10 @@ Available video output drivers are:
xrgb2101010 is a packed 30 bits per pixel/10 bits per channel packed RGB
format with 2 bits of padding.
+ Currently, you need to build mpv with libzimg and enable it with
+ ``--sws-allow-zimg=yes``, or initialization with the 30 bit format will
+ fail.
+
There are cases when xrgb2101010 will work with the ``drm`` VO, but not
with the ``drm`` backend for the ``gpu`` VO. This is because with the
``gpu`` VO, in addition to requiring support in your DRM driver,
diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c
index ce48779a82..5cf4b58a61 100644
--- a/video/out/vo_drm.c
+++ b/video/out/vo_drm.c
@@ -36,11 +36,7 @@
#include "vo.h"
#define IMGFMT_XRGB8888 IMGFMT_BGR0
-#if BYTE_ORDER == BIG_ENDIAN
-#define IMGFMT_XRGB2101010 pixfmt2imgfmt(AV_PIX_FMT_GBRP10BE)
-#else
-#define IMGFMT_XRGB2101010 pixfmt2imgfmt(AV_PIX_FMT_GBRP10LE)
-#endif
+#define IMGFMT_XRGB2101010 IMGFMT_RGB30
#define BYTES_PER_PIXEL 4
#define BITS_PER_PIXEL 32
@@ -303,7 +299,6 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
int w = p->dst.x1 - p->dst.x0;
int h = p->dst.y1 - p->dst.y0;
- mp_sws_set_from_cmdline(p->sws, vo->global);
p->sws->src = *params;
p->sws->dst = (struct mp_image_params) {
.imgfmt = p->imgfmt,
@@ -391,35 +386,10 @@ static void draw_image(struct vo *vo, mp_image_t *mpi, struct framebuffer *front
osd_draw_on_image(vo->osd, p->osd, 0, 0, p->cur_frame);
}
- if (p->depth == 30) {
- // Pack GBRP10 image into XRGB2101010 for DRM
- const int w = p->cur_frame->w;
- const int h = p->cur_frame->h;
-
- const int g_padding = p->cur_frame->stride[0]/sizeof(uint16_t) - w;
- const int b_padding = p->cur_frame->stride[1]/sizeof(uint16_t) - w;
- const int r_padding = p->cur_frame->stride[2]/sizeof(uint16_t) - w;
- const int fbuf_padding = front_buf->stride/sizeof(uint32_t) - w;
-
- uint16_t *g_ptr = (uint16_t*)p->cur_frame->planes[0];
- uint16_t *b_ptr = (uint16_t*)p->cur_frame->planes[1];
- uint16_t *r_ptr = (uint16_t*)p->cur_frame->planes[2];
- uint32_t *fbuf_ptr = (uint32_t*)front_buf->map;
- for (unsigned y = 0; y < h; ++y) {
- for (unsigned x = 0; x < w; ++x) {
- *fbuf_ptr++ = (*r_ptr++ << 20) | (*g_ptr++ << 10) | (*b_ptr++);
- }
- g_ptr += g_padding;
- b_ptr += b_padding;
- r_ptr += r_padding;
- fbuf_ptr += fbuf_padding;
- }
- } else {
- memcpy_pic(front_buf->map, p->cur_frame->planes[0],
- p->cur_frame->w * BYTES_PER_PIXEL, p->cur_frame->h,
- front_buf->stride,
- p->cur_frame->stride[0]);
- }
+ memcpy_pic(front_buf->map, p->cur_frame->planes[0],
+ p->cur_frame->w * BYTES_PER_PIXEL, p->cur_frame->h,
+ front_buf->stride,
+ p->cur_frame->stride[0]);
}
if (mpi != p->last_input) {
@@ -553,7 +523,11 @@ static void uninit(struct vo *vo)
static int preinit(struct vo *vo)
{
struct priv *p = vo->priv;
+
p->sws = mp_sws_alloc(vo);
+ mp_sws_set_from_cmdline(p->sws, vo->global);
+ p->sws->allow_zimg = true;
+
p->ev.version = DRM_EVENT_CONTEXT_VERSION;
p->ev.page_flip_handler = &drm_pflip_cb;
@@ -625,7 +599,9 @@ 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);
}
static int control(struct vo *vo, uint32_t request, void *arg)