Den 22.10.2021 15.28, skrev Thomas Zimmermann:
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,
Like Sam I wonder about the unsigned long here.
Noralf.
const struct drm_rect *clip)
+{
- return clip_offset(clip, pitch, format->cpp[0]);
+} +EXPORT_SYMBOL(drm_fb_clip_offset);