Added stubs for the rest of the vdpau interface
authorThomas Balling Sørensen <tball@io.dk>
Wed, 21 Jul 2010 23:46:40 +0000 (01:46 +0200)
committerThomas Balling Sørensen <tball@io.dk>
Wed, 21 Jul 2010 23:46:40 +0000 (01:46 +0200)
12 files changed:
src/gallium/state_trackers/vdpau/bitmap.c [new file with mode: 0644]
src/gallium/state_trackers/vdpau/color.c [new file with mode: 0644]
src/gallium/state_trackers/vdpau/decode.c
src/gallium/state_trackers/vdpau/device.c
src/gallium/state_trackers/vdpau/ftab.c
src/gallium/state_trackers/vdpau/mixer.c [new file with mode: 0644]
src/gallium/state_trackers/vdpau/output.c [new file with mode: 0644]
src/gallium/state_trackers/vdpau/preemption.c [new file with mode: 0644]
src/gallium/state_trackers/vdpau/presentation.c [new file with mode: 0644]
src/gallium/state_trackers/vdpau/query.c
src/gallium/state_trackers/vdpau/render.c [new file with mode: 0644]
src/gallium/state_trackers/vdpau/surface.c

diff --git a/src/gallium/state_trackers/vdpau/bitmap.c b/src/gallium/state_trackers/vdpau/bitmap.c
new file mode 100644 (file)
index 0000000..f1a9d9a
--- /dev/null
@@ -0,0 +1,75 @@
+/**************************************************************************
+ *
+ * Copyright 2010 Thomas Balling Sørensen.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include <vdpau/vdpau.h>
+#include "vdpau_private.h"
+#include <util/u_debug.h>
+
+VdpStatus
+vlVdpBitmapSurfaceCreate(      VdpDevice device, 
+                                                       VdpRGBAFormat rgba_format, 
+                                                       uint32_t width, uint32_t height, 
+                                                       VdpBool frequently_accessed, 
+                                                       VdpBitmapSurface *surface)
+{
+       debug_printf("[VDPAU] Creating a bitmap surface\n");
+       if (!surface)
+               return VDP_STATUS_INVALID_POINTER;
+
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpBitmapSurfaceDestroy ( VdpBitmapSurface  surface )
+{
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpBitmapSurfaceGetParameters (      VdpBitmapSurface  surface,
+                                                                       VdpRGBAFormat  *rgba_format, 
+                                                                       uint32_t *width, uint32_t *height, 
+                                                                       VdpBool  *frequently_accessed)
+{
+       if (!(rgba_format && width && height && frequently_accessed))
+               return VDP_STATUS_INVALID_POINTER;
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpBitmapSurfacePutBitsNative (      VdpBitmapSurface  surface, 
+                                                                       void const *const *source_data, 
+                                                                       uint32_t const *source_pitches, 
+                                                                       VdpRect  const *destination_rect )
+{
+       if (!(source_data && source_pitches && destination_rect))
+               return VDP_STATUS_INVALID_POINTER;
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
\ No newline at end of file
diff --git a/src/gallium/state_trackers/vdpau/color.c b/src/gallium/state_trackers/vdpau/color.c
new file mode 100644 (file)
index 0000000..e69de29
index 8daf7a47f971bde9ebfc7700f97b036020082978..ec3995b98db3e7cfa025adad1dca5a0388d5b0fa 100644 (file)
@@ -27,7 +27,9 @@
 
 #include "vdpau_private.h"
 #include <util/u_memory.h>
+#include <util/u_math.h>
 #include <pipe/p_video_context.h>
+#include <util/u_debug.h>
 
 VdpStatus
 vlVdpDecoderCreate (   VdpDevice device, 
@@ -37,10 +39,13 @@ vlVdpDecoderCreate (        VdpDevice device,
                                                VdpDecoder *decoder 
 )
 {
+       struct vl_screen *vscreen;
        enum pipe_video_profile p_profile;
        VdpStatus ret;
        vlVdpDecoder *vldecoder;
        
+       debug_printf("[VDPAU] Creating decoder\n");
+       
        if (!decoder)
                return VDP_STATUS_INVALID_POINTER;
        
@@ -58,12 +63,6 @@ vlVdpDecoderCreate (         VdpDevice device,
           ret = VDP_STATUS_RESOURCES;
           goto no_decoder;
    }
-       
-   vldecoder->vlscreen = vl_screen_create(dev->display, dev->screen);
-   if (!vldecoder->vlscreen)  
-      ret = VDP_STATUS_RESOURCES;
-         goto no_screen;
-   
    
    p_profile = ProfileToPipe(profile);
    if (p_profile == PIPE_VIDEO_PROFILE_UNKNOWN)        {
@@ -73,7 +72,7 @@ vlVdpDecoderCreate (  VdpDevice device,
 
        // TODO: Define max_references. Used mainly for H264
        
-       vldecoder->chroma_format = p_profile;
+       vldecoder->profile = p_profile;
        vldecoder->device = dev;
                
        *decoder = vlAddDataHTAB(vldecoder);
@@ -81,6 +80,7 @@ vlVdpDecoderCreate (  VdpDevice device,
       ret = VDP_STATUS_ERROR;
       goto no_handle;
        }
+       debug_printf("[VDPAU] Decoder created succesfully\n");
        
        return VDP_STATUS_OK;
        
@@ -104,26 +104,76 @@ vlVdpDecoderDestroy  (VdpDecoder decoder
       return VDP_STATUS_INVALID_HANDLE;
        }
        
+       if (vldecoder->vctx->vscreen)
+               vl_screen_destroy(vldecoder->vctx->vscreen);
+       
        if (vldecoder->vctx)
                vl_video_destroy(vldecoder->vctx);
                
-       if (vldecoder->vlscreen)
-               vl_screen_destroy(vldecoder->vlscreen);
-               
        FREE(vldecoder);
        
        return VDP_STATUS_OK;
 }
 
 VdpStatus
-vlVdpCreateSurface                (vlVdpDecoder *vldecoder,
+vlVdpCreateSurfaceTarget   (vlVdpDecoder *vldecoder,
                                                        vlVdpSurface *vlsurf
 )
 {
+       struct pipe_resource tmplt;
+       struct pipe_resource *surf_tex;
+       struct pipe_video_context *vpipe;
+               
+       if(!(vldecoder && vlsurf))
+               return VDP_STATUS_INVALID_POINTER;
+               
+       vpipe = vldecoder->vctx;
+               
+       memset(&tmplt, 0, sizeof(struct pipe_resource));
+       tmplt.target = PIPE_TEXTURE_2D;
+       tmplt.format = vlsurf->format;
+       tmplt.last_level = 0;
+       if (vpipe->is_format_supported(vpipe, tmplt.format,
+                                  PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET,
+                                  PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO)) {
+      tmplt.width0 = vlsurf->width;
+      tmplt.height0 = vlsurf->height;
+    }
+    else {
+      assert(vpipe->is_format_supported(vpipe, tmplt.format,
+                                       PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET,
+                                       PIPE_TEXTURE_GEOM_NON_SQUARE));
+      tmplt.width0 = util_next_power_of_two(vlsurf->width);
+      tmplt.height0 = util_next_power_of_two(vlsurf->height);
+    }
+       tmplt.depth0 = 1;
+       tmplt.usage = PIPE_USAGE_DEFAULT;
+       tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
+       tmplt.flags = 0;
+       
+       surf_tex = vpipe->screen->resource_create(vpipe->screen, &tmplt);
+       
+       vlsurf->psurface = vpipe->screen->get_tex_surface(vpipe->screen, surf_tex, 0, 0, 0,
+                                         PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET);
+                                                                                
+       pipe_resource_reference(&surf_tex, NULL);
+       
+       if (!vlsurf->psurface)
+               return VDP_STATUS_RESOURCES;
+       
        
        return VDP_STATUS_OK;
 }
 
+static void
+vlVdpMacroBlocksToPipe(struct pipe_screen *screen,
+                  VdpBitstreamBuffer const *bitstream_buffers,
+                  unsigned int num_macroblocks,
+                  struct pipe_mpeg12_macroblock *pipe_macroblocks)
+{
+       debug_printf("NAF!\n");
+}
+
 VdpStatus
 vlVdpDecoderRenderMpeg2    (vlVdpDecoder *vldecoder,
                                                        vlVdpSurface *vlsurf,
@@ -140,32 +190,43 @@ vlVdpDecoderRenderMpeg2    (vlVdpDecoder *vldecoder,
        struct pipe_surface *p_surf;
        struct pipe_surface *f_surf;
        uint32_t num_macroblocks;
+       VdpStatus ret;
+       
 
        vpipe = vldecoder->vctx->vpipe;
        t_vdp_surf = vlsurf;
-    p_vdp_surf = (vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference);
-       if (p_vdp_surf)
-               return VDP_STATUS_INVALID_HANDLE;
-               
-       f_vdp_surf = (vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference);
-       if (f_vdp_surf)
-               return VDP_STATUS_INVALID_HANDLE;
-               
+       
        /* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */
-       if (p_vdp_surf ==  VDP_INVALID_HANDLE) p_vdp_surf = NULL;
+       if (picture_info->backward_reference ==  VDP_INVALID_HANDLE) 
+               p_vdp_surf = NULL;
+       else    {
+               p_vdp_surf = (vlVdpSurface *)vlGetDataHTAB(picture_info->backward_reference);
+               if (!p_vdp_surf)
+                       return VDP_STATUS_INVALID_HANDLE;
+       }
+
+       if (picture_info->forward_reference ==  VDP_INVALID_HANDLE) 
+               f_vdp_surf = NULL;
+       else    {
+               f_vdp_surf = (vlVdpSurface *)vlGetDataHTAB(picture_info->forward_reference);
+               if (!f_vdp_surf)
+                       return VDP_STATUS_INVALID_HANDLE;
+       }
+               
+       
        if (f_vdp_surf ==  VDP_INVALID_HANDLE) f_vdp_surf = NULL;
        
-       vlVdpCreateSurface(vldecoder,t_vdp_surf);
+       ret = vlVdpCreateSurfaceTarget(vldecoder,t_vdp_surf);
                
-       num_macroblocks = picture_info->slice_count;
+       num_macroblocks = bitstream_buffer_count;
        struct pipe_mpeg12_macroblock pipe_macroblocks[num_macroblocks];
        
-       /*VdpMacroBlocksToPipe(vpipe->screen, macroblocks, blocks, first_macroblock,
-                     num_macroblocks, pipe_macroblocks);*/
+       vlVdpMacroBlocksToPipe(vpipe->screen, bitstream_buffers,
+                     num_macroblocks, pipe_macroblocks);
                
        vpipe->set_decode_target(vpipe,t_surf);
-       /*vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks,
-               &pipe_macroblocks->base, &target_surface_priv->render_fence);*/
+       vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, &pipe_macroblocks->base, NULL);
+       return ret;
 }
 
 VdpStatus
@@ -178,7 +239,9 @@ vlVdpDecoderRender (VdpDecoder decoder,
 {
        vlVdpDecoder *vldecoder;
        vlVdpSurface *vlsurf;
+       struct vl_screen *vscreen;
        VdpStatus ret;
+       debug_printf("[VDPAU] Decoding\n");
                
        if (!(picture_info && bitstream_buffers))
                return VDP_STATUS_INVALID_POINTER;
@@ -198,6 +261,16 @@ vlVdpDecoderRender (VdpDecoder decoder,
        if (vlsurf->chroma_format != vldecoder->chroma_format)
                return VDP_STATUS_INVALID_CHROMA_TYPE;
                
+       vscreen = vl_screen_create(vldecoder->device->display, vldecoder->device->screen);
+       if (!vscreen)
+               return VDP_STATUS_RESOURCES;
+       
+       vldecoder->vctx = vl_video_create(vscreen, vldecoder->profile, vlsurf->format, vlsurf->width, vlsurf->height);
+       if (!vldecoder->vctx)
+               return VDP_STATUS_RESOURCES;
+               
+       vldecoder->vctx->vscreen = vscreen;
+               
     // TODO: Right now only mpeg2 is supported.
        switch (vldecoder->vctx->vpipe->profile)   {
                case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
index 111b15c619fdbf31e640cd8ff43f83819b930614..d370d1c66103a405a4f96fc8c3d32464723be6f4 100644 (file)
@@ -29,6 +29,7 @@
 #include <pipe/p_compiler.h>
 #include <vl_winsys.h>
 #include <util/u_memory.h>
+#include <util/u_debug.h>
 #include "vdpau_private.h"
 
 VdpDeviceCreateX11 vdp_imp_device_create_x11;
@@ -56,7 +57,6 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGe
    dev->display = display;
    dev->screen = screen;
 
-
    *device = vlAddDataHTAB(dev);
    if (*device == 0) {
       ret = VDP_STATUS_ERROR;
@@ -64,6 +64,8 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGe
    }
 
    *get_proc_address = &vlVdpGetProcAddress;
+   
+   debug_printf("[VDPAU] Device created succesfully\n");
 
    return VDP_STATUS_OK;
 
@@ -75,7 +77,8 @@ no_htab:
    return ret;
 }
 
-VdpStatus vlVdpDeviceDestroy(VdpDevice device)
+VdpStatus 
+vlVdpDeviceDestroy(VdpDevice device)
 {
    vlVdpDevice *dev = vlGetDataHTAB(device);
    if (!dev)
@@ -83,10 +86,13 @@ VdpStatus vlVdpDeviceDestroy(VdpDevice device)
    FREE(dev);
    vlDestroyHTAB();
 
+   debug_printf("[VDPAU] Device destroyed succesfully\n");
+
    return VDP_STATUS_OK;
 }
 
-VdpStatus vlVdpGetProcAddress(VdpDevice device, VdpFuncId function_id, void **function_pointer)
+VdpStatus 
+vlVdpGetProcAddress(VdpDevice device, VdpFuncId function_id, void **function_pointer)
 {
    vlVdpDevice *dev = vlGetDataHTAB(device);
    if (!dev)
@@ -100,3 +106,50 @@ VdpStatus vlVdpGetProcAddress(VdpDevice device, VdpFuncId function_id, void **fu
 
    return VDP_STATUS_OK;
 }
+
+#define _ERROR_TYPE(TYPE,STRING) \
+       case TYPE:      \
+               return STRING; \
+       break
+
+char const * 
+vlVdpGetErrorString (
+VdpStatus status)
+{
+       switch (status)
+       {
+               _ERROR_TYPE(VDP_STATUS_OK,"The operation completed successfully; no error.");
+               _ERROR_TYPE(VDP_STATUS_NO_IMPLEMENTATION,"No backend implementation could be loaded.");
+               _ERROR_TYPE(VDP_STATUS_DISPLAY_PREEMPTED,"The display was preempted, or a fatal error occurred. The application must re-initialize VDPAU.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_HANDLE,"An invalid handle value was provided. Either the handle does not exist at all, or refers to an object of an incorrect type.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_POINTER ,"An invalid pointer was provided. Typically, this means that a NULL pointer was provided for an 'output' parameter.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_CHROMA_TYPE ,"An invalid/unsupported VdpChromaType value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_Y_CB_CR_FORMAT,"An invalid/unsupported VdpYCbCrFormat value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_RGBA_FORMAT,"An invalid/unsupported VdpRGBAFormat value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_INDEXED_FORMAT,"An invalid/unsupported VdpIndexedFormat value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_COLOR_STANDARD,"An invalid/unsupported VdpColorStandard value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_COLOR_TABLE_FORMAT,"An invalid/unsupported VdpColorTableFormat value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_BLEND_FACTOR,"An invalid/unsupported VdpOutputSurfaceRenderBlendFactor value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_BLEND_EQUATION,"An invalid/unsupported VdpOutputSurfaceRenderBlendEquation value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_FLAG,"An invalid/unsupported flag value/combination was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_DECODER_PROFILE,"An invalid/unsupported VdpDecoderProfile value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_FEATURE,"An invalid/unsupported VdpVideoMixerFeature value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_PARAMETER ,"An invalid/unsupported VdpVideoMixerParameter value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_ATTRIBUTE,"An invalid/unsupported VdpVideoMixerAttribute value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_VIDEO_MIXER_PICTURE_STRUCTURE,"An invalid/unsupported VdpVideoMixerPictureStructure value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_FUNC_ID,"An invalid/unsupported VdpFuncId value was supplied.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_SIZE,"The size of a supplied object does not match the object it is being used with.\
+                                                       For example, a VdpVideoMixer is configured to process VdpVideoSurface objects of a specific size.\
+                                                       If presented with a VdpVideoSurface of a different size, this error will be raised.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_VALUE,"An invalid/unsupported value was supplied.\
+                                                       This is a catch-all error code for values of type other than those with a specific error code.");
+               _ERROR_TYPE(VDP_STATUS_INVALID_STRUCT_VERSION,"An invalid/unsupported structure version was specified in a versioned structure. \
+                                                       This implies that the implementation is older than the header file the application was built against.");
+               _ERROR_TYPE(VDP_STATUS_RESOURCES,"The system does not have enough resources to complete the requested operation at this time.");
+               _ERROR_TYPE(VDP_STATUS_HANDLE_DEVICE_MISMATCH,"The set of handles supplied are not all related to the same VdpDevice.When performing operations \
+                                                       that operate on multiple surfaces, such as VdpOutputSurfaceRenderOutputSurface or VdpVideoMixerRender, \
+                                                       all supplied surfaces must have been created within the context of the same VdpDevice object. \
+                                                       This error is raised if they were not.");
+               _ERROR_TYPE(VDP_STATUS_ERROR,"A catch-all error, used when no other error code applies.");
+       }
+}
index 7e476e5ee28a5418eec32f8b950b0f0c85adcfa0..1842c4da0ea8a7eb685f7476639811920a6cd81a 100644 (file)
@@ -30,8 +30,8 @@
 
 static void* ftab[67] =
 {
-   0, /* VDP_FUNC_ID_GET_ERROR_STRING */
-   0, /* VDP_FUNC_ID_GET_PROC_ADDRESS */
+   &vlVdpGetErrorString, /* VDP_FUNC_ID_GET_ERROR_STRING */
+   &vlVdpGetProcAddress, /* VDP_FUNC_ID_GET_PROC_ADDRESS */
    &vlVdpGetApiVersion, /* VDP_FUNC_ID_GET_API_VERSION */
    0,
    &vlVdpGetInformationString, /* VDP_FUNC_ID_GET_INFORMATION_STRING */
@@ -40,15 +40,15 @@ static void* ftab[67] =
    &vlVdpVideoSurfaceQueryCapabilities, /* VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES */
    &vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities, /* VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES */
    &vlVdpVideoSurfaceCreate, /* VDP_FUNC_ID_VIDEO_SURFACE_CREATE */
-   0, /* VDP_FUNC_ID_VIDEO_SURFACE_DESTROY */
-   0, /* VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS */
-   0, /* VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR */
-   0, /* VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR */
+   &vlVdpVideoSurfaceDestroy, /* VDP_FUNC_ID_VIDEO_SURFACE_DESTROY */
+   &vlVdpVideoSurfaceGetParameters, /* VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS */
+   &vlVdpVideoSurfaceGetBitsYCbCr, /* VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR */
+   &vlVdpVideoSurfacePutBitsYCbCr, /* VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR */
    &vlVdpOutputSurfaceQueryCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_CAPABILITIES */
    &vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES */
    0, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES */
    &vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_Y_CB_CR_CAPABILITIES */
-   0, /* VDP_FUNC_ID_OUTPUT_SURFACE_CREATE */
+   &vlVdpOutputSurfaceCreate, /* VDP_FUNC_ID_OUTPUT_SURFACE_CREATE */
    0, /* VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY */
    0, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS */
    0, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE */
@@ -56,10 +56,10 @@ static void* ftab[67] =
    0, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED */
    0, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR */
    &vlVdpBitmapSurfaceQueryCapabilities, /* VDP_FUNC_ID_BITMAP_SURFACE_QUERY_CAPABILITIES */
-   0, /* VDP_FUNC_ID_BITMAP_SURFACE_CREATE */
-   0, /* VDP_FUNC_ID_BITMAP_SURFACE_DESTROY */
-   0, /* VDP_FUNC_ID_BITMAP_SURFACE_GET_PARAMETERS */
-   0, /* VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE */
+   &vlVdpBitmapSurfaceCreate, /* VDP_FUNC_ID_BITMAP_SURFACE_CREATE */
+   &vlVdpBitmapSurfaceDestroy, /* VDP_FUNC_ID_BITMAP_SURFACE_DESTROY */
+   &vlVdpBitmapSurfaceGetParameters, /* VDP_FUNC_ID_BITMAP_SURFACE_GET_PARAMETERS */
+   &vlVdpBitmapSurfacePutBitsNative, /* VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE */
    0,
    0,
    0,
@@ -67,10 +67,10 @@ static void* ftab[67] =
    0, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE */
    0, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_VIDEO_SURFACE_LUMA */
    &vlVdpDecoderQueryCapabilities, /* VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES */
-   0, /* VDP_FUNC_ID_DECODER_CREATE */
-   0, /* VDP_FUNC_ID_DECODER_DESTROY */
+   &vlVdpDecoderCreate, /* VDP_FUNC_ID_DECODER_CREATE */
+   &vlVdpDecoderDestroy, /* VDP_FUNC_ID_DECODER_DESTROY */
    0, /* VDP_FUNC_ID_DECODER_GET_PARAMETERS */
-   0, /* VDP_FUNC_ID_DECODER_RENDER */
+   &vlVdpDecoderRender, /* VDP_FUNC_ID_DECODER_RENDER */
    &vlVdpVideoMixerQueryFeatureSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT */
    &vlVdpVideoMixerQueryParameterSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT */
    &vlVdpVideoMixerQueryAttributeSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT */
@@ -85,17 +85,17 @@ static void* ftab[67] =
    0, /* VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES */
    0, /* VDP_FUNC_ID_VIDEO_MIXER_DESTROY */
    0, /* VDP_FUNC_ID_VIDEO_MIXER_RENDER */
-   0, /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY */
-   0, /* VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE */
-   0, /* VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY */
-   0, /* VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR */
-   0, /* VDP_FUNC_ID_PRESENTATION_QUEUE_GET_BACKGROUND_COLOR */
+   &vlVdpPresentationQueueTargetDestroy, /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY */
+   &vlVdpPresentationQueueCreate, /* VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE */
+   &vlVdpPresentationQueueDestroy, /* VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY */
+   &vlVdpPresentationQueueSetBackgroundColor, /* VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR */
+   &vlVdpPresentationQueueGetBackgroundColor, /* VDP_FUNC_ID_PRESENTATION_QUEUE_GET_BACKGROUND_COLOR */
    0,
    0,
-   0, /* VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME */
-   0, /* VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY */
-   0, /* VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE */
-   0, /* VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS */
+   &vlVdpPresentationQueueGetTime, /* VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME */
+   &vlVdpPresentationQueueDisplay, /* VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY */
+   &vlVdpPresentationQueueBlockUntilSurfaceIdle, /* VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE */
+   &vlVdpPresentationQueueQuerySurfaceStatus, /* VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS */
    0  /* VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER */
 };
 
diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c
new file mode 100644 (file)
index 0000000..c5f0689
--- /dev/null
@@ -0,0 +1,43 @@
+/**************************************************************************
+ *
+ * Copyright 2010 Thomas Balling Sørensen.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "vdpau_private.h"
+#include <vdpau/vdpau.h>
+#include <util/u_debug.h>
+
+VdpStatus
+vlVdpOutputSurfaceCreate (     VdpDevice  device, 
+                                                       VdpRGBAFormat  rgba_format, 
+                                                       uint32_t width, uint32_t height, 
+                                                       VdpOutputSurface  *surface)
+{
+       debug_printf("[VDPAU] Creating output surface\n");
+       if (!(width && height))
+               return VDP_STATUS_INVALID_SIZE;
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
\ No newline at end of file
diff --git a/src/gallium/state_trackers/vdpau/preemption.c b/src/gallium/state_trackers/vdpau/preemption.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c
new file mode 100644 (file)
index 0000000..8200cf0
--- /dev/null
@@ -0,0 +1,121 @@
+/**************************************************************************
+ *
+ * Copyright 2010 Thomas Balling Sørensen.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "vdpau_private.h"
+#include <vdpau/vdpau.h>
+#include <util/u_debug.h>
+
+VdpStatus
+vlVdpPresentationQueueTargetDestroy (VdpPresentationQueueTarget  presentation_queue_target)
+{
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpPresentationQueueCreate ( VdpDevice  device, 
+                                                               VdpPresentationQueueTarget  presentation_queue_target, 
+                                                               VdpPresentationQueue  *presentation_queue)
+{
+       debug_printf("[VDPAU] Creating presentation queue\n");
+       
+       if (!presentation_queue)
+               return VDP_STATUS_INVALID_POINTER;
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpPresentationQueueDestroy (VdpPresentationQueue  presentation_queue)
+{
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpPresentationQueueSetBackgroundColor (     VdpPresentationQueue  presentation_queue, 
+                                                                                       VdpColor  *const background_color)
+{
+       if (!background_color)
+               return VDP_STATUS_INVALID_POINTER;
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpPresentationQueueGetBackgroundColor (     VdpPresentationQueue  presentation_queue, 
+                                                                                       VdpColor  *const background_color)
+{
+       if (!background_color)
+               return VDP_STATUS_INVALID_POINTER;
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpPresentationQueueGetTime (        VdpPresentationQueue  presentation_queue, 
+                                                               VdpTime  *current_time)
+{
+       if (!current_time)
+               return VDP_STATUS_INVALID_POINTER;
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpPresentationQueueDisplay (        VdpPresentationQueue  presentation_queue, 
+                                                               VdpOutputSurface  surface, 
+                                                               uint32_t clip_width, 
+                                                               uint32_t clip_height, 
+                                                               VdpTime  earliest_presentation_time)
+{
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpPresentationQueueBlockUntilSurfaceIdle (  VdpPresentationQueue  presentation_queue, 
+                                                                                               VdpOutputSurface  surface, 
+                                                                                               VdpTime  *first_presentation_time)
+{
+       if (!first_presentation_time)
+               return VDP_STATUS_INVALID_POINTER;
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
+
+VdpStatus
+vlVdpPresentationQueueQuerySurfaceStatus (     VdpPresentationQueue  presentation_queue, 
+                                                                                       VdpOutputSurface  surface, 
+                                                                                       VdpPresentationQueueStatus  *status, 
+                                                                                       VdpTime  *first_presentation_time)
+{
+       if (!(status && first_presentation_time))
+               return VDP_STATUS_INVALID_POINTER;
+       
+       return VDP_STATUS_NO_IMPLEMENTATION;
+}
\ No newline at end of file
index eb7cfbcdd362097b596736be6a679656a69d2030..86b5098f1781534cf2150f3a41886514c2e7823c 100644 (file)
@@ -31,6 +31,7 @@
 #include <pipe/p_screen.h>
 #include <pipe/p_defines.h>
 #include <math.h>
+#include <util/u_debug.h>
 
 
 VdpStatus
@@ -60,6 +61,8 @@ vlVdpVideoSurfaceQueryCapabilities(VdpDevice device, VdpChromaType surface_chrom
    struct vl_screen *vlscreen;
    uint32_t max_2d_texture_level;
    VdpStatus ret;
+   
+   debug_printf("[VDPAU] Querying video surfaces\n");
 
    if (!(is_supported && max_width && max_height))
       return VDP_STATUS_INVALID_POINTER;
@@ -102,6 +105,8 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp
 {
        struct vl_screen *vlscreen;
        
+       debug_printf("[VDPAU] Querying get put video surfaces\n");
+       
    if (!is_supported)
       return VDP_STATUS_INVALID_POINTER;
 
@@ -113,7 +118,7 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp
    if (!vlscreen)
       return VDP_STATUS_RESOURCES;
 
-   if (bits_ycbcr_format != VDP_YCBCR_FORMAT_Y8U8V8A8) 
+   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),
                                    PIPE_TEXTURE_2D,
@@ -135,6 +140,8 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
    uint32_t max_decode_height;
    uint32_t max_2d_texture_level;
    struct vl_screen *vlscreen;
+   
+   debug_printf("[VDPAU] Querying decoder\n");
        
    if (!(is_supported && max_level && max_macroblocks && max_width && max_height))
       return VDP_STATUS_INVALID_POINTER;
@@ -178,9 +185,11 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile,
 VdpStatus
 vlVdpOutputSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format,
                                     VdpBool *is_supported, uint32_t *max_width, uint32_t *max_height)
-{
+{      
    if (!(is_supported && max_width && max_height))
       return VDP_STATUS_INVALID_POINTER;
+         
+   debug_printf("[VDPAU] Querying ouput surfaces\n");
 
    return VDP_STATUS_NO_IMPLEMENTATION;
 }
@@ -189,6 +198,8 @@ VdpStatus
 vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format,
                                                     VdpBool *is_supported)
 {
+   debug_printf("[VDPAU] Querying output surfaces get put native cap\n");
+       
    if (!is_supported)
       return VDP_STATUS_INVALID_POINTER;
 
@@ -200,6 +211,7 @@ vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities(VdpDevice device, VdpRGBAFormat
                                                 VdpYCbCrFormat bits_ycbcr_format,
                                                 VdpBool *is_supported)
 {
+   debug_printf("[VDPAU] Querying output surfaces put ycrcb cap\n");
    if (!is_supported)
       return VDP_STATUS_INVALID_POINTER;
 
@@ -210,6 +222,7 @@ VdpStatus
 vlVdpBitmapSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format,
                                     VdpBool *is_supported, uint32_t *max_width, uint32_t *max_height)
 {
+   debug_printf("[VDPAU] Querying bitmap surfaces\n");
    if (!(is_supported && max_width && max_height))
       return VDP_STATUS_INVALID_POINTER;
 
@@ -220,6 +233,7 @@ VdpStatus
 vlVdpVideoMixerQueryFeatureSupport(VdpDevice device, VdpVideoMixerFeature feature,
                                    VdpBool *is_supported)
 {
+   debug_printf("[VDPAU] Querying mixer feature support\n");
    if (!is_supported)
       return VDP_STATUS_INVALID_POINTER;
 
diff --git a/src/gallium/state_trackers/vdpau/render.c b/src/gallium/state_trackers/vdpau/render.c
new file mode 100644 (file)
index 0000000..e69de29
index 18fe788f8701135be111ef3366646d6d25a03c9b..89437c89e4446d9b28d045755ec14db2e4e7afa9 100644 (file)
@@ -30,6 +30,7 @@
 #include <pipe/p_state.h>
 #include <util/u_memory.h>
 #include <util/u_format.h>
+#include <stdio.h>
 
 VdpStatus
 vlVdpVideoSurfaceCreate(VdpDevice device,
@@ -38,6 +39,8 @@ vlVdpVideoSurfaceCreate(VdpDevice device,
                        uint32_t height, 
                        VdpVideoSurface *surface)
 {
+       printf("[VDPAU] Creating a surface\n");
+       
     vlVdpSurface *p_surf;
     VdpStatus ret;