Re: [PATCH] drm: verisilicon: fix cursor offset field update

Chen-Yu Tsai <[email protected]>
Newsgroups org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel
Message-ID <CAGXv+5GBS205Ww1C74+Jxu1Wop5Sh2ZS0Hdub9y7uOSM4L1r_w@mail.gmail.com>
On Wed, Aug 12, 2026 at 11:48 PM Icenowy Zheng <[email protected]> wrote:
>
> The 4th argument of regmap_update_bits() expects a pre-shifted register
> value instead of the field value when it's used to set a single field,
> however I forgot this when writing the code setting the cursor X/Y
> offset fields, thus the write operation doesn't happen at all (because
> of the non-shifted values being masked by regmap_update_bits()).
>
> Fix this problem so the cursor is correctly clipped.
>
> The framebuffer address is also clipped so the cursor offset problem was
> previously not discovered, and the framebuffer address deserves another
> fix for proper cursor behavior when it's clipped.
>
> Fixes: 8c4ae2189125 ("drm: verisilicon: add support for cursor planes")
> Signed-off-by: Icenowy Zheng <[email protected]>

Make sense.

Reviewed-by: Chen-Yu Tsai <[email protected]>

> ---
>  drivers/gpu/drm/verisilicon/vs_cursor_plane.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> index fa4f601dd0c87..4ce311ae48823 100644
> --- a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> +++ b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> @@ -199,7 +199,7 @@ static void vs_cursor_plane_atomic_update(struct drm_plane *plane,
>         } else {
>                 regmap_update_bits(dc->regs, VSDC_CURSOR_CONFIG(output),
>                                    VSDC_CURSOR_CONFIG_X_OFF_MASK,
> -                                  -state->crtc_x);
> +                                  VSDC_CURSOR_CONFIG_X_OFF(-state->crtc_x));
>                 regmap_update_bits(dc->regs, VSDC_CURSOR_LOCATION(output),
>                                    VSDC_CURSOR_LOCATION_X_MASK, 0);
>         }
> @@ -213,7 +213,7 @@ static void vs_cursor_plane_atomic_update(struct drm_plane *plane,
>         } else {
>                 regmap_update_bits(dc->regs, VSDC_CURSOR_CONFIG(output),
>                                    VSDC_CURSOR_CONFIG_Y_OFF_MASK,
> -                                  -state->crtc_y);
> +                                  VSDC_CURSOR_CONFIG_Y_OFF(-state->crtc_y));
>                 regmap_update_bits(dc->regs, VSDC_CURSOR_LOCATION(output),
>                                    VSDC_CURSOR_LOCATION_Y_MASK, 0);
>         }
> --
> 2.52.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.