st/vdpau: add new formats to OutputSurface rendering
[mesa.git] / src / gallium / state_trackers / vdpau / vdpau_private.h
index 2898a863243041a71e18ad258eef61eba71a0991..bb91de13103a288909e1a5278e1c1b3fc870f636 100644 (file)
@@ -34,7 +34,7 @@
 #include <vdpau/vdpau_x11.h>
 
 #include "pipe/p_compiler.h"
-#include "pipe/p_video_decoder.h"
+#include "pipe/p_video_codec.h"
 
 #include "util/u_debug.h"
 #include "util/u_rect.h"
@@ -44,8 +44,7 @@
 #include "vl/vl_csc.h"
 #include "vl/vl_matrix_filter.h"
 #include "vl/vl_median_filter.h"
-
-#include "vl_winsys.h"
+#include "vl/vl_winsys.h"
 
 /* Full VDPAU API documentation available at :
  * ftp://download.nvidia.com/XFree86/vdpau/doxygen/html/index.html */
@@ -90,6 +89,29 @@ PipeToChroma(enum pipe_video_chroma_format pipe_type)
    return -1;
 }
 
+static inline enum pipe_video_chroma_format
+FormatYCBCRToPipeChroma(VdpYCbCrFormat vdpau_format)
+{
+   switch (vdpau_format) {
+      case VDP_YCBCR_FORMAT_NV12:
+         return PIPE_VIDEO_CHROMA_FORMAT_420;
+      case VDP_YCBCR_FORMAT_YV12:
+         return PIPE_VIDEO_CHROMA_FORMAT_420;
+      case VDP_YCBCR_FORMAT_UYVY:
+         return PIPE_VIDEO_CHROMA_FORMAT_422;
+      case VDP_YCBCR_FORMAT_YUYV:
+         return PIPE_VIDEO_CHROMA_FORMAT_422;
+      case VDP_YCBCR_FORMAT_Y8U8V8A8:
+         return PIPE_VIDEO_CHROMA_FORMAT_444;
+      case VDP_YCBCR_FORMAT_V8U8Y8A8:
+         return PIPE_VIDEO_CHROMA_FORMAT_444;
+      default:
+         assert(0);
+   }
+
+   return PIPE_FORMAT_NONE;
+}
+
 static inline enum pipe_format
 FormatYCBCRToPipe(VdpYCbCrFormat vdpau_format)
 {
@@ -102,10 +124,10 @@ FormatYCBCRToPipe(VdpYCbCrFormat vdpau_format)
          return PIPE_FORMAT_UYVY;
       case VDP_YCBCR_FORMAT_YUYV:
          return PIPE_FORMAT_YUYV;
-      case VDP_YCBCR_FORMAT_Y8U8V8A8: /* Not defined in p_format.h */
-         return PIPE_FORMAT_NONE;
+      case VDP_YCBCR_FORMAT_Y8U8V8A8:
+         return PIPE_FORMAT_R8G8B8A8_UNORM;
       case VDP_YCBCR_FORMAT_V8U8Y8A8:
-            return PIPE_FORMAT_VUYA;
+         return PIPE_FORMAT_B8G8R8A8_UNORM;
       default:
          assert(0);
    }
@@ -125,9 +147,9 @@ PipeToFormatYCBCR(enum pipe_format p_format)
          return VDP_YCBCR_FORMAT_UYVY;
       case PIPE_FORMAT_YUYV:
          return VDP_YCBCR_FORMAT_YUYV;
-      //case PIPE_FORMAT_YUVA:
-        // return VDP_YCBCR_FORMAT_Y8U8V8A8;
-      case PIPE_FORMAT_VUYA:
+      case PIPE_FORMAT_R8G8B8A8_UNORM:
+        return VDP_YCBCR_FORMAT_Y8U8V8A8;
+      case PIPE_FORMAT_B8G8R8A8_UNORM:
          return VDP_YCBCR_FORMAT_V8U8Y8A8;
       default:
          assert(0);
@@ -321,19 +343,6 @@ typedef struct
    } delayed_rendering;
 } vlVdpDevice;
 
-typedef struct
-{
-   vlVdpDevice *device;
-   Drawable drawable;
-} vlVdpPresentationQueueTarget;
-
-typedef struct
-{
-   vlVdpDevice *device;
-   Drawable drawable;
-   struct vl_compositor_state cstate;
-} vlVdpPresentationQueue;
-
 typedef struct
 {
    vlVdpDevice *device;
@@ -376,7 +385,6 @@ typedef uint64_t vlVdpTime;
 
 typedef struct
 {
-   vlVdpTime timestamp;
    vlVdpDevice *device;
    struct pipe_surface *surface;
    struct pipe_sampler_view *sampler_view;
@@ -388,7 +396,22 @@ typedef struct
 typedef struct
 {
    vlVdpDevice *device;
-   struct pipe_video_decoder *decoder;
+   Drawable drawable;
+} vlVdpPresentationQueueTarget;
+
+typedef struct
+{
+   vlVdpDevice *device;
+   Drawable drawable;
+   struct vl_compositor_state cstate;
+   vlVdpOutputSurface *last_surf;
+} vlVdpPresentationQueue;
+
+typedef struct
+{
+   vlVdpDevice *device;
+   pipe_mutex mutex;
+   struct pipe_video_codec *decoder;
 } vlVdpDecoder;
 
 typedef uint32_t vlHandle;
@@ -435,6 +458,7 @@ VdpVideoSurfaceDestroy vlVdpVideoSurfaceDestroy;
 VdpVideoSurfaceGetParameters vlVdpVideoSurfaceGetParameters;
 VdpVideoSurfaceGetBitsYCbCr vlVdpVideoSurfaceGetBitsYCbCr;
 VdpVideoSurfacePutBitsYCbCr vlVdpVideoSurfacePutBitsYCbCr;
+void vlVdpVideoSurfaceClear(vlVdpSurface *vlsurf);
 VdpDecoderCreate vlVdpDecoderCreate;
 VdpDecoderDestroy vlVdpDecoderDestroy;
 VdpDecoderGetParameters vlVdpDecoderGetParameters;