[Mesa-dev] [PATCH 3/4] ac: remove amdgpu.h dependency for r600

Aaron Watry awatry at gmail.com
Mon Jun 5 20:31:33 UTC 2017


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

Add a couple of forward declarations and drop the amdgpu.h requirement
when bulding without HAVE_AMD_DRIVERS

With this we can build the r300 and r600 drivers without the need for
amdgpu.

v3: (Aaron)
 - Add stdbool/stdint.h includes in ac_gpu_info.h
   - amdgpu.h pulled in stdbool/stdint, which is needed here regardless of
     if we end up pulling in the amdgpu drm in the end.
 - Include amdgpu.h in ac_gpu_info.h when HAVE_AMD_DRIVERS is defined
 - Remove the amdgpu.h include from .c file
 - Only include struct/typedef if we don't have the real thing.
   - I was getting errors from conflicting type definitions when building r600+cl

v2:
 - Add amdgpu.h include in the C file (Marek)
 - Add a comment about pre C11 typedef redeclaration warning (Eric)

Cc: Nicolai Hähnle <nicolai.haehnle at amd.com>
Cc: Marek Olšák <marek.olsak at amd.com>
Cc: Emil Velikov <emil.velikov at collabora.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101189
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Signed-off-by: Aaron Watry <awatry at gmail.com>
---
 src/amd/common/ac_gpu_info.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/amd/common/ac_gpu_info.h b/src/amd/common/ac_gpu_info.h
index 3f7ade1a0b..4523431cb3 100644
--- a/src/amd/common/ac_gpu_info.h
+++ b/src/amd/common/ac_gpu_info.h
@@ -28,12 +28,23 @@
 
 #include "amd_family.h"
 
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef HAVE_AMD_DRIVERS
 #include <amdgpu.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#ifndef HAVE_AMD_DRIVERS
+    /* Prior to C11 the following may trigger a typedef redeclaration warning */
+    typedef void * amdgpu_device_handle;
+    struct amdgpu_gpu_info;
+#endif
+
 struct radeon_info {
 	/* PCI info: domain:bus:dev:func */
 	uint32_t                    pci_domain;
-- 
2.11.0



More information about the mesa-dev mailing list