virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: linux-hyperv@vger.kernel.org, david@lechnology.com,
	michael+lkml@stapelberg.ch, airlied@linux.ie,
	dri-devel@lists.freedesktop.org,
	maarten.lankhorst@linux.intel.com, javierm@redhat.com,
	mripard@kernel.org, virtualization@lists.linux-foundation.org,
	joshua@stroblindustries.com, drawat.floss@gmail.com,
	noralf@tronnes.org, arnd@arndb.de, daniel@ffwll.ch,
	dirty.ice.hu@gmail.com, airlied@redhat.com, aros@gmx.com,
	kernel@amanoeldawod.com
Subject: Re: [PATCH 1/9] drm/format-helper: Export drm_fb_clip_offset()
Date: Sat, 23 Oct 2021 09:49:00 +0200	[thread overview]
Message-ID: <YXO+bGIW9sn9Rcfw@ravnborg.org> (raw)
In-Reply-To: <20211022132829.7697-2-tzimmermann@suse.de>

Hi Thomas,

On Fri, Oct 22, 2021 at 03:28:21PM +0200, Thomas Zimmermann wrote:
> Provide a function that computes the offset into a blit destination
> buffer. This will allow to move destination-buffer clipping into the
> format-helper callers.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/drm_format_helper.c | 10 ++++++++--
>  include/drm/drm_format_helper.h     |  4 ++++
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
> index 69fde60e36b3..28e9d0d89270 100644
> --- a/drivers/gpu/drm/drm_format_helper.c
> +++ b/drivers/gpu/drm/drm_format_helper.c
> @@ -17,12 +17,18 @@
>  #include <drm/drm_fourcc.h>
>  #include <drm/drm_rect.h>
>  
> -static unsigned int clip_offset(struct drm_rect *clip,
> -				unsigned int pitch, unsigned int cpp)
> +static unsigned int clip_offset(const struct drm_rect *clip, unsigned int pitch, unsigned int cpp)
>  {
>  	return clip->y1 * pitch + clip->x1 * cpp;
>  }
>  
> +unsigned long drm_fb_clip_offset(unsigned int pitch, const struct drm_format_info *format,
> +				 const struct drm_rect *clip)
> +{
> +	return clip_offset(clip, pitch, format->cpp[0]);
> +}
> +EXPORT_SYMBOL(drm_fb_clip_offset);

Exported functions are expected to have kernel-doc documentation.
Just copy more or less from the changelog I think.

Anywhere else (I looked in struct drm_framebuffer) we only need unsigned
int for offsets and width/length - so I cannot see why we do an unsigned
int => unsigned long conversion here.

	Sam

> +
>  /**
>   * drm_fb_memcpy - Copy clip buffer
>   * @dst: Destination buffer
> diff --git a/include/drm/drm_format_helper.h b/include/drm/drm_format_helper.h
> index e86925cf07b9..90b9bd9ecb83 100644
> --- a/include/drm/drm_format_helper.h
> +++ b/include/drm/drm_format_helper.h
> @@ -6,9 +6,13 @@
>  #ifndef __LINUX_DRM_FORMAT_HELPER_H
>  #define __LINUX_DRM_FORMAT_HELPER_H
>  
> +struct drm_format_info;
>  struct drm_framebuffer;
>  struct drm_rect;
>  
> +unsigned long drm_fb_clip_offset(unsigned int pitch, const struct drm_format_info *format,
> +				 const struct drm_rect *clip);
> +
>  void drm_fb_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
>  		   struct drm_rect *clip);
>  void drm_fb_memcpy_dstclip(void __iomem *dst, unsigned int dst_pitch, void *vaddr,
> -- 
> 2.33.0
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-10-23  7:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22 13:28 [PATCH 0/9] drm/simpledrm: Enable damage clips and virtual screens Thomas Zimmermann
2021-10-22 13:28 ` [PATCH 1/9] drm/format-helper: Export drm_fb_clip_offset() Thomas Zimmermann
2021-10-23  7:49   ` Sam Ravnborg [this message]
2021-11-01  8:43     ` Thomas Zimmermann
2021-10-24  8:25   ` Noralf Trønnes
2021-10-22 13:28 ` [PATCH 2/9] drm/format-helper: Rework format-helper memcpy functions Thomas Zimmermann
2021-10-24  8:25   ` Noralf Trønnes
2021-10-22 13:28 ` [PATCH 3/9] drm/format-helper: Add destination-buffer pitch to drm_fb_swab() Thomas Zimmermann
2021-10-24  8:33   ` Noralf Trønnes
2021-10-22 13:28 ` [PATCH 4/9] drm/format-helper: Rework format-helper conversion functions Thomas Zimmermann
2021-10-24 11:32   ` Noralf Trønnes
2021-11-01 13:38     ` Thomas Zimmermann
2021-10-22 13:28 ` [PATCH 5/9] drm/format-helper: Streamline blit-helper interface Thomas Zimmermann
2021-10-24 14:59   ` Noralf Trønnes
2021-10-22 13:28 ` [PATCH 6/9] drm/fb-helper: Allocate shadow buffer of surface height Thomas Zimmermann
2021-10-24 15:10   ` Noralf Trønnes
2021-10-22 13:28 ` [PATCH 7/9] drm/simpledrm: Enable FB_DAMAGE_CLIPS property Thomas Zimmermann
2021-10-24 15:20   ` Noralf Trønnes
2021-11-01  8:56     ` Thomas Zimmermann
2021-10-22 13:28 ` [PATCH 8/9] drm/simpledrm: Support virtual screen sizes Thomas Zimmermann
2021-10-22 13:28 ` [PATCH 9/9] drm: Clarify semantics of struct drm_mode_config.{min, max}_{width, height} Thomas Zimmermann
2021-10-23  7:44 ` [PATCH 0/9] drm/simpledrm: Enable damage clips and virtual screens Sam Ravnborg

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=YXO+bGIW9sn9Rcfw@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=arnd@arndb.de \
    --cc=aros@gmx.com \
    --cc=daniel@ffwll.ch \
    --cc=david@lechnology.com \
    --cc=dirty.ice.hu@gmail.com \
    --cc=drawat.floss@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=joshua@stroblindustries.com \
    --cc=kernel@amanoeldawod.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=michael+lkml@stapelberg.ch \
    --cc=mripard@kernel.org \
    --cc=noralf@tronnes.org \
    --cc=tzimmermann@suse.de \
    --cc=virtualization@lists.linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).