Thread (10 messages) 10 messages, 4 authors, 2022-02-18

Re: [PATCH 2/2] fbdev: Improve performance of sys_imageblit()

From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2022-02-17 12:09:05
Also in: dri-devel

Hi

Am 17.02.22 um 12:05 schrieb Gerd Hoffmann:
quoted
-		for (j = k; j--; ) {
-			shift -= ppw;
-			end_mask = tab[(*src >> shift) & bit_mask];
-			*dst++ = (end_mask & eorx) ^ bgx;
-			if (!shift) {
-				shift = 8;
-				src++;
+		for (j = k; j; j -= jdecr, ++src) {
+			switch (ppw) {
+			case 4: /* 8 bpp */
+				*dst++ = colortab[(*src >> 4) & bit_mask];
+				*dst++ = colortab[(*src >> 0) & bit_mask];
+				break;
+			case 2: /* 16 bpp */
+				*dst++ = colortab[(*src >> 6) & bit_mask];
+				*dst++ = colortab[(*src >> 4) & bit_mask];
+				*dst++ = colortab[(*src >> 2) & bit_mask];
+				*dst++ = colortab[(*src >> 0) & bit_mask];
+				break;
+			case 1: /* 32 bpp */
+				*dst++ = colortab[(*src >> 7) & bit_mask];
+				*dst++ = colortab[(*src >> 6) & bit_mask];
+				*dst++ = colortab[(*src >> 5) & bit_mask];
+				*dst++ = colortab[(*src >> 4) & bit_mask];
+				*dst++ = colortab[(*src >> 3) & bit_mask];
+				*dst++ = colortab[(*src >> 2) & bit_mask];
+				*dst++ = colortab[(*src >> 1) & bit_mask];
+				*dst++ = colortab[(*src >> 0) & bit_mask];
+				break;
  			}
How about moving the switch out of the loop, i.e.

switch (ppw) {
case 4:
     for (j = ...) {
         *dst++ = colortab[(*src >> 4) & bit_mask];
         *dst++ = colortab[(*src >> 0) & bit_mask];
     }
[ ... ]
}

?
No difference. Values for the microbenchmark (rdtsc around 
sys_imageblit()) and the directory listing stabilize at the same 
numbers.  I'll still go with you suggestion, because the code is more 
readable.

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

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help