[Mesa-dev] [PATCH 1/8] intel: Add a new "common" library for more code sharing

Jason Ekstrand jason at jlekstrand.net
Wed Aug 31 20:56:51 UTC 2016


The first thing to go in this new library is brw_device_info.

Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
Cc: Rob Herring <robh at kernel.org>
---

The android build files I just copied-and-pasted from blorp but I don't
have an android build setup so I can't test them.

 src/intel/Android.common.mk                        | 37 ++++++++++++++++++++++
 src/intel/Android.mk                               |  1 +
 src/intel/Makefile.am                              |  1 +
 src/intel/Makefile.common.am                       | 24 ++++++++++++++
 src/intel/Makefile.isl.am                          |  1 +
 src/intel/Makefile.sources                         |  4 +++
 src/intel/blorp/blorp_genX_exec.h                  |  2 +-
 .../dri/i965 => intel/common}/brw_device_info.c    |  0
 .../dri/i965 => intel/common}/brw_device_info.h    |  0
 src/intel/isl/isl_format.c                         |  2 +-
 src/intel/isl/isl_priv.h                           |  2 +-
 .../isl/tests/isl_surf_get_image_offset_test.c     |  2 +-
 src/intel/tools/Makefile.am                        |  1 +
 src/intel/vulkan/Makefile.am                       |  1 +
 src/intel/vulkan/anv_private.h                     |  2 +-
 src/mesa/drivers/dri/i965/Android.mk               |  1 +
 src/mesa/drivers/dri/i965/Makefile.am              |  1 +
 src/mesa/drivers/dri/i965/Makefile.sources         |  2 --
 src/mesa/drivers/dri/i965/brw_compiler.h           |  2 +-
 src/mesa/drivers/dri/i965/intel_screen.h           |  2 +-
 20 files changed, 79 insertions(+), 9 deletions(-)
 create mode 100644 src/intel/Android.common.mk
 create mode 100644 src/intel/Makefile.common.am
 rename src/{mesa/drivers/dri/i965 => intel/common}/brw_device_info.c (100%)
 rename src/{mesa/drivers/dri/i965 => intel/common}/brw_device_info.h (100%)

diff --git a/src/intel/Android.common.mk b/src/intel/Android.common.mk
new file mode 100644
index 0000000..512bcd7
--- /dev/null
+++ b/src/intel/Android.common.mk
@@ -0,0 +1,37 @@
+# Copyright © 2016 Intel Corporation
+# Copyright © 2016 Mauro Rossi <issor.oruam at gmail.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+# ---------------------------------------
+# Build libintel_common
+# ---------------------------------------
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libintel_common
+
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+LOCAL_SRC_FILES := $(COMMON_FILES)
+
+LOCAL_C_INCLUDES :=
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/src/intel/Android.mk b/src/intel/Android.mk
index 0e9c29d..3d501ab 100644
--- a/src/intel/Android.mk
+++ b/src/intel/Android.mk
@@ -26,5 +26,6 @@ LOCAL_PATH := $(call my-dir)
 include $(LOCAL_PATH)/Makefile.sources
 
 include $(LOCAL_PATH)/Android.blorp.mk
+include $(LOCAL_PATH)/Android.common.mk
 include $(LOCAL_PATH)/Android.genxml.mk
 include $(LOCAL_PATH)/Android.isl.mk
diff --git a/src/intel/Makefile.am b/src/intel/Makefile.am
index fa4570d..9186b5c 100644
--- a/src/intel/Makefile.am
+++ b/src/intel/Makefile.am
@@ -53,6 +53,7 @@ CLEANFILES =
 EXTRA_DIST =
 
 include Makefile.blorp.am
+include Makefile.common.am
 include Makefile.genxml.am
 include Makefile.isl.am
 
diff --git a/src/intel/Makefile.common.am b/src/intel/Makefile.common.am
new file mode 100644
index 0000000..a8be54a
--- /dev/null
+++ b/src/intel/Makefile.common.am
@@ -0,0 +1,24 @@
+# Copyright © 2016 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+noinst_LTLIBRARIES += common/libintel_common.la
+
+common_libintel_common_la_SOURCES = $(COMMON_FILES)
diff --git a/src/intel/Makefile.isl.am b/src/intel/Makefile.isl.am
index 8871684..5a317f5 100644
--- a/src/intel/Makefile.isl.am
+++ b/src/intel/Makefile.isl.am
@@ -72,6 +72,7 @@ check_PROGRAMS += isl/tests/isl_surf_get_image_offset_test
 TESTS += $(check_PROGRAMS)
 
 isl_tests_isl_surf_get_image_offset_test_LDADD = \
+	common/libintel_common.la \
 	isl/libisl.la \
 	$(top_builddir)/src/mesa/drivers/dri/i965/libi965_compiler.la \
 	-lm
diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources
index fcf85ea..97f2328 100644
--- a/src/intel/Makefile.sources
+++ b/src/intel/Makefile.sources
@@ -6,6 +6,10 @@ BLORP_FILES = \
 	blorp/blorp_genX_exec.h \
 	blorp/blorp_priv.h
 
+COMMON_FILES = \
+	common/brw_device_info.c \
+	common/brw_device_info.h
+
 GENXML_GENERATED_FILES = \
 	genxml/gen4_pack.h \
 	genxml/gen45_pack.h \
diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h
index 966e4b3..461cfe0 100644
--- a/src/intel/blorp/blorp_genX_exec.h
+++ b/src/intel/blorp/blorp_genX_exec.h
@@ -22,7 +22,7 @@
  */
 
 #include "blorp_priv.h"
-#include "brw_device_info.h"
+#include "common/brw_device_info.h"
 #include "intel_aub.h"
 
 /**
diff --git a/src/mesa/drivers/dri/i965/brw_device_info.c b/src/intel/common/brw_device_info.c
similarity index 100%
rename from src/mesa/drivers/dri/i965/brw_device_info.c
rename to src/intel/common/brw_device_info.c
diff --git a/src/mesa/drivers/dri/i965/brw_device_info.h b/src/intel/common/brw_device_info.h
similarity index 100%
rename from src/mesa/drivers/dri/i965/brw_device_info.h
rename to src/intel/common/brw_device_info.h
diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c
index 8507cc5..c41a0bf 100644
--- a/src/intel/isl/isl_format.c
+++ b/src/intel/isl/isl_format.c
@@ -24,7 +24,7 @@
 #include <assert.h>
 
 #include "isl.h"
-#include "brw_device_info.h"
+#include "common/brw_device_info.h"
 
 struct surface_format_info {
    bool exists;
diff --git a/src/intel/isl/isl_priv.h b/src/intel/isl/isl_priv.h
index 3a7af1a..ab9103e 100644
--- a/src/intel/isl/isl_priv.h
+++ b/src/intel/isl/isl_priv.h
@@ -26,7 +26,7 @@
 #include <assert.h>
 #include <strings.h>
 
-#include "brw_device_info.h"
+#include "common/brw_device_info.h"
 #include "util/macros.h"
 
 #include "isl.h"
diff --git a/src/intel/isl/tests/isl_surf_get_image_offset_test.c b/src/intel/isl/tests/isl_surf_get_image_offset_test.c
index 9015f0e..0c9173d 100644
--- a/src/intel/isl/tests/isl_surf_get_image_offset_test.c
+++ b/src/intel/isl/tests/isl_surf_get_image_offset_test.c
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "brw_device_info.h"
+#include "common/brw_device_info.h"
 #include "isl/isl.h"
 #include "isl/isl_priv.h"
 
diff --git a/src/intel/tools/Makefile.am b/src/intel/tools/Makefile.am
index 9f9bb86..5f4d78d 100644
--- a/src/intel/tools/Makefile.am
+++ b/src/intel/tools/Makefile.am
@@ -37,6 +37,7 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/intel
 
 aubinator_DEPS = \
+	$(top_builddir)/src/intel/common/libintel_common.la \
 	$(top_builddir)/src/mesa/drivers/dri/i965/libi965_compiler.la \
 	$(top_builddir)/src/util/libmesautil.la \
 	$(PER_GEN_LIBS) \
diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 5491a16..2d20de9 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -117,6 +117,7 @@ VULKAN_LIB_DEPS += \
 	$(top_builddir)/src/mesa/drivers/dri/i965/libi965_compiler.la \
 	$(top_builddir)/src/compiler/nir/libnir.la \
 	$(top_builddir)/src/util/libmesautil.la \
+	$(top_builddir)/src/intel/common/libintel_common.la \
 	$(top_builddir)/src/intel/isl/libisl.la \
 	$(PER_GEN_LIBS) \
 	$(PTHREAD_LIBS) \
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index f24020c..74c1e5b 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -40,7 +40,7 @@
 #define VG(x)
 #endif
 
-#include "brw_device_info.h"
+#include "common/brw_device_info.h"
 #include "brw_compiler.h"
 #include "util/macros.h"
 #include "util/list.h"
diff --git a/src/mesa/drivers/dri/i965/Android.mk b/src/mesa/drivers/dri/i965/Android.mk
index 335850a..5ff9553 100644
--- a/src/mesa/drivers/dri/i965/Android.mk
+++ b/src/mesa/drivers/dri/i965/Android.mk
@@ -183,6 +183,7 @@ LOCAL_SRC_FILES := \
 LOCAL_WHOLE_STATIC_LIBRARIES := \
 	$(MESA_DRI_WHOLE_STATIC_LIBRARIES) \
 	$(I965_PERGEN_LIBS) \
+	libintel_common \
 	libmesa_blorp \
 	libmesa_isl
 
diff --git a/src/mesa/drivers/dri/i965/Makefile.am b/src/mesa/drivers/dri/i965/Makefile.am
index 91559c5..a192fc0 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -78,6 +78,7 @@ noinst_LTLIBRARIES = \
 
 libi965_dri_la_SOURCES = $(i965_FILES)
 libi965_dri_la_LIBADD = \
+	$(top_builddir)/src/intel/common/libintel_common.la \
 	$(top_builddir)/src/intel/isl/libisl.la \
 	libi965_compiler.la \
 	$(top_builddir)/src/intel/blorp/libblorp.la \
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
index 9ff5ceb..df90cb4 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -6,8 +6,6 @@ i965_compiler_FILES = \
 	brw_dead_control_flow.cpp \
 	brw_dead_control_flow.h \
 	brw_defines.h \
-	brw_device_info.c \
-	brw_device_info.h \
 	brw_disasm.c \
 	brw_eu.c \
 	brw_eu_compact.c \
diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
index 933ab11..b45fba13 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -24,7 +24,7 @@
 #pragma once
 
 #include <stdio.h>
-#include "brw_device_info.h"
+#include "common/brw_device_info.h"
 #include "main/mtypes.h"
 #include "main/macros.h"
 
diff --git a/src/mesa/drivers/dri/i965/intel_screen.h b/src/mesa/drivers/dri/i965/intel_screen.h
index f62b39f..ab1cc28 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.h
+++ b/src/mesa/drivers/dri/i965/intel_screen.h
@@ -33,7 +33,7 @@
 
 #include "dri_util.h"
 #include "intel_bufmgr.h"
-#include "brw_device_info.h"
+#include "common/brw_device_info.h"
 #include "i915_drm.h"
 #include "xmlconfig.h"
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list