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).
This commit is contained in:
wm4 2017-01-13 10:28:58 +01:00
parent 6de00d10c8
commit 88dfb9a5e7
1 changed files with 1 additions and 8 deletions

View File

@ -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