Mesa (main): mesa/st/vdpau: direct call the vdpau functions.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 21 01:47:16 UTC 2022


Module: Mesa
Branch: main
Commit: a64e5c02bdaacd3b8114268ed1fefe7c8ff581c7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a64e5c02bdaacd3b8114268ed1fefe7c8ff581c7

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Dec 20 14:37:08 2021 +1000

mesa/st/vdpau: direct call the vdpau functions.

This provides versions when vdpau is turned off, removes dd.h entries

Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

---

 src/mesa/main/dd.h                  | 14 --------------
 src/mesa/main/vdpau.c               | 13 +++++++------
 src/mesa/state_tracker/st_context.c |  3 ---
 src/mesa/state_tracker/st_vdpau.c   | 10 ++--------
 src/mesa/state_tracker/st_vdpau.h   | 26 +++++++++++++++++++++-----
 5 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 80e110e9142..0615942212a 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -236,20 +236,6 @@ struct dd_function_table {
 
    /**@}*/
 
-   /**
-    * \name NV_vdpau_interop interface
-    */
-   void (*VDPAUMapSurface)(struct gl_context *ctx, GLenum target,
-                           GLenum access, GLboolean output,
-                           struct gl_texture_object *texObj,
-                           struct gl_texture_image *texImage,
-                           const GLvoid *vdpSurface, GLuint index);
-   void (*VDPAUUnmapSurface)(struct gl_context *ctx, GLenum target,
-                             GLenum access, GLboolean output,
-                             struct gl_texture_object *texObj,
-                             struct gl_texture_image *texImage,
-                             const GLvoid *vdpSurface, GLuint index);
-
    /**
     * Query reset status for GL_ARB_robustness
     *
diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c
index 9eb9218aa25..b648dfbdac2 100644
--- a/src/mesa/main/vdpau.c
+++ b/src/mesa/main/vdpau.c
@@ -42,6 +42,7 @@
 #include "api_exec_decl.h"
 
 #include "state_tracker/st_cb_texture.h"
+#include "state_tracker/st_vdpau.h"
 
 #define MAX_TEXTURES 4
 
@@ -381,9 +382,9 @@ _mesa_VDPAUMapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces)
 
          st_FreeTextureImageBuffer(ctx, image);
 
-         ctx->Driver.VDPAUMapSurface(ctx, surf->target, surf->access,
-                                     surf->output, tex, image,
-                                     surf->vdpSurface, j);
+         st_vdpau_map_surface(ctx, surf->target, surf->access,
+                              surf->output, tex, image,
+                              surf->vdpSurface, j);
 
          _mesa_unlock_texture(ctx, tex);
       }
@@ -429,9 +430,9 @@ _mesa_VDPAUUnmapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces)
 
          image = _mesa_select_tex_image(tex, surf->target, 0);
 
-         ctx->Driver.VDPAUUnmapSurface(ctx, surf->target, surf->access,
-                                       surf->output, tex, image,
-                                       surf->vdpSurface, j);
+         st_vdpau_unmap_surface(ctx, surf->target, surf->access,
+                                surf->output, tex, image,
+                                surf->vdpSurface, j);
 
          if (image)
             st_FreeTextureImageBuffer(ctx, image);
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 518e5d36dd3..b25d5b1c567 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -57,7 +57,6 @@
 #include "st_program.h"
 #include "st_sampler_view.h"
 #include "st_shader_cache.h"
-#include "st_vdpau.h"
 #include "st_texture.h"
 #include "st_util.h"
 #include "pipe/p_context.h"
@@ -834,8 +833,6 @@ st_init_driver_functions(struct pipe_screen *screen,
    st_init_program_functions(functions);
    st_init_flush_functions(screen, functions);
 
-   st_init_vdpau_functions(functions);
-
    /* GL_ARB_get_program_binary */
    enum pipe_shader_ir preferred_ir = (enum pipe_shader_ir)
       screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
diff --git a/src/mesa/state_tracker/st_vdpau.c b/src/mesa/state_tracker/st_vdpau.c
index 660bdce6a44..dfeb3bc9ea0 100644
--- a/src/mesa/state_tracker/st_vdpau.c
+++ b/src/mesa/state_tracker/st_vdpau.c
@@ -181,7 +181,7 @@ st_vdpau_video_surface_dma_buf(struct gl_context *ctx, const void *vdpSurface,
    return st_vdpau_resource_from_description(ctx, &desc);
 }
 
-static void
+void
 st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
                      GLboolean output, struct gl_texture_object *texObj,
                      struct gl_texture_image *texImage,
@@ -257,7 +257,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
    pipe_resource_reference(&res, NULL);
 }
 
-static void
+void
 st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
                        GLboolean output, struct gl_texture_object *texObj,
                        struct gl_texture_image *texImage,
@@ -280,10 +280,4 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
    st_flush(st, NULL, 0);
 }
 
-void
-st_init_vdpau_functions(struct dd_function_table *functions)
-{
-   functions->VDPAUMapSurface = st_vdpau_map_surface;
-   functions->VDPAUUnmapSurface = st_vdpau_unmap_surface;
-}
 #endif
diff --git a/src/mesa/state_tracker/st_vdpau.h b/src/mesa/state_tracker/st_vdpau.h
index 6f4d46091f2..6bc11fcec29 100644
--- a/src/mesa/state_tracker/st_vdpau.h
+++ b/src/mesa/state_tracker/st_vdpau.h
@@ -34,14 +34,30 @@
 #ifndef ST_VDPAU_H
 #define ST_VDPAU_H
 
-struct dd_function_table;
-
 #ifdef HAVE_ST_VDPAU
-extern void
-st_init_vdpau_functions(struct dd_function_table *functions);
+
+void
+st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
+                     GLboolean output, struct gl_texture_object *texObj,
+                     struct gl_texture_image *texImage,
+                     const void *vdpSurface, GLuint index);
+void
+st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
+                       GLboolean output, struct gl_texture_object *texObj,
+                       struct gl_texture_image *texImage,
+                       const void *vdpSurface, GLuint index);
 #else
+
+static inline void
+st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
+                     GLboolean output, struct gl_texture_object *texObj,
+                     struct gl_texture_image *texImage,
+                     const void *vdpSurface, GLuint index) {}
 static inline void
-st_init_vdpau_functions(struct dd_function_table *functions) {}
+st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
+                       GLboolean output, struct gl_texture_object *texObj,
+                       struct gl_texture_image *texImage,
+                       const void *vdpSurface, GLuint index) {}
 #endif
 
 #endif /* ST_VDPAU_H */



More information about the mesa-commit mailing list