All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: "Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Andy Yan" <andy.yan@rock-chips.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Chaoyi Chen" <chaoyi.chen@rock-chips.com>
Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	Daniel Stone <daniels@collabora.com>
Subject: Re: [PATCH v2 5/8] drm/rockchip: vop2: Enforce AFBC source alignment in plane_check
Date: Mon, 08 Dec 2025 08:24:52 +0100	[thread overview]
Message-ID: <4696988.LvFx2qVVIh@workhorse> (raw)
In-Reply-To: <f9f7b446-8575-4f16-aa96-5197b22846e3@rock-chips.com>

On Monday, 8 December 2025 03:48:24 Central European Standard Time Chaoyi Chen wrote:
> Hello Nicolas, Daniel,
> 
> On 12/7/2025 4:45 AM, Nicolas Frattaroli wrote:
> > From: Daniel Stone <daniels@collabora.com>
> > 
> > Planes can only source AFBC framebuffers at multiples of 4px wide on
> > RK3566/RK3568. Instead of clipping on all SoCs when the user asks for an
> > unaligned source rectangle, reject the configuration in the plane's
> > atomic check on RK3566/RK3568 only.
> > 
> > Signed-off-by: Daniel Stone <daniels@collabora.com>
> > [Make RK3566/RK3568 specific, reword message]
> > Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> > ---
> >  drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 14 +++++++++-----
> >  1 file changed, 9 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> > index bc1ed0ffede0..e23213337104 100644
> > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> > @@ -1076,6 +1076,13 @@ static int vop2_plane_atomic_check(struct drm_plane *plane,
> >  		return -EINVAL;
> >  	}
> >  
> > +	if (vop2->version == VOP_VERSION_RK3568 && drm_is_afbc(fb->modifier) && src_w % 4) {
> > +		drm_dbg_kms(vop2->drm,
> > +			    "AFBC source rectangles must be 4-byte aligned; is %d\n",
> > +			    src_w);
> > +		return -EINVAL;
> > +	}
> > +
> >  	return 0;
> >  }
> >  
> > @@ -1237,11 +1244,8 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
> >  	WARN_ON(src_w < 4);
> >  	WARN_ON(src_h < 4);
> >  
> > -	if (afbc_en && src_w % 4) {
> > -		drm_dbg_kms(vop2->drm, "vp%d %s src_w[%d] not 4 pixel aligned\n",
> > -			    vp->id, win->data->name, src_w);
> > -		src_w = ALIGN_DOWN(src_w, 4);
> > -	}
> > +	if (vop2->version == VOP_VERSION_RK3568 && drm_is_afbc(fb->modifier))
> > +		WARN_ON(src_w % 4);
> >  
> >  	act_info = (src_h - 1) << 16 | ((src_w - 1) & 0xffff);
> >  	dsp_info = (dsp_h - 1) << 16 | ((dsp_w - 1) & 0xffff);
> > 
> 
> You haven't replied to Andy's comment yet [0].
> 
> [0] https://lore.kernel.org/dri-devel/7b4e26ec.75f3.19a77276b53.Coremail.andyshrk@163.com/
> 

Hello,

I addressed the follow-ups where it was clarified that the 4 pixel
limitation was RK3566/RK3568-only. I'm not going to bring back the
post-atomic_check modification for a fast path, but I'm open to
suggestions on how to do this differently.

One solution might be to modify the state with the ALIGN_DOWN stuff
in atomic_check instead, where userspace is then aware of the change
being done to its requested parameters. I'll need to double-check
whether this is in line with atomic modesetting's design.

Kind regards,
Nicolas Frattaroli




WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: "Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Andy Yan" <andy.yan@rock-chips.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Chaoyi Chen" <chaoyi.chen@rock-chips.com>
Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	Daniel Stone <daniels@collabora.com>
Subject: Re: [PATCH v2 5/8] drm/rockchip: vop2: Enforce AFBC source alignment in plane_check
Date: Mon, 08 Dec 2025 08:24:52 +0100	[thread overview]
Message-ID: <4696988.LvFx2qVVIh@workhorse> (raw)
In-Reply-To: <f9f7b446-8575-4f16-aa96-5197b22846e3@rock-chips.com>

On Monday, 8 December 2025 03:48:24 Central European Standard Time Chaoyi Chen wrote:
> Hello Nicolas, Daniel,
> 
> On 12/7/2025 4:45 AM, Nicolas Frattaroli wrote:
> > From: Daniel Stone <daniels@collabora.com>
> > 
> > Planes can only source AFBC framebuffers at multiples of 4px wide on
> > RK3566/RK3568. Instead of clipping on all SoCs when the user asks for an
> > unaligned source rectangle, reject the configuration in the plane's
> > atomic check on RK3566/RK3568 only.
> > 
> > Signed-off-by: Daniel Stone <daniels@collabora.com>
> > [Make RK3566/RK3568 specific, reword message]
> > Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> > ---
> >  drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 14 +++++++++-----
> >  1 file changed, 9 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> > index bc1ed0ffede0..e23213337104 100644
> > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
> > @@ -1076,6 +1076,13 @@ static int vop2_plane_atomic_check(struct drm_plane *plane,
> >  		return -EINVAL;
> >  	}
> >  
> > +	if (vop2->version == VOP_VERSION_RK3568 && drm_is_afbc(fb->modifier) && src_w % 4) {
> > +		drm_dbg_kms(vop2->drm,
> > +			    "AFBC source rectangles must be 4-byte aligned; is %d\n",
> > +			    src_w);
> > +		return -EINVAL;
> > +	}
> > +
> >  	return 0;
> >  }
> >  
> > @@ -1237,11 +1244,8 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
> >  	WARN_ON(src_w < 4);
> >  	WARN_ON(src_h < 4);
> >  
> > -	if (afbc_en && src_w % 4) {
> > -		drm_dbg_kms(vop2->drm, "vp%d %s src_w[%d] not 4 pixel aligned\n",
> > -			    vp->id, win->data->name, src_w);
> > -		src_w = ALIGN_DOWN(src_w, 4);
> > -	}
> > +	if (vop2->version == VOP_VERSION_RK3568 && drm_is_afbc(fb->modifier))
> > +		WARN_ON(src_w % 4);
> >  
> >  	act_info = (src_h - 1) << 16 | ((src_w - 1) & 0xffff);
> >  	dsp_info = (dsp_h - 1) << 16 | ((dsp_w - 1) & 0xffff);
> > 
> 
> You haven't replied to Andy's comment yet [0].
> 
> [0] https://lore.kernel.org/dri-devel/7b4e26ec.75f3.19a77276b53.Coremail.andyshrk@163.com/
> 

Hello,

I addressed the follow-ups where it was clarified that the 4 pixel
limitation was RK3566/RK3568-only. I'm not going to bring back the
post-atomic_check modification for a fast path, but I'm open to
suggestions on how to do this differently.

One solution might be to modify the state with the ALIGN_DOWN stuff
in atomic_check instead, where userspace is then aware of the change
being done to its requested parameters. I'll need to double-check
whether this is in line with atomic modesetting's design.

Kind regards,
Nicolas Frattaroli



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2025-12-08  7:25 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-06 20:45 [PATCH v2 0/8] drm/rockchip: No more post-atomic_check fixups Nicolas Frattaroli
2025-12-06 20:45 ` Nicolas Frattaroli
2025-12-06 20:45 ` [PATCH v2 1/8] drm/rockchip: vop2: Switch impossible format conditional to WARN_ON Nicolas Frattaroli
2025-12-06 20:45   ` Nicolas Frattaroli
2026-01-20 12:49   ` Thomas Zimmermann
2026-01-20 12:49     ` Thomas Zimmermann
2026-01-20 12:57     ` Nicolas Frattaroli
2026-01-20 12:57       ` Nicolas Frattaroli
2025-12-06 20:45 ` [PATCH v2 2/8] drm/rockchip: vop2: Switch impossible pos " Nicolas Frattaroli
2025-12-06 20:45   ` Nicolas Frattaroli
2026-01-20 12:52   ` Thomas Zimmermann
2026-01-20 12:52     ` Thomas Zimmermann
2025-12-06 20:45 ` [PATCH v2 3/8] drm/rockchip: vop2: Fix Esmart test condition Nicolas Frattaroli
2025-12-06 20:45   ` Nicolas Frattaroli
2026-01-20 12:58   ` Thomas Zimmermann
2026-01-20 12:58     ` Thomas Zimmermann
2025-12-06 20:45 ` [PATCH v2 4/8] drm/rockchip: vop2: Enforce scaling workaround in plane_check Nicolas Frattaroli
2025-12-06 20:45   ` Nicolas Frattaroli
2025-12-06 20:45 ` [PATCH v2 5/8] drm/rockchip: vop2: Enforce AFBC source alignment " Nicolas Frattaroli
2025-12-06 20:45   ` Nicolas Frattaroli
2025-12-08  2:48   ` Chaoyi Chen
2025-12-08  2:48     ` Chaoyi Chen
2025-12-08  7:24     ` Nicolas Frattaroli [this message]
2025-12-08  7:24       ` Nicolas Frattaroli
2025-12-09 10:58       ` Nicolas Frattaroli
2025-12-09 10:58         ` Nicolas Frattaroli
2025-12-11 11:06         ` Chaoyi Chen
2025-12-11 11:06           ` Chaoyi Chen
2025-12-11 14:16           ` Nicolas Frattaroli
2025-12-11 14:16             ` Nicolas Frattaroli
2025-12-12  9:59             ` Chaoyi Chen
2025-12-12  9:59               ` Chaoyi Chen
2026-01-20 12:47               ` Andy Yan
2026-01-20 12:47                 ` Andy Yan
2026-01-20 10:35         ` Daniel Stone
2026-01-20 10:35           ` Daniel Stone
2025-12-06 20:45 ` [PATCH v2 6/8] drm/rockchip: vop2: Enforce AFBC transform stride align " Nicolas Frattaroli
2025-12-06 20:45   ` Nicolas Frattaroli
2025-12-06 20:45 ` [PATCH v2 7/8] drm/rockchip: vop2: Use drm_is_afbc helper function Nicolas Frattaroli
2025-12-06 20:45   ` Nicolas Frattaroli
2025-12-06 20:45 ` [PATCH v2 8/8] drm/rockchip: vop2: Simplify format_mod_supported Nicolas Frattaroli
2025-12-06 20:45   ` Nicolas Frattaroli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4696988.LvFx2qVVIh@workhorse \
    --to=nicolas.frattaroli@collabora.com \
    --cc=airlied@gmail.com \
    --cc=andy.yan@rock-chips.com \
    --cc=chaoyi.chen@rock-chips.com \
    --cc=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.