Re: [PATCH 1/9] drm/format-helper: Export drm_fb_clip_offset()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

Am 23.10.21 um 09:49 schrieb Sam Ravnborg:
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@xxxxxxx>
---
  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.

That's an oversight. Sorry.


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.

On ancient platforms, int was 16 bit wide. So for values that are array indices or buffer indices, I naturally use long, which is 32-bit at least. Never mind, it's not relevant any longer. I'll convert this code to unsigned int.

Best regards
Thomas


	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

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux