Skip to contentSkip to conversation

drm/amdgpu: register a dirty framebuffer callback for fbcon

PATCH Superseded Hamza Mahfooz 5 participants 7 messages Aug 15, 2023 – Aug 23, 2023

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: register a dirty framebuffer callback for fbcon

fbcon requires that we implement &drm_framebuffer_funcs.dirty. Otherwise, the framebuffer might take a while to flush (which would manifest as noticeable lag). However, we can't enable this callback for non-fbcon cases since it might cause too many atomic commits to be made at once. So, implement amdgpu_dirtyfb() and only enable it for fbcon framebuffers on devices that support atomic KMS.

---
v2: update variable names

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 26 ++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +25 -1
index d20dd3f852fc..d3b59f99cb7c 100644
@@ -38,6 +38,8 @@
 #include <linux/pci.h>
 #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_fb_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -532,11 +534,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 (strcmp(fb->comm, "[fbcon]"))
+		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)
 {
@@ -1139,7 +1159,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;
Signature · 1 line
2.41.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Hamza Mahfooz

fbcon requires that we implement &drm_framebuffer_funcs.dirty. Otherwise, the framebuffer might take a while to flush (which would manifest as noticeable lag). However, we can't enable this callback for non-fbcon cases since it might cause too many atomic commits to be made at once. So, implement amdgpu_dirtyfb() and only enable it for fbcon framebuffers on devices that support atomic KMS.

Cc Aurabindo Pillai <[email protected]>
Cc Mario Limonciello <[email protected]>

This is safe specifically because other things like FB_DAMAGE_CLIPS have come back to 6.1.y as well via f1edb2f58adb ("drm/amd/display: add FB_DAMAGE_CLIPS support") and fixups to that.

Quoted 2 lines
Quoted 62 lines

---
v2: update variable names

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 26 ++++++++++++++++++++-
  1 file changed, 25 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +25 -1
index d20dd3f852fc..d3b59f99cb7c 100644
@@ -38,6 +38,8 @@
  #include <linux/pci.h>
  #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_fb_helper.h>
  #include <drm/drm_gem_framebuffer_helper.h>
@@ -532,11 +534,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 (strcmp(fb->comm, "[fbcon]"))
+		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)
  {
@@ -1139,7 +1159,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;
#2 lore raw
In reply to Hamza Mahfooz

Am 15.08.23 um 19:26 schrieb Hamza Mahfooz:

Quoted 32 lines

fbcon requires that we implement &drm_framebuffer_funcs.dirty. Otherwise, the framebuffer might take a while to flush (which would manifest as noticeable lag). However, we can't enable this callback for non-fbcon cases since it might cause too many atomic commits to be made at once. So, implement amdgpu_dirtyfb() and only enable it for fbcon framebuffers on devices that support atomic KMS.

---
v2: update variable names

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 26 ++++++++++++++++++++-
  1 file changed, 25 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 -0
index d20dd3f852fc..d3b59f99cb7c 100644
@@ -38,6 +38,8 @@
  #include <linux/pci.h>
  #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_fb_helper.h>
  #include <drm/drm_gem_framebuffer_helper.h>

drivers/gpu/drm/amd/amdgpu/amdgpu_display.c bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, · line 543

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +7 -0
@@ -532,11 +534,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 (strcmp(fb->comm, "[fbcon]"))
+		return -ENOSYS;

Once more to the v2 of this patch: Tests like those are a pretty big NO-GO for upstreaming.

Regards,
Christian.

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +16 -1
+
+	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)
  {
@@ -1139,7 +1159,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;
#3 lore raw
Quoted 40 lines · Christian König

Am 15.08.23 um 19:26 schrieb Hamza Mahfooz:

Quoted 37 lines

fbcon requires that we implement &drm_framebuffer_funcs.dirty. Otherwise, the framebuffer might take a while to flush (which would manifest as noticeable lag). However, we can't enable this callback for non-fbcon cases since it might cause too many atomic commits to be made at once. So, implement amdgpu_dirtyfb() and only enable it for fbcon framebuffers on devices that support atomic KMS.

---
v2: update variable names
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 26 ++++++++++++++++++++-

  1 file changed, 25 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +3 -0
index d20dd3f852fc..d3b59f99cb7c 100644
@@ -38,6 +38,8 @@
   #include <linux/pci.h>
   #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_fb_helper.h>
   #include <drm/drm_gem_framebuffer_helper.h>
@@ -532,11 +534,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,
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_display.c bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, · line 543

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +6 -0
+              unsigned int flags, unsigned int color,
+              struct drm_clip_rect *clips, unsigned int num_clips)
+{
+
+    if (strcmp(fb->comm, "[fbcon]"))
+        return -ENOSYS;

Once more to the v2 of this patch: Tests like those are a pretty big NO-GO for upstreaming.

On closer inspection it is actually sufficient to check if file is NULL here (since it means that the request isn't from userspace). So, do you think that would be palatable for upstream?

Quoted 35 lines

Regards,
Christian.

Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +16 -1
+
+    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)
   {
@@ -1139,7 +1159,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;
Signature · 1 line
Hamza
maintainer
#4 lore raw

Am 16.08.23 um 15:41 schrieb Hamza Mahfooz:

Quoted 52 lines · Christian König
Quoted 41 lines

Am 15.08.23 um 19:26 schrieb Hamza Mahfooz:

Quoted 38 lines

fbcon requires that we implement &drm_framebuffer_funcs.dirty. Otherwise, the framebuffer might take a while to flush (which would manifest as noticeable lag). However, we can't enable this callback for non-fbcon cases since it might cause too many atomic commits to be made at once. So, implement amdgpu_dirtyfb() and only enable it for fbcon framebuffers on devices that support atomic KMS.

---
v2: update variable names
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 26
++++++++++++++++++++-

  1 file changed, 25 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +3 -0
index d20dd3f852fc..d3b59f99cb7c 100644
@@ -38,6 +38,8 @@
   #include <linux/pci.h>
   #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_fb_helper.h>
   #include <drm/drm_gem_framebuffer_helper.h>
@@ -532,11 +534,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,
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_display.c bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, · line 543

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +6 -0
+              unsigned int flags, unsigned int color,
+              struct drm_clip_rect *clips, unsigned int num_clips)
+{
+
+    if (strcmp(fb->comm, "[fbcon]"))
+        return -ENOSYS;

Once more to the v2 of this patch: Tests like those are a pretty big NO-GO for upstreaming.

Quoted 3 lines

On closer inspection it is actually sufficient to check if file is NULL here (since it means that the request isn't from userspace). So, do you think that would be palatable for upstream?

That's certainly better than doing a string compare, but I'm not sure if that's sufficient.

In general drivers shouldn't have any special handling for fdcon.

You should probably have Thomas Zimmermann <[email protected]> take a look at this.

Regards,
Christian.

Quoted 36 lines
Quoted 36 lines

Regards,
Christian.

Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +16 -1
+
+    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)
   {
@@ -1139,7 +1159,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;
#5 lore raw

@Mahfooz, Hamza
can you respin with the NULL check?

Alex

Quoted 108 lines · Christian König

Am 16.08.23 um 15:41 schrieb Hamza Mahfooz:

Quoted 54 lines · Christian König
Quoted 43 lines

Am 15.08.23 um 19:26 schrieb Hamza Mahfooz:

Quoted 40 lines

fbcon requires that we implement &drm_framebuffer_funcs.dirty. Otherwise, the framebuffer might take a while to flush (which would manifest as noticeable lag). However, we can't enable this callback for non-fbcon cases since it might cause too many atomic commits to be made at once. So, implement amdgpu_dirtyfb() and only enable it for fbcon framebuffers on devices that support atomic KMS.

---
v2: update variable names

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 26
++++++++++++++++++++-
  1 file changed, 25 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +4 -0
index d20dd3f852fc..d3b59f99cb7c 100644
@@ -38,6 +38,8 @@
  #include <linux/pci.h>
  #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_fb_helper.h>
  #include <drm/drm_gem_framebuffer_helper.h>
@@ -532,11 +534,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,
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_display.c bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, · line 543

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +5 -0
+              struct drm_clip_rect *clips, unsigned int num_clips)
+{
+
+    if (strcmp(fb->comm, "[fbcon]"))
+        return -ENOSYS;

Once more to the v2 of this patch: Tests like those are a pretty big NO-GO for upstreaming.

Quoted 3 lines

On closer inspection it is actually sufficient to check if file is NULL here (since it means that the request isn't from userspace). So, do you think that would be palatable for upstream?

That's certainly better than doing a string compare, but I'm not sure if that's sufficient.

In general drivers shouldn't have any special handling for fdcon.

You should probably have Thomas Zimmermann <[email protected]> take a look at this.

Regards,
Christian.

Quoted 36 lines
Quoted 36 lines

Regards,
Christian.

Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +16 -1
+
+    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)
  {
@@ -1139,7 +1159,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;
#6 lore raw
Quoted 2 lines · Alex Deucher

@Mahfooz, Hamza
can you respin with the NULL check?

sure.

Quoted 113 lines

Alex

Quoted 108 lines · Christian König

Am 16.08.23 um 15:41 schrieb Hamza Mahfooz:

Quoted 54 lines · Christian König
Quoted 43 lines

Am 15.08.23 um 19:26 schrieb Hamza Mahfooz:

Quoted 40 lines

fbcon requires that we implement &drm_framebuffer_funcs.dirty. Otherwise, the framebuffer might take a while to flush (which would manifest as noticeable lag). However, we can't enable this callback for non-fbcon cases since it might cause too many atomic commits to be made at once. So, implement amdgpu_dirtyfb() and only enable it for fbcon framebuffers on devices that support atomic KMS.

---
v2: update variable names

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 26
++++++++++++++++++++-
   1 file changed, 25 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +4 -0
index d20dd3f852fc..d3b59f99cb7c 100644
@@ -38,6 +38,8 @@
   #include <linux/pci.h>
   #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_fb_helper.h>
   #include <drm/drm_gem_framebuffer_helper.h>
@@ -532,11 +534,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,
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_display.c bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector, · line 543

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +5 -0
+              struct drm_clip_rect *clips, unsigned int num_clips)
+{
+
+    if (strcmp(fb->comm, "[fbcon]"))
+        return -ENOSYS;

Once more to the v2 of this patch: Tests like those are a pretty big NO-GO for upstreaming.

Quoted 3 lines

On closer inspection it is actually sufficient to check if file is NULL here (since it means that the request isn't from userspace). So, do you think that would be palatable for upstream?

That's certainly better than doing a string compare, but I'm not sure if that's sufficient.

In general drivers shouldn't have any special handling for fdcon.

You should probably have Thomas Zimmermann <[email protected]> take a look at this.

Regards,
Christian.

Quoted 36 lines
Quoted 36 lines

Regards,
Christian.

Quoted 30 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +16 -1
+
+    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)
   {
@@ -1139,7 +1159,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;
Signature · 1 line
Hamza