Re: [PATCH 1/2] drm/msm: provide fb_dirty implemenation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/06/2023 13:48, Thomas Zimmermann wrote:
Hi

Am 12.06.23 um 11:14 schrieb Marijn Suijten:
On 2023-06-12 06:16:15, Dmitry Baryshkov wrote:
Since commit 93e81e38e197 ("drm/fb_helper: Minimize damage-helper
overhead") the drm_fb_helper_funcs::fb_dirty helper is required for
proper dirty/damage processing. The drm/msm driver requires that to
function to let CMD panels to work. Use simplified version of
drm_fbdev_generic_helper_fb_dirty() to fix support for CMD mode panels.

Reported-by: Degdag Mohamed <degdagmohamed@xxxxxxxxx>
Fixes: 93e81e38e197 ("drm/fb_helper: Minimize damage-helper overhead")
Cc: Thomas Zimmermann <tzimmermann@xxxxxxx>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>

Thanks, this solves the following warning:

     msm_dpu ae01000.display-controller: drm_WARN_ON_ONCE(!helper->funcs->fb_dirty)      WARNING: CPU: 0 PID: 9 at drivers/gpu/drm/drm_fb_helper.c:381 drm_fb_helper_damage_work+0x1c0/0x20c

Reviewed-by: Marijn Suijten <marijn.suijten@xxxxxxxxxxxxxx>

Note that drm_fb_helper_funcs documents this as "This callback is
optional": is it no longer optional, or are we enabling a damage feature
that makes it not-optional?

It is optional in the sense that most hardware and drivers don't require damage handling. Those that do, also require this callback.

Can we please get this documented? I think it was really optional beforehand.


Best regards
Thomas


- Marijn

---
  drivers/gpu/drm/msm/msm_fbdev.c | 20 ++++++++++++++++++++
  1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index fa9c1cbffae3..b933a85420f6 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -139,8 +139,28 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
      return ret;
  }
+static int msm_fbdev_fb_dirty(struct drm_fb_helper *helper,
+                  struct drm_clip_rect *clip)
+{
+    struct drm_device *dev = helper->dev;
+    int ret;
+
+    /* Call damage handlers only if necessary */
+    if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+        return 0;
+
+    if (helper->fb->funcs->dirty) {
+        ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1); +        if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", ret))
+            return ret;
+    }
+
+    return 0;
+}
+
  static const struct drm_fb_helper_funcs msm_fb_helper_funcs = {
      .fb_probe = msm_fbdev_create,
+    .fb_dirty = msm_fbdev_fb_dirty,
  };
  /*
--
2.39.2



--
With best wishes
Dmitry




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux