drm/format-helper: Introduce drm_pixmap, font support and filling
Subsystems (8)
Thomas Zimmermann
maintainercover drm/format-helper: Introduce drm_pixmap, font support and filling
This RFC patchset implements various features required for DRM panic handling [1] and should (for now) be seen in that context.
Most of all, the patchset replaces struct drm_framebuffer with struct drm_pixmap in the format-conversion helpers. DRM pixmap represents a source of pixel data for the blitting operations. Patches 1 to 19 update the interface, implementation and all of the callers. These patches could be useful even without DRM panic handling.
With struct drm_pixmap in place, patches 20 to 22 implement rudimentary support for blitting font data. The pixmap refers to a character's glyph, which the blit routines write to the destination memory. An example on blitting strings is given in patch 20's commit description.
Patch 23 adds rudimentary support for fill operations. The design is based on blitting, but blits the same color into each pixel.
[1] https://patchwork.freedesktop.org/series/122244/
Thomas Zimmermann (23):
drm/format-helper: Add struct drm_pixmap drm/format-helper: Use struct drm_pixmap for drm_fb_memcpy() drm/format-helper: Streamline drm_fb_xfrm() implementations drm/format-helper: Use struct drm_pixmap internally drm/format-helper: Use struct drm_pixmap for drm_fb_swab() drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_rgb332()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_rgb565()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_xrgb1555()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_argb1555()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_rgba5551()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_rgb888()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_argb8888()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_abgr8888()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_xbgr8888()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_xrgb2101010()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_argb2101010()
drm/format-helper: Use struct drm_pixmap for
drm_fb_xrgb8888_to_gray8() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_mono() drm/format-helper: Use struct drm_pixmap for drm_fb_blit() [DO NOT MERGE] drm/format-helper: Add font-support for DRM pixmap [DO NOT MERGE] drm/format-helper: Add color palette
[DO NOT MERGE] drm/format-helper: Support blitting from C1 to XRGB8888 [DO NOT MERGE] drm/format-helper: Add drm_fb_fill() to fill screen
with color
drivers/gpu/drm/ast/ast_mode.c | 4 +- drivers/gpu/drm/drm_format_helper.c | 678 ++++++++++++------ drivers/gpu/drm/drm_mipi_dbi.c | 9 +- drivers/gpu/drm/gud/gud_pipe.c | 24 +- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 4 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 4 +- drivers/gpu/drm/solomon/ssd130x.c | 12 +- .../gpu/drm/tests/drm_format_helper_test.c | 106 ++- drivers/gpu/drm/tiny/cirrus.c | 6 +- drivers/gpu/drm/tiny/ofdrm.c | 6 +- drivers/gpu/drm/tiny/repaper.c | 4 +- drivers/gpu/drm/tiny/simpledrm.c | 6 +- drivers/gpu/drm/tiny/st7586.c | 4 +- include/drm/drm_format_helper.h | 116 ++- 14 files changed, 678 insertions(+), 305 deletions(-)
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 1/23 drm/format-helper: Add struct drm_pixmap
Add struct drm_pixmap to wrap the source parameters for all drawing operations. This consists of the format, the clipping rectangle, the line pitch and source data buffers. Also add a helper that creates a pixmap from a framebuffer.
Existing code uses struct drm_framebuffer for drawing. Converting the drawing interfaces to struct drm_pixmap will allow for other types of source buffers, such as plain memory buffers or font data from struct font_desc.
--- drivers/gpu/drm/drm_format_helper.c | 49 +++++++++++++++++++++++++++++ include/drm/drm_format_helper.h | 36 ++++++++++++++++++--- 2 files changed, 81 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_format_helper.c +49 -0
@@ -132,6 +132,55 @@ unsigned int drm_fb_clip_offset(unsigned int pitch, const struct drm_format_info }EXPORT_SYMBOL (drm_fb_clip_offset); +static void drm_pixmap_init (struct drm_pixmap *pix,const struct drm_format_info *format, +const struct iosys_map *data,const unsigned int *pitches, +const struct drm_rect *clip) +{ +size_t i; + + pix->format = format; + +/* +* TODO: Set the size and data pointers from the +* clipping rectangle and remove their computation +* from the xfrm helpers. +*/ +memcpy (&pix->clip, clip,sizeof (pix->clip)); + +for (i =0 ; i < format->num_planes; ++i) + pix->pitches[i] = pitches[i]; +for (; i <ARRAY_SIZE (pix->pitches); ++i) + pix->pitches[i] =0 ; + +for (i =0 ; i < format->num_planes; ++i) + pix->data[i] = data[i]; +for (; i <ARRAY_SIZE (pix->data); ++i) +iosys_map_clear (&pix->data[i]); +} + +/** +* drm_pixmap_init_from_framebuffer - Initializes a pixmap from a DRM framebuffer +* @pix: The pixmap to initialize +* @fb: DRM framebuffer +* @data: Array of source buffers +* @clip: Clip rectangle area to copy +* +* The parameter @data refers to an array with least as many entries as +* there are planes in @fb's format. Each entry stores the value for the +* format's respective color plane at the same index. +*/ +void drm_pixmap_init_from_framebuffer (struct drm_pixmap *pix,const struct drm_framebuffer *fb, +const struct iosys_map *data,const struct drm_rect *clip) +{ +const struct drm_rect full_clip =DRM_RECT_INIT (0 ,0 , fb->width, fb->height); + +if (!clip) + clip = &full_clip; + +drm_pixmap_init (pix, fb->format, data, fb->pitches, clip); +} +EXPORT_SYMBOL (drm_pixmap_init_from_framebuffer); +/* TODO: Make this function work with multi-plane formats. */ static int __drm_fb_xfrm(void *dst, unsigned long dst_pitch, unsigned long dst_pixsize, const void *vaddr, const struct drm_framebuffer *fb,
include/drm/drm_format_helper.h +32 -4
@@ -6,14 +6,14 @@#ifndef __LINUX_DRM_FORMAT_HELPER_H#define __LINUX_DRM_FORMAT_HELPER_H +#include <linux/iosys-map.h> #include <linux/types.h> +#include <drm/drm_fourcc.h> +#include <drm/drm_rect.h> +struct drm_device ; -struct drm_format_info ;struct drm_framebuffer ; -struct drm_rect ; - -struct iosys_map ;/** * struct drm_format_conv_state - Stores format-conversion state
@@ -66,6 +66,34 @@ void *drm_format_conv_state_reserve(struct drm_format_conv_state *state, size_t new_size, gfp_t flags);void drm_format_conv_state_release (struct drm_format_conv_state *state); +/** +* struct drm_pixmap - source pixmap for format-conversion helpers +* +* A pixmap represents the source data for drawing operations. All +* fields are considered private. +*/ +struct drm_pixmap { +/** +* @format: The pixmap's color format +*/ +const struct drm_format_info *format; +/** +* @clip: The cliping rectangle. +*/ +struct drm_rect clip; +/** +* @pitches: Per-plane offset between two consecutive rows of pixels in Bytes +*/ +unsigned int pitches[DRM_FORMAT_MAX_PLANES ]; +/** +* @data: Per-plane source buffer +*/ +struct iosys_map data[DRM_FORMAT_MAX_PLANES ]; +}; + +void drm_pixmap_init_from_framebuffer (struct drm_pixmap *pix,const struct drm_framebuffer *fb, +const struct iosys_map *data,const struct drm_rect *clip); +unsigned int drm_fb_clip_offset (unsigned int pitch,const struct drm_format_info *format,const struct drm_rect *clip);
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 2/23 drm/format-helper: Use struct drm_pixmap for drm_fb_memcpy()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_memcpy() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_memcpy() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/ast/ast_mode.c | 4 ++- drivers/gpu/drm/drm_format_helper.c | 31 ++++++++++--------- drivers/gpu/drm/drm_mipi_dbi.c | 5 ++- drivers/gpu/drm/gud/gud_pipe.c | 9 ++++-- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 4 ++- drivers/gpu/drm/mgag200/mgag200_mode.c | 4 ++- .../gpu/drm/tests/drm_format_helper_test.c | 5 ++- include/drm/drm_format_helper.h | 3 +- 8 files changed, 42 insertions(+), 23 deletions(-)
drivers/gpu/drm/ast/ast_mode.c +3 -1
@@ -632,9 +632,11 @@ static void ast_handle_damage(struct ast_plane *ast_plane, struct iosys_map *src const struct drm_rect *clip) {struct iosys_map dst =IOSYS_MAP_INIT_VADDR_IOMEM (ast_plane->vaddr); +struct drm_pixmap src_pix;iosys_map_incr (&dst,drm_fb_clip_offset (fb->pitches[0 ], fb->format, clip)); -drm_fb_memcpy (&dst, fb->pitches, src, fb, clip); +drm_pixmap_init_from_framebuffer (&src_pix, fb, src, clip); +drm_fb_memcpy (&dst, fb->pitches, &src_pix); } static void ast_primary_plane_helper_atomic_update(struct drm_plane *plane,
drivers/gpu/drm/drm_format_helper.c +17 -14
@@ -298,29 +298,29 @@ static int drm_fb_xfrm(struct iosys_map *dst,* @dst: Array of destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of source buffers -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * * This function copies parts of a framebuffer to display memory. Destination and -* framebuffer formats must match. No conversion takes place. The parameters @dst, -* @dst_pitch and @src refer to arrays. Each array must have at least as many entries -* as there are planes in @fb's format. Each entry stores the value for the format's +* framebuffer formats must match. No conversion takes place. The parameters @dst +* and @dst_pitch refer to arrays. Each array must have at least as many entries +* as there are planes in pixmap's format. Each entry stores the value for the format's * respective color plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the * top-left corner). */ void drm_fb_memcpy (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip) +const struct drm_pixmap *src_pix) {static const unsigned int default_dst_pitch[DRM_FORMAT_MAX_PLANES ] = {0 ,0 ,0 ,0 }; -const struct drm_format_info *format = fb->format; -unsigned int i, y, lines =drm_rect_height (clip); +const struct drm_format_info *format = src_pix->format; +const struct drm_rect *src_clip = &src_pix->clip; +const unsigned int *src_pitches = src_pix->pitches; +const struct iosys_map *src = src_pix->data; +unsigned int i, y, lines =drm_rect_height (src_clip);if (!dst_pitch) dst_pitch = default_dst_pitch;
@@ -328,7 +328,7 @@ void drm_fb_memcpy(struct iosys_map *dst, const unsigned int *dst_pitch,for (i =0 ; i < format->num_planes; ++i) {unsigned int bpp_i =drm_format_info_bpp (format, i);unsigned int cpp_i =DIV_ROUND_UP (bpp_i,8 ); -size_t len_i =DIV_ROUND_UP (drm_rect_width (clip) * bpp_i,8 ); +size_t len_i =DIV_ROUND_UP (drm_rect_width (src_clip) * bpp_i,8 );unsigned int dst_pitch_i = dst_pitch[i];struct iosys_map dst_i = dst[i];struct iosys_map src_i = src[i];
@@ -336,11 +336,11 @@ void drm_fb_memcpy(struct iosys_map *dst, const unsigned int *dst_pitch,if (!dst_pitch_i) dst_pitch_i = len_i; -iosys_map_incr (&src_i,clip_offset (clip, fb->pitches[i], cpp_i)); +iosys_map_incr (&src_i,clip_offset (src_clip, src_pitches[i], cpp_i));for (y =0 ; y < lines; y++) {/* TODO: handle src_i in I/O memory here */ iosys_map_memcpy_to (&dst_i,0 , src_i.vaddr, len_i); -iosys_map_incr (&src_i, fb->pitches[i]); +iosys_map_incr (&src_i, src_pitches[i]);iosys_map_incr (&dst_i, dst_pitch_i); } }
@@ -1058,9 +1058,12 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d const struct drm_rect *clip, struct drm_format_conv_state *state) { uint32_t fb_format = fb->format->format; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);if (fb_format == dst_format) { -drm_fb_memcpy (dst, dst_pitch, src, fb, clip); +drm_fb_memcpy (dst, dst_pitch, src_pix);return 0 ; }else if (fb_format == (dst_format |DRM_FORMAT_BIG_ENDIAN )) {drm_fb_swab (dst, dst_pitch, src, fb, clip, false, state);
drivers/gpu/drm/drm_mipi_dbi.c +4 -1
@@ -208,19 +208,22 @@ int mipi_dbi_buf_copy(void *dst, struct iosys_map *src, struct drm_framebuffer * {struct drm_gem_object *gem =drm_gem_fb_get_obj (fb,0 );struct iosys_map dst_map =IOSYS_MAP_INIT_VADDR (dst); +struct drm_pixmap src_pix;int ret; ret =drm_gem_fb_begin_cpu_access (fb,DMA_FROM_DEVICE );if (ret)return ret; +drm_pixmap_init_from_framebuffer (&src_pix, fb, src, clip); +switch (fb->format->format) {case DRM_FORMAT_RGB565 :if (swap)drm_fb_swab (&dst_map,NULL , src, fb, clip, !gem->import_attach, fmtcnv_state);else -drm_fb_memcpy (&dst_map,NULL , src, fb, clip); +drm_fb_memcpy (&dst_map,NULL , &src_pix);break ;case DRM_FORMAT_XRGB8888 :drm_fb_xrgb8888_to_rgb565 (&dst_map,NULL , src, fb, clip, fmtcnv_state, swap);
drivers/gpu/drm/gud/gud_pipe.c +7 -2
@@ -160,6 +160,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb,struct iosys_map dst;void *vaddr, *buf;size_t pitch, len; +struct drm_pixmap src_pix; pitch =drm_format_info_min_pitch (format,0 ,drm_rect_width (rect)); len = pitch *drm_rect_height (rect);
@@ -174,6 +175,8 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb, buf = gdrm->bulk_buf;iosys_map_set_vaddr (&dst, buf); +drm_pixmap_init_from_framebuffer (&src_pix, fb, src, rect); +/* * Imported buffers are assumed to be write-combined and thus uncached * with slow reads (at least on ARM).
@@ -201,7 +204,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb,/* can compress directly from the framebuffer */ buf = vaddr + rect->y1 * pitch; }else { -drm_fb_memcpy (&dst,NULL , src, fb, rect); +drm_fb_memcpy (&dst,NULL , &src_pix); }memset (req,0 ,sizeof (*req));
@@ -392,6 +395,7 @@ static int gud_fb_queue_damage(struct gud_device *gdrm, struct drm_framebuffer * {struct drm_framebuffer *old_fb =NULL ;struct iosys_map shadow_map; +struct drm_pixmap src_pix;mutex_lock (&gdrm->damage_lock);
@@ -405,7 +409,8 @@ static int gud_fb_queue_damage(struct gud_device *gdrm, struct drm_framebuffer *iosys_map_set_vaddr (&shadow_map, gdrm->shadow_buf);iosys_map_incr (&shadow_map,drm_fb_clip_offset (fb->pitches[0 ], fb->format, damage)); -drm_fb_memcpy (&shadow_map, fb->pitches, src, fb, damage); +drm_pixmap_init_from_framebuffer (&src_pix, fb, src, damage); +drm_fb_memcpy (&shadow_map, fb->pitches, &src_pix);if (fb != gdrm->fb) { old_fb = gdrm->fb;
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +3 -1
@@ -25,13 +25,15 @@ static int hyperv_blit_to_vram_rect(struct drm_framebuffer *fb, {struct hyperv_drm_device *hv =to_hv (fb->dev);struct iosys_map dst =IOSYS_MAP_INIT_VADDR_IOMEM (hv->vram); +struct drm_pixmap src_pix;int idx;if (!drm_dev_enter (&hv->dev, &idx))return -ENODEV ;iosys_map_incr (&dst,drm_fb_clip_offset (fb->pitches[0 ], fb->format, rect)); -drm_fb_memcpy (&dst, fb->pitches, vmap, fb, rect); +drm_pixmap_init_from_framebuffer (&src_pix, fb, vmap, rect); +drm_fb_memcpy (&dst, fb->pitches, &src_pix);drm_dev_exit (idx);
drivers/gpu/drm/mgag200/mgag200_mode.c +3 -1
@@ -433,9 +433,11 @@ static void mgag200_handle_damage(struct mga_device *mdev, const struct iosys_ma struct drm_framebuffer *fb, struct drm_rect *clip) { struct iosys_map dst = IOSYS_MAP_INIT_VADDR_IOMEM(mdev->vram); +struct drm_pixmap src_pix;iosys_map_incr (&dst,drm_fb_clip_offset (fb->pitches[0 ], fb->format, clip)); -drm_fb_memcpy (&dst, fb->pitches, vmap, fb, clip); +drm_pixmap_init_from_framebuffer (&src_pix, fb, vmap, clip); +drm_fb_memcpy (&dst, fb->pitches, &src_pix); }/*
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -1801,6 +1801,7 @@ static void drm_test_fb_memcpy(struct kunit *test)struct drm_framebuffer fb = { .format =drm_format_info (params->format), }; +struct drm_pixmap src_pix;memcpy (fb.pitches, params->src_pitches,DRM_FORMAT_MAX_PLANES *sizeof (int ));
@@ -1820,7 +1821,9 @@ static void drm_test_fb_memcpy(struct kunit *test)const unsigned int *dst_pitches = params->dst_pitches[0 ] ==TEST_USE_DEFAULT_PITCH ?NULL : params->dst_pitches; -drm_fb_memcpy (dst, dst_pitches, src, &fb, ¶ms->clip); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, src, ¶ms->clip); + +drm_fb_memcpy (dst, dst_pitches, &src_pix);for (size_t i =0 ; i < fb.format->num_planes; i++) { expected[i] =cpubuf_to_le32 (test, params->expected[i],TEST_BUF_SIZE );
include/drm/drm_format_helper.h +1 -2
@@ -98,8 +98,7 @@ unsigned int drm_fb_clip_offset(unsigned int pitch, const struct drm_format_info const struct drm_rect *clip);void drm_fb_memcpy (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip); +const struct drm_pixmap *src_pix); void drm_fb_swab(struct iosys_map *dst, const unsigned int *dst_pitch, const struct iosys_map *src, const struct drm_framebuffer *fb, const struct drm_rect *clip, bool cached,
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 3/23 drm/format-helper: Streamline drm_fb_xfrm() implementations
In reply to Thomas ZimmermannMake the implementations of drm_fb_xfrm() independent from struct framebuffer and rename several variables. Done to simplify further cleanups; no functional changes.
--- drivers/gpu/drm/drm_format_helper.c | 66 ++++++++++++++--------------- 1 file changed, 33 insertions(+), 33 deletions(-)
drivers/gpu/drm/drm_format_helper.c +33 -33
@@ -181,16 +181,15 @@ void drm_pixmap_init_from_framebuffer(struct drm_pixmap *pix, const struct drm_f }EXPORT_SYMBOL (drm_pixmap_init_from_framebuffer); -/* TODO: Make this function work with multi-plane formats. */ static int __drm_fb_xfrm (void *dst,unsigned long dst_pitch,unsigned long dst_pixsize, -const void *vaddr,const struct drm_framebuffer *fb, -const struct drm_rect *clip,bool vaddr_cached_hint, +const void *src,unsigned long src_pitch,unsigned long src_pixsize, +const struct drm_rect *src_clip,bool src_cached_hint,struct drm_format_conv_state *state,void (*xfrm_line)(void *dbuf,const void *sbuf,unsigned int npixels)) { -unsigned long linepixels =drm_rect_width (clip); -unsigned long lines =drm_rect_height (clip); -size_t sbuf_len = linepixels * fb->format->cpp[0 ]; +unsigned long pixels =drm_rect_width (src_clip); +unsigned long lines =drm_rect_height (src_clip); +size_t sbuf_len = pixels * src_pixsize;void *stmp =NULL ;unsigned long i;const void *sbuf;
@@ -200,47 +199,46 @@ static int __drm_fb_xfrm(void *dst, unsigned long dst_pitch, unsigned long dst_p* caching, so reads are uncached. Speed up access by fetching * one line at a time. */ -if (!vaddr_cached_hint) { +if (!src_cached_hint) { stmp =drm_format_conv_state_reserve (state, sbuf_len,GFP_KERNEL );if (!stmp)return -ENOMEM ; }if (!dst_pitch) - dst_pitch =drm_rect_width (clip) * dst_pixsize; - vaddr +=clip_offset (clip, fb->pitches[0 ], fb->format->cpp[0 ]); + dst_pitch = pixels * dst_pixsize; + src +=clip_offset (src_clip, src_pitch, src_pixsize);for (i =0 ; i < lines; ++i) {if (stmp) - sbuf =memcpy (stmp, vaddr, sbuf_len); + sbuf =memcpy (stmp, src, sbuf_len);else - sbuf = vaddr; -xfrm_line (dst, sbuf, linepixels); - vaddr += fb->pitches[0 ]; + sbuf = src; +xfrm_line (dst, sbuf, pixels); + src += src_pitch; dst += dst_pitch; }return 0 ; } -/* TODO: Make this function work with multi-plane formats. */ static int __drm_fb_xfrm_toio (void __iomem *dst,unsigned long dst_pitch,unsigned long dst_pixsize, -const void *vaddr,const struct drm_framebuffer *fb, -const struct drm_rect *clip,bool vaddr_cached_hint, +const void *src,unsigned long src_pitch,unsigned long src_pixsize, +const struct drm_rect *src_clip,bool src_cached_hint,struct drm_format_conv_state *state,void (*xfrm_line)(void *dbuf,const void *sbuf,unsigned int npixels)) { -unsigned long linepixels =drm_rect_width (clip); -unsigned long lines =drm_rect_height (clip); -size_t dbuf_len = linepixels * dst_pixsize; +unsigned long npixels =drm_rect_width (src_clip); +unsigned long lines =drm_rect_height (src_clip); +size_t dbuf_len = npixels * dst_pixsize;size_t stmp_off =round_up (dbuf_len,ARCH_KMALLOC_MINALIGN );/* for sbuf alignment */ -size_t sbuf_len = linepixels * fb->format->cpp[0 ]; +size_t sbuf_len = npixels * src_pixsize;void *stmp =NULL ;unsigned long i;const void *sbuf;void *dbuf; -if (vaddr_cached_hint) { +if (src_cached_hint) { dbuf =drm_format_conv_state_reserve (state, dbuf_len,GFP_KERNEL ); }else { dbuf =drm_format_conv_state_reserve (state, stmp_off + sbuf_len,GFP_KERNEL );
@@ -250,17 +248,17 @@ static int __drm_fb_xfrm_toio(void __iomem *dst, unsigned long dst_pitch, unsignreturn -ENOMEM ;if (!dst_pitch) - dst_pitch = linepixels * dst_pixsize; - vaddr +=clip_offset (clip, fb->pitches[0 ], fb->format->cpp[0 ]); + dst_pitch = npixels * dst_pixsize; + src +=clip_offset (src_clip, src_pitch, src_pixsize);for (i =0 ; i < lines; ++i) {if (stmp) - sbuf =memcpy (stmp, vaddr, sbuf_len); + sbuf =memcpy (stmp, src, sbuf_len);else - sbuf = vaddr; -xfrm_line (dbuf, sbuf, linepixels); + sbuf = src; +xfrm_line (dbuf, sbuf, npixels);memcpy_toio (dst, dbuf, dbuf_len); - vaddr += fb->pitches[0 ]; + src += src_pitch; dst += dst_pitch; }
@@ -284,13 +282,15 @@ static int drm_fb_xfrm(struct iosys_map *dst,/* TODO: handle src in I/O memory here */ if (dst[0 ].is_iomem) -return __drm_fb_xfrm_toio (dst[0 ].vaddr_iomem, dst_pitch[0 ], dst_pixsize[0 ], - src[0 ].vaddr, fb, clip, vaddr_cached_hint, state, - xfrm_line); +return __drm_fb_xfrm_toio ( + dst[0 ].vaddr_iomem, dst_pitch[0 ], dst_pixsize[0 ], + src[0 ].vaddr, fb->pitches[0 ], fb->format->cpp[0 ], + clip, vaddr_cached_hint, state, xfrm_line);else -return __drm_fb_xfrm (dst[0 ].vaddr, dst_pitch[0 ], dst_pixsize[0 ], - src[0 ].vaddr, fb, clip, vaddr_cached_hint, state, - xfrm_line); +return __drm_fb_xfrm ( + dst[0 ].vaddr, dst_pitch[0 ], dst_pixsize[0 ], + src[0 ].vaddr, fb->pitches[0 ], fb->format->cpp[0 ], + clip, vaddr_cached_hint, state, xfrm_line); }/**
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 4/23 drm/format-helper: Use struct drm_pixmap internally
In reply to Thomas ZimmermannImplement drm_fb_xfrm() with struct drm_pixmap and adapt all callers. The internal instances if struct drm_pixmap will eventually be pushed into external callers of the format-helper interface.
--- drivers/gpu/drm/drm_format_helper.c | 76 +++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 19 deletions(-)
drivers/gpu/drm/drm_format_helper.c +57 -19
@@ -268,8 +268,7 @@ static int __drm_fb_xfrm_toio(void __iomem *dst, unsigned long dst_pitch, unsign/* TODO: Make this function work with multi-plane formats. */ static int drm_fb_xfrm (struct iosys_map *dst,const unsigned int *dst_pitch,const u8 *dst_pixsize, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,bool vaddr_cached_hint, +const struct drm_pixmap *src_pix,bool vaddr_cached_hint,struct drm_format_conv_state *state,void (*xfrm_line)(void *dbuf,const void *sbuf,unsigned int npixels)) {
@@ -284,13 +283,13 @@ static int drm_fb_xfrm(struct iosys_map *dst,if (dst[0 ].is_iomem)return __drm_fb_xfrm_toio ( dst[0 ].vaddr_iomem, dst_pitch[0 ], dst_pixsize[0 ], - src[0 ].vaddr, fb->pitches[0 ], fb->format->cpp[0 ], - clip, vaddr_cached_hint, state, xfrm_line); + src_pix->data[0 ].vaddr, src_pix->pitches[0 ], src_pix->format->cpp[0 ], + &src_pix->clip, vaddr_cached_hint, state, xfrm_line);else return __drm_fb_xfrm ( dst[0 ].vaddr, dst_pitch[0 ], dst_pixsize[0 ], - src[0 ].vaddr, fb->pitches[0 ], fb->format->cpp[0 ], - clip, vaddr_cached_hint, state, xfrm_line); + src_pix->data[0 ].vaddr, src_pix->pitches[0 ], src_pix->format->cpp[0 ], + &src_pix->clip, vaddr_cached_hint, state, xfrm_line); }/**
@@ -397,6 +396,9 @@ void drm_fb_swab(struct iosys_map *dst, const unsigned int *dst_pitch,const struct drm_format_info *format = fb->format;u8 cpp =DIV_ROUND_UP (drm_format_info_bpp (format,0 ),8 );void (*swab_line)(void *dbuf,const void *sbuf,unsigned int npixels); +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);switch (cpp) {case 4 :
@@ -411,7 +413,7 @@ void drm_fb_swab(struct iosys_map *dst, const unsigned int *dst_pitch,return ; } -drm_fb_xfrm (dst, dst_pitch, &cpp, src, fb, clip, cached, state, swab_line); +drm_fb_xfrm (dst, dst_pitch, &cpp, src_pix, cached, state, swab_line); }EXPORT_SYMBOL (drm_fb_swab);
@@ -458,8 +460,11 @@ void drm_fb_xrgb8888_to_rgb332(struct iosys_map *dst, const unsigned int *dst_pistatic const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {1 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_rgb332_line); }EXPORT_SYMBOL (drm_fb_xrgb8888_to_rgb332);
@@ -530,6 +535,9 @@ void drm_fb_xrgb8888_to_rgb565(struct iosys_map *dst, const unsigned int *dst_pistatic const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {2 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);void (*xfrm_line)(void *dbuf,const void *sbuf,unsigned int npixels);
@@ -538,7 +546,7 @@ void drm_fb_xrgb8888_to_rgb565(struct iosys_map *dst, const unsigned int *dst_pielse xfrm_line = drm_fb_xrgb8888_to_rgb565_line; -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, xfrm_line); +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, xfrm_line); }EXPORT_SYMBOL (drm_fb_xrgb8888_to_rgb565);
@@ -588,8 +596,11 @@ void drm_fb_xrgb8888_to_xrgb1555(struct iosys_map *dst, const unsigned int *dst_static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {2 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_xrgb1555_line); }EXPORT_SYMBOL (drm_fb_xrgb8888_to_xrgb1555);
@@ -641,8 +652,11 @@ void drm_fb_xrgb8888_to_argb1555(struct iosys_map *dst, const unsigned int *dst_static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {2 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_argb1555_line); }EXPORT_SYMBOL (drm_fb_xrgb8888_to_argb1555);
@@ -694,8 +708,11 @@ void drm_fb_xrgb8888_to_rgba5551(struct iosys_map *dst, const unsigned int *dst_static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {2 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_rgba5551_line); }EXPORT_SYMBOL (drm_fb_xrgb8888_to_rgba5551);
@@ -745,8 +762,11 @@ void drm_fb_xrgb8888_to_rgb888(struct iosys_map *dst, const unsigned int *dst_pistatic const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {3 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_rgb888_line); }EXPORT_SYMBOL (drm_fb_xrgb8888_to_rgb888);
@@ -794,8 +814,11 @@ void drm_fb_xrgb8888_to_argb8888(struct iosys_map *dst, const unsigned int *dst_static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {4 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_argb8888_line); }EXPORT_SYMBOL (drm_fb_xrgb8888_to_argb8888);
@@ -826,8 +849,11 @@ static void drm_fb_xrgb8888_to_abgr8888(struct iosys_map *dst, const unsigned instatic const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {4 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_abgr8888_line); }
@@ -857,8 +883,11 @@ static void drm_fb_xrgb8888_to_xbgr8888(struct iosys_map *dst, const unsigned instatic const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {4 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_xbgr8888_line); }
@@ -910,8 +939,11 @@ void drm_fb_xrgb8888_to_xrgb2101010(struct iosys_map *dst, const unsigned int *dstatic const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {4 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_xrgb2101010_line); }EXPORT_SYMBOL (drm_fb_xrgb8888_to_xrgb2101010);
@@ -965,8 +997,11 @@ void drm_fb_xrgb8888_to_argb2101010(struct iosys_map *dst, const unsigned int *dstatic const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {4 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_argb2101010_line); }EXPORT_SYMBOL (drm_fb_xrgb8888_to_argb2101010);
@@ -1021,8 +1056,11 @@ void drm_fb_xrgb8888_to_gray8(struct iosys_map *dst, const unsigned int *dst_pitstatic const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {1 , }; +struct drm_pixmap pixmap; +struct drm_pixmap *src_pix = &pixmap; +drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); -drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src, fb, clip, false, state, +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_gray8_line); }EXPORT_SYMBOL (drm_fb_xrgb8888_to_gray8);
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 5/23 drm/format-helper: Use struct drm_pixmap for drm_fb_swab()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_swab() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_swab() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 29 +++++++++---------- drivers/gpu/drm/drm_mipi_dbi.c | 2 +- drivers/gpu/drm/gud/gud_pipe.c | 3 +- .../gpu/drm/tests/drm_format_helper_test.c | 5 +++- include/drm/drm_format_helper.h | 6 ++-- 5 files changed, 23 insertions(+), 22 deletions(-)
drivers/gpu/drm/drm_format_helper.c +13 -16
@@ -368,19 +368,18 @@ static void drm_fb_swab32_line(void *dbuf, const void *sbuf, unsigned int pixels/** * drm_fb_swab - Swap bytes into clip buffer +* @dev: DRM device * @dst: Array of destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of source buffers -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @cached: Source buffer is mapped cached (eg. not write-combined) * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and swaps per-pixel * bytes during the process. Destination and framebuffer formats must match. The -* parameters @dst, @dst_pitch and @src refer to arrays. Each array must have at -* least as many entries as there are planes in @fb's format. Each entry stores the +* parameters @dst and @dst_pitch refer to arrays. Each array must have at least +* as many entries as there are planes in the pixmap's format. Each entry stores the * value for the format's respective color plane at the same index. If @cached is * false a temporary buffer is used to cache one pixel line at a time to speed up * slow uncached reads.
@@ -388,17 +387,14 @@ static void drm_fb_swab32_line(void *dbuf, const void *sbuf, unsigned int pixels* This function does not apply clipping on @dst (i.e. the destination is at the * top-left corner). */ -void drm_fb_swab (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,bool cached, +void drm_fb_swab (struct drm_device *dev, +struct iosys_map *dst,const unsigned int *dst_pitch, +const struct drm_pixmap *src_pix,bool cached,struct drm_format_conv_state *state) { -const struct drm_format_info *format = fb->format; +const struct drm_format_info *format = src_pix->format;u8 cpp =DIV_ROUND_UP (drm_format_info_bpp (format,0 ),8 );void (*swab_line)(void *dbuf,const void *sbuf,unsigned int npixels); -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);switch (cpp) {case 4 :
@@ -408,7 +404,7 @@ void drm_fb_swab(struct iosys_map *dst, const unsigned int *dst_pitch, swab_line = drm_fb_swab16_line;break ;default : -drm_warn_once (fb->dev,"Format %p4cc has unsupported pixel size.\n" , +drm_warn_once (dev,"Format %p4cc has unsupported pixel size.\n" , &format->format);return ; }
@@ -1095,6 +1091,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d const struct iosys_map *src, const struct drm_framebuffer *fb, const struct drm_rect *clip, struct drm_format_conv_state *state) { + struct drm_device *dev = fb->dev;uint32_t fb_format = fb->format->format;struct drm_pixmap pixmap;struct drm_pixmap *src_pix = &pixmap;
@@ -1104,10 +1101,10 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_memcpy (dst, dst_pitch, src_pix);return 0 ; }else if (fb_format == (dst_format |DRM_FORMAT_BIG_ENDIAN )) { -drm_fb_swab (dst, dst_pitch, src, fb, clip, false, state); +drm_fb_swab (dev, dst, dst_pitch, src_pix, false, state);return 0 ; }else if (fb_format == (dst_format & ~DRM_FORMAT_BIG_ENDIAN )) { -drm_fb_swab (dst, dst_pitch, src, fb, clip, false, state); +drm_fb_swab (dev, dst, dst_pitch, src_pix, false, state);return 0 ; }else if (fb_format ==DRM_FORMAT_XRGB8888 ) {if (dst_format ==DRM_FORMAT_RGB565 ) {
@@ -1141,7 +1138,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_xrgb8888_to_argb2101010 (dst, dst_pitch, src, fb, clip, state);return 0 ; }else if (dst_format ==DRM_FORMAT_BGRX8888 ) { -drm_fb_swab (dst, dst_pitch, src, fb, clip, false, state); +drm_fb_swab (dev, dst, dst_pitch, src_pix, false, state);return 0 ; } }
drivers/gpu/drm/drm_mipi_dbi.c +1 -1
@@ -220,7 +220,7 @@ int mipi_dbi_buf_copy(void *dst, struct iosys_map *src, struct drm_framebuffer *switch (fb->format->format) {case DRM_FORMAT_RGB565 :if (swap) -drm_fb_swab (&dst_map,NULL , src, fb, clip, !gem->import_attach, +drm_fb_swab (fb->dev, &dst_map,NULL , &src_pix, !gem->import_attach, fmtcnv_state);else drm_fb_memcpy (&dst_map,NULL , &src_pix);
drivers/gpu/drm/gud/gud_pipe.c +2 -1
@@ -156,6 +156,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb,struct gud_set_buffer_req *req, struct drm_format_conv_state *fmtcnv_state) { + struct drm_device *drm = &gdrm->drm;u8 compression = gdrm->compression;struct iosys_map dst;void *vaddr, *buf;
@@ -199,7 +200,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb, len =gud_xrgb8888_to_color (buf, format, vaddr, fb, rect); } }else if (gud_is_big_endian () && format->cpp[0 ] >1 ) { -drm_fb_swab (&dst,NULL , src, fb, rect, cached_reads, fmtcnv_state); +drm_fb_swab (drm, &dst,NULL , &src_pix, cached_reads, fmtcnv_state); }else if (compression && cached_reads && pitch == fb->pitches[0 ]) {/* can compress directly from the framebuffer */ buf = vaddr + rect->y1 * pitch;
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -1099,6 +1099,7 @@ static void drm_test_fb_swab(struct kunit *test) .format = drm_format_info(DRM_FORMAT_XRGB8888), .pitches = { params->pitch, 0, 0 }, }; +struct drm_pixmap src_pix; dst_size =conversion_buf_size (DRM_FORMAT_XRGB8888 , result->dst_pitch, ¶ms->clip,0 );
@@ -1115,7 +1116,9 @@ static void drm_test_fb_swab(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_swab (&dst, dst_pitch, &src, &fb, ¶ms->clip, false, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_swab (NULL , &dst, dst_pitch, &src_pix, false, &fmtcnv_state); buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size);
include/drm/drm_format_helper.h +3 -3
@@ -99,9 +99,9 @@ unsigned int drm_fb_clip_offset(unsigned int pitch, const struct drm_format_infovoid drm_fb_memcpy (struct iosys_map *dst,const unsigned int *dst_pitch,const struct drm_pixmap *src_pix); -void drm_fb_swab (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,bool cached, +void drm_fb_swab (struct drm_device *dev, +struct iosys_map *dst,const unsigned int *dst_pitch, +const struct drm_pixmap *src_pix,bool cached,struct drm_format_conv_state *state); void drm_fb_xrgb8888_to_rgb332(struct iosys_map *dst, const unsigned int *dst_pitch, const struct iosys_map *src, const struct drm_framebuffer *fb,
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 6/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_rgb332()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_rgb332() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_rgb332() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 14 ++++---------- drivers/gpu/drm/gud/gud_pipe.c | 2 +- drivers/gpu/drm/solomon/ssd130x.c | 4 +++- drivers/gpu/drm/tests/drm_format_helper_test.c | 5 ++++- include/drm/drm_format_helper.h | 3 +-- 5 files changed, 13 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_format_helper.c +4 -10
@@ -433,15 +433,13 @@ static void drm_fb_xrgb8888_to_rgb332_line(void *dbuf, const void *sbuf, unsigne* @dst: Array of RGB332 destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffers -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and converts the * color format during the process. Destination and framebuffer formats must match. The -* parameters @dst, @dst_pitch and @src refer to arrays. Each array must have at -* least as many entries as there are planes in @fb's format. Each entry stores the +* parameters @dst and @dst_pitch refer to arrays. Each array must have at +* least as many entries as there are planes in pixmap's format. Each entry stores the * value for the format's respective color plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the
@@ -450,15 +448,11 @@ static void drm_fb_xrgb8888_to_rgb332_line(void *dbuf, const void *sbuf, unsigne* Drivers can use this function for RGB332 devices that don't support XRGB8888 natively. */ void drm_fb_xrgb8888_to_rgb332 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state) +const struct drm_pixmap *src_pix,struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {1 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_rgb332_line);
drivers/gpu/drm/gud/gud_pipe.c +1 -1
@@ -190,7 +190,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb, }else if (format->format ==DRM_FORMAT_R8 ) {drm_fb_xrgb8888_to_gray8 (&dst,NULL , src, fb, rect, fmtcnv_state); }else if (format->format ==DRM_FORMAT_RGB332 ) { -drm_fb_xrgb8888_to_rgb332 (&dst,NULL , src, fb, rect, fmtcnv_state); +drm_fb_xrgb8888_to_rgb332 (&dst,NULL , &src_pix, fmtcnv_state); }else if (format->format ==DRM_FORMAT_RGB565 ) {drm_fb_xrgb8888_to_rgb565 (&dst,NULL , src, fb, rect, fmtcnv_state,gud_is_big_endian ());
drivers/gpu/drm/solomon/ssd130x.c +3 -1
@@ -1069,6 +1069,7 @@ static int ssd133x_fb_blit_rect(struct drm_framebuffer *fb,const struct drm_format_info *fi =drm_format_info (DRM_FORMAT_RGB332 );unsigned int dst_pitch;struct iosys_map dst; +struct drm_pixmap src_pix;int ret =0 ;if (!fi)
@@ -1081,7 +1082,8 @@ static int ssd133x_fb_blit_rect(struct drm_framebuffer *fb,return ret;iosys_map_set_vaddr (&dst, data_array); -drm_fb_xrgb8888_to_rgb332 (&dst, &dst_pitch, vmap, fb, rect, fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, fb, vmap, rect); +drm_fb_xrgb8888_to_rgb332 (&dst, &dst_pitch, &src_pix, fmtcnv_state);drm_gem_fb_end_cpu_access (fb,DMA_FROM_DEVICE );
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -646,6 +646,7 @@ static void drm_test_fb_xrgb8888_to_rgb332(struct kunit *test)u8 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -667,7 +668,9 @@ static void drm_test_fb_xrgb8888_to_rgb332(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_rgb332 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_xrgb8888_to_rgb332 (&dst, dst_pitch, &src_pix, &fmtcnv_state);KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); }
include/drm/drm_format_helper.h +1 -2
@@ -104,8 +104,7 @@ void drm_fb_swab(struct drm_device *dev, const struct drm_pixmap *src_pix, bool cached, struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_rgb332 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state); +const struct drm_pixmap *src_pix,struct drm_format_conv_state *state); void drm_fb_xrgb8888_to_rgb565(struct iosys_map *dst, const unsigned int *dst_pitch, const struct iosys_map *src, const struct drm_framebuffer *fb, const struct drm_rect *clip, struct drm_format_conv_state *state,
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 7/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_rgb565()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_rgb565() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_rgb565() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 18 ++++++------------ drivers/gpu/drm/drm_mipi_dbi.c | 2 +- drivers/gpu/drm/gud/gud_pipe.c | 2 +- drivers/gpu/drm/tests/drm_format_helper_test.c | 9 +++++---- include/drm/drm_format_helper.h | 5 ++--- 5 files changed, 15 insertions(+), 21 deletions(-)
drivers/gpu/drm/drm_format_helper.c +6 -12
@@ -500,16 +500,14 @@ static void drm_fb_xrgb8888_to_rgb565_swab_line(void *dbuf, const void *sbuf,* @dst: Array of RGB565 destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffer -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * @swab: Swap bytes * * This function copies parts of a framebuffer to display memory and converts the * color format during the process. Destination and framebuffer formats must match. The -* parameters @dst, @dst_pitch and @src refer to arrays. Each array must have at -* least as many entries as there are planes in @fb's format. Each entry stores the +* parameters @dst and @dst_pitch refer to arrays. Each array must have at +* least as many entries as there are planes in pixmap's format. Each entry stores the * value for the format's respective color plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the
@@ -518,16 +516,12 @@ static void drm_fb_xrgb8888_to_rgb565_swab_line(void *dbuf, const void *sbuf,* Drivers can use this function for RGB565 devices that don't support XRGB8888 natively. */ void drm_fb_xrgb8888_to_rgb565 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state, -bool swab) +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state,bool swab) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {2 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);void (*xfrm_line)(void *dbuf,const void *sbuf,unsigned int npixels);
@@ -1102,7 +1096,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t dreturn 0 ; }else if (fb_format ==DRM_FORMAT_XRGB8888 ) {if (dst_format ==DRM_FORMAT_RGB565 ) { -drm_fb_xrgb8888_to_rgb565 (dst, dst_pitch, src, fb, clip, state, false); +drm_fb_xrgb8888_to_rgb565 (dst, dst_pitch, src_pix, state, false);return 0 ; }else if (dst_format ==DRM_FORMAT_XRGB1555 ) {drm_fb_xrgb8888_to_xrgb1555 (dst, dst_pitch, src, fb, clip, state);
drivers/gpu/drm/drm_mipi_dbi.c +1 -1
@@ -226,7 +226,7 @@ int mipi_dbi_buf_copy(void *dst, struct iosys_map *src, struct drm_framebuffer *drm_fb_memcpy (&dst_map,NULL , &src_pix);break ;case DRM_FORMAT_XRGB8888 : -drm_fb_xrgb8888_to_rgb565 (&dst_map,NULL , src, fb, clip, fmtcnv_state, swap); +drm_fb_xrgb8888_to_rgb565 (&dst_map,NULL , &src_pix, fmtcnv_state, swap);break ;default : drm_err_once(fb->dev, "Format is not supported: %p4cc\n",
drivers/gpu/drm/gud/gud_pipe.c +1 -1
@@ -192,7 +192,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb, }else if (format->format ==DRM_FORMAT_RGB332 ) {drm_fb_xrgb8888_to_rgb332 (&dst,NULL , &src_pix, fmtcnv_state); }else if (format->format ==DRM_FORMAT_RGB565 ) { -drm_fb_xrgb8888_to_rgb565 (&dst,NULL , src, fb, rect, fmtcnv_state, +drm_fb_xrgb8888_to_rgb565 (&dst,NULL , &src_pix, fmtcnv_state,gud_is_big_endian ()); }else if (format->format ==DRM_FORMAT_RGB888 ) {drm_fb_xrgb8888_to_rgb888 (&dst,NULL , src, fb, rect, fmtcnv_state);
drivers/gpu/drm/tests/drm_format_helper_test.c +5 -4
@@ -682,6 +682,7 @@ static void drm_test_fb_xrgb8888_to_rgb565(struct kunit *test)u16 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -703,14 +704,14 @@ static void drm_test_fb_xrgb8888_to_rgb565(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_rgb565 (&dst, dst_pitch, &src, &fb, ¶ms->clip, - &fmtcnv_state, false); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_xrgb8888_to_rgb565 (&dst, dst_pitch, &src_pix, &fmtcnv_state, false); buf =le16buf_to_cpu (test, (__force const __le16 *)buf, dst_size /sizeof (__le16));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); buf = dst.vaddr;/* restore original value of buf */ -drm_fb_xrgb8888_to_rgb565 (&dst, &result->dst_pitch, &src, &fb, ¶ms->clip, - &fmtcnv_state, true); +drm_fb_xrgb8888_to_rgb565 (&dst, &result->dst_pitch, &src_pix, &fmtcnv_state, true); buf =le16buf_to_cpu (test, (__force const __le16 *)buf, dst_size /sizeof (__le16));KUNIT_EXPECT_MEMEQ (test, buf, result->expected_swab, dst_size);
include/drm/drm_format_helper.h +2 -3
@@ -106,9 +106,8 @@ void drm_fb_swab(struct drm_device *dev,void drm_fb_xrgb8888_to_rgb332 (struct iosys_map *dst,const unsigned int *dst_pitch,const struct drm_pixmap *src_pix,struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_rgb565 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state, -bool swab); +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state,bool swab);void drm_fb_xrgb8888_to_xrgb1555 (struct iosys_map *dst,const unsigned int *dst_pitch,const struct iosys_map *src,const struct drm_framebuffer *fb,const struct drm_rect *clip,struct drm_format_conv_state *state);
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 8/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_xrgb1555()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_xrgb1555() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_xrgb1555() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 19 +++++++------------ .../gpu/drm/tests/drm_format_helper_test.c | 4 +++- include/drm/drm_format_helper.h | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_format_helper.c +7 -12
@@ -556,15 +556,13 @@ static void drm_fb_xrgb8888_to_xrgb1555_line(void *dbuf, const void *sbuf, unsig* @dst: Array of XRGB1555 destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffer -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and converts -* the color format during the process. The parameters @dst, @dst_pitch and -* @src refer to arrays. Each array must have at least as many entries as -* there are planes in @fb's format. Each entry stores the value for the +* the color format during the process. The parameters @dst and @dst_pitch +* refer to arrays. Each array must have at least as many entries as there +* are planes in the pixmap's format. Each entry stores the value for the * format's respective color plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the
@@ -574,15 +572,12 @@ static void drm_fb_xrgb8888_to_xrgb1555_line(void *dbuf, const void *sbuf, unsig* XRGB8888 natively. */ void drm_fb_xrgb8888_to_xrgb1555 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state) +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {2 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_xrgb1555_line);
@@ -1099,7 +1094,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_xrgb8888_to_rgb565 (dst, dst_pitch, src_pix, state, false);return 0 ; }else if (dst_format ==DRM_FORMAT_XRGB1555 ) { -drm_fb_xrgb8888_to_xrgb1555 (dst, dst_pitch, src, fb, clip, state); +drm_fb_xrgb8888_to_xrgb1555 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_ARGB1555 ) {drm_fb_xrgb8888_to_argb1555 (dst, dst_pitch, src, fb, clip, state);
drivers/gpu/drm/tests/drm_format_helper_test.c +3 -1
@@ -737,6 +737,7 @@ static void drm_test_fb_xrgb8888_to_xrgb1555(struct kunit *test)u16 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -758,7 +759,8 @@ static void drm_test_fb_xrgb8888_to_xrgb1555(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_xrgb1555 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); +drm_fb_xrgb8888_to_xrgb1555 (&dst, dst_pitch, &src_pix, &fmtcnv_state); buf =le16buf_to_cpu (test, (__force const __le16 *)buf, dst_size /sizeof (__le16));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size);
include/drm/drm_format_helper.h +2 -2
@@ -109,8 +109,8 @@ void drm_fb_xrgb8888_to_rgb565(struct iosys_map *dst, const unsigned int *dst_piconst struct drm_pixmap *src_pix, struct drm_format_conv_state *state, bool swab);void drm_fb_xrgb8888_to_xrgb1555 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state); +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_argb1555 (struct iosys_map *dst,const unsigned int *dst_pitch,const struct iosys_map *src,const struct drm_framebuffer *fb,const struct drm_rect *clip,struct drm_format_conv_state *state);
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 9/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_argb1555()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_argb1555() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_argb1555() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 19 +++++++------------ .../gpu/drm/tests/drm_format_helper_test.c | 5 ++++- include/drm/drm_format_helper.h | 4 ++-- 3 files changed, 13 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_format_helper.c +7 -12
@@ -607,15 +607,13 @@ static void drm_fb_xrgb8888_to_argb1555_line(void *dbuf, const void *sbuf, unsig* @dst: Array of ARGB1555 destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffer -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and converts -* the color format during the process. The parameters @dst, @dst_pitch and -* @src refer to arrays. Each array must have at least as many entries as -* there are planes in @fb's format. Each entry stores the value for the +* the color format during the process. The parameters @dst and @dst_pitch refer +* to arrays. Each array must have at least as many entries as there are planes +* in the pixmap's format. Each entry stores the value for the * format's respective color plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the
@@ -625,15 +623,12 @@ static void drm_fb_xrgb8888_to_argb1555_line(void *dbuf, const void *sbuf, unsig* XRGB8888 natively. It sets an opaque alpha channel as part of the conversion. */ void drm_fb_xrgb8888_to_argb1555 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state) +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {2 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_argb1555_line);
@@ -1097,7 +1092,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_xrgb8888_to_xrgb1555 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_ARGB1555 ) { -drm_fb_xrgb8888_to_argb1555 (dst, dst_pitch, src, fb, clip, state); +drm_fb_xrgb8888_to_argb1555 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_RGBA5551 ) {drm_fb_xrgb8888_to_rgba5551 (dst, dst_pitch, src, fb, clip, state);
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -786,6 +786,7 @@ static void drm_test_fb_xrgb8888_to_argb1555(struct kunit *test)u16 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -807,7 +808,9 @@ static void drm_test_fb_xrgb8888_to_argb1555(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_argb1555 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_xrgb8888_to_argb1555 (&dst, dst_pitch, &src_pix, &fmtcnv_state); buf =le16buf_to_cpu (test, (__force const __le16 *)buf, dst_size /sizeof (__le16));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size);
include/drm/drm_format_helper.h +2 -2
@@ -112,8 +112,8 @@ void drm_fb_xrgb8888_to_xrgb1555(struct iosys_map *dst, const unsigned int *dst_const struct drm_pixmap *src_pix, struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_argb1555 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state); +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_rgba5551 (struct iosys_map *dst,const unsigned int *dst_pitch,const struct iosys_map *src,const struct drm_framebuffer *fb,const struct drm_rect *clip,struct drm_format_conv_state *state);
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 10/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_rgba5551()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_rgba5551() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_rgba5551() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 13 ++++--------- drivers/gpu/drm/tests/drm_format_helper_test.c | 5 ++++- include/drm/drm_format_helper.h | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_format_helper.c +4 -9
@@ -658,9 +658,7 @@ static void drm_fb_xrgb8888_to_rgba5551_line(void *dbuf, const void *sbuf, unsig* @dst: Array of RGBA5551 destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffer -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and converts
@@ -676,15 +674,12 @@ static void drm_fb_xrgb8888_to_rgba5551_line(void *dbuf, const void *sbuf, unsig* XRGB8888 natively. It sets an opaque alpha channel as part of the conversion. */ void drm_fb_xrgb8888_to_rgba5551 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state) +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {2 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_rgba5551_line);
@@ -1095,7 +1090,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_xrgb8888_to_argb1555 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_RGBA5551 ) { -drm_fb_xrgb8888_to_rgba5551 (dst, dst_pitch, src, fb, clip, state); +drm_fb_xrgb8888_to_rgba5551 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_RGB888 ) {drm_fb_xrgb8888_to_rgb888 (dst, dst_pitch, src, fb, clip, state);
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -836,6 +836,7 @@ static void drm_test_fb_xrgb8888_to_rgba5551(struct kunit *test)u16 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -857,7 +858,9 @@ static void drm_test_fb_xrgb8888_to_rgba5551(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_rgba5551 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_xrgb8888_to_rgba5551 (&dst, dst_pitch, &src_pix, &fmtcnv_state); buf =le16buf_to_cpu (test, (__force const __le16 *)buf, dst_size /sizeof (__le16));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size);
include/drm/drm_format_helper.h +2 -2
@@ -115,8 +115,8 @@ void drm_fb_xrgb8888_to_argb1555(struct iosys_map *dst, const unsigned int *dst_const struct drm_pixmap *src_pix, struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_rgba5551 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state); +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_rgb888 (struct iosys_map *dst,const unsigned int *dst_pitch,const struct iosys_map *src,const struct drm_framebuffer *fb,const struct drm_rect *clip,struct drm_format_conv_state *state);
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 11/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_rgb888()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_rgb888() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_rgb888() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 17 ++++++----------- drivers/gpu/drm/gud/gud_pipe.c | 2 +- drivers/gpu/drm/tests/drm_format_helper_test.c | 5 ++++- include/drm/drm_format_helper.h | 4 ++-- 4 files changed, 13 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_format_helper.c +6 -11
@@ -707,15 +707,13 @@ static void drm_fb_xrgb8888_to_rgb888_line(void *dbuf, const void *sbuf, unsigne* @dst: Array of RGB888 destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffers -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and converts the * color format during the process. Destination and framebuffer formats must match. The -* parameters @dst, @dst_pitch and @src refer to arrays. Each array must have at -* least as many entries as there are planes in @fb's format. Each entry stores the +* parameters @dst and @dst_pitch refer to arrays. Each array must have at +* least as many entries as there are planes in the pixmap's format. Each entry stores the * value for the format's respective color plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the
@@ -725,15 +723,12 @@ static void drm_fb_xrgb8888_to_rgb888_line(void *dbuf, const void *sbuf, unsigne* support XRGB8888. */ void drm_fb_xrgb8888_to_rgb888 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state) +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {3 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_rgb888_line);
@@ -1093,7 +1088,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_xrgb8888_to_rgba5551 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_RGB888 ) { -drm_fb_xrgb8888_to_rgb888 (dst, dst_pitch, src, fb, clip, state); +drm_fb_xrgb8888_to_rgb888 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_ARGB8888 ) {drm_fb_xrgb8888_to_argb8888 (dst, dst_pitch, src, fb, clip, state);
drivers/gpu/drm/gud/gud_pipe.c +1 -1
@@ -195,7 +195,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb,drm_fb_xrgb8888_to_rgb565 (&dst,NULL , &src_pix, fmtcnv_state,gud_is_big_endian ()); }else if (format->format ==DRM_FORMAT_RGB888 ) { -drm_fb_xrgb8888_to_rgb888 (&dst,NULL , src, fb, rect, fmtcnv_state); +drm_fb_xrgb8888_to_rgb888 (&dst,NULL , &src_pix, fmtcnv_state); }else { len =gud_xrgb8888_to_color (buf, format, vaddr, fb, rect); }
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -886,6 +886,7 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)u8 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -911,7 +912,9 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_rgb888 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_xrgb8888_to_rgb888 (&dst, dst_pitch, &src_pix, &fmtcnv_state);KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); buf = dst.vaddr;/* restore original value of buf */
include/drm/drm_format_helper.h +2 -2
@@ -118,8 +118,8 @@ void drm_fb_xrgb8888_to_rgba5551(struct iosys_map *dst, const unsigned int *dst_const struct drm_pixmap *src_pix, struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_rgb888 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state); +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_argb8888 (struct iosys_map *dst,const unsigned int *dst_pitch,const struct iosys_map *src,const struct drm_framebuffer *fb,const struct drm_rect *clip,struct drm_format_conv_state *state);
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 12/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_argb8888()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_argb8888() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_argb8888() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 19 +++++++------------ .../gpu/drm/tests/drm_format_helper_test.c | 5 ++++- include/drm/drm_format_helper.h | 4 ++-- 3 files changed, 13 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_format_helper.c +7 -12
@@ -754,16 +754,14 @@ static void drm_fb_xrgb8888_to_argb8888_line(void *dbuf, const void *sbuf, unsig* @dst: Array of ARGB8888 destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffer -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and converts the -* color format during the process. The parameters @dst, @dst_pitch and @src refer +* color format during the process. The parameters @dst and @dst_pitch refer * to arrays. Each array must have at least as many entries as there are planes in -* @fb's format. Each entry stores the value for the format's respective color plane -* at the same index. +* the pixmap's format. Each entry stores the value for the format's respective color +* plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the * top-left corner).
@@ -772,15 +770,12 @@ static void drm_fb_xrgb8888_to_argb8888_line(void *dbuf, const void *sbuf, unsig* natively. It sets an opaque alpha channel as part of the conversion. */ void drm_fb_xrgb8888_to_argb8888 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state) +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {4 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_argb8888_line);
@@ -1091,7 +1086,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_xrgb8888_to_rgb888 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_ARGB8888 ) { -drm_fb_xrgb8888_to_argb8888 (dst, dst_pitch, src, fb, clip, state); +drm_fb_xrgb8888_to_argb8888 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_XBGR8888 ) {drm_fb_xrgb8888_to_xbgr8888 (dst, dst_pitch, src, fb, clip, state);
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -937,6 +937,7 @@ static void drm_test_fb_xrgb8888_to_argb8888(struct kunit *test)u32 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -958,7 +959,9 @@ static void drm_test_fb_xrgb8888_to_argb8888(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_argb8888 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_xrgb8888_to_argb8888 (&dst, dst_pitch, &src_pix, &fmtcnv_state); buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size);
include/drm/drm_format_helper.h +2 -2
@@ -121,8 +121,8 @@ void drm_fb_xrgb8888_to_rgb888(struct iosys_map *dst, const unsigned int *dst_piconst struct drm_pixmap *src_pix, struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_argb8888 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state); +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state); void drm_fb_xrgb8888_to_xrgb2101010(struct iosys_map *dst, const unsigned int *dst_pitch, const struct iosys_map *src, const struct drm_framebuffer *fb, const struct drm_rect *clip,
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 13/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_abgr8888()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_abgr8888() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_abgr8888() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_format_helper.c +2 -7
@@ -800,17 +800,12 @@ static void drm_fb_xrgb8888_to_abgr8888_line(void *dbuf, const void *sbuf, unsig }static void drm_fb_xrgb8888_to_abgr8888 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src, -const struct drm_framebuffer *fb, -const struct drm_rect *clip, +const struct drm_pixmap *src_pix,struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {4 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_abgr8888_line);
@@ -1092,7 +1087,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_xrgb8888_to_xbgr8888 (dst, dst_pitch, src, fb, clip, state);return 0 ; }else if (dst_format ==DRM_FORMAT_ABGR8888 ) { -drm_fb_xrgb8888_to_abgr8888 (dst, dst_pitch, src, fb, clip, state); +drm_fb_xrgb8888_to_abgr8888 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_XRGB2101010 ) {drm_fb_xrgb8888_to_xrgb2101010 (dst, dst_pitch, src, fb, clip, state);
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 14/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_xbgr8888()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_xbgr8888() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_xbgr8888() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_format_helper.c +2 -7
@@ -829,17 +829,12 @@ static void drm_fb_xrgb8888_to_xbgr8888_line(void *dbuf, const void *sbuf, unsig }static void drm_fb_xrgb8888_to_xbgr8888 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src, -const struct drm_framebuffer *fb, -const struct drm_rect *clip, +const struct drm_pixmap *src_pix,struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {4 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_xbgr8888_line);
@@ -1084,7 +1079,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_xrgb8888_to_argb8888 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_XBGR8888 ) { -drm_fb_xrgb8888_to_xbgr8888 (dst, dst_pitch, src, fb, clip, state); +drm_fb_xrgb8888_to_xbgr8888 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_ABGR8888 ) {drm_fb_xrgb8888_to_abgr8888 (dst, dst_pitch, src_pix, state);
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 15/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_xrgb2101010()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_xrgb2101010() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_xrgb2101010() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 16 +++++----------- drivers/gpu/drm/tests/drm_format_helper_test.c | 5 ++++- include/drm/drm_format_helper.h | 3 +-- 3 files changed, 10 insertions(+), 14 deletions(-)
drivers/gpu/drm/drm_format_helper.c +5 -11
@@ -863,15 +863,13 @@ static void drm_fb_xrgb8888_to_xrgb2101010_line(void *dbuf, const void *sbuf, un* @dst: Array of XRGB2101010 destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffers -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and converts the * color format during the process. Destination and framebuffer formats must match. The -* parameters @dst, @dst_pitch and @src refer to arrays. Each array must have at -* least as many entries as there are planes in @fb's format. Each entry stores the +* parameters @dst and @dst_pitch refer to arrays. Each array must have at +* least as many entries as there are planes in the pixmap's format. Each entry stores the * value for the format's respective color plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the
@@ -881,16 +879,12 @@ static void drm_fb_xrgb8888_to_xrgb2101010_line(void *dbuf, const void *sbuf, un* natively. */ void drm_fb_xrgb8888_to_xrgb2101010 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip, +const struct drm_pixmap *src_pix,struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {4 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_xrgb2101010_line);
@@ -1085,7 +1079,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_xrgb8888_to_abgr8888 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_XRGB2101010 ) { -drm_fb_xrgb8888_to_xrgb2101010 (dst, dst_pitch, src, fb, clip, state); +drm_fb_xrgb8888_to_xrgb2101010 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_ARGB2101010 ) {drm_fb_xrgb8888_to_argb2101010 (dst, dst_pitch, src, fb, clip, state);
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -987,6 +987,7 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)u32 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -1008,7 +1009,9 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_xrgb8888_to_xrgb2101010 (&dst, dst_pitch, &src_pix, &fmtcnv_state); buf =le32buf_to_cpu (test, buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size);
include/drm/drm_format_helper.h +1 -2
@@ -124,8 +124,7 @@ void drm_fb_xrgb8888_to_argb8888(struct iosys_map *dst, const unsigned int *dst_const struct drm_pixmap *src_pix, struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_xrgb2101010 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip, +const struct drm_pixmap *src_pix,struct drm_format_conv_state *state); void drm_fb_xrgb8888_to_argb2101010(struct iosys_map *dst, const unsigned int *dst_pitch, const struct iosys_map *src, const struct drm_framebuffer *fb,
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 16/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_argb2101010()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_argb2101010() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_argb2101010() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 18 ++++++------------ drivers/gpu/drm/tests/drm_format_helper_test.c | 5 ++++- include/drm/drm_format_helper.h | 3 +-- 3 files changed, 11 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_format_helper.c +6 -12
@@ -915,15 +915,13 @@ static void drm_fb_xrgb8888_to_argb2101010_line(void *dbuf, const void *sbuf, un* @dst: Array of ARGB2101010 destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffers -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and converts -* the color format during the process. The parameters @dst, @dst_pitch and -* @src refer to arrays. Each array must have at least as many entries as -* there are planes in @fb's format. Each entry stores the value for the +* the color format during the process. The parameters @dst and @dst_pitch +* refer to arrays. Each array must have at least as many entries as +* there are planes in the pixmap's format. Each entry stores the value for the * format's respective color plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the
@@ -933,16 +931,12 @@ static void drm_fb_xrgb8888_to_argb2101010_line(void *dbuf, const void *sbuf, un* natively. */ void drm_fb_xrgb8888_to_argb2101010 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip, +const struct drm_pixmap *src_pix,struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {4 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_argb2101010_line);
@@ -1082,7 +1076,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t ddrm_fb_xrgb8888_to_xrgb2101010 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_ARGB2101010 ) { -drm_fb_xrgb8888_to_argb2101010 (dst, dst_pitch, src, fb, clip, state); +drm_fb_xrgb8888_to_argb2101010 (dst, dst_pitch, src_pix, state);return 0 ; }else if (dst_format ==DRM_FORMAT_BGRX8888 ) {drm_fb_swab (dev, dst, dst_pitch, src_pix, false, state);
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -1035,6 +1035,7 @@ static void drm_test_fb_xrgb8888_to_argb2101010(struct kunit *test)u32 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -1056,7 +1057,9 @@ static void drm_test_fb_xrgb8888_to_argb2101010(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_argb2101010 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_xrgb8888_to_argb2101010 (&dst, dst_pitch, &src_pix, &fmtcnv_state); buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size);
include/drm/drm_format_helper.h +1 -2
@@ -127,8 +127,7 @@ void drm_fb_xrgb8888_to_xrgb2101010(struct iosys_map *dst, const unsigned int *dconst struct drm_pixmap *src_pix, struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_argb2101010 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip, +const struct drm_pixmap *src_pix,struct drm_format_conv_state *state); void drm_fb_xrgb8888_to_gray8(struct iosys_map *dst, const unsigned int *dst_pitch, const struct iosys_map *src, const struct drm_framebuffer *fb,
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 17/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_gray8()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_gray8() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_gray8() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 15 +++++---------- drivers/gpu/drm/gud/gud_pipe.c | 6 ++++-- drivers/gpu/drm/solomon/ssd130x.c | 4 +++- drivers/gpu/drm/tests/drm_format_helper_test.c | 5 ++++- drivers/gpu/drm/tiny/st7586.c | 4 +++- include/drm/drm_format_helper.h | 4 ++-- 6 files changed, 21 insertions(+), 17 deletions(-)
drivers/gpu/drm/drm_format_helper.c +5 -10
@@ -965,15 +965,13 @@ static void drm_fb_xrgb8888_to_gray8_line(void *dbuf, const void *sbuf, unsigned* @dst: Array of 8-bit grayscale destination buffers * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffers -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and converts the * color format during the process. Destination and framebuffer formats must match. The -* parameters @dst, @dst_pitch and @src refer to arrays. Each array must have at -* least as many entries as there are planes in @fb's format. Each entry stores the +* parameters @dst and @dst_pitch refer to arrays. Each array must have at +* least as many entries as there are planes in the pixmap's format. Each entry stores the * value for the format's respective color plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the
@@ -987,15 +985,12 @@ static void drm_fb_xrgb8888_to_gray8_line(void *dbuf, const void *sbuf, unsigned* ITU BT.601 is being used for the RGB -> luma (brightness) conversion. */ void drm_fb_xrgb8888_to_gray8 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state) +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state) {static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = {1 , }; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip);drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, drm_fb_xrgb8888_to_gray8_line);
drivers/gpu/drm/gud/gud_pipe.c +4 -2
@@ -59,6 +59,7 @@ static size_t gud_xrgb8888_to_r124(u8 *dst, const struct drm_format_info *formatunsigned int x, y, width, height;u8 pix, *pix8, *block = dst;/* Assign to silence compiler warning */ struct iosys_map dst_map, vmap; +struct drm_pixmap src_pix;size_t len;void *buf;
@@ -76,7 +77,8 @@ static size_t gud_xrgb8888_to_r124(u8 *dst, const struct drm_format_info *formatiosys_map_set_vaddr (&dst_map, buf);iosys_map_set_vaddr (&vmap, src); -drm_fb_xrgb8888_to_gray8 (&dst_map,NULL , &vmap, fb, rect, fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, fb, &vmap, rect); +drm_fb_xrgb8888_to_gray8 (&dst_map,NULL , &src_pix, fmtcnv_state); pix8 = buf;for (y =0 ; y < height; y++) {
@@ -188,7 +190,7 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb,if (!len)return -ENOMEM ; }else if (format->format ==DRM_FORMAT_R8 ) { -drm_fb_xrgb8888_to_gray8 (&dst,NULL , src, fb, rect, fmtcnv_state); +drm_fb_xrgb8888_to_gray8 (&dst,NULL , &src_pix, fmtcnv_state); }else if (format->format ==DRM_FORMAT_RGB332 ) {drm_fb_xrgb8888_to_rgb332 (&dst,NULL , &src_pix, fmtcnv_state); }else if (format->format ==DRM_FORMAT_RGB565 ) {
drivers/gpu/drm/solomon/ssd130x.c +3 -1
@@ -1039,6 +1039,7 @@ static int ssd132x_fb_blit_rect(struct drm_framebuffer *fb,struct ssd130x_device *ssd130x =drm_to_ssd130x (fb->dev);unsigned int dst_pitch =drm_rect_width (rect);struct iosys_map dst; +struct drm_pixmap src_pix;int ret =0 ;/* Align x to display segment boundaries */
@@ -1051,7 +1052,8 @@ static int ssd132x_fb_blit_rect(struct drm_framebuffer *fb,return ret;iosys_map_set_vaddr (&dst, buf); -drm_fb_xrgb8888_to_gray8 (&dst, &dst_pitch, vmap, fb, rect, fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, fb, vmap, rect); +drm_fb_xrgb8888_to_gray8 (&dst, &dst_pitch, &src_pix, fmtcnv_state);drm_gem_fb_end_cpu_access (fb,DMA_FROM_DEVICE );
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -613,6 +613,7 @@ static void drm_test_fb_xrgb8888_to_gray8(struct kunit *test)u8 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -634,7 +635,9 @@ static void drm_test_fb_xrgb8888_to_gray8(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_gray8 (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_xrgb8888_to_gray8 (&dst, dst_pitch, &src_pix, &fmtcnv_state);KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); }
drivers/gpu/drm/tiny/st7586.c +3 -1
@@ -71,6 +71,7 @@ static void st7586_xrgb8888_to_gray332(u8 *dst, void *vaddr,unsigned int x, y;u8 *src, *buf, val;struct iosys_map dst_map, vmap; +struct drm_pixmap src_pix; buf =kmalloc (len,GFP_KERNEL );if (!buf)
@@ -78,7 +79,8 @@ static void st7586_xrgb8888_to_gray332(u8 *dst, void *vaddr,iosys_map_set_vaddr (&dst_map, buf);iosys_map_set_vaddr (&vmap, vaddr); -drm_fb_xrgb8888_to_gray8 (&dst_map,NULL , &vmap, fb, clip, fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, fb, &vmap, clip); +drm_fb_xrgb8888_to_gray8 (&dst_map,NULL , &src_pix, fmtcnv_state); src = buf;for (y = clip->y1; y < clip->y2; y++) {
include/drm/drm_format_helper.h +2 -2
@@ -130,8 +130,8 @@ void drm_fb_xrgb8888_to_argb2101010(struct iosys_map *dst, const unsigned int *dconst struct drm_pixmap *src_pix, struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_gray8 (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state); +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state); int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t dst_format, const struct iosys_map *src, const struct drm_framebuffer *fb,
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 18/23 drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_mono()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_xrgb8888_to_mono() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_xrgb8888_to_mono() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 28 +++++++++---------- drivers/gpu/drm/solomon/ssd130x.c | 4 ++- .../gpu/drm/tests/drm_format_helper_test.c | 5 +++- drivers/gpu/drm/tiny/repaper.c | 4 ++- include/drm/drm_format_helper.h | 7 +++-- 5 files changed, 28 insertions(+), 20 deletions(-)
drivers/gpu/drm/drm_format_helper.c +14 -14
@@ -1105,18 +1105,17 @@ static void drm_fb_gray8_to_mono_line(void *dbuf, const void *sbuf, unsigned int/** * drm_fb_xrgb8888_to_mono - Convert XRGB8888 to monochrome +* @dev: DRM device * @dst: Array of monochrome destination buffers (0=black, 1=white) * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. -* @src: Array of XRGB8888 source buffers -* @fb: DRM framebuffer -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory and converts the * color format during the process. Destination and framebuffer formats must match. The -* parameters @dst, @dst_pitch and @src refer to arrays. Each array must have at -* least as many entries as there are planes in @fb's format. Each entry stores the +* parameters @dst and @dst_pitch refer to arrays. Each array must have at +* least as many entries as there are planes in the pixmap's format. Each entry stores the * value for the format's respective color plane at the same index. * * This function does not apply clipping on @dst (i.e. the destination is at the
@@ -1134,25 +1133,26 @@ static void drm_fb_gray8_to_mono_line(void *dbuf, const void *sbuf, unsigned int* This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale and * then the result is converted from grayscale to monochrome. */ -void drm_fb_xrgb8888_to_mono (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state) +void drm_fb_xrgb8888_to_mono (struct drm_device *dev, +struct iosys_map *dst,const unsigned int *dst_pitch, +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state) {static const unsigned int default_dst_pitch[DRM_FORMAT_MAX_PLANES ] = {0 ,0 ,0 ,0 }; +const struct drm_rect *clip = &src_pix->clip;unsigned int linepixels =drm_rect_width (clip);unsigned int lines =drm_rect_height (clip); -unsigned int cpp = fb->format->cpp[0 ]; +unsigned int cpp = src_pix->format->cpp[0 ];unsigned int len_src32 = linepixels * cpp; -struct drm_device *dev = fb->dev; -void *vaddr = src[0 ].vaddr; +void *vaddr = src_pix->data[0 ].vaddr;unsigned int dst_pitch_0;unsigned int y;u8 *mono = dst[0 ].vaddr, *gray8;u32 *src32; -if (drm_WARN_ON (dev, fb->format->format !=DRM_FORMAT_XRGB8888 )) +if (drm_WARN_ON (dev, src_pix->format->format !=DRM_FORMAT_XRGB8888 ))return ;if (!dst_pitch)
@@ -1182,12 +1182,12 @@ void drm_fb_xrgb8888_to_mono(struct iosys_map *dst, const unsigned int *dst_pitc gray8 = (u8 *)src32 + len_src32; - vaddr +=clip_offset (clip, fb->pitches[0 ], cpp); + vaddr +=clip_offset (clip, src_pix->pitches[0 ], cpp);for (y =0 ; y < lines; y++) { src32 =memcpy (src32, vaddr, len_src32);drm_fb_xrgb8888_to_gray8_line (gray8, src32, linepixels);drm_fb_gray8_to_mono_line (mono, gray8, linepixels); - vaddr += fb->pitches[0 ]; + vaddr += src_pix->pitches[0 ]; mono += dst_pitch_0; } }
drivers/gpu/drm/solomon/ssd130x.c +3 -1
@@ -1008,6 +1008,7 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb,struct ssd130x_device *ssd130x =drm_to_ssd130x (fb->dev);struct iosys_map dst;unsigned int dst_pitch; +struct drm_pixmap src_pix;int ret =0 ;/* Align y to display page boundaries */
@@ -1021,7 +1022,8 @@ static int ssd130x_fb_blit_rect(struct drm_framebuffer *fb,return ret;iosys_map_set_vaddr (&dst, buf); -drm_fb_xrgb8888_to_mono (&dst, &dst_pitch, vmap, fb, rect, fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, fb, vmap, rect); +drm_fb_xrgb8888_to_mono (fb->dev, &dst, &dst_pitch, &src_pix, fmtcnv_state);drm_gem_fb_end_cpu_access (fb,DMA_FROM_DEVICE );
drivers/gpu/drm/tests/drm_format_helper_test.c +4 -1
@@ -1088,6 +1088,7 @@ static void drm_test_fb_xrgb8888_to_mono(struct kunit *test)u8 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -1109,7 +1110,9 @@ static void drm_test_fb_xrgb8888_to_mono(struct kunit *test)const unsigned int *dst_pitch = (result->dst_pitch ==TEST_USE_DEFAULT_PITCH ) ?NULL : &result->dst_pitch; -drm_fb_xrgb8888_to_mono (&dst, dst_pitch, &src, &fb, ¶ms->clip, &fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + +drm_fb_xrgb8888_to_mono (NULL , &dst, dst_pitch, &src_pix, &fmtcnv_state);KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size); }
drivers/gpu/drm/tiny/repaper.c +3 -1
@@ -517,6 +517,7 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb,unsigned int dst_pitch =0 ;struct iosys_map dst, vmap;struct drm_rect clip; +struct drm_pixmap src_pix;int idx, ret =0 ;u8 *buf =NULL ;
@@ -546,7 +547,8 @@ static int repaper_fb_dirty(struct drm_framebuffer *fb,iosys_map_set_vaddr (&dst, buf);iosys_map_set_vaddr (&vmap, dma_obj->vaddr); -drm_fb_xrgb8888_to_mono (&dst, &dst_pitch, &vmap, fb, &clip, fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, fb, &vmap, &clip); +drm_fb_xrgb8888_to_mono (fb->dev, &dst, &dst_pitch, &src_pix, fmtcnv_state);drm_gem_fb_end_cpu_access (fb,DMA_FROM_DEVICE );
include/drm/drm_format_helper.h +4 -3
@@ -137,9 +137,10 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d const struct iosys_map *src, const struct drm_framebuffer *fb, const struct drm_rect *clip, struct drm_format_conv_state *state); -void drm_fb_xrgb8888_to_mono (struct iosys_map *dst,const unsigned int *dst_pitch, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state); +void drm_fb_xrgb8888_to_mono (struct drm_device *dev, +struct iosys_map *dst,const unsigned int *dst_pitch, +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state); size_t drm_fb_build_fourcc_list(struct drm_device *dev, const u32 *native_fourccs, size_t native_nfourccs,
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 19/23 drm/format-helper: Use struct drm_pixmap for drm_fb_blit()
In reply to Thomas ZimmermannStore the source-buffer parameters of drm_fb_blit() in struct drm_pixmap. Update the function's interface and all of its callers.
Callers of drm_fb_blit() initialize the pixmap's instance from a pre-existing instance of struct drm_framebuffer. There's potential to simplify some of that code in a later patch.
--- drivers/gpu/drm/drm_format_helper.c | 24 +++++------- .../gpu/drm/tests/drm_format_helper_test.c | 38 ++++++++++--------- drivers/gpu/drm/tiny/cirrus.c | 6 ++- drivers/gpu/drm/tiny/ofdrm.c | 6 ++- drivers/gpu/drm/tiny/simpledrm.c | 6 ++- include/drm/drm_format_helper.h | 7 ++-- 6 files changed, 47 insertions(+), 40 deletions(-)
drivers/gpu/drm/drm_format_helper.c +10 -14
@@ -999,19 +999,18 @@ EXPORT_SYMBOL(drm_fb_xrgb8888_to_gray8);/** * drm_fb_blit - Copy parts of a framebuffer to display memory +* @dev: DRM device * @dst: Array of display-memory addresses to copy to * @dst_pitch: Array of numbers of bytes between the start of two consecutive scanlines * within @dst; can be NULL if scanlines are stored next to each other. * @dst_format: FOURCC code of the display's color format -* @src: The framebuffer memory to copy from -* @fb: The framebuffer to copy from -* @clip: Clip rectangle area to copy +* @src_pix: Source pixmap to copy from * @state: Transform and conversion state * * This function copies parts of a framebuffer to display memory. If the * formats of the display and the framebuffer mismatch, the blit function -* will attempt to convert between them during the process. The parameters @dst, -* @dst_pitch and @src refer to arrays. Each array must have at least as many +* will attempt to convert between them during the process. The parameters @dst +* and @dst_pitch refer to arrays. Each array must have at least as many * entries as there are planes in @dst_format's format. Each entry stores the * value for the format's respective color plane at the same index. *
@@ -1023,15 +1022,12 @@ EXPORT_SYMBOL(drm_fb_xrgb8888_to_gray8);* -EINVAL if the color-format conversion failed, or * a negative error code otherwise. */ -int drm_fb_blit (struct iosys_map *dst,const unsigned int *dst_pitch,uint32_t dst_format, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state) +int drm_fb_blit (struct drm_device *dev, +struct iosys_map *dst,const unsigned int *dst_pitch,uint32_t dst_format, +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state) { -struct drm_device *dev = fb->dev; -uint32_t fb_format = fb->format->format; -struct drm_pixmap pixmap; -struct drm_pixmap *src_pix = &pixmap; -drm_pixmap_init_from_framebuffer (src_pix, fb, src, clip); +uint32_t fb_format = src_pix->format->format;if (fb_format == dst_format) {drm_fb_memcpy (dst, dst_pitch, src_pix);
@@ -1079,7 +1075,7 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d } } -drm_warn_once (fb->dev,"No conversion helper from %p4cc to %p4cc found.\n" , +drm_warn_once (dev,"No conversion helper from %p4cc to %p4cc found.\n" , &fb_format, &dst_format);return -EINVAL ;
drivers/gpu/drm/tests/drm_format_helper_test.c +21 -17
@@ -723,7 +723,7 @@ static void drm_test_fb_xrgb8888_to_rgb565(struct kunit *test)int blit_result =0 ; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_RGB565 , &src, &fb, ¶ms->clip, + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_RGB565 , &src_pix, &fmtcnv_state); buf =le16buf_to_cpu (test, (__force const __le16 *)buf, dst_size /sizeof (__le16));
@@ -772,7 +772,7 @@ static void drm_test_fb_xrgb8888_to_xrgb1555(struct kunit *test)int blit_result =0 ; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_XRGB1555 , &src, &fb, ¶ms->clip, + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_XRGB1555 , &src_pix, &fmtcnv_state); buf =le16buf_to_cpu (test, (__force const __le16 *)buf, dst_size /sizeof (__le16));
@@ -822,7 +822,7 @@ static void drm_test_fb_xrgb8888_to_argb1555(struct kunit *test)int blit_result =0 ; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_ARGB1555 , &src, &fb, ¶ms->clip, + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_ARGB1555 , &src_pix, &fmtcnv_state); buf =le16buf_to_cpu (test, (__force const __le16 *)buf, dst_size /sizeof (__le16));
@@ -872,7 +872,7 @@ static void drm_test_fb_xrgb8888_to_rgba5551(struct kunit *test)int blit_result =0 ; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_RGBA5551 , &src, &fb, ¶ms->clip, + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_RGBA5551 , &src_pix, &fmtcnv_state); buf =le16buf_to_cpu (test, (__force const __le16 *)buf, dst_size /sizeof (__le16));
@@ -925,7 +925,7 @@ static void drm_test_fb_xrgb8888_to_rgb888(struct kunit *test)int blit_result =0 ; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_RGB888 , &src, &fb, ¶ms->clip, + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_RGB888 , &src_pix, &fmtcnv_state);KUNIT_EXPECT_FALSE (test, blit_result);
@@ -973,7 +973,7 @@ static void drm_test_fb_xrgb8888_to_argb8888(struct kunit *test)int blit_result =0 ; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_ARGB8888 , &src, &fb, ¶ms->clip, + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_ARGB8888 , &src_pix, &fmtcnv_state); buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));
@@ -1023,8 +1023,8 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test)int blit_result =0 ; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_XRGB2101010 , &src, &fb, - ¶ms->clip, &fmtcnv_state); + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_XRGB2101010 , &src_pix, + &fmtcnv_state);KUNIT_EXPECT_FALSE (test, blit_result);KUNIT_EXPECT_MEMEQ (test, buf, result->expected, dst_size);
@@ -1071,8 +1071,8 @@ static void drm_test_fb_xrgb8888_to_argb2101010(struct kunit *test)int blit_result =0 ; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_ARGB2101010 , &src, &fb, - ¶ms->clip, &fmtcnv_state); + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_ARGB2101010 , &src_pix, + &fmtcnv_state); buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));
@@ -1157,8 +1157,8 @@ static void drm_test_fb_swab(struct kunit *test)int blit_result; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_XRGB8888 |DRM_FORMAT_BIG_ENDIAN , - &src, &fb, ¶ms->clip, &fmtcnv_state); + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_XRGB8888 |DRM_FORMAT_BIG_ENDIAN , + &src_pix, &fmtcnv_state); buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));KUNIT_EXPECT_FALSE (test, blit_result);
@@ -1167,7 +1167,7 @@ static void drm_test_fb_swab(struct kunit *test) buf = dst.vaddr;memset (buf,0 , dst_size); - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_BGRX8888 , &src, &fb, ¶ms->clip, + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_BGRX8888 , &src_pix, &fmtcnv_state); buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));
@@ -1182,7 +1182,7 @@ static void drm_test_fb_swab(struct kunit *test) mock_format.format |=DRM_FORMAT_BIG_ENDIAN ; fb.format = &mock_format; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_XRGB8888 , &src, &fb, ¶ms->clip, + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_XRGB8888 , &src_pix, &fmtcnv_state); buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));
@@ -1198,6 +1198,7 @@ static void drm_test_fb_xrgb8888_to_abgr8888(struct kunit *test)u32 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -1221,7 +1222,8 @@ static void drm_test_fb_xrgb8888_to_abgr8888(struct kunit *test)int blit_result =0 ; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_ABGR8888 , &src, &fb, ¶ms->clip, +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_ABGR8888 , &src_pix, &fmtcnv_state); buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));
@@ -1238,6 +1240,7 @@ static void drm_test_fb_xrgb8888_to_xbgr8888(struct kunit *test)u32 *buf =NULL ;__le32 *xrgb8888 =NULL ;struct iosys_map dst, src; +struct drm_pixmap src_pix;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -1261,7 +1264,8 @@ static void drm_test_fb_xrgb8888_to_xbgr8888(struct kunit *test)int blit_result =0 ; - blit_result =drm_fb_blit (&dst, dst_pitch,DRM_FORMAT_XBGR8888 , &src, &fb, ¶ms->clip, +drm_pixmap_init_from_framebuffer (&src_pix, &fb, &src, ¶ms->clip); + blit_result =drm_fb_blit (NULL , &dst, dst_pitch,DRM_FORMAT_XBGR8888 , &src_pix, &fmtcnv_state); buf =le32buf_to_cpu (test, (__force const __le32 *)buf, dst_size /sizeof (u32));
@@ -1868,7 +1872,7 @@ static void drm_test_fb_memcpy(struct kunit *test)int blit_result; - blit_result =drm_fb_blit (dst, dst_pitches, params->format, src, &fb, ¶ms->clip, + blit_result =drm_fb_blit (NULL , dst, dst_pitches, params->format, &src_pix, &fmtcnv_state);KUNIT_EXPECT_FALSE (test, blit_result);
drivers/gpu/drm/tiny/cirrus.c +4 -2
@@ -410,9 +410,11 @@ static void cirrus_primary_plane_helper_atomic_update(struct drm_plane *plane,drm_atomic_for_each_plane_damage (&iter, &damage) {unsigned int offset =drm_fb_clip_offset (pitch, format, &damage);struct iosys_map dst =IOSYS_MAP_INIT_OFFSET (&vaddr, offset); +struct drm_pixmap src_pix; -drm_fb_blit (&dst, &pitch, format->format, shadow_plane_state->data, fb, - &damage, &shadow_plane_state->fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, fb, shadow_plane_state->data, &damage); +drm_fb_blit (plane->dev, &dst, &pitch, format->format, &src_pix, + &shadow_plane_state->fmtcnv_state); }drm_dev_exit (idx);
drivers/gpu/drm/tiny/ofdrm.c +4 -2
@@ -824,13 +824,15 @@ static void ofdrm_primary_plane_helper_atomic_update(struct drm_plane *plane,drm_atomic_for_each_plane_damage (&iter, &damage) {struct iosys_map dst = odev->screen_base;struct drm_rect dst_clip = plane_state->dst; +struct drm_pixmap src_pix;if (!drm_rect_intersect (&dst_clip, &damage))continue ;iosys_map_incr (&dst,drm_fb_clip_offset (dst_pitch, dst_format, &dst_clip)); -drm_fb_blit (&dst, &dst_pitch, dst_format->format, shadow_plane_state->data, fb, - &damage, &shadow_plane_state->fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, fb, shadow_plane_state->data, &damage); +drm_fb_blit (dev, &dst, &dst_pitch, dst_format->format, &src_pix, + &shadow_plane_state->fmtcnv_state); }drm_dev_exit (idx);
drivers/gpu/drm/tiny/simpledrm.c +4 -2
@@ -641,13 +641,15 @@ static void simpledrm_primary_plane_helper_atomic_update(struct drm_plane *planedrm_atomic_for_each_plane_damage (&iter, &damage) {struct drm_rect dst_clip = plane_state->dst;struct iosys_map dst = sdev->screen_base; +struct drm_pixmap src_pix;if (!drm_rect_intersect (&dst_clip, &damage))continue ;iosys_map_incr (&dst,drm_fb_clip_offset (sdev->pitch, sdev->format, &dst_clip)); -drm_fb_blit (&dst, &sdev->pitch, sdev->format->format, shadow_plane_state->data, - fb, &damage, &shadow_plane_state->fmtcnv_state); +drm_pixmap_init_from_framebuffer (&src_pix, fb, shadow_plane_state->data, &damage); +drm_fb_blit (dev, &dst, &sdev->pitch, sdev->format->format, &src_pix, + &shadow_plane_state->fmtcnv_state); }drm_dev_exit (idx);
include/drm/drm_format_helper.h +4 -3
@@ -133,9 +133,10 @@ void drm_fb_xrgb8888_to_gray8(struct iosys_map *dst, const unsigned int *dst_pitconst struct drm_pixmap *src_pix, struct drm_format_conv_state *state); -int drm_fb_blit (struct iosys_map *dst,const unsigned int *dst_pitch,uint32_t dst_format, -const struct iosys_map *src,const struct drm_framebuffer *fb, -const struct drm_rect *clip,struct drm_format_conv_state *state); +int drm_fb_blit (struct drm_device *dev, +struct iosys_map *dst,const unsigned int *dst_pitch,uint32_t dst_format, +const struct drm_pixmap *src_pix, +struct drm_format_conv_state *state); void drm_fb_xrgb8888_to_mono(struct drm_device *dev, struct iosys_map *dst, const unsigned int *dst_pitch,
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 20/23 drm/format-helper: Add font-support for DRM pixmap
In reply to Thomas ZimmermannAdd support for blitting characters. An instance of struct font_desc stores the the character shapes. The blitting source pixmap contains a reference to a character's glyph, which can then be blitted to the destination. drm_pixmap_init_from_font_desc() sets up the pixmap.
struct drm_pixmap;
drm_pixmap_init_from_font_desc(&drm_pixmap, font_desc, font_data, 'c'); drm_fb_blit(..., &pixmap, ...); // blits the character 'c'
To blit a string of characters, drm_pixmap_set_font_char() updates the character's value.
struct drm_pixmap;
const char *str = "Hello world!"
drm_pixmap_init_from_font_desc(&drm_pixmap, font_desc, font_data, '\0');
while (*str) {
drm_pixmap_set_font_char(&pixmap, font_data, *str);
drm_fb_blit(..., &pixmap, ...); // blits *str
++str;
}Further helpers can be build from these primitives.
--- drivers/gpu/drm/drm_format_helper.c | 27 +++++++++++++++++++++++++++ include/drm/drm_format_helper.h | 4 ++++ 2 files changed, 31 insertions(+)
drivers/gpu/drm/drm_format_helper.c +27 -0
@@ -8,6 +8,7 @@* (at your option) any later version. */ +#include <linux/font.h> #include <linux/io.h> #include <linux/iosys-map.h> #include <linux/module.h>
@@ -181,6 +182,32 @@ void drm_pixmap_init_from_framebuffer(struct drm_pixmap *pix, const struct drm_f }EXPORT_SYMBOL (drm_pixmap_init_from_framebuffer); +void drm_pixmap_init_from_font_desc (struct drm_pixmap *pix,const struct font_desc *font, +const struct iosys_map *data,int c) +{ +const struct drm_rect clip =DRM_RECT_INIT (0 ,0 , font->width, font->height); +const struct drm_format_info *format =drm_format_info (DRM_FORMAT_C1 ); +const unsigned int pitches[DRM_FORMAT_MAX_PLANES ] = { +drm_format_info_min_pitch (format,0 , font->width), + }; +struct iosys_map cdata[DRM_FORMAT_MAX_PLANES ] = { +IOSYS_MAP_INIT_OFFSET (&data[0 ], c * font->height * pitches[0 ]), + }; + +drm_pixmap_init (pix, format, cdata, pitches, &clip); +} +EXPORT_SYMBOL (drm_pixmap_init_from_font_desc); + +void drm_pixmap_set_font_char (struct drm_pixmap *pix,const struct iosys_map *data,int c) +{ +unsigned int height =drm_rect_height (&pix->clip); +size_t i; + +for (i =0 ; i < pix->format->num_planes; ++i) + pix->data[i] =IOSYS_MAP_INIT_OFFSET (&data[i], c * height * pix->pitches[i]); +} +EXPORT_SYMBOL (drm_pixmap_set_font_char); + static int __drm_fb_xfrm(void *dst, unsigned long dst_pitch, unsigned long dst_pixsize, const void *src, unsigned long src_pitch, unsigned long src_pixsize, const struct drm_rect *src_clip, bool src_cached_hint,
include/drm/drm_format_helper.h +4 -0
@@ -14,6 +14,7 @@struct drm_device ;struct drm_framebuffer ; +struct font_desc ;/** * struct drm_format_conv_state - Stores format-conversion state
@@ -93,6 +94,9 @@ struct drm_pixmap {void drm_pixmap_init_from_framebuffer (struct drm_pixmap *pix,const struct drm_framebuffer *fb,const struct iosys_map *data,const struct drm_rect *clip); +void drm_pixmap_init_from_font_desc (struct drm_pixmap *pix,const struct font_desc *font, +const struct iosys_map *data,int c); +void drm_pixmap_set_font_char (struct drm_pixmap *pix,const struct iosys_map *data,int c);unsigned int drm_fb_clip_offset (unsigned int pitch,const struct drm_format_info *format,const struct drm_rect *clip);
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 21/23 drm/format-helper: Add color palette
In reply to Thomas ZimmermannAdd a color palette to struct drm_format_conv_state. The palette points to an array of struct drm_color_lut. It allows to blit from an index color formats to a component-based destination.
The palette exists independently from the source pixmap and is thus stored struct drm_format_conv_state instead of struct drm_pixmap. As a nice side effect, this also allows for techniques like palette swapping and color cycling.
--- drivers/gpu/drm/drm_format_helper.c | 71 +++++++++++++++++++---------- include/drm/drm_format_helper.h | 2 + 2 files changed, 48 insertions(+), 25 deletions(-)
drivers/gpu/drm/drm_format_helper.c +46 -25
@@ -212,7 +212,8 @@ static int __drm_fb_xfrm(void *dst, unsigned long dst_pitch, unsigned long dst_p const void *src, unsigned long src_pitch, unsigned long src_pixsize, const struct drm_rect *src_clip, bool src_cached_hint, struct drm_format_conv_state *state, - void (*xfrm_line)(void *dbuf, const void *sbuf, unsigned int npixels)) + void (*xfrm_line)(void *dbuf, const void *sbuf, unsigned int npixels, + const struct drm_color_lut *palette)) { unsigned long pixels = drm_rect_width(src_clip);unsigned long lines =drm_rect_height (src_clip);
@@ -241,7 +242,7 @@ static int __drm_fb_xfrm(void *dst, unsigned long dst_pitch, unsigned long dst_p sbuf =memcpy (stmp, src, sbuf_len); else sbuf = src; -xfrm_line (dst, sbuf, pixels); +xfrm_line (dst, sbuf, pixels, state->palette); src += src_pitch; dst += dst_pitch; }
@@ -253,7 +254,8 @@ static int __drm_fb_xfrm_toio(void __iomem *dst, unsigned long dst_pitch, unsign const void *src, unsigned long src_pitch, unsigned long src_pixsize, const struct drm_rect *src_clip, bool src_cached_hint, struct drm_format_conv_state *state, - void (*xfrm_line)(void *dbuf, const void *sbuf, unsigned int npixels)) + void (*xfrm_line)(void *dbuf, const void *sbuf, unsigned int npixels, + const struct drm_color_lut* palette)) { unsigned long npixels = drm_rect_width(src_clip);unsigned long lines =drm_rect_height (src_clip);
@@ -283,7 +285,7 @@ static int __drm_fb_xfrm_toio(void __iomem *dst, unsigned long dst_pitch, unsign sbuf =memcpy (stmp, src, sbuf_len); else sbuf = src; -xfrm_line (dbuf, sbuf, npixels); +xfrm_line (dbuf, sbuf, npixels, state->palette);memcpy_toio (dst, dbuf, dbuf_len); src += src_pitch; dst += dst_pitch;
@@ -297,7 +299,8 @@ static int drm_fb_xfrm(struct iosys_map *dst, const unsigned int *dst_pitch, const u8 *dst_pixsize, const struct drm_pixmap *src_pix, bool vaddr_cached_hint, struct drm_format_conv_state *state, - void (*xfrm_line)(void *dbuf, const void *sbuf, unsigned int npixels)) + void (*xfrm_line)(void *dbuf, const void *sbuf, unsigned int npixels, + const struct drm_color_lut *palette)) { static const unsigned int default_dst_pitch[DRM_FORMAT_MAX_PLANES] = { 0, 0, 0, 0
@@ -373,7 +376,8 @@ void drm_fb_memcpy(struct iosys_map *dst, const unsigned int *dst_pitch, }EXPORT_SYMBOL (drm_fb_memcpy); -static void drm_fb_swab16_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_swab16_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {u16 *dbuf16 = dbuf;const u16 *sbuf16 = sbuf;
@@ -383,7 +387,8 @@ static void drm_fb_swab16_line(void *dbuf, const void *sbuf, unsigned int pixels *dbuf16++ =swab16 (*sbuf16++); } -static void drm_fb_swab32_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_swab32_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {u32 *dbuf32 = dbuf;const u32 *sbuf32 = sbuf;
@@ -421,7 +426,8 @@ void drm_fb_swab(struct drm_device *dev, {const struct drm_format_info *format = src_pix->format;u8 cpp =DIV_ROUND_UP (drm_format_info_bpp (format,0 ),8 ); -void (*swab_line)(void *dbuf,const void *sbuf,unsigned int npixels); +void (*swab_line)(void *dbuf,const void *sbuf,unsigned int npixels, +const struct drm_color_lut *palette);switch (cpp) {case 4 :
@@ -440,7 +446,8 @@ void drm_fb_swab(struct drm_device *dev, }EXPORT_SYMBOL (drm_fb_swab); -static void drm_fb_xrgb8888_to_rgb332_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_rgb332_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {u8 *dbuf8 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -486,7 +493,8 @@ void drm_fb_xrgb8888_to_rgb332(struct iosys_map *dst, const unsigned int *dst_pi }EXPORT_SYMBOL (drm_fb_xrgb8888_to_rgb332); -static void drm_fb_xrgb8888_to_rgb565_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_rgb565_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {__le16 *dbuf16 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -505,7 +513,8 @@ static void drm_fb_xrgb8888_to_rgb565_line(void *dbuf, const void *sbuf, unsigne/* TODO: implement this helper as conversion to RGB565|BIG_ENDIAN */ static void drm_fb_xrgb8888_to_rgb565_swab_line (void *dbuf,const void *sbuf, -unsigned int pixels) +unsigned int pixels, +const struct drm_color_lut *palette) {__le16 *dbuf16 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -550,7 +559,8 @@ void drm_fb_xrgb8888_to_rgb565(struct iosys_map *dst, const unsigned int *dst_pi 2, }; -void (*xfrm_line)(void *dbuf,const void *sbuf,unsigned int npixels); +void (*xfrm_line)(void *dbuf,const void *sbuf,unsigned int npixels, +const struct drm_color_lut *palette);if (swab) xfrm_line = drm_fb_xrgb8888_to_rgb565_swab_line;
@@ -561,7 +571,8 @@ void drm_fb_xrgb8888_to_rgb565(struct iosys_map *dst, const unsigned int *dst_pi }EXPORT_SYMBOL (drm_fb_xrgb8888_to_rgb565); -static void drm_fb_xrgb8888_to_xrgb1555_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_xrgb1555_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {__le16 *dbuf16 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -611,7 +622,8 @@ void drm_fb_xrgb8888_to_xrgb1555(struct iosys_map *dst, const unsigned int *dst_ }EXPORT_SYMBOL (drm_fb_xrgb8888_to_xrgb1555); -static void drm_fb_xrgb8888_to_argb1555_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_argb1555_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {__le16 *dbuf16 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -662,7 +674,8 @@ void drm_fb_xrgb8888_to_argb1555(struct iosys_map *dst, const unsigned int *dst_ }EXPORT_SYMBOL (drm_fb_xrgb8888_to_argb1555); -static void drm_fb_xrgb8888_to_rgba5551_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_rgba5551_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {__le16 *dbuf16 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -713,7 +726,8 @@ void drm_fb_xrgb8888_to_rgba5551(struct iosys_map *dst, const unsigned int *dst_ }EXPORT_SYMBOL (drm_fb_xrgb8888_to_rgba5551); -static void drm_fb_xrgb8888_to_rgb888_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_rgb888_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {u8 *dbuf8 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -762,7 +776,8 @@ void drm_fb_xrgb8888_to_rgb888(struct iosys_map *dst, const unsigned int *dst_pi }EXPORT_SYMBOL (drm_fb_xrgb8888_to_rgb888); -static void drm_fb_xrgb8888_to_argb8888_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_argb8888_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {__le32 *dbuf32 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -809,7 +824,8 @@ void drm_fb_xrgb8888_to_argb8888(struct iosys_map *dst, const unsigned int *dst_ }EXPORT_SYMBOL (drm_fb_xrgb8888_to_argb8888); -static void drm_fb_xrgb8888_to_abgr8888_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_abgr8888_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {__le32 *dbuf32 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -838,7 +854,8 @@ static void drm_fb_xrgb8888_to_abgr8888(struct iosys_map *dst, const unsigned in drm_fb_xrgb8888_to_abgr8888_line); } -static void drm_fb_xrgb8888_to_xbgr8888_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_xbgr8888_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {__le32 *dbuf32 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -867,7 +884,8 @@ static void drm_fb_xrgb8888_to_xbgr8888(struct iosys_map *dst, const unsigned in drm_fb_xrgb8888_to_xbgr8888_line); } -static void drm_fb_xrgb8888_to_xrgb2101010_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_xrgb2101010_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {__le32 *dbuf32 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -918,7 +936,8 @@ void drm_fb_xrgb8888_to_xrgb2101010(struct iosys_map *dst, const unsigned int *d }EXPORT_SYMBOL (drm_fb_xrgb8888_to_xrgb2101010); -static void drm_fb_xrgb8888_to_argb2101010_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_argb2101010_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {__le32 *dbuf32 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -970,7 +989,8 @@ void drm_fb_xrgb8888_to_argb2101010(struct iosys_map *dst, const unsigned int *d }EXPORT_SYMBOL (drm_fb_xrgb8888_to_argb2101010); -static void drm_fb_xrgb8888_to_gray8_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_xrgb8888_to_gray8_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {u8 *dbuf8 = dbuf;const __le32 *sbuf32 = sbuf;
@@ -1109,7 +1129,8 @@ int drm_fb_blit(struct drm_device *dev, }EXPORT_SYMBOL (drm_fb_blit); -static void drm_fb_gray8_to_mono_line (void *dbuf,const void *sbuf,unsigned int pixels) +static void drm_fb_gray8_to_mono_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) {u8 *dbuf8 = dbuf;const u8 *sbuf8 = sbuf;
@@ -1208,8 +1229,8 @@ void drm_fb_xrgb8888_to_mono(struct drm_device *dev, vaddr +=clip_offset (clip, src_pix->pitches[0 ], cpp);for (y =0 ; y < lines; y++) { src32 =memcpy (src32, vaddr, len_src32); -drm_fb_xrgb8888_to_gray8_line (gray8, src32, linepixels); -drm_fb_gray8_to_mono_line (mono, gray8, linepixels); +drm_fb_xrgb8888_to_gray8_line (gray8, src32, linepixels, state->palette); +drm_fb_gray8_to_mono_line (mono, gray8, linepixels, state->palette); vaddr += src_pix->pitches[0 ]; mono += dst_pitch_0; }
include/drm/drm_format_helper.h +2 -0
@@ -31,6 +31,8 @@ struct drm_format_conv_state {size_t size;bool preallocated; } tmp; + +const struct drm_color_lut *palette; };#define __DRM_FORMAT_CONV_STATE_INIT (_mem, _size, _preallocated) { \
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 22/23 drm/format-helper: Support blitting from C1 to XRGB8888
In reply to Thomas ZimmermannImplemented for drawing fonts, the C1-to-XRGB8888 blitting code writes single bits into an XRGB8888-based buffer. The color is read from the given palette.
--- drivers/gpu/drm/drm_format_helper.c | 39 +++++++++++++++++++++++++++++ include/drm/drm_format_helper.h | 2 ++ 2 files changed, 41 insertions(+)
drivers/gpu/drm/drm_format_helper.c +39 -0
@@ -462,6 +462,45 @@ static void drm_fb_xrgb8888_to_rgb332_line(void *dbuf, const void *sbuf, unsigne } } +static void drm_fb_c1_to_xrgb8888_line (void *dbuf,const void *sbuf,unsigned int pixels, +const struct drm_color_lut *palette) +{ +__le32 *dbuf32 = dbuf; +const __le32 *sbuf32 = sbuf; +unsigned int shift =0 ; +unsigned int x; +u32 pix; +u32 bit; +u32 val32; + +for (x =0 ; x < pixels; x++) { +if (!shift) { + pix =le32_to_cpu (sbuf32[x /32 ]); + shift =32 ; + } + --shift; + bit = (pix >> shift) &BIT (0 ); + + val32 =GENMASK (31 ,24 ) | + ((palette[bit].red >>8 ) <<16 ) | + ((palette[bit].green >>8 ) <<8 ) | + ((palette[bit].blue >>8 )); + dbuf32[x] =cpu_to_le32 (val32); + } +} + +void drm_fb_c1_to_xrgb8888 (struct iosys_map *dst,const unsigned int *dst_pitch, +const struct drm_pixmap *src_pix,struct drm_format_conv_state *state) +{ +static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = { +4 , + }; + +drm_fb_xfrm (dst, dst_pitch, dst_pixsize, src_pix, false, state, + drm_fb_c1_to_xrgb8888_line); +} +EXPORT_SYMBOL (drm_fb_c1_to_xrgb8888); +/** * drm_fb_xrgb8888_to_rgb332 - Convert XRGB8888 to RGB332 clip buffer * @dst: Array of RGB332 destination buffers
include/drm/drm_format_helper.h +2 -0
@@ -109,6 +109,8 @@ void drm_fb_swab(struct drm_device *dev, struct iosys_map *dst, const unsigned int *dst_pitch, const struct drm_pixmap *src_pix, bool cached, struct drm_format_conv_state *state); +void drm_fb_c1_to_xrgb8888 (struct iosys_map *dst,const unsigned int *dst_pitch, +const struct drm_pixmap *src_pix,struct drm_format_conv_state *state);void drm_fb_xrgb8888_to_rgb332 (struct iosys_map *dst,const unsigned int *dst_pitch,const struct drm_pixmap *src_pix,struct drm_format_conv_state *state); void drm_fb_xrgb8888_to_rgb565(struct iosys_map *dst, const unsigned int *dst_pitch,
Signature · 1 line
2.43.0
Thomas Zimmermann
maintainerPATCH 23/23 drm/format-helper: Add drm_fb_fill() to fill screen with color
In reply to Thomas ZimmermannAdd drm_fb_fill(), which fills areas with a single static color, and implement support for XRGB888 and RGB565. There's common infrastructure code to move over the destination area and a per-line draw function for each color format.
--- drivers/gpu/drm/drm_format_helper.c | 150 ++++++++++++++++++++++++++++ include/drm/drm_format_helper.h | 11 ++ 2 files changed, 161 insertions(+)
drivers/gpu/drm/drm_format_helper.c +150 -0
@@ -1413,3 +1413,153 @@ size_t drm_fb_build_fourcc_list(struct drm_device *dev,return fourccs - fourccs_out; }EXPORT_SYMBOL (drm_fb_build_fourcc_list); + +/* +* FILL +*/ + +static int __drm_fill (void *dst,unsigned long dst_pitch,unsigned long dst_pixsize, +unsigned int src_color,unsigned long npixels,unsigned long lines, +struct drm_format_conv_state *state, +void (*fill_line)(void *dbuf,unsigned int npixels, +const struct drm_color_lut *color)) +{ +const struct drm_color_lut *color = &state->palette[src_color]; +unsigned long i; + +if (!dst_pitch) + dst_pitch = npixels * dst_pixsize; + +for (i =0 ; i < lines; ++i) { +fill_line (dst, npixels, color); + dst += dst_pitch; + } + +return 0 ; +} + +static int __drm_fill_toio (void __iomem *dst,unsigned long dst_pitch,unsigned long dst_pixsize, +unsigned int src_color,unsigned long npixels,unsigned long lines, +struct drm_format_conv_state *state, +void (*fill_line)(void *dbuf,unsigned int npixels, +const struct drm_color_lut *color)) +{ +const struct drm_color_lut *color = &state->palette[src_color]; +size_t dbuf_len = npixels * dst_pixsize; +unsigned long i; +void *dbuf; + + dbuf =drm_format_conv_state_reserve (state, dbuf_len,GFP_KERNEL ); +if (!dbuf) +return -ENOMEM ; + +if (!dst_pitch) + dst_pitch = npixels * dst_pixsize; + +for (i =0 ; i < lines; ++i) { +fill_line (dbuf, npixels, color); +memcpy_toio (dst, dbuf, dbuf_len); + dst += dst_pitch; + } + +return 0 ; +} + +static int drm_fill (struct iosys_map *dst, +const unsigned int *dst_pitch,const u8 *dst_pixsize, +unsigned int src_color,unsigned long pixels,unsigned long lines, +struct drm_format_conv_state *state, +void (*fill_line)(void *dbuf,unsigned int npixels, +const struct drm_color_lut *color)) +{ +static const unsigned int default_dst_pitch[DRM_FORMAT_MAX_PLANES ] = { +0 ,0 ,0 ,0 + }; + +if (!dst_pitch) + dst_pitch = default_dst_pitch; + +/* TODO: handle src in I/O memory here */ +if (dst[0 ].is_iomem) +return __drm_fill_toio ( + dst[0 ].vaddr_iomem, dst_pitch[0 ], dst_pixsize[0 ], + src_color, pixels, lines, state, fill_line); +else +return __drm_fill ( + dst[0 ].vaddr, dst_pitch[0 ], dst_pixsize[0 ], + src_color, pixels, lines, state, fill_line); +} + +static void drm_fill_rgb565_line (void *dbuf,unsigned int pixels, +const struct drm_color_lut *color) +{ + +__le32 *dbuf16 = dbuf; +unsigned int x; +u16 pix = ((color->red >>11 ) <<11 ) | + ((color->green >>10 ) <<5 ) | + ((color->blue >>11 )); + +for (x =0 ; x < pixels; x++) + *dbuf16++ =cpu_to_le16 (pix); +} + +void drm_fb_fill_rgb565 (struct iosys_map *dst,const unsigned int *dst_pitch, +unsigned int src_color,unsigned long pixels,unsigned long lines, +struct drm_format_conv_state *state) +{ +static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = { +2 , + }; + +drm_fill (dst, dst_pitch, dst_pixsize, src_color, pixels, lines, + state, drm_fill_rgb565_line); +} +EXPORT_SYMBOL (drm_fb_fill_rgb565); + +static void drm_fill_xrgb8888_line (void *dbuf,unsigned int pixels, +const struct drm_color_lut *color) +{ + +__le32 *dbuf32 = dbuf; +unsigned int x; +u32 pix =GENMASK (31 ,24 ) |/* fill unused bits */ + ((color->red >>8 ) <<16 ) | + ((color->green >>8 ) <<8 ) | + ((color->blue >>8 )); + +for (x =0 ; x < pixels; x++) + *dbuf32++ =cpu_to_le32 (pix); +} + +void drm_fb_fill_xrgb8888 (struct iosys_map *dst,const unsigned int *dst_pitch, +unsigned int src_color,unsigned long pixels,unsigned long lines, +struct drm_format_conv_state *state) +{ +static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES ] = { +4 , + }; + +drm_fill (dst, dst_pitch, dst_pixsize, src_color, pixels, lines, + state, drm_fill_xrgb8888_line); +} +EXPORT_SYMBOL (drm_fb_fill_xrgb8888); + +int drm_fb_fill (struct drm_device *dev, +struct iosys_map *dst,const unsigned int *dst_pitch,uint32_t dst_format, +unsigned int src_color,unsigned long pixels,unsigned long lines, +struct drm_format_conv_state *state) +{ +if (dst_format ==DRM_FORMAT_RGB565 ) { +drm_fb_fill_rgb565 (dst, dst_pitch, src_color, pixels, lines, state); +return 0 ; + }else if (dst_format ==DRM_FORMAT_XRGB8888 ) { +drm_fb_fill_xrgb8888 (dst, dst_pitch, src_color, pixels, lines, state); +return 0 ; + } + +drm_warn_once (dev,"No fill helper for %p4cc found.\n" , &dst_format); + +return -EINVAL ; +} +EXPORT_SYMBOL (drm_fb_fill);
include/drm/drm_format_helper.h +11 -0
@@ -155,4 +155,15 @@ size_t drm_fb_build_fourcc_list(struct drm_device *dev, const u32 *native_fourccs, size_t native_nfourccs, u32 *fourccs_out, size_t nfourccs_out); +void drm_fb_fill_rgb565 (struct iosys_map *dst,const unsigned int *dst_pitch, +unsigned int src_color,unsigned long pixels,unsigned long lines, +struct drm_format_conv_state *state); +void drm_fb_fill_xrgb8888 (struct iosys_map *dst,const unsigned int *dst_pitch, +unsigned int src_color,unsigned long pixels,unsigned long lines, +struct drm_format_conv_state *state); +int drm_fb_fill (struct drm_device *dev, +struct iosys_map *dst,const unsigned int *dst_pitch,uint32_t dst_format, +unsigned int src_color,unsigned long pixels,unsigned long lines, +struct drm_format_conv_state *state); +#endif /* __LINUX_DRM_FORMAT_HELPER_H */
Signature · 1 line
2.43.0
Jocelyn Falempe
reviewerHi Thomas,
Thanks for taking the time to write this series.
I find the drm_pixmap is a nice improvement, and simplifies a bit the code.
Regarding the font blit, I'm not convinced by this approach.
I don't see the benefit of using the same function between fonts and framebuffer copy, as it's unlikely to have 16bit or 32bit fonts in the kernel, or to have monochrome buffer from userspace. And the big format switch will dispatch to different functions, so there is almost no code sharing between both paths.
Also for each format supported, you now need 2 functions for xrgb8888_to_yyyyy blit, 2 functions for c1_to_yyyyy blit, and 2 functions for fill_yyyyyy. That doesn't scale well, and there is a lot of duplication between those functions.
I prefer the way Noralf Thronnes has done it in [1] and only consider the pixel width.
[1] https://lore.kernel.org/dri-devel/[email protected]/
Best regards,
Signature · 1 line
Jocelyn
Quoted 73 lines · Thomas Zimmermann
This RFC patchset implements various features required for DRM panic handling [1] and should (for now) be seen in that context.
Most of all, the patchset replaces struct
drm_framebufferwith structdrm_pixmapin the format-conversion helpers. DRM pixmap represents a source of pixel data for the blitting operations. Patches 1 to 19 update the interface, implementation and all of the callers. These patches could be useful even without DRM panic handling.With struct
drm_pixmapin place, patches 20 to 22 implement rudimentary support for blitting font data. The pixmap refers to a character's glyph, which the blit routines write to the destination memory. An example on blitting strings is given in patch 20's commit description.Patch 23 adds rudimentary support for fill operations. The design is based on blitting, but blits the same color into each pixel.
[1] https://patchwork.freedesktop.org/series/122244/
Thomas Zimmermann (23):
drm/format-helper: Add structdrm_pixmapdrm/format-helper: Use structdrm_pixmapfordrm_fb_memcpy()drm/format-helper: Streamlinedrm_fb_xfrm()implementations drm/format-helper: Use structdrm_pixmapinternally drm/format-helper: Use structdrm_pixmapfordrm_fb_swab()drm/format-helper: Use structdrm_pixmapfordrm_fb_xrgb8888_to_rgb332() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_rgb565() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_xrgb1555() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_argb1555() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_rgba5551() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_rgb888() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_argb8888() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_abgr8888() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_xbgr8888() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_xrgb2101010() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_argb2101010() drm/format-helper: Use struct drm_pixmap for drm_fb_xrgb8888_to_gray8()drm/format-helper: Use struct
drm_pixmapfordrm_fb_xrgb8888_to_mono()drm/format-helper: Use structdrm_pixmapfordrm_fb_blit()[DO NOT MERGE] drm/format-helper: Add font-support for DRM pixmap [DO NOT MERGE] drm/format-helper: Add color palette
[DO NOT MERGE] drm/format-helper: Support blitting from C1 to XRGB8888 [DO NOT MERGE] drm/format-helper: Adddrm_fb_fill()to fill screen
with colordrivers/gpu/drm/ast/ast_mode.c | 4 +- drivers/gpu/drm/drm_format_helper.c | 678 ++++++++++++------ drivers/gpu/drm/drm_mipi_dbi.c | 9 +- drivers/gpu/drm/gud/gud_pipe.c | 24 +- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 4 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 4 +- drivers/gpu/drm/solomon/ssd130x.c | 12 +- .../gpu/drm/tests/drm_format_helper_test.c | 106 ++- drivers/gpu/drm/tiny/cirrus.c | 6 +- drivers/gpu/drm/tiny/ofdrm.c | 6 +- drivers/gpu/drm/tiny/repaper.c | 4 +- drivers/gpu/drm/tiny/simpledrm.c | 6 +- drivers/gpu/drm/tiny/st7586.c | 4 +- include/drm/drm_format_helper.h | 116 ++- 14 files changed, 678 insertions(+), 305 deletions(-)