All of 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 5/9] drm: vkms: Add fb information to `vkms_writeback_job`
Date: Wed, 27 Apr 2022 10:31:43 +0300	[thread overview]
Message-ID: <20220427103143.3e84de91@eldfell> (raw)
In-Reply-To: <efaba095-498a-f03d-bab9-e2284b65dd59@gmail.com>

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

On Tue, 26 Apr 2022 21:43:12 -0300
Igor Torrente <igormtorrente@gmail.com> wrote:

> On 4/26/22 04:09, Pekka Paalanen wrote:
> > On Mon, 25 Apr 2022 21:56:12 -0300
> > Igor Torrente <igormtorrente@gmail.com> wrote:
> >   
> >> Hi Pekka,
> >>
> >> On 4/25/22 04:56, Pekka Paalanen wrote:  
> >>> On Sat, 23 Apr 2022 12:12:51 -0300
> >>> Igor Torrente <igormtorrente@gmail.com> wrote:
> >>>      
> >>>> Hi Pekka,
> >>>>
> >>>> On 4/20/22 08:23, Pekka Paalanen wrote:  
> >>>>> On Mon,  4 Apr 2022 17:45:11 -0300
> >>>>> Igor Torrente <igormtorrente@gmail.com> wrote:
> >>>>>         
> >>>>>> This commit is the groundwork to introduce new formats to the planes and
> >>>>>> writeback buffer. As part of it, a new buffer metadata field is added to
> >>>>>> `vkms_writeback_job`, this metadata is represented by the `vkms_composer`
> >>>>>> struct.  
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> should this be talking about vkms_frame_info struct instead?  
> >>>>
> >>>> Yes it should. I will fix this. Thanks.
> >>>>     
> >>>>>         
> >>>>>>
> >>>>>> Also adds two new function pointers (`{wb,plane}_format_transform_func`)
> >>>>>> are defined to handle format conversion to/from internal format.
> >>>>>>
> >>>>>> These things will allow us, in the future, to have different compositing
> >>>>>> and wb format types.
> >>>>>>
> >>>>>> V2: Change the code to get the drm_framebuffer reference and not copy its
> >>>>>>        contents(Thomas Zimmermann).
> >>>>>> V3: Drop the refcount in the wb code(Thomas Zimmermann).
> >>>>>> V5: Add {wb,plane}_format_transform_func to vkms_writeback_job
> >>>>>>        and vkms_plane_state (Pekka Paalanen)
> >>>>>>
> >>>>>> Signed-off-by: Igor Torrente <igormtorrente@gmail.com>
> >>>>>> ---
> >>>>>>     drivers/gpu/drm/vkms/vkms_composer.c  |  4 ++--
> >>>>>>     drivers/gpu/drm/vkms/vkms_drv.h       | 31 +++++++++++++++++++++------
> >>>>>>     drivers/gpu/drm/vkms/vkms_plane.c     | 10 ++++-----
> >>>>>>     drivers/gpu/drm/vkms/vkms_writeback.c | 20 ++++++++++++++---
> >>>>>>     4 files changed, 49 insertions(+), 16 deletions(-)  
> > 
> > ...
> >   
> >>>>>> diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> >>>>>> index 2e6342164bef..2704cfb6904b 100644
> >>>>>> --- a/drivers/gpu/drm/vkms/vkms_drv.h
> >>>>>> +++ b/drivers/gpu/drm/vkms/vkms_drv.h  
> > 
> > ...
> >   
> >>>>>> +
> >>>>>> +struct vkms_writeback_job {
> >>>>>> +	struct dma_buf_map data[DRM_FORMAT_MAX_PLANES];
> >>>>>> +	struct vkms_frame_info frame_info;  
> >>>>>
> >>>>> Which frame_info is this? Should the field be called wb_frame_info?  
> >>>>
> >>>> Considering it's already in the writeback_job struct do you think this
> >>>> necessary?  
> >>>
> >>> This struct has 'data' too, and that is not the wb buffer, right?  
> >>
> >> AFAIU, no. Each plane has its own `iosys_map map[]`.
> >>  
> >>>
> >>> Hmm, if it's not the wb buffer, then using DRM_FORMAT_MAX_PLANES is
> >>> odd...  
> >>
> >> Yeah. I honestly don't have any clue why we have an array of `iosys_map`
> >> for each plane, why we only use the map[0] and why we only call
> >> `iosys_map_is_null` only to the `primary_composer`.
> >>
> >> Maybe @tzimmermann or @rodrigosiqueiramelo can shed some light on these
> >> questions.  
> > 
> > Yeah, those questions would be really good to figure out.
> > 
> > FWIW, I can tell you this: "plane" has two different meanings in the
> > context of KMS:
> > 
> > https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/glossary.md#plane
> > 
> > DRM_FORMAT_MAX_PLANES refers to the number of planes (or the number of
> > memory buffers) for a single image (single framebuffer). Most often
> > with RGB there is just one plane in one memory buffer. RGB buffer could
> > be accompanied with e.g. a compression data buffer, so two planes,
> > one buffer each. Different YUV formats have different numbers of planes
> > from N=1 to 3, and those plane may be stored in 1 to N memory buffers
> > (with dmabuf handles pointing to them).
> > 
> > The number of planes and the number of memory buffers are often
> > conflated in APIs by just passing the same memory buffer multiple times
> > when multiple planes are stored in the same buffer (with different
> > offset).
> > 
> > The number of planes is determined by the pixel format and the format
> > modifier. The number of memory buffers is more... vaguely defined and
> > may vary sometimes.  
> 
> Right. So probably this answers the first two questions. And also
> probably my initial implementation of YUV420 and NV12 is wrong.

If I'm reading the code right, it's using the maximum number of image
planes (four) as the maximum number of KMS planes (chosen by the
driver). IOW, it confusing the two meanings of "plane" which have
nothing to do with each other.

Assuming that there is one data[] element for each KMS plane created by
VKMS. That makes a further assumption that each KMS plane framebuffer
has only one image plane. I think. Which they do when you are limited
to RGB formats.


Thanks,
pq

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

  reply	other threads:[~2022-04-27  7: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 [this message]
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
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=20220427103143.3e84de91@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 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.