All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] fbdev: Fix image blitting for arbitrary image widths
@ 2022-03-13 19:29 ` Thomas Zimmermann
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Zimmermann @ 2022-03-13 19:29 UTC (permalink / raw)
  To: daniel, deller, m.szyprowski, geert, javierm, sam
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Recent optimization of the fbdev image-bitting helpers broke the code for
image width that do not align with multiples of 8. Both, sys and cfb, are
affected. Fix this problem by handling the trailing pixels on each line
separately.

Tested with simpledrm and the 7x14 font.

Thomas Zimmermann (2):
  fbdev: Fix sys_imageblit() for arbitrary image widths
  fbdev: Fix cfb_imageblit() for arbitrary image widths

 drivers/video/fbdev/core/cfbimgblt.c | 28 +++++++++++++++++++++++----
 drivers/video/fbdev/core/sysimgblt.c | 29 ++++++++++++++++++++++++----
 2 files changed, 49 insertions(+), 8 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 0/2] fbdev: Fix image blitting for arbitrary image widths
@ 2022-03-13 19:29 ` Thomas Zimmermann
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Zimmermann @ 2022-03-13 19:29 UTC (permalink / raw)
  To: daniel, deller, m.szyprowski, geert, javierm, sam
  Cc: linux-fbdev, Thomas Zimmermann, dri-devel

Recent optimization of the fbdev image-bitting helpers broke the code for
image width that do not align with multiples of 8. Both, sys and cfb, are
affected. Fix this problem by handling the trailing pixels on each line
separately.

Tested with simpledrm and the 7x14 font.

Thomas Zimmermann (2):
  fbdev: Fix sys_imageblit() for arbitrary image widths
  fbdev: Fix cfb_imageblit() for arbitrary image widths

 drivers/video/fbdev/core/cfbimgblt.c | 28 +++++++++++++++++++++++----
 drivers/video/fbdev/core/sysimgblt.c | 29 ++++++++++++++++++++++++----
 2 files changed, 49 insertions(+), 8 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/2] fbdev: Fix sys_imageblit() for arbitrary image widths
  2022-03-13 19:29 ` Thomas Zimmermann
@ 2022-03-13 19:29   ` Thomas Zimmermann
  -1 siblings, 0 replies; 17+ messages in thread
From: Thomas Zimmermann @ 2022-03-13 19:29 UTC (permalink / raw)
  To: daniel, deller, m.szyprowski, geert, javierm, sam
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Commit 6f29e04938bf ("fbdev: Improve performance of sys_imageblit()")
broke sys_imageblit() for image width that are not aligned to 8-bit
boundaries. Fix this by handling the trailing pixels on each line
separately. The performance improvements in the original commit do not
regress by this change.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 6f29e04938bf ("fbdev: Improve performance of sys_imageblit()")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/video/fbdev/core/sysimgblt.c | 29 ++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/core/sysimgblt.c b/drivers/video/fbdev/core/sysimgblt.c
index 722c327a381b..335e92b813fc 100644
--- a/drivers/video/fbdev/core/sysimgblt.c
+++ b/drivers/video/fbdev/core/sysimgblt.c
@@ -188,7 +188,7 @@ static void fast_imageblit(const struct fb_image *image, struct fb_info *p,
 {
 	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
 	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
-	u32 bit_mask, eorx;
+	u32 bit_mask, eorx, shift;
 	const char *s = image->data, *src;
 	u32 *dst;
 	const u32 *tab;
@@ -229,17 +229,23 @@ static void fast_imageblit(const struct fb_image *image, struct fb_info *p,
 
 	for (i = image->height; i--; ) {
 		dst = dst1;
+		shift = 8;
 		src = s;
 
+		/*
+		 * Manually unroll the per-line copying loop for better
+		 * performance. This works until we processed the last
+		 * completely filled source byte (inclusive).
+		 */
 		switch (ppw) {
 		case 4: /* 8 bpp */
-			for (j = k; j; j -= 2, ++src) {
+			for (j = k; j >= 2; j -= 2, ++src) {
 				*dst++ = colortab[(*src >> 4) & bit_mask];
 				*dst++ = colortab[(*src >> 0) & bit_mask];
 			}
 			break;
 		case 2: /* 16 bpp */
-			for (j = k; j; j -= 4, ++src) {
+			for (j = k; j >= 4; j -= 4, ++src) {
 				*dst++ = colortab[(*src >> 6) & bit_mask];
 				*dst++ = colortab[(*src >> 4) & bit_mask];
 				*dst++ = colortab[(*src >> 2) & bit_mask];
@@ -247,7 +253,7 @@ static void fast_imageblit(const struct fb_image *image, struct fb_info *p,
 			}
 			break;
 		case 1: /* 32 bpp */
-			for (j = k; j; j -= 8, ++src) {
+			for (j = k; j >= 8; j -= 8, ++src) {
 				*dst++ = colortab[(*src >> 7) & bit_mask];
 				*dst++ = colortab[(*src >> 6) & bit_mask];
 				*dst++ = colortab[(*src >> 5) & bit_mask];
@@ -259,6 +265,21 @@ static void fast_imageblit(const struct fb_image *image, struct fb_info *p,
 			}
 			break;
 		}
+
+		/*
+		 * For image widths that are not a multiple of 8, there
+		 * are trailing pixels left on the current line. Print
+		 * them as well.
+		 */
+		for (; j--; ) {
+			shift -= ppw;
+			*dst++ = colortab[(*src >> shift) & bit_mask];
+			if (!shift) {
+				shift = 8;
+				++src;
+			}
+		}
+
 		dst1 += p->fix.line_length;
 		s += spitch;
 	}
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 1/2] fbdev: Fix sys_imageblit() for arbitrary image widths
@ 2022-03-13 19:29   ` Thomas Zimmermann
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Zimmermann @ 2022-03-13 19:29 UTC (permalink / raw)
  To: daniel, deller, m.szyprowski, geert, javierm, sam
  Cc: linux-fbdev, Thomas Zimmermann, dri-devel

Commit 6f29e04938bf ("fbdev: Improve performance of sys_imageblit()")
broke sys_imageblit() for image width that are not aligned to 8-bit
boundaries. Fix this by handling the trailing pixels on each line
separately. The performance improvements in the original commit do not
regress by this change.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 6f29e04938bf ("fbdev: Improve performance of sys_imageblit()")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/video/fbdev/core/sysimgblt.c | 29 ++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/core/sysimgblt.c b/drivers/video/fbdev/core/sysimgblt.c
index 722c327a381b..335e92b813fc 100644
--- a/drivers/video/fbdev/core/sysimgblt.c
+++ b/drivers/video/fbdev/core/sysimgblt.c
@@ -188,7 +188,7 @@ static void fast_imageblit(const struct fb_image *image, struct fb_info *p,
 {
 	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
 	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
-	u32 bit_mask, eorx;
+	u32 bit_mask, eorx, shift;
 	const char *s = image->data, *src;
 	u32 *dst;
 	const u32 *tab;
@@ -229,17 +229,23 @@ static void fast_imageblit(const struct fb_image *image, struct fb_info *p,
 
 	for (i = image->height; i--; ) {
 		dst = dst1;
+		shift = 8;
 		src = s;
 
+		/*
+		 * Manually unroll the per-line copying loop for better
+		 * performance. This works until we processed the last
+		 * completely filled source byte (inclusive).
+		 */
 		switch (ppw) {
 		case 4: /* 8 bpp */
-			for (j = k; j; j -= 2, ++src) {
+			for (j = k; j >= 2; j -= 2, ++src) {
 				*dst++ = colortab[(*src >> 4) & bit_mask];
 				*dst++ = colortab[(*src >> 0) & bit_mask];
 			}
 			break;
 		case 2: /* 16 bpp */
-			for (j = k; j; j -= 4, ++src) {
+			for (j = k; j >= 4; j -= 4, ++src) {
 				*dst++ = colortab[(*src >> 6) & bit_mask];
 				*dst++ = colortab[(*src >> 4) & bit_mask];
 				*dst++ = colortab[(*src >> 2) & bit_mask];
@@ -247,7 +253,7 @@ static void fast_imageblit(const struct fb_image *image, struct fb_info *p,
 			}
 			break;
 		case 1: /* 32 bpp */
-			for (j = k; j; j -= 8, ++src) {
+			for (j = k; j >= 8; j -= 8, ++src) {
 				*dst++ = colortab[(*src >> 7) & bit_mask];
 				*dst++ = colortab[(*src >> 6) & bit_mask];
 				*dst++ = colortab[(*src >> 5) & bit_mask];
@@ -259,6 +265,21 @@ static void fast_imageblit(const struct fb_image *image, struct fb_info *p,
 			}
 			break;
 		}
+
+		/*
+		 * For image widths that are not a multiple of 8, there
+		 * are trailing pixels left on the current line. Print
+		 * them as well.
+		 */
+		for (; j--; ) {
+			shift -= ppw;
+			*dst++ = colortab[(*src >> shift) & bit_mask];
+			if (!shift) {
+				shift = 8;
+				++src;
+			}
+		}
+
 		dst1 += p->fix.line_length;
 		s += spitch;
 	}
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/2] fbdev: Fix cfb_imageblit() for arbitrary image widths
  2022-03-13 19:29 ` Thomas Zimmermann
@ 2022-03-13 19:29   ` Thomas Zimmermann
  -1 siblings, 0 replies; 17+ messages in thread
From: Thomas Zimmermann @ 2022-03-13 19:29 UTC (permalink / raw)
  To: daniel, deller, m.szyprowski, geert, javierm, sam
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Commit 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
broke cfb_imageblit() for image widths that are not aligned to 8-bit
boundaries. Fix this by handling the trailing pixels on each line
separately. The performance improvements in the original commit do not
regress by this change.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/video/fbdev/core/cfbimgblt.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c
index 7361cfabdd85..9ebda4e0dc7a 100644
--- a/drivers/video/fbdev/core/cfbimgblt.c
+++ b/drivers/video/fbdev/core/cfbimgblt.c
@@ -218,7 +218,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
 {
 	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
 	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
-	u32 bit_mask, eorx;
+	u32 bit_mask, eorx, shift;
 	const char *s = image->data, *src;
 	u32 __iomem *dst;
 	const u32 *tab = NULL;
@@ -259,17 +259,23 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
 
 	for (i = image->height; i--; ) {
 		dst = (u32 __iomem *)dst1;
+		shift = 8;
 		src = s;
 
+		/*
+		 * Manually unroll the per-line copying loop for better
+		 * performance. This works until we processed the last
+		 * completely filled source byte (inclusive).
+		 */
 		switch (ppw) {
 		case 4: /* 8 bpp */
-			for (j = k; j; j -= 2, ++src) {
+			for (j = k; j >= 2; j -= 2, ++src) {
 				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
 				FB_WRITEL(colortab[(*src >> 0) & bit_mask], dst++);
 			}
 			break;
 		case 2: /* 16 bpp */
-			for (j = k; j; j -= 4, ++src) {
+			for (j = k; j >= 4; j -= 4, ++src) {
 				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
 				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
 				FB_WRITEL(colortab[(*src >> 2) & bit_mask], dst++);
@@ -277,7 +283,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
 			}
 			break;
 		case 1: /* 32 bpp */
-			for (j = k; j; j -= 8, ++src) {
+			for (j = k; j >= 8; j -= 8, ++src) {
 				FB_WRITEL(colortab[(*src >> 7) & bit_mask], dst++);
 				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
 				FB_WRITEL(colortab[(*src >> 5) & bit_mask], dst++);
@@ -290,6 +296,20 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
 			break;
 		}
 
+		/*
+		 * For image widths that are not a multiple of 8, there
+		 * are trailing pixels left on the current line. Print
+		 * them as well.
+		 */
+		for (; j--; ) {
+			shift -= ppw;
+			FB_WRITEL(colortab[(*src >> shift) & bit_mask], dst++);
+			if (!shift) {
+				shift = 8;
+				++src;
+			}
+		}
+
 		dst1 += p->fix.line_length;
 		s += spitch;
 	}
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/2] fbdev: Fix cfb_imageblit() for arbitrary image widths
@ 2022-03-13 19:29   ` Thomas Zimmermann
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Zimmermann @ 2022-03-13 19:29 UTC (permalink / raw)
  To: daniel, deller, m.szyprowski, geert, javierm, sam
  Cc: linux-fbdev, Thomas Zimmermann, dri-devel

Commit 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
broke cfb_imageblit() for image widths that are not aligned to 8-bit
boundaries. Fix this by handling the trailing pixels on each line
separately. The performance improvements in the original commit do not
regress by this change.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/video/fbdev/core/cfbimgblt.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c
index 7361cfabdd85..9ebda4e0dc7a 100644
--- a/drivers/video/fbdev/core/cfbimgblt.c
+++ b/drivers/video/fbdev/core/cfbimgblt.c
@@ -218,7 +218,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
 {
 	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
 	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
-	u32 bit_mask, eorx;
+	u32 bit_mask, eorx, shift;
 	const char *s = image->data, *src;
 	u32 __iomem *dst;
 	const u32 *tab = NULL;
@@ -259,17 +259,23 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
 
 	for (i = image->height; i--; ) {
 		dst = (u32 __iomem *)dst1;
+		shift = 8;
 		src = s;
 
+		/*
+		 * Manually unroll the per-line copying loop for better
+		 * performance. This works until we processed the last
+		 * completely filled source byte (inclusive).
+		 */
 		switch (ppw) {
 		case 4: /* 8 bpp */
-			for (j = k; j; j -= 2, ++src) {
+			for (j = k; j >= 2; j -= 2, ++src) {
 				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
 				FB_WRITEL(colortab[(*src >> 0) & bit_mask], dst++);
 			}
 			break;
 		case 2: /* 16 bpp */
-			for (j = k; j; j -= 4, ++src) {
+			for (j = k; j >= 4; j -= 4, ++src) {
 				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
 				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
 				FB_WRITEL(colortab[(*src >> 2) & bit_mask], dst++);
@@ -277,7 +283,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
 			}
 			break;
 		case 1: /* 32 bpp */
-			for (j = k; j; j -= 8, ++src) {
+			for (j = k; j >= 8; j -= 8, ++src) {
 				FB_WRITEL(colortab[(*src >> 7) & bit_mask], dst++);
 				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
 				FB_WRITEL(colortab[(*src >> 5) & bit_mask], dst++);
@@ -290,6 +296,20 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
 			break;
 		}
 
+		/*
+		 * For image widths that are not a multiple of 8, there
+		 * are trailing pixels left on the current line. Print
+		 * them as well.
+		 */
+		for (; j--; ) {
+			shift -= ppw;
+			FB_WRITEL(colortab[(*src >> shift) & bit_mask], dst++);
+			if (!shift) {
+				shift = 8;
+				++src;
+			}
+		}
+
 		dst1 += p->fix.line_length;
 		s += spitch;
 	}
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/2] fbdev: Fix cfb_imageblit() for arbitrary image widths
  2022-03-13 19:29   ` Thomas Zimmermann
  (?)
@ 2022-03-14  8:41   ` Marek Szyprowski
  -1 siblings, 0 replies; 17+ messages in thread
From: Marek Szyprowski @ 2022-03-14  8:41 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, deller, geert, javierm, sam
  Cc: linux-fbdev, dri-devel

On 13.03.2022 20:29, Thomas Zimmermann wrote:
> Commit 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> broke cfb_imageblit() for image widths that are not aligned to 8-bit
> boundaries. Fix this by handling the trailing pixels on each line
> separately. The performance improvements in the original commit do not
> regress by this change.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>   drivers/video/fbdev/core/cfbimgblt.c | 28 ++++++++++++++++++++++++----
>   1 file changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c
> index 7361cfabdd85..9ebda4e0dc7a 100644
> --- a/drivers/video/fbdev/core/cfbimgblt.c
> +++ b/drivers/video/fbdev/core/cfbimgblt.c
> @@ -218,7 +218,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>   {
>   	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
>   	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
> -	u32 bit_mask, eorx;
> +	u32 bit_mask, eorx, shift;
>   	const char *s = image->data, *src;
>   	u32 __iomem *dst;
>   	const u32 *tab = NULL;
> @@ -259,17 +259,23 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>   
>   	for (i = image->height; i--; ) {
>   		dst = (u32 __iomem *)dst1;
> +		shift = 8;
>   		src = s;
>   
> +		/*
> +		 * Manually unroll the per-line copying loop for better
> +		 * performance. This works until we processed the last
> +		 * completely filled source byte (inclusive).
> +		 */
>   		switch (ppw) {
>   		case 4: /* 8 bpp */
> -			for (j = k; j; j -= 2, ++src) {
> +			for (j = k; j >= 2; j -= 2, ++src) {
>   				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
>   				FB_WRITEL(colortab[(*src >> 0) & bit_mask], dst++);
>   			}
>   			break;
>   		case 2: /* 16 bpp */
> -			for (j = k; j; j -= 4, ++src) {
> +			for (j = k; j >= 4; j -= 4, ++src) {
>   				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
>   				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
>   				FB_WRITEL(colortab[(*src >> 2) & bit_mask], dst++);
> @@ -277,7 +283,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>   			}
>   			break;
>   		case 1: /* 32 bpp */
> -			for (j = k; j; j -= 8, ++src) {
> +			for (j = k; j >= 8; j -= 8, ++src) {
>   				FB_WRITEL(colortab[(*src >> 7) & bit_mask], dst++);
>   				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
>   				FB_WRITEL(colortab[(*src >> 5) & bit_mask], dst++);
> @@ -290,6 +296,20 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>   			break;
>   		}
>   
> +		/*
> +		 * For image widths that are not a multiple of 8, there
> +		 * are trailing pixels left on the current line. Print
> +		 * them as well.
> +		 */
> +		for (; j--; ) {
> +			shift -= ppw;
> +			FB_WRITEL(colortab[(*src >> shift) & bit_mask], dst++);
> +			if (!shift) {
> +				shift = 8;
> +				++src;
> +			}
> +		}
> +
>   		dst1 += p->fix.line_length;
>   		s += spitch;
>   	}

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/2] fbdev: Fix sys_imageblit() for arbitrary image widths
  2022-03-13 19:29   ` Thomas Zimmermann
@ 2022-03-14 20:56     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 17+ messages in thread
From: Geert Uytterhoeven @ 2022-03-14 20:56 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Daniel Vetter, Helge Deller, Marek Szyprowski,
	Javier Martinez Canillas, Sam Ravnborg,
	Linux Fbdev development list, DRI Development

Hi Thomas,

On Sun, Mar 13, 2022 at 8:29 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Commit 6f29e04938bf ("fbdev: Improve performance of sys_imageblit()")
> broke sys_imageblit() for image width that are not aligned to 8-bit
> boundaries. Fix this by handling the trailing pixels on each line
> separately. The performance improvements in the original commit do not
> regress by this change.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks for fixing! This was very valuable for hammering the bugs
out of ssd130xdrm and the xrgb888-to-mono conversion...

Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/2] fbdev: Fix sys_imageblit() for arbitrary image widths
@ 2022-03-14 20:56     ` Geert Uytterhoeven
  0 siblings, 0 replies; 17+ messages in thread
From: Geert Uytterhoeven @ 2022-03-14 20:56 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Linux Fbdev development list, Helge Deller,
	Javier Martinez Canillas, DRI Development, Sam Ravnborg,
	Marek Szyprowski

Hi Thomas,

On Sun, Mar 13, 2022 at 8:29 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Commit 6f29e04938bf ("fbdev: Improve performance of sys_imageblit()")
> broke sys_imageblit() for image width that are not aligned to 8-bit
> boundaries. Fix this by handling the trailing pixels on each line
> separately. The performance improvements in the original commit do not
> regress by this change.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks for fixing! This was very valuable for hammering the bugs
out of ssd130xdrm and the xrgb888-to-mono conversion...

Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/2] fbdev: Fix cfb_imageblit() for arbitrary image widths
  2022-03-13 19:29   ` Thomas Zimmermann
@ 2022-03-17 10:54     ` Daniel Vetter
  -1 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2022-03-17 10:54 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, deller, m.szyprowski, geert, javierm, sam, linux-fbdev,
	dri-devel

On Sun, Mar 13, 2022 at 08:29:52PM +0100, Thomas Zimmermann wrote:
> Commit 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> broke cfb_imageblit() for image widths that are not aligned to 8-bit
> boundaries. Fix this by handling the trailing pixels on each line
> separately. The performance improvements in the original commit do not
> regress by this change.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>

On both patches:

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/video/fbdev/core/cfbimgblt.c | 28 ++++++++++++++++++++++++----
>  1 file changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c
> index 7361cfabdd85..9ebda4e0dc7a 100644
> --- a/drivers/video/fbdev/core/cfbimgblt.c
> +++ b/drivers/video/fbdev/core/cfbimgblt.c
> @@ -218,7 +218,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  {
>  	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
>  	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
> -	u32 bit_mask, eorx;
> +	u32 bit_mask, eorx, shift;
>  	const char *s = image->data, *src;
>  	u32 __iomem *dst;
>  	const u32 *tab = NULL;
> @@ -259,17 +259,23 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  
>  	for (i = image->height; i--; ) {
>  		dst = (u32 __iomem *)dst1;
> +		shift = 8;
>  		src = s;
>  
> +		/*
> +		 * Manually unroll the per-line copying loop for better
> +		 * performance. This works until we processed the last
> +		 * completely filled source byte (inclusive).
> +		 */
>  		switch (ppw) {
>  		case 4: /* 8 bpp */
> -			for (j = k; j; j -= 2, ++src) {
> +			for (j = k; j >= 2; j -= 2, ++src) {
>  				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 0) & bit_mask], dst++);
>  			}
>  			break;
>  		case 2: /* 16 bpp */
> -			for (j = k; j; j -= 4, ++src) {
> +			for (j = k; j >= 4; j -= 4, ++src) {
>  				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 2) & bit_mask], dst++);
> @@ -277,7 +283,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  			}
>  			break;
>  		case 1: /* 32 bpp */
> -			for (j = k; j; j -= 8, ++src) {
> +			for (j = k; j >= 8; j -= 8, ++src) {
>  				FB_WRITEL(colortab[(*src >> 7) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 5) & bit_mask], dst++);
> @@ -290,6 +296,20 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  			break;
>  		}
>  
> +		/*
> +		 * For image widths that are not a multiple of 8, there
> +		 * are trailing pixels left on the current line. Print
> +		 * them as well.
> +		 */
> +		for (; j--; ) {
> +			shift -= ppw;
> +			FB_WRITEL(colortab[(*src >> shift) & bit_mask], dst++);
> +			if (!shift) {
> +				shift = 8;
> +				++src;
> +			}
> +		}
> +
>  		dst1 += p->fix.line_length;
>  		s += spitch;
>  	}
> -- 
> 2.35.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/2] fbdev: Fix cfb_imageblit() for arbitrary image widths
@ 2022-03-17 10:54     ` Daniel Vetter
  0 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2022-03-17 10:54 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: linux-fbdev, deller, javierm, dri-devel, geert, sam, m.szyprowski

On Sun, Mar 13, 2022 at 08:29:52PM +0100, Thomas Zimmermann wrote:
> Commit 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> broke cfb_imageblit() for image widths that are not aligned to 8-bit
> boundaries. Fix this by handling the trailing pixels on each line
> separately. The performance improvements in the original commit do not
> regress by this change.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>

On both patches:

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/video/fbdev/core/cfbimgblt.c | 28 ++++++++++++++++++++++++----
>  1 file changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c
> index 7361cfabdd85..9ebda4e0dc7a 100644
> --- a/drivers/video/fbdev/core/cfbimgblt.c
> +++ b/drivers/video/fbdev/core/cfbimgblt.c
> @@ -218,7 +218,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  {
>  	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
>  	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
> -	u32 bit_mask, eorx;
> +	u32 bit_mask, eorx, shift;
>  	const char *s = image->data, *src;
>  	u32 __iomem *dst;
>  	const u32 *tab = NULL;
> @@ -259,17 +259,23 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  
>  	for (i = image->height; i--; ) {
>  		dst = (u32 __iomem *)dst1;
> +		shift = 8;
>  		src = s;
>  
> +		/*
> +		 * Manually unroll the per-line copying loop for better
> +		 * performance. This works until we processed the last
> +		 * completely filled source byte (inclusive).
> +		 */
>  		switch (ppw) {
>  		case 4: /* 8 bpp */
> -			for (j = k; j; j -= 2, ++src) {
> +			for (j = k; j >= 2; j -= 2, ++src) {
>  				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 0) & bit_mask], dst++);
>  			}
>  			break;
>  		case 2: /* 16 bpp */
> -			for (j = k; j; j -= 4, ++src) {
> +			for (j = k; j >= 4; j -= 4, ++src) {
>  				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 2) & bit_mask], dst++);
> @@ -277,7 +283,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  			}
>  			break;
>  		case 1: /* 32 bpp */
> -			for (j = k; j; j -= 8, ++src) {
> +			for (j = k; j >= 8; j -= 8, ++src) {
>  				FB_WRITEL(colortab[(*src >> 7) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 5) & bit_mask], dst++);
> @@ -290,6 +296,20 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  			break;
>  		}
>  
> +		/*
> +		 * For image widths that are not a multiple of 8, there
> +		 * are trailing pixels left on the current line. Print
> +		 * them as well.
> +		 */
> +		for (; j--; ) {
> +			shift -= ppw;
> +			FB_WRITEL(colortab[(*src >> shift) & bit_mask], dst++);
> +			if (!shift) {
> +				shift = 8;
> +				++src;
> +			}
> +		}
> +
>  		dst1 += p->fix.line_length;
>  		s += spitch;
>  	}
> -- 
> 2.35.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/2] fbdev: Fix sys_imageblit() for arbitrary image widths
  2022-03-13 19:29   ` Thomas Zimmermann
  (?)
  (?)
@ 2022-03-17 11:20   ` Javier Martinez Canillas
  -1 siblings, 0 replies; 17+ messages in thread
From: Javier Martinez Canillas @ 2022-03-17 11:20 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, deller, m.szyprowski, geert, sam
  Cc: linux-fbdev, dri-devel

Hello Thomas,

On 3/13/22 20:29, Thomas Zimmermann wrote:
> Commit 6f29e04938bf ("fbdev: Improve performance of sys_imageblit()")
> broke sys_imageblit() for image width that are not aligned to 8-bit
> boundaries. Fix this by handling the trailing pixels on each line
> separately. The performance improvements in the original commit do not
> regress by this change.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 6f29e04938bf ("fbdev: Improve performance of sys_imageblit()")
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---

Looks good to me. Also Marek and Geert mentioned that fixes the issue
they were seeing.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/2] fbdev: Fix cfb_imageblit() for arbitrary image widths
  2022-03-13 19:29   ` Thomas Zimmermann
                     ` (2 preceding siblings ...)
  (?)
@ 2022-03-17 11:22   ` Javier Martinez Canillas
  -1 siblings, 0 replies; 17+ messages in thread
From: Javier Martinez Canillas @ 2022-03-17 11:22 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, deller, m.szyprowski, geert, sam
  Cc: linux-fbdev, dri-devel

On 3/13/22 20:29, Thomas Zimmermann wrote:
> Commit 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> broke cfb_imageblit() for image widths that are not aligned to 8-bit
> boundaries. Fix this by handling the trailing pixels on each line
> separately. The performance improvements in the original commit do not
> regress by this change.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Linux Engineering
Red Hat


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [2/2] fbdev: Fix cfb_imageblit() for arbitrary image widths
  2022-03-13 19:29   ` Thomas Zimmermann
@ 2022-03-24 21:15     ` Guenter Roeck
  -1 siblings, 0 replies; 17+ messages in thread
From: Guenter Roeck @ 2022-03-24 21:15 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, deller, m.szyprowski, geert, javierm, sam, linux-fbdev,
	dri-devel

On Sun, Mar 13, 2022 at 08:29:52PM +0100, Thomas Zimmermann wrote:
> Commit 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> broke cfb_imageblit() for image widths that are not aligned to 8-bit
> boundaries. Fix this by handling the trailing pixels on each line
> separately. The performance improvements in the original commit do not
> regress by this change.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Tested-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/video/fbdev/core/cfbimgblt.c | 28 ++++++++++++++++++++++++----
>  1 file changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c
> index 7361cfabdd85..9ebda4e0dc7a 100644
> --- a/drivers/video/fbdev/core/cfbimgblt.c
> +++ b/drivers/video/fbdev/core/cfbimgblt.c
> @@ -218,7 +218,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  {
>  	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
>  	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
> -	u32 bit_mask, eorx;
> +	u32 bit_mask, eorx, shift;
>  	const char *s = image->data, *src;
>  	u32 __iomem *dst;
>  	const u32 *tab = NULL;
> @@ -259,17 +259,23 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  
>  	for (i = image->height; i--; ) {
>  		dst = (u32 __iomem *)dst1;
> +		shift = 8;
>  		src = s;
>  
> +		/*
> +		 * Manually unroll the per-line copying loop for better
> +		 * performance. This works until we processed the last
> +		 * completely filled source byte (inclusive).
> +		 */
>  		switch (ppw) {
>  		case 4: /* 8 bpp */
> -			for (j = k; j; j -= 2, ++src) {
> +			for (j = k; j >= 2; j -= 2, ++src) {
>  				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 0) & bit_mask], dst++);
>  			}
>  			break;
>  		case 2: /* 16 bpp */
> -			for (j = k; j; j -= 4, ++src) {
> +			for (j = k; j >= 4; j -= 4, ++src) {
>  				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 2) & bit_mask], dst++);
> @@ -277,7 +283,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  			}
>  			break;
>  		case 1: /* 32 bpp */
> -			for (j = k; j; j -= 8, ++src) {
> +			for (j = k; j >= 8; j -= 8, ++src) {
>  				FB_WRITEL(colortab[(*src >> 7) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 5) & bit_mask], dst++);
> @@ -290,6 +296,20 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  			break;
>  		}
>  
> +		/*
> +		 * For image widths that are not a multiple of 8, there
> +		 * are trailing pixels left on the current line. Print
> +		 * them as well.
> +		 */
> +		for (; j--; ) {
> +			shift -= ppw;
> +			FB_WRITEL(colortab[(*src >> shift) & bit_mask], dst++);
> +			if (!shift) {
> +				shift = 8;
> +				++src;
> +			}
> +		}
> +
>  		dst1 += p->fix.line_length;
>  		s += spitch;
>  	}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [2/2] fbdev: Fix cfb_imageblit() for arbitrary image widths
@ 2022-03-24 21:15     ` Guenter Roeck
  0 siblings, 0 replies; 17+ messages in thread
From: Guenter Roeck @ 2022-03-24 21:15 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: linux-fbdev, deller, javierm, dri-devel, geert, sam, m.szyprowski

On Sun, Mar 13, 2022 at 08:29:52PM +0100, Thomas Zimmermann wrote:
> Commit 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> broke cfb_imageblit() for image widths that are not aligned to 8-bit
> boundaries. Fix this by handling the trailing pixels on each line
> separately. The performance improvements in the original commit do not
> regress by this change.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 0d03011894d2 ("fbdev: Improve performance of cfb_imageblit()")
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Tested-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/video/fbdev/core/cfbimgblt.c | 28 ++++++++++++++++++++++++----
>  1 file changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/cfbimgblt.c b/drivers/video/fbdev/core/cfbimgblt.c
> index 7361cfabdd85..9ebda4e0dc7a 100644
> --- a/drivers/video/fbdev/core/cfbimgblt.c
> +++ b/drivers/video/fbdev/core/cfbimgblt.c
> @@ -218,7 +218,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  {
>  	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
>  	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
> -	u32 bit_mask, eorx;
> +	u32 bit_mask, eorx, shift;
>  	const char *s = image->data, *src;
>  	u32 __iomem *dst;
>  	const u32 *tab = NULL;
> @@ -259,17 +259,23 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  
>  	for (i = image->height; i--; ) {
>  		dst = (u32 __iomem *)dst1;
> +		shift = 8;
>  		src = s;
>  
> +		/*
> +		 * Manually unroll the per-line copying loop for better
> +		 * performance. This works until we processed the last
> +		 * completely filled source byte (inclusive).
> +		 */
>  		switch (ppw) {
>  		case 4: /* 8 bpp */
> -			for (j = k; j; j -= 2, ++src) {
> +			for (j = k; j >= 2; j -= 2, ++src) {
>  				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 0) & bit_mask], dst++);
>  			}
>  			break;
>  		case 2: /* 16 bpp */
> -			for (j = k; j; j -= 4, ++src) {
> +			for (j = k; j >= 4; j -= 4, ++src) {
>  				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 4) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 2) & bit_mask], dst++);
> @@ -277,7 +283,7 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  			}
>  			break;
>  		case 1: /* 32 bpp */
> -			for (j = k; j; j -= 8, ++src) {
> +			for (j = k; j >= 8; j -= 8, ++src) {
>  				FB_WRITEL(colortab[(*src >> 7) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 6) & bit_mask], dst++);
>  				FB_WRITEL(colortab[(*src >> 5) & bit_mask], dst++);
> @@ -290,6 +296,20 @@ static inline void fast_imageblit(const struct fb_image *image, struct fb_info *
>  			break;
>  		}
>  
> +		/*
> +		 * For image widths that are not a multiple of 8, there
> +		 * are trailing pixels left on the current line. Print
> +		 * them as well.
> +		 */
> +		for (; j--; ) {
> +			shift -= ppw;
> +			FB_WRITEL(colortab[(*src >> shift) & bit_mask], dst++);
> +			if (!shift) {
> +				shift = 8;
> +				++src;
> +			}
> +		}
> +
>  		dst1 += p->fix.line_length;
>  		s += spitch;
>  	}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/2] fbdev: Fix sys_imageblit() for arbitrary image widths
@ 2022-03-14 14:44 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2022-03-14 14:44 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 29189 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220313192952.12058-2-tzimmermann@suse.de>
References: <20220313192952.12058-2-tzimmermann@suse.de>
TO: Thomas Zimmermann <tzimmermann@suse.de>
TO: daniel(a)ffwll.ch
TO: deller(a)gmx.de
TO: m.szyprowski(a)samsung.com
TO: geert(a)linux-m68k.org
TO: javierm(a)redhat.com
TO: sam(a)ravnborg.org
CC: linux-fbdev(a)vger.kernel.org
CC: dri-devel(a)lists.freedesktop.org
CC: Thomas Zimmermann <tzimmermann@suse.de>

Hi Thomas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20220310]
[cannot apply to linus/master v5.17-rc7 v5.17-rc6 v5.17-rc5 v5.17-rc8]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/fbdev-Fix-image-blitting-for-arbitrary-image-widths/20220314-033209
base:    71941773e143369a73c9c4a3b62fbb60736a1182
:::::: branch date: 19 hours ago
:::::: commit date: 19 hours ago
config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220314/202203142244.kD75RW4r-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0467eb2cb7654c15ae366967ef35093c5724c416)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/34e093954c6d2a7ff3da7c7d599ba6486855c3d1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Thomas-Zimmermann/fbdev-Fix-image-blitting-for-arbitrary-image-widths/20220314-033209
        git checkout 34e093954c6d2a7ff3da7c7d599ba6486855c3d1
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   drivers/acpi/apei/erst.c:1015:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memcpy(record->buf, rcd->data, len - sizeof(*rcd));
           ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   drivers/acpi/apei/erst.c:1015:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
           memcpy(record->buf, rcd->data, len - sizeof(*rcd));
           ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   drivers/acpi/apei/erst.c:1046:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(rcd, 0, sizeof(*rcd));
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   drivers/acpi/apei/erst.c:1046:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(rcd, 0, sizeof(*rcd));
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   drivers/acpi/apei/erst.c:1047:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memcpy(rcd->hdr.signature, CPER_SIG_RECORD, CPER_SIG_SIZE);
           ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   drivers/acpi/apei/erst.c:1047:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
           memcpy(rcd->hdr.signature, CPER_SIG_RECORD, CPER_SIG_SIZE);
           ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   Suppressed 37 warnings (37 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   45 warnings generated.
   Suppressed 45 warnings (45 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   45 warnings generated.
   Suppressed 45 warnings (45 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   45 warnings generated.
   Suppressed 45 warnings (45 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   45 warnings generated.
   Suppressed 45 warnings (45 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   46 warnings generated.
>> drivers/video/fbdev/core/sysimgblt.c:274:10: warning: The expression is an uninitialized value. The computed value will also be garbage [clang-analyzer-core.uninitialized.Assign]
                   for (; j--; ) {
                          ^
   drivers/video/fbdev/core/sysimgblt.c:296:6: note: Assuming field 'state' is equal to FBINFO_STATE_RUNNING
           if (p->state != FBINFO_STATE_RUNNING)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:296:2: note: Taking false branch
           if (p->state != FBINFO_STATE_RUNNING)
           ^
   drivers/video/fbdev/core/sysimgblt.c:307:6: note: Assuming field 'fb_sync' is null
           if (p->fbops->fb_sync)
               ^~~~~~~~~~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:307:2: note: Taking false branch
           if (p->fbops->fb_sync)
           ^
   drivers/video/fbdev/core/sysimgblt.c:310:6: note: Assuming field 'depth' is equal to 1
           if (image->depth == 1) {
               ^~~~~~~~~~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:310:2: note: Taking true branch
           if (image->depth == 1) {
           ^
   drivers/video/fbdev/core/sysimgblt.c:311:7: note: Assuming field 'visual' is not equal to FB_VISUAL_TRUECOLOR
                   if (p->fix.visual == FB_VISUAL_TRUECOLOR ||
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:311:7: note: Left side of '||' is false
   drivers/video/fbdev/core/sysimgblt.c:312:7: note: Assuming field 'visual' is not equal to FB_VISUAL_DIRECTCOLOR
                       p->fix.visual == FB_VISUAL_DIRECTCOLOR) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:311:3: note: Taking false branch
                   if (p->fix.visual == FB_VISUAL_TRUECOLOR ||
                   ^
   drivers/video/fbdev/core/sysimgblt.c:320:7: note: Assuming the condition is true
                   if (32 % bpp == 0 && !start_index && !pitch_index &&
                       ^~~~~~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:320:7: note: Left side of '&&' is true
   drivers/video/fbdev/core/sysimgblt.c:320:24: note: Assuming 'start_index' is 0
                   if (32 % bpp == 0 && !start_index && !pitch_index &&
                                        ^~~~~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:320:7: note: Left side of '&&' is true
                   if (32 % bpp == 0 && !start_index && !pitch_index &&
                       ^
   drivers/video/fbdev/core/sysimgblt.c:320:40: note: Assuming 'pitch_index' is 0
                   if (32 % bpp == 0 && !start_index && !pitch_index &&
                                                        ^~~~~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:320:7: note: Left side of '&&' is true
                   if (32 % bpp == 0 && !start_index && !pitch_index &&
                       ^
   drivers/video/fbdev/core/sysimgblt.c:321:8: note: Assuming the condition is true
                       ((width & (32/bpp-1)) == 0) &&
                        ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:320:7: note: Left side of '&&' is true
                   if (32 % bpp == 0 && !start_index && !pitch_index &&
                       ^
   drivers/video/fbdev/core/sysimgblt.c:322:7: note: Assuming 'bpp' is >= 8
                       bpp >= 8 && bpp <= 32)
                       ^~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:320:7: note: Left side of '&&' is true
                   if (32 % bpp == 0 && !start_index && !pitch_index &&
                       ^
   drivers/video/fbdev/core/sysimgblt.c:322:19: note: Assuming 'bpp' is <= 32
                       bpp >= 8 && bpp <= 32)
                                   ^~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:320:3: note: Taking true branch
                   if (32 % bpp == 0 && !start_index && !pitch_index &&
                   ^
   drivers/video/fbdev/core/sysimgblt.c:323:4: note: Calling 'fast_imageblit'
                           fast_imageblit(image, p, dst1, fgcolor, bgcolor);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/video/fbdev/core/sysimgblt.c:197:9: note: 'j' declared without an initial value
           int i, j, k;
                  ^
   drivers/video/fbdev/core/sysimgblt.c:199:2: note: Control jumps to 'case 32:' @line 208
           switch (bpp) {
           ^
   drivers/video/fbdev/core/sysimgblt.c:211:3: note:  Execution continues on line 216
                   break;
                   ^
   drivers/video/fbdev/core/sysimgblt.c:216:2: note: Loop condition is false. Execution continues on line 223
           for (i = ppw-1; i--; ) {
           ^
   drivers/video/fbdev/core/sysimgblt.c:227:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < tablen; ++i)
           ^
   drivers/video/fbdev/core/sysimgblt.c:227:2: note: Loop condition is true.  Entering loop body
   drivers/video/fbdev/core/sysimgblt.c:227:2: note: Loop condition is false. Execution continues on line 230
   drivers/video/fbdev/core/sysimgblt.c:230:2: note: Loop condition is true.  Entering loop body
           for (i = image->height; i--; ) {
           ^
   drivers/video/fbdev/core/sysimgblt.c:240:3: note: 'Default' branch taken. Execution continues on line 274
                   switch (ppw) {
                   ^
   drivers/video/fbdev/core/sysimgblt.c:274:10: note: The expression is an uninitialized value. The computed value will also be garbage
                   for (; j--; ) {
                          ^
   Suppressed 45 warnings (45 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   68 warnings generated.
   drivers/ptp/ptp_chardev.c:24:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(&rq, 0, sizeof(rq));
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'

vim +274 drivers/video/fbdev/core/sysimgblt.c

68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  177  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  178  /*
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  179   * fast_imageblit - optimized monochrome color expansion
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  180   *
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  181   * Only if:  bits_per_pixel == 8, 16, or 32
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  182   *           image->width is divisible by pixel/dword (ppw);
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  183   *           fix->line_legth is divisible by 4;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  184   *           beginning and end of a scanline is dword aligned
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  185   */
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  186  static void fast_imageblit(const struct fb_image *image, struct fb_info *p,
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  187  				  void *dst1, u32 fgcolor, u32 bgcolor)
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  188  {
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  189  	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  190  	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  191  	u32 bit_mask, eorx, shift;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  192  	const char *s = image->data, *src;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  193  	u32 *dst;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  194  	const u32 *tab;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  195  	size_t tablen;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  196  	u32 colortab[16];
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  197  	int i, j, k;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  198  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  199  	switch (bpp) {
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  200  	case 8:
e4c690e061b909 drivers/video/sysimgblt.c            Anton Vorontsov    2008-04-28  201  		tab = fb_be_math(p) ? cfb_tab8_be : cfb_tab8_le;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  202  		tablen = 16;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  203  		break;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  204  	case 16:
e4c690e061b909 drivers/video/sysimgblt.c            Anton Vorontsov    2008-04-28  205  		tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  206  		tablen = 4;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  207  		break;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  208  	case 32:
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  209  		tab = cfb_tab32;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  210  		tablen = 2;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  211  		break;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  212  	default:
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  213  		return;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  214  	}
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  215  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  216  	for (i = ppw-1; i--; ) {
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  217  		fgx <<= bpp;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  218  		bgx <<= bpp;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  219  		fgx |= fgcolor;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  220  		bgx |= bgcolor;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  221  	}
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  222  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  223  	bit_mask = (1 << ppw) - 1;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  224  	eorx = fgx ^ bgx;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  225  	k = image->width/ppw;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  226  
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  227  	for (i = 0; i < tablen; ++i)
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  228  		colortab[i] = (tab[i] & eorx) ^ bgx;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  229  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  230  	for (i = image->height; i--; ) {
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  231  		dst = dst1;
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  232  		shift = 8;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  233  		src = s;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  234  
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  235  		/*
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  236  		 * Manually unroll the per-line copying loop for better
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  237  		 * performance. This works until we processed the last
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  238  		 * completely filled source byte (inclusive).
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  239  		 */
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  240  		switch (ppw) {
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  241  		case 4: /* 8 bpp */
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  242  			for (j = k; j >= 2; j -= 2, ++src) {
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  243  				*dst++ = colortab[(*src >> 4) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  244  				*dst++ = colortab[(*src >> 0) & bit_mask];
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  245  			}
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  246  			break;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  247  		case 2: /* 16 bpp */
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  248  			for (j = k; j >= 4; j -= 4, ++src) {
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  249  				*dst++ = colortab[(*src >> 6) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  250  				*dst++ = colortab[(*src >> 4) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  251  				*dst++ = colortab[(*src >> 2) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  252  				*dst++ = colortab[(*src >> 0) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  253  			}
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  254  			break;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  255  		case 1: /* 32 bpp */
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  256  			for (j = k; j >= 8; j -= 8, ++src) {
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  257  				*dst++ = colortab[(*src >> 7) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  258  				*dst++ = colortab[(*src >> 6) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  259  				*dst++ = colortab[(*src >> 5) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  260  				*dst++ = colortab[(*src >> 4) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  261  				*dst++ = colortab[(*src >> 3) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  262  				*dst++ = colortab[(*src >> 2) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  263  				*dst++ = colortab[(*src >> 1) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  264  				*dst++ = colortab[(*src >> 0) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  265  			}
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  266  			break;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  267  		}
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  268  
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  269  		/*
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  270  		 * For image widths that are not a multiple of 8, there
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  271  		 * are trailing pixels left on the current line. Print
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  272  		 * them as well.
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  273  		 */
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13 @274  		for (; j--; ) {
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  275  			shift -= ppw;
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  276  			*dst++ = colortab[(*src >> shift) & bit_mask];
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  277  			if (!shift) {
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  278  				shift = 8;
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  279  				++src;
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  280  			}
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  281  		}
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  282  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  283  		dst1 += p->fix.line_length;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  284  		s += spitch;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  285  	}
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  286  }
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  287  

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/2] fbdev: Fix sys_imageblit() for arbitrary image widths
@ 2022-03-14  2:19 kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2022-03-14  2:19 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 14262 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220313192952.12058-2-tzimmermann@suse.de>
References: <20220313192952.12058-2-tzimmermann@suse.de>
TO: Thomas Zimmermann <tzimmermann@suse.de>
TO: daniel(a)ffwll.ch
TO: deller(a)gmx.de
TO: m.szyprowski(a)samsung.com
TO: geert(a)linux-m68k.org
TO: javierm(a)redhat.com
TO: sam(a)ravnborg.org
CC: linux-fbdev(a)vger.kernel.org
CC: dri-devel(a)lists.freedesktop.org
CC: Thomas Zimmermann <tzimmermann@suse.de>

Hi Thomas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20220310]
[cannot apply to linus/master v5.17-rc7 v5.17-rc6 v5.17-rc5 v5.17-rc8]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/fbdev-Fix-image-blitting-for-arbitrary-image-widths/20220314-033209
base:    71941773e143369a73c9c4a3b62fbb60736a1182
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20220314/202203141008.L3JTRr7U-lkp(a)intel.com/config)
compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/video/fbdev/core/sysimgblt.c:274 fast_imageblit() error: uninitialized symbol 'j'.

vim +/j +274 drivers/video/fbdev/core/sysimgblt.c

68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  177  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  178  /*
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  179   * fast_imageblit - optimized monochrome color expansion
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  180   *
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  181   * Only if:  bits_per_pixel == 8, 16, or 32
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  182   *           image->width is divisible by pixel/dword (ppw);
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  183   *           fix->line_legth is divisible by 4;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  184   *           beginning and end of a scanline is dword aligned
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  185   */
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  186  static void fast_imageblit(const struct fb_image *image, struct fb_info *p,
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  187  				  void *dst1, u32 fgcolor, u32 bgcolor)
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  188  {
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  189  	u32 fgx = fgcolor, bgx = bgcolor, bpp = p->var.bits_per_pixel;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  190  	u32 ppw = 32/bpp, spitch = (image->width + 7)/8;
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  191  	u32 bit_mask, eorx, shift;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  192  	const char *s = image->data, *src;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  193  	u32 *dst;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  194  	const u32 *tab;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  195  	size_t tablen;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  196  	u32 colortab[16];
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  197  	int i, j, k;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  198  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  199  	switch (bpp) {
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  200  	case 8:
e4c690e061b909 drivers/video/sysimgblt.c            Anton Vorontsov    2008-04-28  201  		tab = fb_be_math(p) ? cfb_tab8_be : cfb_tab8_le;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  202  		tablen = 16;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  203  		break;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  204  	case 16:
e4c690e061b909 drivers/video/sysimgblt.c            Anton Vorontsov    2008-04-28  205  		tab = fb_be_math(p) ? cfb_tab16_be : cfb_tab16_le;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  206  		tablen = 4;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  207  		break;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  208  	case 32:
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  209  		tab = cfb_tab32;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  210  		tablen = 2;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  211  		break;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  212  	default:
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  213  		return;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  214  	}
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  215  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  216  	for (i = ppw-1; i--; ) {
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  217  		fgx <<= bpp;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  218  		bgx <<= bpp;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  219  		fgx |= fgcolor;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  220  		bgx |= bgcolor;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  221  	}
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  222  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  223  	bit_mask = (1 << ppw) - 1;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  224  	eorx = fgx ^ bgx;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  225  	k = image->width/ppw;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  226  
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  227  	for (i = 0; i < tablen; ++i)
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  228  		colortab[i] = (tab[i] & eorx) ^ bgx;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  229  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  230  	for (i = image->height; i--; ) {
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  231  		dst = dst1;
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  232  		shift = 8;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  233  		src = s;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  234  
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  235  		/*
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  236  		 * Manually unroll the per-line copying loop for better
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  237  		 * performance. This works until we processed the last
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  238  		 * completely filled source byte (inclusive).
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  239  		 */
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  240  		switch (ppw) {
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  241  		case 4: /* 8 bpp */
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  242  			for (j = k; j >= 2; j -= 2, ++src) {
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  243  				*dst++ = colortab[(*src >> 4) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  244  				*dst++ = colortab[(*src >> 0) & bit_mask];
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  245  			}
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  246  			break;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  247  		case 2: /* 16 bpp */
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  248  			for (j = k; j >= 4; j -= 4, ++src) {
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  249  				*dst++ = colortab[(*src >> 6) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  250  				*dst++ = colortab[(*src >> 4) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  251  				*dst++ = colortab[(*src >> 2) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  252  				*dst++ = colortab[(*src >> 0) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  253  			}
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  254  			break;
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  255  		case 1: /* 32 bpp */
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  256  			for (j = k; j >= 8; j -= 8, ++src) {
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  257  				*dst++ = colortab[(*src >> 7) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  258  				*dst++ = colortab[(*src >> 6) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  259  				*dst++ = colortab[(*src >> 5) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  260  				*dst++ = colortab[(*src >> 4) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  261  				*dst++ = colortab[(*src >> 3) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  262  				*dst++ = colortab[(*src >> 2) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  263  				*dst++ = colortab[(*src >> 1) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  264  				*dst++ = colortab[(*src >> 0) & bit_mask];
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  265  			}
6f29e04938bf50 drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-02-23  266  			break;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  267  		}
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  268  
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  269  		/*
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  270  		 * For image widths that are not a multiple of 8, there
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  271  		 * are trailing pixels left on the current line. Print
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  272  		 * them as well.
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  273  		 */
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13 @274  		for (; j--; ) {
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  275  			shift -= ppw;
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  276  			*dst++ = colortab[(*src >> shift) & bit_mask];
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  277  			if (!shift) {
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  278  				shift = 8;
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  279  				++src;
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  280  			}
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  281  		}
34e093954c6d2a drivers/video/fbdev/core/sysimgblt.c Thomas Zimmermann  2022-03-13  282  
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  283  		dst1 += p->fix.line_length;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  284  		s += spitch;
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  285  	}
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  286  }
68648ed1f58d98 drivers/video/sysimgblt.c            Antonino A. Daplas 2007-05-08  287  

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-03-24 22:00 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-13 19:29 [PATCH 0/2] fbdev: Fix image blitting for arbitrary image widths Thomas Zimmermann
2022-03-13 19:29 ` Thomas Zimmermann
2022-03-13 19:29 ` [PATCH 1/2] fbdev: Fix sys_imageblit() " Thomas Zimmermann
2022-03-13 19:29   ` Thomas Zimmermann
2022-03-14 20:56   ` Geert Uytterhoeven
2022-03-14 20:56     ` Geert Uytterhoeven
2022-03-17 11:20   ` Javier Martinez Canillas
2022-03-13 19:29 ` [PATCH 2/2] fbdev: Fix cfb_imageblit() " Thomas Zimmermann
2022-03-13 19:29   ` Thomas Zimmermann
2022-03-14  8:41   ` Marek Szyprowski
2022-03-17 10:54   ` Daniel Vetter
2022-03-17 10:54     ` Daniel Vetter
2022-03-17 11:22   ` Javier Martinez Canillas
2022-03-24 21:15   ` [2/2] " Guenter Roeck
2022-03-24 21:15     ` Guenter Roeck
2022-03-14  2:19 [PATCH 1/2] fbdev: Fix sys_imageblit() " kernel test robot
2022-03-14 14:44 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.