Mesa (master): st/mesa: provide static inline st_init_vdpau_functions

Emil Velikov evelikov at kemper.freedesktop.org
Mon Jan 22 16:56:38 UTC 2018


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

Author: Emil Velikov <emil.velikov at collabora.com>
Date:   Fri Jan 19 16:53:47 2018 +0000

st/mesa: provide static inline st_init_vdpau_functions

The ifdef spaghetty in st_vdpau.c is rather confusing and misleading.
Simplily it by introducing a static inline helper noop (when
HAVE_ST_VDPAU is not defined) in the header.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Acked-by: Christian König <christian.koenig at amd.com>

---

 src/mesa/state_tracker/st_vdpau.c | 9 +++------
 src/mesa/state_tracker/st_vdpau.h | 5 +++++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesa/state_tracker/st_vdpau.c b/src/mesa/state_tracker/st_vdpau.c
index e0126cc03d..eb61aef111 100644
--- a/src/mesa/state_tracker/st_vdpau.c
+++ b/src/mesa/state_tracker/st_vdpau.c
@@ -31,6 +31,8 @@
  *
  */
 
+#ifdef HAVE_ST_VDPAU
+
 #include "main/texobj.h"
 #include "main/teximage.h"
 #include "main/errors.h"
@@ -48,8 +50,6 @@
 #include "st_format.h"
 #include "st_cb_flush.h"
 
-#ifdef HAVE_ST_VDPAU
-
 #include "state_tracker/vdpau_interop.h"
 #include "state_tracker/vdpau_dmabuf.h"
 #include "state_tracker/vdpau_funcs.h"
@@ -268,13 +268,10 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
    st_flush(st, NULL, 0);
 }
 
-#endif
-
 void
 st_init_vdpau_functions(struct dd_function_table *functions)
 {
-#ifdef HAVE_ST_VDPAU
    functions->VDPAUMapSurface = st_vdpau_map_surface;
    functions->VDPAUUnmapSurface = st_vdpau_unmap_surface;
-#endif
 }
+#endif
diff --git a/src/mesa/state_tracker/st_vdpau.h b/src/mesa/state_tracker/st_vdpau.h
index 59c744305c..6f4d46091f 100644
--- a/src/mesa/state_tracker/st_vdpau.h
+++ b/src/mesa/state_tracker/st_vdpau.h
@@ -36,7 +36,12 @@
 
 struct dd_function_table;
 
+#ifdef HAVE_ST_VDPAU
 extern void
 st_init_vdpau_functions(struct dd_function_table *functions);
+#else
+static inline void
+st_init_vdpau_functions(struct dd_function_table *functions) {}
+#endif
 
 #endif /* ST_VDPAU_H */




More information about the mesa-commit mailing list