st/vdpau: avoid asserting on new VDP_YCBCR_* formats
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 7 Mar 2020 21:18:26 +0000 (16:18 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 3 Apr 2020 01:40:35 +0000 (01:40 +0000)
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>

src/gallium/state_trackers/vdpau/vdpau_private.h

index 420573b57ad49d78da18dac527eea52dc3b2a8e0..80bb5aee0feb10c513d367480ed7c1e29b974d04 100644 (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