st/mesa: provide static inline st_init_vdpau_functions
authorEmil Velikov <emil.velikov@collabora.com>
Fri, 19 Jan 2018 16:53:47 +0000 (16:53 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 22 Jan 2018 16:31:15 +0000 (16:31 +0000)
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@collabora.com>
Acked-by: Christian König <christian.koenig@amd.com>
src/mesa/state_tracker/st_vdpau.c
src/mesa/state_tracker/st_vdpau.h

index e0126cc03d8b97f02e6c3ed9ce159b9eef261447..eb61aef1116682c5bd3bb566c0b7f492fa2c8a30 100644 (file)
@@ -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
index 59c744305cf39d817d24361b800565bff41b1ec2..6f4d46091f28f8d6813f390ded6df2f20a9d5de5 100644 (file)
 
 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 */