From: jsg Date: Tue, 19 Sep 2023 12:52:45 +0000 (+0000) Subject: drm/amdgpu: register a dirty framebuffer callback for fbcon X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7cddb3e7020ede39f6a63b75663a5e87583a3ec6;p=openbsd drm/amdgpu: register a dirty framebuffer callback for fbcon From Hamza Mahfooz cb30ff2adb10a660ded094b088aca763aaf74dea in linux-6.1.y/6.1.54 0a611560f53bfd489e33f4a718c915f1a6123d03 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_display.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_display.c index 298241ac73d..184a234aa6a 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_display.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_display.c @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include #include @@ -493,11 +495,29 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, return true; } +static int amdgpu_dirtyfb(struct drm_framebuffer *fb, struct drm_file *file, + unsigned int flags, unsigned int color, + struct drm_clip_rect *clips, unsigned int num_clips) +{ + + if (file) + return -ENOSYS; + + return drm_atomic_helper_dirtyfb(fb, file, flags, color, clips, + num_clips); +} + 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 = amdgpu_dirtyfb +}; + uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, uint64_t bo_flags) { @@ -1100,7 +1120,11 @@ static int amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev, 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;