drm/amdgpu: don't register a dirty callback for non-atomic
authorjsg <jsg@openbsd.org>
Mon, 3 Oct 2022 12:02:12 +0000 (12:02 +0000)
committerjsg <jsg@openbsd.org>
Mon, 3 Oct 2022 12:02:12 +0000 (12:02 +0000)
From Alex Deucher
21b0301f2234112fbe5cfc1e13968f0a12f0f2d2 in linux 5.15.y/5.15.71
abbc7a3dafb91b9d4ec56b70ec9a7520f8e13334 in mainline linux

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

index 8c89f76..a09507a 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/pm_runtime.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_damage_helper.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_fb_helper.h>
@@ -491,6 +492,11 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,
 static const struct drm_framebuffer_funcs amdgpu_fb_funcs = {
        .destroy = drm_gem_fb_destroy,
        .create_handle = drm_gem_fb_create_handle,
+};
+
+static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = {
+       .destroy = drm_gem_fb_destroy,
+       .create_handle = drm_gem_fb_create_handle,
        .dirty = drm_atomic_helper_dirtyfb,
 };
 
@@ -1111,7 +1117,10 @@ int amdgpu_display_gem_fb_verify_and_init(
        if (ret)
                goto err;
 
-       ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
+       if (drm_drv_uses_atomic_modeset(dev))
+               ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs_atomic);
+       else
+               ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
        if (ret)
                goto err;