diff mbox series

[1/2] drm/i915/fbdev: Implement fb_dirty for intel custom fb helper

Message ID 20221221111902.1742095-2-jouni.hogander@intel.com (mailing list archive)
State New, archived
Headers show
Series Fixes for intel fb helper | expand

Commit Message

Hogander, Jouni Dec. 21, 2022, 11:19 a.m. UTC
After splitting generic drm_fb_helper into it's own file it's left to
helper implementation to have fb_dirty function. Currently intel
fb doesn't have it. This is causing problems to features (PSR, FBC, DRRS)
relying on dirty callback.

Implement simple fb_dirty callback to deliver notifications about updates
in fb console.

v2: Improved commit message and added Fixes tag

Fixes: 8ab59da26bc0 ("drm/fb-helper: Move generic fbdev emulation into separate source file")
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 drivers/gpu/drm/i915/display/intel_fbdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Thomas Zimmermann Dec. 21, 2022, 11:54 a.m. UTC | #1
Hi

Am 21.12.22 um 12:19 schrieb Jouni Högander:
> After splitting generic drm_fb_helper into it's own file it's left to
> helper implementation to have fb_dirty function. Currently intel
> fb doesn't have it. This is causing problems to features (PSR, FBC, DRRS)
> relying on dirty callback.
> 
> Implement simple fb_dirty callback to deliver notifications about updates
> in fb console.

If this is only required for the kernel console, you maybe want to 
rather change the fb_ops.

The kernel console only uses fb_fillrect, fb_copyarea and fb_imageblit. 
[1] Something simple as

void intel_fbdev_fillrect(...)
{
	drm_fb_helper_cfb_fillrect();

	/* comment on PSR problems */	
	fb->funcs->dirty()
}

should work. Same for the other two helpers.

Not using fb_dirty will also avoid the fbdev's internal damage worker, 
which is otherwise scheduled for each console update.

Best regards
Thomas

[1] 
https://elixir.bootlin.com/linux/v6.1/source/drivers/gpu/drm/i915/display/intel_fbdev.c#L127

> 
> v2: Improved commit message and added Fixes tag
> 
> Fixes: 8ab59da26bc0 ("drm/fb-helper: Move generic fbdev emulation into separate source file")
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_fbdev.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index 03ed4607a46d..20bbdeaf2e6f 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -328,8 +328,17 @@ static int intelfb_create(struct drm_fb_helper *helper,
>   	return ret;
>   }
>   
> +static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect *clip)
> +{
> +	if (helper->fb->funcs->dirty)
> +		return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
> +
> +	return 0;
> +}
> +
>   static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
>   	.fb_probe = intelfb_create,
> +	.fb_dirty = intelfb_dirty,
>   };
>   
>   static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 03ed4607a46d..20bbdeaf2e6f 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -328,8 +328,17 @@  static int intelfb_create(struct drm_fb_helper *helper,
 	return ret;
 }
 
+static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect *clip)
+{
+	if (helper->fb->funcs->dirty)
+		return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
+
+	return 0;
+}
+
 static const struct drm_fb_helper_funcs intel_fb_helper_funcs = {
 	.fb_probe = intelfb_create,
+	.fb_dirty = intelfb_dirty,
 };
 
 static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)