vdpau: implement VdpOutputSurfaceGetParameters
authorChristian König <deathsimple@vodafone.de>
Sun, 10 Jul 2011 11:40:04 +0000 (13:40 +0200)
committerChristian König <deathsimple@vodafone.de>
Sun, 10 Jul 2011 11:48:37 +0000 (13:48 +0200)
src/gallium/state_trackers/vdpau/output.c
src/gallium/state_trackers/vdpau/query.c
src/gallium/state_trackers/vdpau/surface.c
src/gallium/state_trackers/vdpau/vdpau_private.h

index fc9e02ded47a04f6430c1ec59db40880b7d74eb4..f67d6ccff6bab576d42cfb7c1fb1a390a700658e 100644 (file)
@@ -135,7 +135,19 @@ vlVdpOutputSurfaceGetParameters(VdpOutputSurface surface,
                                 VdpRGBAFormat *rgba_format,
                                 uint32_t *width, uint32_t *height)
 {
-   return VDP_STATUS_NO_IMPLEMENTATION;
+   vlVdpOutputSurface *vlsurface;
+
+   VDPAU_MSG(VDPAU_TRACE, "[VDPAU] getting surface parameters\n");
+        
+   vlsurface = vlGetDataHTAB(surface);
+   if (!vlsurface)
+      return VDP_STATUS_INVALID_HANDLE;
+
+   *rgba_format = PipeToFormatRGBA(vlsurface->sampler_view->texture->format);
+   *width = vlsurface->sampler_view->texture->width0;
+   *height = vlsurface->sampler_view->texture->height0;
+
+   return VDP_STATUS_OK;
 }
 
 VdpStatus
index abe5b8f6701ce10c86aaaddd97ec932d0b224493..971ac672229fe49a6216a6d70ac1d33011c40b52 100644 (file)
@@ -120,7 +120,7 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp
 
    if (bits_ycbcr_format != VDP_YCBCR_FORMAT_Y8U8V8A8 && bits_ycbcr_format != VDP_YCBCR_FORMAT_V8U8Y8A8)
       *is_supported = vlscreen->pscreen->is_format_supported(vlscreen->pscreen,
-                                                             FormatToPipe(bits_ycbcr_format),
+                                                             FormatYCBCRToPipe(bits_ycbcr_format),
                                                              PIPE_TEXTURE_2D,
                                                              1,
                                                              PIPE_BIND_RENDER_TARGET);
index 877d0259c564f96d4160159ef056d1bf70d7328b..d3f6b5d8bc5c9eafd5b2a5a823fe036491682adf 100644 (file)
@@ -158,7 +158,7 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface,
                               void const *const *source_data,
                               uint32_t const *source_pitches)
 {
-   enum pipe_format pformat = FormatToPipe(source_ycbcr_format);
+   enum pipe_format pformat = FormatYCBCRToPipe(source_ycbcr_format);
    struct pipe_context *pipe;
    struct pipe_sampler_view **sampler_views;
    unsigned i;
index 8cf9ca1f4e59ac1dd09d4165a06fb67bf07a99b7..bbc426e0e274e4079c7cfd3804fe124b05e69d27 100644 (file)
@@ -84,7 +84,7 @@ PipeToChroma(enum pipe_video_chroma_format pipe_type)
 
 
 static inline enum pipe_format
-FormatToPipe(VdpYCbCrFormat vdpau_format)
+FormatYCBCRToPipe(VdpYCbCrFormat vdpau_format)
 {
    switch (vdpau_format) {
       case VDP_YCBCR_FORMAT_NV12:
@@ -106,6 +106,29 @@ FormatToPipe(VdpYCbCrFormat vdpau_format)
    return -1;
 }
 
+static inline VdpYCbCrFormat
+PipeToFormatYCBCR(enum pipe_format p_format)
+{
+   switch (p_format) {
+      case PIPE_FORMAT_NV12:
+         return VDP_YCBCR_FORMAT_NV12;
+      case PIPE_FORMAT_YV12:
+         return VDP_YCBCR_FORMAT_YV12;
+      case PIPE_FORMAT_UYVY:
+         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:
+        return VDP_YCBCR_FORMAT_V8U8Y8A8;
+      default:
+         assert(0);
+   }
+
+   return -1;
+}
+
 static inline enum pipe_format
 FormatRGBAToPipe(VdpRGBAFormat vdpau_format)
 {
@@ -127,22 +150,20 @@ FormatRGBAToPipe(VdpRGBAFormat vdpau_format)
    return -1;
 }
 
-static inline VdpYCbCrFormat
-PipeToFormat(enum pipe_format p_format)
+static inline VdpRGBAFormat
+PipeToFormatRGBA(enum pipe_format p_format)
 {
    switch (p_format) {
-      case PIPE_FORMAT_NV12:
-         return VDP_YCBCR_FORMAT_NV12;
-      case PIPE_FORMAT_YV12:
-         return VDP_YCBCR_FORMAT_YV12;
-      case PIPE_FORMAT_UYVY:
-         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:
-        return VDP_YCBCR_FORMAT_V8U8Y8A8;
+      case PIPE_FORMAT_A8_UNORM:
+         return VDP_RGBA_FORMAT_A8;
+      case PIPE_FORMAT_B10G10R10A2_UNORM:
+         return VDP_RGBA_FORMAT_B10G10R10A2;
+      case PIPE_FORMAT_B8G8R8A8_UNORM:
+         return VDP_RGBA_FORMAT_B8G8R8A8;
+      case PIPE_FORMAT_R10G10B10A2_UNORM:
+         return VDP_RGBA_FORMAT_R10G10B10A2;
+      case PIPE_FORMAT_R8G8B8A8_UNORM:
+         return VDP_RGBA_FORMAT_R8G8B8A8;
       default:
          assert(0);
    }