Re: [PATCH RFC] drm/verisilicon: Switch to drm_fb_dma_get_addr() for framebuffer addresses

Chen-Yu Tsai <[email protected]>
Newsgroups org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel
Message-ID <CAGXv+5HEzgudvL+VdNniLjYaMDr_Rck2PP=qfe96jv0MphF5Eg@mail.gmail.com>
On Fri, Aug 7, 2026 at 6:48 PM Chen-Yu Tsai <[email protected]> wrote:
>
> The verisilicon driver has a custom framebuffer address calculating
> helper that the common drm_fb_dma_get_addr() can substitute.
>
> Differences from drm_fb_dma_get_addr():
>
> - Uses drm_format_info_min_pitch() to calculate the horizontal offset;
>   however the driver does not support any of the blocked formats, so
>   this just ends up being the same as in drm_fb_dma_get_addr():
>   "cpp[plane] * y"
>
> - Uses clipped source coordinates instead of non-clipped coordinates
>   as in drm_fb_dma_get_addr();
>
>   For the primary plane this doesn't matter, since the primary plane
>   must match the output, i.e. it cannot be clipped. Also this driver
>   doesn't support scaling.
>
>   For the cursor plane this seems wrong, as the clipping seems to be
>   done by the hardware, and thus the buffer address should be unclipped.
>
> As such, it should be fine to use the common helper and drop the custom
> code.
>
> Signed-off-by: Chen-Yu Tsai <[email protected]>
> ---
>
> This is only compile tested. I do not have the hardware.
> ---
>  drivers/gpu/drm/verisilicon/vs_cursor_plane.c |  3 ++-
>  drivers/gpu/drm/verisilicon/vs_plane.c        | 20 -------------------
>  .../gpu/drm/verisilicon/vs_primary_plane.c    |  6 +++++-
>  3 files changed, 7 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> index fa4f601dd0c8..ae03d415d66b 100644
> --- a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> +++ b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> @@ -176,7 +176,8 @@ static void vs_cursor_plane_atomic_update(struct drm_plane *plane,
>                 break;
>         }
>
> -       dma_addr = vs_fb_get_dma_addr(fb, &state->src);
> +       /* hardware handles clipping as seen below */
> +       dma_addr = drm_fb_dma_get_gem_addr(fb, 0);

Blah, I don't know what happened, but this doesn't compile.

I'll send a new version.
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.