Temporarily change the connector to unregistered when adding the backlight
authorjsg <jsg@openbsd.org>
Tue, 26 Mar 2024 11:17:36 +0000 (11:17 +0000)
committerjsg <jsg@openbsd.org>
Tue, 26 Mar 2024 11:17:36 +0000 (11:17 +0000)
property to avoid warnings.  Matches how inteldrm_native_backlight()
handles this.

problem reported and fix tested by tb@

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

index e66e503..3c0df8a 100644 (file)
@@ -3457,15 +3457,24 @@ amdgpu_init_backlight(struct amdgpu_device *adev)
        drm_for_each_connector_iter(connector, &conn_iter) {
                aconnector = to_amdgpu_dm_connector(connector);
 
+               if (connector->registration_state != DRM_CONNECTOR_REGISTERED)
+                       continue;
+
                if (aconnector->bl_idx == -1)
                        continue;
 
+               dev->registered = false;
+               connector->registration_state = DRM_CONNECTOR_UNREGISTERED;
+
                connector->backlight_device = bd;
                connector->backlight_property = drm_property_create_range(dev,
                    0, "Backlight", 0, bd->props.max_brightness);
                drm_object_attach_property(&connector->base,
                    connector->backlight_property, bd->props.brightness);
 
+               connector->registration_state = DRM_CONNECTOR_REGISTERED;
+               dev->registered = true;
+
                break;
        }
        drm_connector_list_iter_end(&conn_iter);