dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pekka Paalanen <ppaalanen@gmail.com>
To: Igor Torrente <igormtorrente@gmail.com>
Cc: hamohammed.sa@gmail.com, tzimmermann@suse.de,
	rodrigosiqueiramelo@gmail.com, airlied@linux.ie,
	leandro.ribeiro@collabora.com, melissa.srw@gmail.com,
	dri-devel@lists.freedesktop.org, tales.aparecida@gmail.com,
	~lkcamp/patches@lists.sr.ht
Subject: Re: [PATCH v5 6/9] drm: vkms: Refactor the plane composer to accept new formats
Date: Fri, 29 Apr 2022 15:31:24 +0300	[thread overview]
Message-ID: <20220429153124.31ba4ae4@eldfell> (raw)
In-Reply-To: <5095c372-f326-03cf-5229-69e2aac72a02@gmail.com>

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

On Wed, 27 Apr 2022 21:44:34 -0300
Igor Torrente <igormtorrente@gmail.com> wrote:

> On 4/27/22 04:43, Pekka Paalanen wrote:
> > On Tue, 26 Apr 2022 22:22:22 -0300
> > Igor Torrente <igormtorrente@gmail.com> wrote:
> >   
> >> On April 26, 2022 10:03:09 PM GMT-03:00, Igor Torrente <igormtorrente@gmail.com> wrote:  
> >>>
> >>>
> >>> On 4/25/22 22:54, Igor Torrente wrote:  
> >>>> Hi Pekka,
> >>>>
> >>>> On 4/25/22 05:10, Pekka Paalanen wrote:  
> >>>>> On Sat, 23 Apr 2022 15:53:20 -0300
> >>>>> Igor Torrente <igormtorrente@gmail.com> wrote:
> >>>>>      
> > 
> > ...
> >   
> >>>>>>>>> +static void argb_u16_to_XRGB8888(struct vkms_frame_info *frame_info,
> >>>>>>>>> +				 const struct line_buffer *src_buffer, int y)
> >>>>>>>>> +{
> >>>>>>>>> +	int x, x_dst = frame_info->dst.x1;
> >>>>>>>>> +	u8 *dst_pixels = packed_pixels_addr(frame_info, x_dst, y);
> >>>>>>>>> +	struct pixel_argb_u16 *in_pixels = src_buffer->pixels;
> >>>>>>>>> +	int x_limit = min_t(size_t, drm_rect_width(&frame_info->dst),
> >>>>>>>>> +			    src_buffer->n_pixels);
> >>>>>>>>> +
> >>>>>>>>> +	for (x = 0; x < x_limit; x++, dst_pixels += 4) {
> >>>>>>>>> +		dst_pixels[3] = (u8)0xff;  
> >>>>>>>>
> >>>>>>>> When writing to XRGB, it's not necessary to ensure the X channel has
> >>>>>>>> any sensible value. Anyone reading from XRGB must ignore that value
> >>>>>>>> anyway. So why not write something wacky here, like 0xa1, that is far
> >>>>>>>> enough from both 0x00 or 0xff to not be confused with them even
> >>>>>>>> visually? Also not 0x7f or 0x80 which are close to half of 0xff.
> >>>>>>>>
> >>>>>>>> Or, you could save a whole function and just use argb_u16_to_ARGBxxxx()
> >>>>>>>> instead, even for XRGB destination.  
> >>>>>>>
> >>>>>>>
> >>>>>>> Right. Maybe I could just leave the channel untouched.  
> >>>>>
> >>>>> Untouched may not be a good idea. Leaving anything untouched always has
> >>>>> the risk of leaking information through uninitialized memory. Maybe not
> >>>>> in this case because the destination is allocated by userspace already,
> >>>>> but nothing beats being obviously correct.  
> >>>>
> >>>> Makes sense.
> >>>>      
> >>>>>
> >>>>> Whatever you decide here, be prepared for it becoming de-facto kernel
> >>>>> UABI, because it is easy for userspace to (accidentally) rely on the
> >>>>> value, no matter what you pick.  
> >>>>
> >>>> I hope to make the right decision then.  
> >>>
> >>> The de-facto UABI seems to be already in place for {A, X}RGB8888.  
> >>
> >> "Only XRGB_8888  
> > 
> > If that's only IGT, then you should raise an issue with IGT about this,
> > to figure out if IGT is wrong by accident or if it is deliberate, and
> > are we stuck with it.
> > 
> > This is why I would want to fill X with garbage, to make the
> > expectations clear before the "obvious and logical constant value for X"
> > makes a mess by making XRGB indistinguishable from ARGB. Then the next
> > question is, do we need a special function to write out XRGB values, or
> > can we simply re-use the ARGB function.
> > 
> > Do the tests expect X channel to be filled with 0xff or with the actual
> > A values? This question will matter when all planes have ARGB
> > framebuffers and no background color. Then even more questions will
> > arise about what should actually happen with A values (blending
> > equation).  
> 
> I dig into the igt code a little bit and found that it's waiting for the 
> channel to not be changed.
> It fills all the pixels in the line with a value and calculates the CRC 
> of the entire buffer, including the alpha.
> 
> I will crate an issue asking if this is intended.

I just remembered this:
https://lists.freedesktop.org/archives/igt-dev/2022-March/039920.html


Thanks,
pq

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

  reply	other threads:[~2022-04-29 12:31 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04 20:45 [PATCH v5 0/9] Add new formats support to vkms Igor Torrente
2022-04-04 20:45 ` [PATCH v5 1/9] drm: vkms: Alloc the compose frame using vzalloc Igor Torrente
2022-04-05 14:05   ` André Almeida
2022-04-05 19:03     ` Igor Torrente
2022-04-04 20:45 ` [PATCH v5 2/9] drm: vkms: Replace hardcoded value of `vkms_composer.map` to DRM_FORMAT_MAX_PLANES Igor Torrente
2022-04-04 20:45 ` [PATCH v5 3/9] drm: vkms: Rename `vkms_composer` to `vkms_frame_info` Igor Torrente
2022-04-04 20:45 ` [PATCH v5 4/9] drm: drm_atomic_helper: Add a new helper to deal with the writeback connector validation Igor Torrente
2022-04-05 14:21   ` André Almeida
2022-04-05 19:05     ` Igor Torrente
2022-04-04 20:45 ` [PATCH v5 5/9] drm: vkms: Add fb information to `vkms_writeback_job` Igor Torrente
2022-04-20 11:23   ` Pekka Paalanen
2022-04-23 15:12     ` Igor Torrente
2022-04-25  7:56       ` Pekka Paalanen
2022-04-26  0:56         ` Igor Torrente
2022-04-26  7:09           ` Pekka Paalanen
2022-04-27  0:43             ` Igor Torrente
2022-04-27  7:31               ` Pekka Paalanen
2022-04-04 20:45 ` [PATCH v5 6/9] drm: vkms: Refactor the plane composer to accept new formats Igor Torrente
2022-04-20 12:36   ` Pekka Paalanen
2022-04-23 16:04     ` Igor Torrente
2022-04-23 18:53       ` Igor Torrente
2022-04-25  8:10         ` Pekka Paalanen
2022-04-26  1:54           ` Igor Torrente
2022-04-27  1:03             ` Igor Torrente
2022-04-27  1:22               ` Igor Torrente
2022-04-27  7:43                 ` Pekka Paalanen
2022-04-28  0:44                   ` Igor Torrente
2022-04-29 12:31                     ` Pekka Paalanen [this message]
2022-04-04 20:45 ` [PATCH v5 7/9] drm: vkms: Supports to the case where primary plane doesn't match the CRTC Igor Torrente
2022-04-20 13:13   ` Pekka Paalanen
2022-04-24  0:41     ` Igor Torrente
2022-04-04 20:45 ` [PATCH v5 8/9] drm: vkms: Adds XRGB_16161616 and ARGB_1616161616 formats Igor Torrente
2022-04-20 13:19   ` Pekka Paalanen
2022-05-07  7:32   ` Thomas Zimmermann
2022-05-10 20:32     ` Igor Torrente
2022-04-04 20:45 ` [PATCH v5 9/9] drm: vkms: Add support to the RGB565 format Igor Torrente
2022-04-21 10:58   ` Pekka Paalanen
2022-04-27  0:53     ` Igor Torrente
2022-04-27  7:55       ` Pekka Paalanen
2022-05-06 23:05         ` Igor Torrente
2022-05-09  7:53           ` Pekka Paalanen
2022-05-10 19:24             ` Igor Torrente
2022-06-13  9:52 ` [PATCH v5 0/9] Add new formats support to vkms Melissa Wen
2022-06-13 20:26   ` Igor Torrente

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=20220429153124.31ba4ae4@eldfell \
    --to=ppaalanen@gmail.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=igormtorrente@gmail.com \
    --cc=leandro.ribeiro@collabora.com \
    --cc=melissa.srw@gmail.com \
    --cc=rodrigosiqueiramelo@gmail.com \
    --cc=tales.aparecida@gmail.com \
    --cc=tzimmermann@suse.de \
    --cc=~lkcamp/patches@lists.sr.ht \
    /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