xf86-video-ati: Branch 'master' - 2 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Tue Jan 24 09:20:12 UTC 2017


 .editorconfig |    3 +++
 src/ati.c     |   40 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 39 insertions(+), 4 deletions(-)

New commits:
commit a1787e4615a76ab0bb12498be66591c86a6b07ae
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Jan 18 19:07:11 2017 +0900

    ati: Support loading the amdgpu driver from the ati wrapper
    
    If .../share/X11/xorg.conf.d/10-amdgpu.conf doesn't exist, but the ati
    wrapper is loaded, it will otherwise try to use the radeon driver even
    for GPUs driven by the amdgpu kernel driver. This can only fail,
    potentially in bad ways.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/ati.c b/src/ati.c
index 227665e..6fd2156 100644
--- a/src/ati.c
+++ b/src/ati.c
@@ -58,6 +58,7 @@
 #endif
 
 #include <pciaccess.h>
+#include <xf86drm.h>
 #include "atipcirename.h"
 
 #include "ati.h"
@@ -68,6 +69,7 @@
 #define MACH64_DRIVER_NAME  "mach64"
 #define R128_DRIVER_NAME    "r128"
 #define RADEON_DRIVER_NAME  "radeon"
+#define AMDGPU_DRIVER_NAME  "amdgpu"
 
 enum
 {
@@ -140,9 +142,9 @@ ati_device_get_indexed(int index)
 void
 ati_gdev_subdriver(pointer options)
 {
-    int      nATIGDev, nMach64GDev, nR128GDev, nRadeonGDev;
+    int      nATIGDev, nMach64GDev, nR128GDev, nRadeonGDev, nAmdgpuGDev;
     GDevPtr *ATIGDevs;
-    Bool     load_mach64 = FALSE, load_r128 = FALSE, load_radeon = FALSE;
+    Bool     load_mach64 = FALSE, load_r128 = FALSE, load_radeon = FALSE, load_amdgpu = FALSE;
     int      i;
 
     /* let the subdrivers configure for themselves */
@@ -154,6 +156,7 @@ ati_gdev_subdriver(pointer options)
     nMach64GDev = xf86MatchDevice(MACH64_DRIVER_NAME, NULL);
     nR128GDev = xf86MatchDevice(R128_DRIVER_NAME, NULL);
     nRadeonGDev = xf86MatchDevice(RADEON_DRIVER_NAME, NULL);
+    nAmdgpuGDev = xf86MatchDevice(AMDGPU_DRIVER_NAME, NULL);
 
     for (i = 0; i < nATIGDev; i++) {
         GDevPtr     ati_gdev = ATIGDevs[i];
@@ -200,8 +203,34 @@ ati_gdev_subdriver(pointer options)
         }
 
         if (chip_family == ATI_CHIP_FAMILY_Radeon) {
-            ati_gdev->driver = RADEON_DRIVER_NAME;
-            load_radeon = TRUE;
+            char *busid;
+
+            XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d",
+                        device->domain, device->bus, device->dev,
+                        device->func);
+
+            if (busid) {
+                int fd = drmOpen(NULL, busid);
+
+                if (fd >= 0) {
+                    drmVersionPtr version = drmGetVersion(fd);
+
+                    if (version->version_major == 3) {
+                        ati_gdev->driver = AMDGPU_DRIVER_NAME;
+                        load_amdgpu = TRUE;
+                    }
+
+                    free(version);
+                    drmClose(fd);
+                }
+
+                free(busid);
+            }
+
+            if (strcmp(ati_gdev->driver, AMDGPU_DRIVER_NAME) != 0) {
+                ati_gdev->driver = RADEON_DRIVER_NAME;
+                load_radeon = TRUE;
+            }
         }
     }
 
@@ -219,6 +248,9 @@ ati_gdev_subdriver(pointer options)
 
     if (load_radeon && (nRadeonGDev == 0))
          xf86LoadOneModule(RADEON_DRIVER_NAME, options);
+
+    if (load_amdgpu && (nAmdgpuGDev == 0))
+         xf86LoadOneModule(AMDGPU_DRIVER_NAME, options);
 }
 
 /*
commit 41b82c776b571e1556f300d77c715aebdd87d8e6
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Jan 24 18:14:23 2017 +0900

    .editorconfig: src/ati.c only uses spaces for indentation
    
    Trivial.

diff --git a/.editorconfig b/.editorconfig
index 2131011..91f0ff8 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -8,3 +8,6 @@ charset=utf-8
 
 [src/{drmmode_display.c,radeon_dri3.c,radeon_glamor.c,radeon_glamor.h,radeon_glamor_wrappers.c}]
 indent_size=8
+
+[src/ati.c]
+indent_style=space


More information about the xorg-commit mailing list