All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jocelyn Falempe <jfalempe@redhat.com>
To: michel.daenzer@mailbox.org,
	Thomas Zimmermann <tzimmermann@suse.de>,
	dri-devel@lists.freedesktop.org, lyude@redhat.com
Subject: Re: [PATCH] mgag200: Enable atomic gamma lut update
Date: Mon, 9 May 2022 23:00:54 +0200	[thread overview]
Message-ID: <0be47bc4-ae27-0293-eeb0-83010d0ab948@redhat.com> (raw)
In-Reply-To: <6b7acc25-64b3-297d-7842-a8cd59c8d98d@daenzer.net>

On 09/05/2022 18:04, Michel Dänzer wrote:
> On 2022-05-09 16:22, Thomas Zimmermann wrote:
>>
>> It might also make sense to adjust the starting value of the lut table such that its final entry is used for the final entry in the HW palette. For typical gamma ramps ~2, the curve is fairly flat for small values and goes up steeply at high values. (Please correct me if I'm misinterpreting the gamma ramps.)
> 
> I don't think that's accurate. The most common ramp should be a straight line from 0 to the maximum value, and others may be curved toward the top or bottom.
> 
> 
>> For 15-bit case I'd do thing like this.
>>
>>   lut += 7;
>>   for (i < 0; i < 32; ++i, lut += 8) {
>>      // write  lut
>>   }
>>
>> 16-bit is complicated and may better be done in 2 loops
>>
>>   lutr += 7;
>>   lutg += 3;
>>   lutb += 7;
>>   for (i < 0; i < 32; ++i, lutr += 8, lutg += 3, lutb += 8) {
>>     // write  r/g/b lut
>>   }
>>   for (; i < 64; ++i, lutg += 3) {
>>     // write  0/g/0 lut
>>   }
> 
> That'll just drop the first 3-7 entries of the LUT instead of the last ones, i.e. generally the full black entries instead of the full white ones.
> 
> Ideally, the loop should start at 0 and then count as evenly as possible up to 255/63/31. I realize that's tricky though, and I don't have any specific suggestions for how to achieve this offhand.
> 
> 

If you want 32 values from the 256 table, something like this should work:

for (i=0; i<32; i++) {
    lut_index = i * 8 + i / 4;
}

lut_index will have this value:

0, 8, 16, 24, 33, 41, 49, 57, 66, 74, 82, 90, 99, 107, 115, 123, 132, 
140, 148, 156, 165, 173, 181, 189, 198, 206, 214, 222, 231, 239, 247, 255


-- 

Jocelyn


  reply	other threads:[~2022-05-09 21:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09  9:49 [PATCH] mgag200: Enable atomic gamma lut update Jocelyn Falempe
2022-05-09 14:22 ` Thomas Zimmermann
2022-05-09 15:43   ` Jocelyn Falempe
2022-05-10  7:13     ` Thomas Zimmermann
2022-05-09 16:04   ` Michel Dänzer
2022-05-09 21:00     ` Jocelyn Falempe [this message]
2022-05-10  6:58       ` Thomas Zimmermann
2022-05-09 21:37 ` kernel test robot
2022-05-09 21:37   ` kernel test robot

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=0be47bc4-ae27-0293-eeb0-83010d0ab948@redhat.com \
    --to=jfalempe@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    --cc=michel.daenzer@mailbox.org \
    --cc=tzimmermann@suse.de \
    /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 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.