fix xbacklight on amdgpu
authorjsg <jsg@openbsd.org>
Mon, 25 Mar 2024 11:37:18 +0000 (11:37 +0000)
committerjsg <jsg@openbsd.org>
Mon, 25 Mar 2024 11:37:18 +0000 (11:37 +0000)
Call amdgpu_init_backlight() after drm_dev_register() otherwise
the connector isn't registered yet and dm->backlight_dev is not set.

tb@ mentioned this broke with the 6.6 drm update and confirmed this fixes it.
Debugged with help from dtucker@ on another machine.

sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c

index 6f3e190..d6dced8 100644 (file)
@@ -3491,16 +3491,15 @@ amdgpu_attachhook(struct device *self)
        if (adev->mode_info.mode_config_initialized &&
            !list_empty(&adev_to_drm(adev)->mode_config.connector_list)) {
 
-               /* OpenBSD specific backlight property on connector */
-               amdgpu_init_backlight(adev);
-
                /*
                 * in linux via amdgpu_pci_probe -> drm_dev_register
-                * must be after (local) backlight property added not before
-                * and before drm_fbdev_generic_setup()
+                * must be before drm_fbdev_generic_setup()
                 */
                drm_dev_register(dev, adev->flags);
 
+               /* OpenBSD specific backlight property on connector */
+               amdgpu_init_backlight(adev);
+
                /* select 8 bpp console on low vram cards */
                if (adev->gmc.real_vram_size <= (32*1024*1024))
                        drm_fbdev_generic_setup(adev_to_drm(adev), 8);