vl: some more fixes and addition to the decoder handling
authorThomas Balling Sørensen <tball@tball-laptop.(none)>
Wed, 6 Oct 2010 22:26:46 +0000 (00:26 +0200)
committerThomas Balling Sørensen <tball@tball-laptop.(none)>
Wed, 6 Oct 2010 22:26:46 +0000 (00:26 +0200)
src/gallium/state_trackers/vdpau/decode.c
src/gallium/state_trackers/vdpau/device.c
src/gallium/state_trackers/vdpau/mixer.c
src/gallium/state_trackers/vdpau/vdpau_private.h

index f60033046681a7f2478d62123404d5bba6e16550..1b49b4b252030fea6378616a77c349b5d0e9dfa6 100644 (file)
@@ -74,7 +74,10 @@ vlVdpDecoderCreate (         VdpDevice device,
        // TODO: Define max_references. Used mainly for H264
        
        vldecoder->profile = p_profile;
+       vldecoder->height = height;
+       vldecoder->width = width;
        vldecoder->device = dev;
+       vldecoder->vctx = NULL;
                
        *decoder = vlAddDataHTAB(vldecoder);
        if (*decoder == 0) {
@@ -127,27 +130,27 @@ vlVdpCreateSurfaceTarget   (vlVdpDecoder *vldecoder,
 {
        struct pipe_resource tmplt;
        struct pipe_resource *surf_tex;
-       struct pipe_video_context *vpipe;
+       struct pipe_video_context *vctx;
        
        debug_printf("[VDPAU] Creating surface\n");
                
        if(!(vldecoder && vlsurf))
                return VDP_STATUS_INVALID_POINTER;
                
-       vpipe = vldecoder->vctx;
+       vctx = 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,
+       if (vctx->is_format_supported(vctx, 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,
+      assert(vctx->is_format_supported(vctx, tmplt.format,
                                        PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET,
                                        PIPE_TEXTURE_GEOM_NON_SQUARE));
       tmplt.width0 = util_next_power_of_two(vlsurf->width);
@@ -158,9 +161,9 @@ vlVdpCreateSurfaceTarget   (vlVdpDecoder *vldecoder,
        tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
        tmplt.flags = 0;
        
-       surf_tex = vpipe->screen->resource_create(vpipe->screen, &tmplt);
+       surf_tex = vctx->screen->resource_create(vctx->screen, &tmplt);
        
-       vlsurf->psurface = vpipe->screen->get_tex_surface(vpipe->screen, surf_tex, 0, 0, 0,
+       vlsurf->psurface = vctx->screen->get_tex_surface(vctx->screen, surf_tex, 0, 0, 0,
                                          PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET);
                                                                                 
        pipe_resource_reference(&surf_tex, NULL);
@@ -193,7 +196,6 @@ vlVdpDecoderRenderMpeg2    (vlVdpDecoder *vldecoder,
        
        debug_printf("[VDPAU] Decoding MPEG2\n");
 
-       vpipe = vldecoder->vctx->vpipe;
        t_vdp_surf = vlsurf;
        
        /* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */
@@ -218,6 +220,8 @@ vlVdpDecoderRenderMpeg2    (vlVdpDecoder *vldecoder,
        
        ret = vlVdpCreateSurfaceTarget(vldecoder,t_vdp_surf);
 
+       vpipe = vldecoder->vctx->vpipe;
+
        if (vlVdpMPEG2BitstreamToMacroblock(vpipe->screen, bitstream_buffers, bitstream_buffer_count,
                      &num_macroblocks, &pipe_macroblocks))
                                         {
@@ -228,7 +232,7 @@ vlVdpDecoderRenderMpeg2    (vlVdpDecoder *vldecoder,
                                         }
                
        vpipe->set_decode_target(vpipe,t_surf);
-       //vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL);
+       vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL);
        
        skip_frame:
        return ret;
@@ -263,14 +267,15 @@ vlVdpDecoderRender (VdpDecoder decoder,
        if (vlsurf->device != vldecoder->device)
                return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
                
-       if (vlsurf->chroma_format != vldecoder->chroma_format)
-               return VDP_STATUS_INVALID_CHROMA_TYPE;
+       /* Test doesn't make sence */
+       /*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);
+       vldecoder->vctx = vl_video_create(vscreen, vldecoder->profile, vlsurf->format, vldecoder->width, vldecoder->height);
        if (!vldecoder->vctx)
                return VDP_STATUS_RESOURCES;
                
index 4ca198e874d9b5ac766576bfe42d38c409601d6c..496e2b8def07f223232dd16c60cb939de7cf09b6 100644 (file)
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 #include <pipe/p_compiler.h>
+#include <pipe/p_video_context.h>
 #include <vl_winsys.h>
 #include <util/u_memory.h>
 #include <util/u_debug.h>
@@ -51,8 +52,15 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGe
       ret = VDP_STATUS_RESOURCES;
       goto no_dev;
    }
+
    dev->display = display;
    dev->screen = screen;
+   dev->vscreen = vl_screen_create(display, screen);
+   if (!dev->vscreen)
+          {
+      ret = VDP_STATUS_RESOURCES;
+      goto no_vscreen;
+   }
 
    *device = vlAddDataHTAB(dev);
    if (*device == 0) {
@@ -66,6 +74,8 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGe
    return VDP_STATUS_OK;
 
 no_handle:
+   /* Destroy vscreen */
+no_vscreen:
    FREE(dev);
 no_dev:
    vlDestroyHTAB();
index 8bf42f53ff244bedc55dd402fd0aa10180b75a08..124125ebaad3666fab771da650ea30affc70f8ff 100644 (file)
@@ -130,6 +130,11 @@ vlVdpVideoMixerSetAttributeValues (
        vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
        if (!vmixer)
                return VDP_STATUS_INVALID_HANDLE;
+               
+       /*
+        * TODO: Implement the function
+        * 
+        * */
        
        return VDP_STATUS_OK;
 }
\ No newline at end of file
index 36ef124c13d484906a4020e3ac20d107cdf9797d..de206365ce2c75323bdcede68462b5a88ac0eaab 100644 (file)
@@ -163,8 +163,9 @@ static enum pipe_video_profile ProfileToPipe(VdpDecoderProfile vdpau_profile)
 
 typedef struct
 {
-   void *display;
+   Display *display;
    int screen;
+   struct vl_screen *vscreen;
 } vlVdpDevice;
 
 typedef struct
@@ -207,10 +208,11 @@ typedef struct
 typedef struct
 {
        vlVdpDevice *device;
-       struct vl_screen *vlscreen;
-       struct vl_context *vctx;
+    struct vl_context *vctx;
        enum pipe_video_chroma_format chroma_format;
        enum pipe_video_profile profile;
+       uint32_t width;
+       uint32_t height;
 } vlVdpDecoder;
 
 typedef uint32_t vlHandle;