dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: linux-fbdev@vger.kernel.org, deller@gmx.de, javierm@redhat.com,
	dri-devel@lists.freedesktop.org, geert@linux-m68k.org
Subject: Re: [PATCH 2/2] fbdev: Improve performance of sys_imageblit()
Date: Thu, 17 Feb 2022 13:08:55 +0100	[thread overview]
Message-ID: <0fcec169-b0d4-676d-7d3f-e94adccf7c22@suse.de> (raw)
In-Reply-To: <20220217110519.ql5baa46sbsfb5cy@sirius.home.kraxel.org>


[-- Attachment #1.1: Type: text/plain, Size: 1912 bytes --]

Hi

Am 17.02.22 um 12:05 schrieb Gerd Hoffmann:
>> -		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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2022-02-17 12:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 10:34 [PATCH 0/2] fbdev: Improve performance of fbdev console Thomas Zimmermann
2022-02-17 10:34 ` [PATCH 1/2] fbdev: Improve performance of sys_fillrect() Thomas Zimmermann
2022-02-18  9:09   ` Javier Martinez Canillas
2022-02-18  9:35   ` Sam Ravnborg
2022-02-17 10:34 ` [PATCH 2/2] fbdev: Improve performance of sys_imageblit() Thomas Zimmermann
2022-02-17 11:05   ` Gerd Hoffmann
2022-02-17 12:08     ` Thomas Zimmermann [this message]
2022-02-18  9:24   ` Javier Martinez Canillas
2022-02-18 10:14   ` Sam Ravnborg
2022-02-18 14:09     ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0fcec169-b0d4-676d-7d3f-e94adccf7c22@suse.de \
    --to=tzimmermann@suse.de \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=javierm@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=linux-fbdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).