[Mesa-dev] [PATCH 3/4] st/dri: inline dri2_buffer.h within dri2.c

Emil Velikov emil.l.velikov at gmail.com
Fri Aug 24 13:05:59 UTC 2018


From: Emil Velikov <emil.velikov at collabora.com>

The header was used only by dri2.c, containing a two-member struct and cast wrapper.
Just inline it where it's used/needed.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 .../state_trackers/dri/Makefile.sources       |  3 +--
 src/gallium/state_trackers/dri/dri2.c         | 15 ++++++++++++-
 src/gallium/state_trackers/dri/dri2_buffer.h  | 22 -------------------
 src/gallium/state_trackers/dri/meson.build    |  2 +-
 4 files changed, 16 insertions(+), 26 deletions(-)
 delete mode 100644 src/gallium/state_trackers/dri/dri2_buffer.h

diff --git a/src/gallium/state_trackers/dri/Makefile.sources b/src/gallium/state_trackers/dri/Makefile.sources
index 36d5d47bb33..a610293bb11 100644
--- a/src/gallium/state_trackers/dri/Makefile.sources
+++ b/src/gallium/state_trackers/dri/Makefile.sources
@@ -11,8 +11,7 @@ common_SOURCES := \
 	dri_screen.h
 
 dri2_SOURCES := \
-	dri2.c \
-	dri2_buffer.h
+	dri2.c
 
 drisw_SOURCES := \
 	drisw.c
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 2ac32205d9a..3cbca4e5dc3 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -45,15 +45,28 @@
 #include "main/bufferobj.h"
 #include "main/texobj.h"
 
+#include "dri_util.h"
+
 #include "dri_helpers.h"
 #include "dri_drawable.h"
 #include "dri_query_renderer.h"
-#include "dri2_buffer.h"
 
 #ifndef DRM_FORMAT_MOD_INVALID
 #define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
 #endif
 
+struct dri2_buffer
+{
+   __DRIbuffer base;
+   struct pipe_resource *resource;
+};
+
+static inline struct dri2_buffer *
+dri2_buffer(__DRIbuffer * driBufferPriv)
+{
+   return (struct dri2_buffer *) driBufferPriv;
+}
+
 static const int fourcc_formats[] = {
    __DRI_IMAGE_FOURCC_ARGB2101010,
    __DRI_IMAGE_FOURCC_XRGB2101010,
diff --git a/src/gallium/state_trackers/dri/dri2_buffer.h b/src/gallium/state_trackers/dri/dri2_buffer.h
deleted file mode 100644
index 0cee4e906e6..00000000000
--- a/src/gallium/state_trackers/dri/dri2_buffer.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef DRI2_BUFFER_H
-#define DRI2_BUFFER_H
-
-#include "dri_util.h"
-
-struct pipe_surface;
-
-struct dri2_buffer
-{
-   __DRIbuffer base;
-   struct pipe_resource *resource;
-};
-
-static inline struct dri2_buffer *
-dri2_buffer(__DRIbuffer * driBufferPriv)
-{
-   return (struct dri2_buffer *) driBufferPriv;
-}
-
-#endif
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/meson.build b/src/gallium/state_trackers/dri/meson.build
index dfc37fcd81c..4bb41157e42 100644
--- a/src/gallium/state_trackers/dri/meson.build
+++ b/src/gallium/state_trackers/dri/meson.build
@@ -38,7 +38,7 @@ if with_dri
 endif
 
 if with_dri2
-  files_libdri += files('dri2.c', 'dri2_buffer.h')
+  files_libdri += files('dri2.c')
 endif
 
 libdri_c_args = []
-- 
2.18.0



More information about the mesa-dev mailing list