diff options
author | EmperorPenguin18 <60635017+EmperorPenguin18@users.noreply.github.com> | 2023-01-19 19:25:15 -0500 |
---|---|---|
committer | Philip Langdale <github.philipl@overt.org> | 2023-04-20 14:37:15 -0700 |
commit | c7a8e715786f7a76443775015d5a554012382d45 (patch) | |
tree | cbfc330d51f2025635fa17bc6e1d003213a242a0 /video/out | |
parent | c50f536bd1ac1f8154d2b1dcaccd25ab150b414a (diff) | |
download | mpv-c7a8e715786f7a76443775015d5a554012382d45.tar.bz2 mpv-c7a8e715786f7a76443775015d5a554012382d45.tar.xz |
hwdec_drmprime: support rpi4_8 and rpi4_10 formats
HEVC hardware decode with drm wasn't working on the RPi 4. Mpv would
report the image format (rpi4_8 for 8-bit and rpi4_10 for 10-bit) wasn't
supported. The change to hwdec_drmprime.c identifies these two formats
as NV12 because it functions exactly the same. The change to
dmabuf_interop_gl.c adds support for P030 which rpi4_10 uses. These
changes were tested on a Pi 4 with this fork of ffmpeg:
https://github.com/jc-kynesim/rpi-ffmpeg.
Signed-off-by: EmperorPenguin18 <60635017+EmperorPenguin18@users.noreply.github.com>
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/hwdec/dmabuf_interop_gl.c | 3 | ||||
-rw-r--r-- | video/out/hwdec/hwdec_drmprime.c | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/video/out/hwdec/dmabuf_interop_gl.c b/video/out/hwdec/dmabuf_interop_gl.c index cd62e960ca..4bca008e58 100644 --- a/video/out/hwdec/dmabuf_interop_gl.c +++ b/video/out/hwdec/dmabuf_interop_gl.c @@ -185,6 +185,9 @@ static bool vaapi_gl_map(struct ra_hwdec_mapper *mapper, format[2] = DRM_FORMAT_R8; break; case DRM_FORMAT_P010: +#ifdef DRM_FORMAT_P030 /* Format added in a newer libdrm version than minimum */ + case DRM_FORMAT_P030: +#endif format[0] = DRM_FORMAT_R16; format[1] = DRM_FORMAT_GR1616; break; diff --git a/video/out/hwdec/hwdec_drmprime.c b/video/out/hwdec/hwdec_drmprime.c index 52ac54e30d..8a7c503757 100644 --- a/video/out/hwdec/hwdec_drmprime.c +++ b/video/out/hwdec/hwdec_drmprime.c @@ -167,7 +167,17 @@ static int mapper_init(struct ra_hwdec_mapper *mapper) struct dmabuf_interop_priv *p = mapper->priv; mapper->dst_params = mapper->src_params; - mapper->dst_params.imgfmt = mapper->src_params.hw_subfmt; + + /* + * rpi4_8 and rpi4_10 function identically to NV12. These two pixel + * formats however are not defined in upstream ffmpeg so a string + * comparison is used to identify them instead of a mpv IMGFMT. + */ + const char* fmt_name = mp_imgfmt_to_name(mapper->src_params.hw_subfmt); + if (strcmp(fmt_name, "rpi4_8") == 0 || strcmp(fmt_name, "rpi4_10") == 0) + mapper->dst_params.imgfmt = IMGFMT_NV12; + else + mapper->dst_params.imgfmt = mapper->src_params.hw_subfmt; mapper->dst_params.hw_subfmt = 0; struct ra_imgfmt_desc desc = {0}; |