From 9b2ac6ee78ec6d6073bfa80a1b392b2a28a31878 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 3 Oct 2022 12:02:12 +0000 Subject: [PATCH] drm/amdgpu: don't register a dirty callback for non-atomic 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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_display.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_display.c index 8c89f76d91e..a09507a973c 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_display.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_display.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -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; -- 2.20.1