diff options
authorwm4 <wm4@nowhere>2017-01-13 10:28:58 +0100
committerwm4 <wm4@nowhere>2017-01-13 10:28:58 +0100
commit88dfb9a5e71d55fd09d8dd92fd4bf54928b5d7cd (patch)
parent6de00d10c88486fc013ebca40b5ff103285d527d (diff)
vo_opengl: hwdec_vaegl: remove redundant vaapi surface format check
For surfaces allocated by libavutil, we assume that the sw_format (i.e. in hw_subfmt in mp_image_params) is always correct. The API guarantees that it explicitly sets the equivalent vaapi format on surface allocation. For surfaces allocated by mpv's old vaapi code, we explicitly retrieve the format right after decoding. Unless the driver magically changes the format asynchronously, it will still be correct once the surface reaches the renderer. In both cases, checking the format again is obviously redundant. In addition, it doesn't require us to maintain a libva fourcc <-> mpfmt table and the va_fourcc_to_imgfmt() function. This also unbreaks 10 bit rendering support (still disabled by default).
1 files changed, 1 insertions, 8 deletions
diff --git a/video/out/opengl/hwdec_vaegl.c b/video/out/opengl/hwdec_vaegl.c
index d70c036e51..bc48e45e0e 100644
--- a/video/out/opengl/hwdec_vaegl.c
+++ b/video/out/opengl/hwdec_vaegl.c
@@ -297,13 +297,6 @@ static int map_frame(struct gl_hwdec *hw, struct mp_image *hw_image,
if (!CHECK_VA_STATUS(p, "vaDeriveImage()"))
goto err;
- int mpfmt = va_fourcc_to_imgfmt(va_image->format.fourcc);
- if (p->current_mpfmt != mpfmt) {
- MP_FATAL(p, "mid-stream hwdec format change (%s -> %s) not supported\n",
- mp_imgfmt_to_name(p->current_mpfmt), mp_imgfmt_to_name(mpfmt));
- goto err;
- }
VABufferInfo buffer_info = {.mem_type = VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME};
status = vaAcquireBufferHandle(p->display, va_image->buf, &buffer_info);
if (!CHECK_VA_STATUS(p, "vaAcquireBufferHandle()"))
@@ -312,7 +305,7 @@ static int map_frame(struct gl_hwdec *hw, struct mp_image *hw_image,
struct mp_image layout = {0};
mp_image_set_params(&layout, &hw_image->params);
- mp_image_setfmt(&layout, mpfmt);
+ mp_image_setfmt(&layout, p->current_mpfmt);
int drm_fmts[8] = {
// 1 bytes per component, 1-4 components