st/vdpau: avoid asserting on new VDP_YCBCR_* formats

Depending on user's vdpau headers, not all of those defines may exist.
Eventually we may want a private copy of these, but this is simple
enough for now.

Fixes asserts when running vdpauinfo which supports these recently added
formats.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4108>
This commit is contained in:
Ilia Mirkin 2020-03-07 16:18:26 -05:00 committed by Marge Bot
parent c71c1f44b0
commit c1cc79739a
1 changed files with 21 additions and 2 deletions

View File

@ -134,11 +134,30 @@ FormatYCBCRToPipe(VdpYCbCrFormat vdpau_format)
return PIPE_FORMAT_R8G8B8A8_UNORM;
case VDP_YCBCR_FORMAT_V8U8Y8A8:
return PIPE_FORMAT_B8G8R8A8_UNORM;
#ifdef VDP_YCBCR_FORMAT_P010
case VDP_YCBCR_FORMAT_P010:
return PIPE_FORMAT_P010;
#endif
#ifdef VDP_YCBCR_FORMAT_P016
case VDP_YCBCR_FORMAT_P016:
return PIPE_FORMAT_P016;
#endif
default:
assert(0);
/* NOTE: Can't be "unreachable", as it's quite reachable. */
assert(!"unexpected VdpYCbCrFormat");
/* fallthrough */
#ifdef VDP_YCBCR_FORMAT_Y_UV_444
case VDP_YCBCR_FORMAT_Y_UV_444:
#endif
#ifdef VDP_YCBCR_FORMAT_Y_U_V_444
case VDP_YCBCR_FORMAT_Y_U_V_444:
#endif
#ifdef VDP_YCBCR_FORMAT_Y_U_V_444_16
case VDP_YCBCR_FORMAT_Y_U_V_444_16:
#endif
return PIPE_FORMAT_NONE;
}
return PIPE_FORMAT_NONE;
}
static inline VdpYCbCrFormat