[Mesa-dev] [PATCH 4/4] amd/addrlib: move addrlib from amdgpu winsys to common code

Dave Airlie airlied at gmail.com
Mon Sep 5 01:03:40 UTC 2016


From: Dave Airlie <airlied at redhat.com>

---
 src/amd/Makefile.addrlib.am                        | 35 ++++++++++++++++++++++
 src/amd/Makefile.am                                |  3 ++
 src/amd/Makefile.sources                           | 24 ++++++++++++++-
 .../amdgpu/drm => amd}/addrlib/addrinterface.cpp   |  0
 .../amdgpu/drm => amd}/addrlib/addrinterface.h     |  0
 .../winsys/amdgpu/drm => amd}/addrlib/addrtypes.h  |  0
 .../amdgpu/drm => amd}/addrlib/core/addrcommon.h   |  0
 .../drm => amd}/addrlib/core/addrelemlib.cpp       |  0
 .../amdgpu/drm => amd}/addrlib/core/addrelemlib.h  |  0
 .../amdgpu/drm => amd}/addrlib/core/addrlib.cpp    |  0
 .../amdgpu/drm => amd}/addrlib/core/addrlib.h      |  0
 .../amdgpu/drm => amd}/addrlib/core/addrobject.cpp |  0
 .../amdgpu/drm => amd}/addrlib/core/addrobject.h   |  0
 .../drm => amd}/addrlib/inc/chip/r800/si_gb_reg.h  |  0
 .../drm => amd}/addrlib/inc/lnx_common_defs.h      |  0
 .../addrlib/r800/chip/si_ci_vi_merged_enum.h       |  0
 .../amdgpu/drm => amd}/addrlib/r800/ciaddrlib.cpp  |  0
 .../amdgpu/drm => amd}/addrlib/r800/ciaddrlib.h    |  0
 .../amdgpu/drm => amd}/addrlib/r800/egbaddrlib.cpp |  0
 .../amdgpu/drm => amd}/addrlib/r800/egbaddrlib.h   |  0
 .../amdgpu/drm => amd}/addrlib/r800/siaddrlib.cpp  |  0
 .../amdgpu/drm => amd}/addrlib/r800/siaddrlib.h    |  0
 .../winsys/amdgpu/drm => amd/common}/amdgpu_id.h   |  2 +-
 src/gallium/winsys/amdgpu/drm/Makefile.am          |  7 ++---
 src/gallium/winsys/amdgpu/drm/Makefile.sources     | 20 -------------
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c      |  2 +-
 26 files changed, 65 insertions(+), 28 deletions(-)
 create mode 100644 src/amd/Makefile.addrlib.am
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/addrinterface.cpp (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/addrinterface.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/addrtypes.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/core/addrcommon.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/core/addrelemlib.cpp (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/core/addrelemlib.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/core/addrlib.cpp (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/core/addrlib.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/core/addrobject.cpp (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/core/addrobject.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/inc/chip/r800/si_gb_reg.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/inc/lnx_common_defs.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/r800/chip/si_ci_vi_merged_enum.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/r800/ciaddrlib.cpp (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/r800/ciaddrlib.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/r800/egbaddrlib.cpp (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/r800/egbaddrlib.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/r800/siaddrlib.cpp (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd}/addrlib/r800/siaddrlib.h (100%)
 rename src/{gallium/winsys/amdgpu/drm => amd/common}/amdgpu_id.h (99%)

diff --git a/src/amd/Makefile.addrlib.am b/src/amd/Makefile.addrlib.am
new file mode 100644
index 0000000..434e692
--- /dev/null
+++ b/src/amd/Makefile.addrlib.am
@@ -0,0 +1,35 @@
+# Copyright 2016 Red Hat Inc.
+#
+# 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.
+
+ADDRLIB_LIBS = addrlib/libamdgpu_addrlib.la
+
+addrlib_libamdgpu_addrlib_la_CPPFLAGS = \
+	-I$(top_srcdir)/src/ \
+	-I$(srcdir)/common \
+	-I$(srcdir)/addrlib \
+	-I$(srcdir)/addrlib/core \
+	-I$(srcdir)/addrlib/inc/chip/r800 \
+	-I$(srcdir)/addrlib/r800/chip \
+	-DBRAHMA_BUILD=1
+
+noinst_LTLIBRARIES += $(ADDRLIB_LIBS)
+
+addrlib_libamdgpu_addrlib_la_SOURCES = $(ADDRLIB_FILES)
diff --git a/src/amd/Makefile.am b/src/amd/Makefile.am
index d9b5a06..d01d435 100644
--- a/src/amd/Makefile.am
+++ b/src/amd/Makefile.am
@@ -21,4 +21,7 @@
 
 include Makefile.sources
 
+noinst_LTLIBRARIES =
+
 EXTRA_DIST = $(COMMON_HEADER_FILES)
+include Makefile.addrlib.am
diff --git a/src/amd/Makefile.sources b/src/amd/Makefile.sources
index 7e08cd5..e508324 100644
--- a/src/amd/Makefile.sources
+++ b/src/amd/Makefile.sources
@@ -1,4 +1,26 @@
 COMMON_HEADER_FILES = \
 	common/sid.h \
 	common/r600d_common.h \
-	common/amd_family.h
+	common/amd_family.h \
+	common/amdgpu_id.h
+
+ADDRLIB_FILES = \
+	addrlib/addrinterface.cpp \
+	addrlib/addrinterface.h \
+	addrlib/addrtypes.h \
+	addrlib/core/addrcommon.h \
+	addrlib/core/addrelemlib.cpp \
+	addrlib/core/addrelemlib.h \
+	addrlib/core/addrlib.cpp \
+	addrlib/core/addrlib.h \
+	addrlib/core/addrobject.cpp \
+	addrlib/core/addrobject.h \
+	addrlib/inc/chip/r800/si_gb_reg.h \
+	addrlib/inc/lnx_common_defs.h \
+	addrlib/r800/chip/si_ci_vi_merged_enum.h \
+	addrlib/r800/ciaddrlib.cpp \
+	addrlib/r800/ciaddrlib.h \
+	addrlib/r800/egbaddrlib.cpp \
+	addrlib/r800/egbaddrlib.h \
+	addrlib/r800/siaddrlib.cpp \
+	addrlib/r800/siaddrlib.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/addrinterface.cpp b/src/amd/addrlib/addrinterface.cpp
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/addrinterface.cpp
rename to src/amd/addrlib/addrinterface.cpp
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/addrinterface.h b/src/amd/addrlib/addrinterface.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/addrinterface.h
rename to src/amd/addrlib/addrinterface.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/addrtypes.h b/src/amd/addrlib/addrtypes.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/addrtypes.h
rename to src/amd/addrlib/addrtypes.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/core/addrcommon.h b/src/amd/addrlib/core/addrcommon.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/core/addrcommon.h
rename to src/amd/addrlib/core/addrcommon.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/core/addrelemlib.cpp b/src/amd/addrlib/core/addrelemlib.cpp
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/core/addrelemlib.cpp
rename to src/amd/addrlib/core/addrelemlib.cpp
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/core/addrelemlib.h b/src/amd/addrlib/core/addrelemlib.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/core/addrelemlib.h
rename to src/amd/addrlib/core/addrelemlib.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/core/addrlib.cpp b/src/amd/addrlib/core/addrlib.cpp
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/core/addrlib.cpp
rename to src/amd/addrlib/core/addrlib.cpp
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/core/addrlib.h b/src/amd/addrlib/core/addrlib.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/core/addrlib.h
rename to src/amd/addrlib/core/addrlib.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/core/addrobject.cpp b/src/amd/addrlib/core/addrobject.cpp
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/core/addrobject.cpp
rename to src/amd/addrlib/core/addrobject.cpp
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/core/addrobject.h b/src/amd/addrlib/core/addrobject.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/core/addrobject.h
rename to src/amd/addrlib/core/addrobject.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/inc/chip/r800/si_gb_reg.h b/src/amd/addrlib/inc/chip/r800/si_gb_reg.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/inc/chip/r800/si_gb_reg.h
rename to src/amd/addrlib/inc/chip/r800/si_gb_reg.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/inc/lnx_common_defs.h b/src/amd/addrlib/inc/lnx_common_defs.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/inc/lnx_common_defs.h
rename to src/amd/addrlib/inc/lnx_common_defs.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/r800/chip/si_ci_vi_merged_enum.h b/src/amd/addrlib/r800/chip/si_ci_vi_merged_enum.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/r800/chip/si_ci_vi_merged_enum.h
rename to src/amd/addrlib/r800/chip/si_ci_vi_merged_enum.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/r800/ciaddrlib.cpp b/src/amd/addrlib/r800/ciaddrlib.cpp
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/r800/ciaddrlib.cpp
rename to src/amd/addrlib/r800/ciaddrlib.cpp
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/r800/ciaddrlib.h b/src/amd/addrlib/r800/ciaddrlib.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/r800/ciaddrlib.h
rename to src/amd/addrlib/r800/ciaddrlib.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/r800/egbaddrlib.cpp b/src/amd/addrlib/r800/egbaddrlib.cpp
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/r800/egbaddrlib.cpp
rename to src/amd/addrlib/r800/egbaddrlib.cpp
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/r800/egbaddrlib.h b/src/amd/addrlib/r800/egbaddrlib.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/r800/egbaddrlib.h
rename to src/amd/addrlib/r800/egbaddrlib.h
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/r800/siaddrlib.cpp b/src/amd/addrlib/r800/siaddrlib.cpp
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/r800/siaddrlib.cpp
rename to src/amd/addrlib/r800/siaddrlib.cpp
diff --git a/src/gallium/winsys/amdgpu/drm/addrlib/r800/siaddrlib.h b/src/amd/addrlib/r800/siaddrlib.h
similarity index 100%
rename from src/gallium/winsys/amdgpu/drm/addrlib/r800/siaddrlib.h
rename to src/amd/addrlib/r800/siaddrlib.h
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_id.h b/src/amd/common/amdgpu_id.h
similarity index 99%
rename from src/gallium/winsys/amdgpu/drm/amdgpu_id.h
rename to src/amd/common/amdgpu_id.h
index 40b835c..f91df55 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_id.h
+++ b/src/amd/common/amdgpu_id.h
@@ -32,7 +32,7 @@
 #ifndef AMDGPU_ID_H
 #define AMDGPU_ID_H
 
-#include "pipe/p_config.h"
+#include "util/u_endian.h"
 
 #if defined(PIPE_ARCH_LITTLE_ENDIAN)
 #define LITTLEENDIAN_CPU
diff --git a/src/gallium/winsys/amdgpu/drm/Makefile.am b/src/gallium/winsys/amdgpu/drm/Makefile.am
index a719913..543325c 100644
--- a/src/gallium/winsys/amdgpu/drm/Makefile.am
+++ b/src/gallium/winsys/amdgpu/drm/Makefile.am
@@ -4,14 +4,11 @@ include $(top_srcdir)/src/gallium/Automake.inc
 AM_CFLAGS = \
 	$(GALLIUM_WINSYS_CFLAGS) \
 	$(AMDGPU_CFLAGS) \
-	-I$(srcdir)/addrlib \
-	-I$(srcdir)/addrlib/core \
-	-I$(srcdir)/addrlib/inc/chip/r800 \
-	-I$(srcdir)/addrlib/r800/chip \
-	-DBRAHMA_BUILD=1
+	-I$(top_srcdir)/src/amd/
 
 AM_CXXFLAGS = $(AM_CFLAGS)
 
 noinst_LTLIBRARIES = libamdgpuwinsys.la
 
+libamdgpuwinsys_la_LIBADD = $(top_builddir)/src/amd/addrlib/libamdgpu_addrlib.la
 libamdgpuwinsys_la_SOURCES = $(C_SOURCES)
diff --git a/src/gallium/winsys/amdgpu/drm/Makefile.sources b/src/gallium/winsys/amdgpu/drm/Makefile.sources
index 2363004..cb2f01f 100644
--- a/src/gallium/winsys/amdgpu/drm/Makefile.sources
+++ b/src/gallium/winsys/amdgpu/drm/Makefile.sources
@@ -1,28 +1,8 @@
 C_SOURCES := \
-	addrlib/addrinterface.cpp \
-	addrlib/addrinterface.h \
-	addrlib/addrtypes.h \
-	addrlib/core/addrcommon.h \
-	addrlib/core/addrelemlib.cpp \
-	addrlib/core/addrelemlib.h \
-	addrlib/core/addrlib.cpp \
-	addrlib/core/addrlib.h \
-	addrlib/core/addrobject.cpp \
-	addrlib/core/addrobject.h \
-	addrlib/inc/chip/r800/si_gb_reg.h \
-	addrlib/inc/lnx_common_defs.h \
-	addrlib/r800/chip/si_ci_vi_merged_enum.h \
-	addrlib/r800/ciaddrlib.cpp \
-	addrlib/r800/ciaddrlib.h \
-	addrlib/r800/egbaddrlib.cpp \
-	addrlib/r800/egbaddrlib.h \
-	addrlib/r800/siaddrlib.cpp \
-	addrlib/r800/siaddrlib.h \
 	amdgpu_bo.c \
 	amdgpu_bo.h \
 	amdgpu_cs.c \
 	amdgpu_cs.h \
-	amdgpu_id.h \
 	amdgpu_public.h \
 	amdgpu_surface.c \
 	amdgpu_winsys.c \
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index 0ae1861..33aa492 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -39,7 +39,7 @@
 #include <xf86drm.h>
 #include <stdio.h>
 #include <sys/stat.h>
-#include "amdgpu_id.h"
+#include "amd/common/amdgpu_id.h"
 
 #define CIK_TILE_MODE_COLOR_2D			14
 
-- 
2.5.5



More information about the mesa-dev mailing list