[PATCH xf86-video-amdgpu 2/7] Use family information from libdrm_amdgpu / kernel

Michel Dänzer michel at daenzer.net
Tue Nov 1 09:31:20 UTC 2016


From: Michel Dänzer <michel.daenzer at amd.com>

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_drv.h |  2 +-
 src/amdgpu_kms.c | 18 +++++-------------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index fc6a79d..62aa1c1 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -193,7 +193,7 @@ typedef struct {
 	EntityInfoPtr pEnt;
 	pciVideoPtr PciInfo;
 	int Chipset;
-	AMDGPUChipFamily ChipFamily;
+	uint32_t family;
 	struct gbm_device *gbm;
 
 	 Bool(*CloseScreen) (CLOSE_SCREEN_ARGS_DECL);
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 077a8f8..68570e4 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -53,7 +53,6 @@
 
 #include <X11/extensions/damageproto.h>
 
-#include "amdgpu_chipinfo_gen.h"
 #include "amdgpu_bo_helper.h"
 #include "amdgpu_pixmap.h"
 
@@ -1159,10 +1158,10 @@ static Bool AMDGPUPreInitAccel_KMS(ScrnInfoPtr pScrn)
 	return TRUE;
 }
 
-static Bool AMDGPUPreInitChipType_KMS(ScrnInfoPtr pScrn)
+static Bool AMDGPUPreInitChipType_KMS(ScrnInfoPtr pScrn,
+				      struct amdgpu_gpu_info *gpu_info)
 {
 	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
-	int i;
 
 	info->Chipset = PCI_DEV_DEVICE_ID(info->PciInfo);
 	pScrn->chipset =
@@ -1183,13 +1182,7 @@ static Bool AMDGPUPreInitChipType_KMS(ScrnInfoPtr pScrn)
 		   "Chipset: \"%s\" (ChipID = 0x%04x)\n",
 		   pScrn->chipset, info->Chipset);
 
-	for (i = 0; i < sizeof(AMDGPUCards) / sizeof(AMDGPUCardInfo); i++) {
-		if (info->Chipset == AMDGPUCards[i].pci_device_id) {
-			AMDGPUCardInfo *card = &AMDGPUCards[i];
-			info->ChipFamily = card->chip_family;
-			break;
-		}
-	}
+	info->family = gpu_info->family_id;
 
 	return TRUE;
 }
@@ -1331,7 +1324,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	memset(&gpu_info, 0, sizeof(gpu_info));
 	amdgpu_query_gpu_info(pAMDGPUEnt->pDev, &gpu_info);
 
-	if (!AMDGPUPreInitChipType_KMS(pScrn))
+	if (!AMDGPUPreInitChipType_KMS(pScrn, &gpu_info))
 		goto fail;
 
 	info->dri2.available = FALSE;
@@ -1412,8 +1405,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	else
 		pAMDGPUEnt->HasCRTC2 = TRUE;
 
-	if (info->ChipFamily >= CHIP_FAMILY_TAHITI &&
-	    info->ChipFamily <= CHIP_FAMILY_HAINAN) {
+	if (info->family < AMDGPU_FAMILY_CI) {
 		info->cursor_w = CURSOR_WIDTH;
 		info->cursor_h = CURSOR_HEIGHT;
 	} else {
-- 
2.10.2



More information about the amd-gfx mailing list