gallium: replace INLINE with inline
[mesa.git] / src / mesa / state_tracker / st_vdpau.c
index 9b165ee39031ecaef908795c01a789f0c7a0878d..63af1196af1d515ef436aeeeb634f94741d5bb4f 100644 (file)
@@ -47,6 +47,7 @@
 #include "st_context.h"
 #include "st_texture.h"
 #include "st_format.h"
+#include "st_cb_flush.h"
 
 static void
 st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
@@ -62,10 +63,10 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
    struct st_texture_image *stImage = st_texture_image(texImage);
  
    struct pipe_resource *res;
-   struct pipe_sampler_view *sv, templ;
-   gl_format texFormat;
+   struct pipe_sampler_view templ, **sampler_view;
+   mesa_format texFormat;
 
-   getProcAddr = ctx->vdpGetProcAddress;
+   getProcAddr = (void *)ctx->vdpGetProcAddress;
    if (output) {
       VdpOutputSurfaceGallium *f;
       
@@ -82,6 +83,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
       }
 
    } else {
+      struct pipe_sampler_view *sv;
       VdpVideoSurfaceGallium *f;
 
       struct pipe_video_buffer *buffer;
@@ -137,7 +139,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
                               texFormat);
 
    pipe_resource_reference(&stObj->pt, res);
-   pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+   st_texture_release_all_sampler_views(st, stObj);
    pipe_resource_reference(&stImage->pt, res);
 
    u_sampler_view_default_template(&templ, res, res->format);
@@ -147,7 +149,9 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
    templ.swizzle_g = GET_SWZ(stObj->base._Swizzle, 1);
    templ.swizzle_b = GET_SWZ(stObj->base._Swizzle, 2);
    templ.swizzle_a = GET_SWZ(stObj->base._Swizzle, 3);
-   stObj->sampler_view = st->pipe->create_sampler_view(st->pipe, res, &templ);
+
+   sampler_view = st_texture_get_sampler_view(st, stObj);
+   *sampler_view = st->pipe->create_sampler_view(st->pipe, res, &templ);
 
    stObj->width0 = res->width0;
    stObj->height0 = res->height0;
@@ -163,14 +167,17 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
                        struct gl_texture_image *texImage,
                        const GLvoid *vdpSurface, GLuint index)
 {
+   struct st_context *st = st_context(ctx);
    struct st_texture_object *stObj = st_texture_object(texObj);
    struct st_texture_image *stImage = st_texture_image(texImage);
 
    pipe_resource_reference(&stObj->pt, NULL);
-   pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+   st_texture_release_all_sampler_views(st, stObj);
    pipe_resource_reference(&stImage->pt, NULL);
 
    _mesa_dirty_texobj(ctx, texObj);
+
+   st_flush(st, NULL, 0);
 }
 
 void