diff mbox series

[1/2] drm/modeset: Handle tiled displays in pan_display_atomic.

Message ID 20250116142825.3933-1-dev@lankhorst.se (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/modeset: Handle tiled displays in pan_display_atomic. | expand

Commit Message

Maarten Lankhorst Jan. 16, 2025, 2:28 p.m. UTC
Tiled displays have a different x/y offset to begin with. Instead of
attempting to remember this, just apply a delta instead.

Hope this works..

Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
 drivers/gpu/drm/drm_fb_helper.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Thomas Zimmermann Jan. 20, 2025, 11:39 a.m. UTC | #1
Hi


Am 16.01.25 um 15:28 schrieb Maarten Lankhorst:
> Tiled displays have a different x/y offset to begin with. Instead of
> attempting to remember this, just apply a delta instead.
>
> Hope this works..

As far as I understand the tile code, this makes sense.

>
> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/drm_fb_helper.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index c9008113111ba..fb3614a7ba44b 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -1354,14 +1354,14 @@ int drm_fb_helper_set_par(struct fb_info *info)
>   }
>   EXPORT_SYMBOL(drm_fb_helper_set_par);
>   
> -static void pan_set(struct drm_fb_helper *fb_helper, int x, int y)
> +static void pan_set(struct drm_fb_helper *fb_helper, int dx, int dy)
>   {
>   	struct drm_mode_set *mode_set;
>   
>   	mutex_lock(&fb_helper->client.modeset_mutex);
>   	drm_client_for_each_modeset(mode_set, &fb_helper->client) {
> -		mode_set->x = x;
> -		mode_set->y = y;
> +		mode_set->x += dx;
> +		mode_set->y += dy;
>   	}
>   	mutex_unlock(&fb_helper->client.modeset_mutex);
>   }
> @@ -1370,16 +1370,18 @@ static int pan_display_atomic(struct fb_var_screeninfo *var,
>   			      struct fb_info *info)
>   {
>   	struct drm_fb_helper *fb_helper = info->par;
> -	int ret;
> +	int ret, dx, dy;
>   
> -	pan_set(fb_helper, var->xoffset, var->yoffset);
> +	dx = var->xoffset - info->var.xoffset;
> +	dy = var->yoffset - info->var.yoffset;
> +	pan_set(fb_helper, dx, dy);
>   
>   	ret = drm_client_modeset_commit_locked(&fb_helper->client);
>   	if (!ret) {
>   		info->var.xoffset = var->xoffset;
>   		info->var.yoffset = var->yoffset;
>   	} else
> -		pan_set(fb_helper, info->var.xoffset, info->var.yoffset);
> +		pan_set(fb_helper, -dx, -dy);
>   
>   	return ret;
>   }
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index c9008113111ba..fb3614a7ba44b 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1354,14 +1354,14 @@  int drm_fb_helper_set_par(struct fb_info *info)
 }
 EXPORT_SYMBOL(drm_fb_helper_set_par);
 
-static void pan_set(struct drm_fb_helper *fb_helper, int x, int y)
+static void pan_set(struct drm_fb_helper *fb_helper, int dx, int dy)
 {
 	struct drm_mode_set *mode_set;
 
 	mutex_lock(&fb_helper->client.modeset_mutex);
 	drm_client_for_each_modeset(mode_set, &fb_helper->client) {
-		mode_set->x = x;
-		mode_set->y = y;
+		mode_set->x += dx;
+		mode_set->y += dy;
 	}
 	mutex_unlock(&fb_helper->client.modeset_mutex);
 }
@@ -1370,16 +1370,18 @@  static int pan_display_atomic(struct fb_var_screeninfo *var,
 			      struct fb_info *info)
 {
 	struct drm_fb_helper *fb_helper = info->par;
-	int ret;
+	int ret, dx, dy;
 
-	pan_set(fb_helper, var->xoffset, var->yoffset);
+	dx = var->xoffset - info->var.xoffset;
+	dy = var->yoffset - info->var.yoffset;
+	pan_set(fb_helper, dx, dy);
 
 	ret = drm_client_modeset_commit_locked(&fb_helper->client);
 	if (!ret) {
 		info->var.xoffset = var->xoffset;
 		info->var.yoffset = var->yoffset;
 	} else
-		pan_set(fb_helper, info->var.xoffset, info->var.yoffset);
+		pan_set(fb_helper, -dx, -dy);
 
 	return ret;
 }