drm/amdgpu: set DRIVER_ATOMIC flag early
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 23 Jan 2018 22:05:03 +0000 (17:05 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 19 Feb 2018 19:19:03 +0000 (14:19 -0500)
The atomic debugfs stuff gets created in drm_dev_alloc()
but this gets called before we've enumerated all of our
IPs, so move the DRIVER_ATOMIC flag setting to fix that.

Since DRIVER_ATOMIC is a driver flag it's currently global
to the driver so setting it affects all GPUs driven by the
driver.  Unfortunately, not all GPUs support atomic.  Warn
the user if that is the case.

This is the same as our current behavior, but at least the
atomic debugfs stuff gets created now.

Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index d1a6958..367f331 100644 (file)
@@ -578,6 +578,11 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
        struct drm_device *dev;
        unsigned long flags = ent->driver_data;
        int ret, retry = 0;
+       bool supports_atomic = false;
+
+       if (!amdgpu_virtual_display &&
+           amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
+               supports_atomic = true;
 
        if ((flags & AMD_EXP_HW_SUPPORT) && !amdgpu_exp_hw_support) {
                DRM_INFO("This hardware requires experimental hardware support.\n"
@@ -598,6 +603,13 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
        if (ret)
                return ret;
 
+       /* warn the user if they mix atomic and non-atomic capable GPUs */
+       if ((kms_driver.driver_features & DRIVER_ATOMIC) && !supports_atomic)
+               DRM_ERROR("Mixing atomic and non-atomic capable GPUs!\n");
+       /* support atomic early so the atomic debugfs stuff gets created */
+       if (supports_atomic)
+               kms_driver.driver_features |= DRIVER_ATOMIC;
+
        dev = drm_dev_alloc(&kms_driver, &pdev->dev);
        if (IS_ERR(dev))
                return PTR_ERR(dev);
index 12fcfd4..ad49c33 100644 (file)
@@ -1619,8 +1619,6 @@ static int dm_early_init(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-       adev->ddev->driver->driver_features |= DRIVER_ATOMIC;
-
        switch (adev->asic_type) {
        case CHIP_BONAIRE:
        case CHIP_HAWAII: