Re: [RFC PATCH v3 0/3] Support for Solid Fill Planes
On Fri, 6 Jan 2023 23:49:34 +0200 Dmitry Baryshkov wrote: > On Fri, 6 Jan 2023 at 20:41, Daniel Vetter wrote: > > > > On Fri, Jan 06, 2023 at 05:43:23AM +0200, Dmitry Baryshkov wrote: > > > On Fri, 6 Jan 2023 at 02:38, Jessica Zhang > > > wrote: > > > > > > > > > > > > > > > > On 1/5/2023 3:33 AM, Daniel Vetter wrote: > > > > > On Wed, Jan 04, 2023 at 03:40:33PM -0800, Jessica Zhang wrote: > > > > >> Introduce and add support for a solid_fill property. When the > > > > >> solid_fill > > > > >> property is set, and the framebuffer is set to NULL, memory fetch > > > > >> will be > > > > >> disabled. > > > > >> > > > > >> In addition, loosen the NULL FB checks within the atomic commit > > > > >> callstack > > > > >> to allow a NULL FB when the solid_fill property is set and add FB > > > > >> checks > > > > >> in methods where the FB was previously assumed to be non-NULL. > > > > >> > > > > >> Finally, have the DPU driver use drm_plane_state.solid_fill and > > > > >> instead of > > > > >> dpu_plane_state.color_fill, and add extra checks in the DPU atomic > > > > >> commit > > > > >> callstack to account for a NULL FB in cases where solid_fill is set. > > > > >> > > > > >> Some drivers support hardware that have optimizations for solid fill > > > > >> planes. This series aims to expose these capabilities to userspace as > > > > >> some compositors have a solid fill flag (ex. SOLID_COLOR in the > > > > >> Android > > > > >> hardware composer HAL) that can be set by apps like the Android Gears > > > > >> app. > > > > >> > > > > >> Userspace can set the solid_fill property to a blob containing the > > > > >> appropriate version number and solid fill color (in RGB323232 > > > > >> format) and > > > > >> setting the framebuffer to NULL. > > > > >> > > > > >> Note: Currently, there's only one version of the solid_fill blob > > > > >> property. > > > > >> However if other drivers want to support a similar feature, but > > > > >> require > > > > >> more than just the solid fill color, they can extend this feature by > > > > >> creating additional versions of the drm_solid_fill struct. > > > > >> > > > > >> Changes in V2: > > > > >> - Dropped SOLID_FILL_FORMAT property (Simon) > > > > >> - Switched to implementing solid_fill property as a blob (Simon, > > > > >> Dmitry) > > > > >> - Changed to checks for if solid_fill_blob is set (Dmitry) > > > > >> - Abstracted (plane_state && !solid_fill_blob) checks to helper > > > > >> method > > > > >>(Dmitry) > > > > >> - Removed DPU_PLANE_COLOR_FILL_FLAG > > > > >> - Fixed whitespace and indentation issues (Dmitry) > > > > > > > > > > Now that this is a blob, I do wonder again whether it's not cleaner > > > > > to set > > > > > the blob as the FB pointer. Or create some kind other kind of special > > > > > data > > > > > source objects (because solid fill is by far not the only such thing). > > > > > > > > > > We'd still end up in special cases like when userspace that doesn't > > > > > understand solid fill tries to read out such a framebuffer, but these > > > > > cases already exist anyway for lack of priviledges. > > > > > > > > > > So I still think that feels like the more consistent way to integrate > > > > > this > > > > > feature. Which doesn't mean it has to happen like that, but the > > > > > patches/cover letter should at least explain why we don't do it like > > > > > this. > > > > > > > > Hi Daniel, > > > > > > > > IIRC we were facing some issues with this check [1] when trying to set > > > > FB to a PROP_BLOB instead. Which is why we went with making it a > > > > separate property instead. Will mention this in the cover letter. > > > > > > What kind of issues? Could you please describe them? > > > > We switched from bitmask to enum style for prop types, which means it's > > not possible to express with the current uapi a property which accepts > > both an object or a blob. > > > > Which yeah sucks a bit ... > > > > But! > > > > blob properties are kms objects (like framebuffers), so it should be > > possible to stuff a blob into an object property as-is. Of course you need > > to update the validation code to make sure we accept either an fb or a > > blob for the internal representation. But that kind of split internally is > > required no matter what I think. > > I checked your idea and notes from Jessica. So while we can pass blobs > to property objects, the prop_fb_id is created as an object property > with the type DRM_MODE_OBJECT_FB. Passing DRM_MODE_OBJECT_BLOB would > fail a check in drm_property_change_valid_get() -> > __drm_mode_object_find(). And I don't think that we should break the > existing validation code for this special case. > > If you insist on using FB_ID for passing solid_fill information, I'd > ask you to reconsider using a 1x1 framebuffer. It would be fully > compatible with the existing userspace, which can then treat it > seamlessly. Hi, indeed, what about simply using a 1x1 framebuffer for real
Re: [RFC PATCH v3 0/3] Support for Solid Fill Planes
On Tuesday, January 31st, 2023 at 10:25, Pekka Paalanen wrote: > indeed, what about simply using a 1x1 framebuffer for real? Why was that > approach rejected? Ideally we don't want to allocate any GPU memory for the solid-fill stuff. And if we special-case 1x1 FB creation to not be backed by real GPU memory then we hit several situations where user-space expects a real FB but there isn't: for instance, GETFB2 converts from FB object ID to GEM handles. Even if we make GETFB2 fail and accept that this breaks user-space, then there is no way for user-space to recover the FB color for flicker-free transitions and such. This is all purely from a uAPI PoV, completely ignoring the potential issues with the internal kernel abstractions which might not be suitable for this either.
Re: [RFC PATCH v3 0/3] Support for Solid Fill Planes
On Tue, 31 Jan 2023 10:06:39 + Simon Ser wrote: > On Tuesday, January 31st, 2023 at 10:25, Pekka Paalanen > wrote: > > > indeed, what about simply using a 1x1 framebuffer for real? Why was that > > approach rejected? > > Ideally we don't want to allocate any GPU memory for the solid-fill > stuff. And if we special-case 1x1 FB creation to not be backed by real > GPU memory then we hit several situations where user-space expects a > real FB but there isn't: for instance, GETFB2 converts from FB object > ID to GEM handles. Even if we make GETFB2 fail and accept that this > breaks user-space, then there is no way for user-space to recover the > FB color for flicker-free transitions and such. > > This is all purely from a uAPI PoV, completely ignoring the potential > issues with the internal kernel abstractions which might not be suitable > for this either. I mean a real 1x1 buffer: a dumb buffer. It would be absolutely compatible with anything existing, because it is a real FB. As a dumb buffer it would be trivial to write into and read out. As 1x1 it would be tiny (one page?). Even if something needs to raw-access uncached memory over 33 MHz PCI bus or whatever the worst case is, it's just one pixel, so it's fast enough, right? And it only needs to be read once when set, like USB display drivers do. The driver does not need to manually apply any color operations, because none are supported in this special case. One can put all these limitations and even pixel format in the plane property that tells userspace that a 1x1 FB works here. To recap, the other alternatives under discussion I see right now are: - this proposal of dedicated fill color property - stuffing something new into FB_ID property There is also the question of other kinds of plane content sources like live camera feeds where userspace won't be shovelling each frame individually like we do now. 1x1 dumb buffer is not as small and lean as a dedicated fill color property, but the UAPI design questions seem to be much less. What's the best trade-off and for whom? Thanks, pq pgp8JvF70KNH8.pgp Description: OpenPGP digital signature
Re: [RFC PATCH v3 0/3] Support for Solid Fill Planes
On Tuesday, January 31st, 2023 at 12:13, Pekka Paalanen wrote: > On Tue, 31 Jan 2023 10:06:39 + > Simon Ser wrote: > > > On Tuesday, January 31st, 2023 at 10:25, Pekka Paalanen > > wrote: > > > > > indeed, what about simply using a 1x1 framebuffer for real? Why was that > > > approach rejected? > > > > Ideally we don't want to allocate any GPU memory for the solid-fill > > stuff. And if we special-case 1x1 FB creation to not be backed by real > > GPU memory then we hit several situations where user-space expects a > > real FB but there isn't: for instance, GETFB2 converts from FB object > > ID to GEM handles. Even if we make GETFB2 fail and accept that this > > breaks user-space, then there is no way for user-space to recover the > > FB color for flicker-free transitions and such. > > > > This is all purely from a uAPI PoV, completely ignoring the potential > > issues with the internal kernel abstractions which might not be suitable > > for this either. > > I mean a real 1x1 buffer: a dumb buffer. > > It would be absolutely compatible with anything existing, because it is > a real FB. As a dumb buffer it would be trivial to write into and read > out. As 1x1 it would be tiny (one page?). Even if something needs to > raw-access uncached memory over 33 MHz PCI bus or whatever the worst > case is, it's just one pixel, so it's fast enough, right? And it only > needs to be read once when set, like USB display drivers do. The driver > does not need to manually apply any color operations, because none are > supported in this special case. > > One can put all these limitations and even pixel format in the plane > property that tells userspace that a 1x1 FB works here. > > To recap, the other alternatives under discussion I see right now are: > > - this proposal of dedicated fill color property > - stuffing something new into FB_ID property > > There is also the question of other kinds of plane content sources like > live camera feeds where userspace won't be shovelling each frame > individually like we do now. > > 1x1 dumb buffer is not as small and lean as a dedicated fill color > property, but the UAPI design questions seem to be much less. What's > the best trade-off and for whom? By "real memory" yes I mean the 1 page. Using a real buffer also brings back other discussions, e.g. the one about which pixel formats to accept.
Re: [RFC PATCH v3 0/3] Support for Solid Fill Planes
On Tue, 31 Jan 2023 11:21:18 + Simon Ser wrote: > On Tuesday, January 31st, 2023 at 12:13, Pekka Paalanen > wrote: > > > On Tue, 31 Jan 2023 10:06:39 + > > Simon Ser wrote: > > > > > On Tuesday, January 31st, 2023 at 10:25, Pekka Paalanen > > > wrote: > > > > > > > indeed, what about simply using a 1x1 framebuffer for real? Why was that > > > > approach rejected? > > > > > > Ideally we don't want to allocate any GPU memory for the solid-fill > > > stuff. And if we special-case 1x1 FB creation to not be backed by real > > > GPU memory then we hit several situations where user-space expects a > > > real FB but there isn't: for instance, GETFB2 converts from FB object > > > ID to GEM handles. Even if we make GETFB2 fail and accept that this > > > breaks user-space, then there is no way for user-space to recover the > > > FB color for flicker-free transitions and such. > > > > > > This is all purely from a uAPI PoV, completely ignoring the potential > > > issues with the internal kernel abstractions which might not be suitable > > > for this either. > > > > I mean a real 1x1 buffer: a dumb buffer. > > > > It would be absolutely compatible with anything existing, because it is > > a real FB. As a dumb buffer it would be trivial to write into and read > > out. As 1x1 it would be tiny (one page?). Even if something needs to > > raw-access uncached memory over 33 MHz PCI bus or whatever the worst > > case is, it's just one pixel, so it's fast enough, right? And it only > > needs to be read once when set, like USB display drivers do. The driver > > does not need to manually apply any color operations, because none are > > supported in this special case. > > > > One can put all these limitations and even pixel format in the plane > > property that tells userspace that a 1x1 FB works here. > > > > To recap, the other alternatives under discussion I see right now are: > > > > - this proposal of dedicated fill color property > > - stuffing something new into FB_ID property > > > > There is also the question of other kinds of plane content sources like > > live camera feeds where userspace won't be shovelling each frame > > individually like we do now. > > > > 1x1 dumb buffer is not as small and lean as a dedicated fill color > > property, but the UAPI design questions seem to be much less. What's > > the best trade-off and for whom? > > By "real memory" yes I mean the 1 page. > > Using a real buffer also brings back other discussions, e.g. the one about > which pixel formats to accept. Yeah, which is why I wrote: "One can put all these limitations and even pixel format in the plane property". It doesn't even need to be a variable in the UAPI, it can be hardcoded in the UAPI doc. Please, do not understand this as me strongly advocating for the real FB approach! I just don't want that option to be misunderstood. I don't really care which design is chosen, but I do care about documenting why other designs were rejected. If the rejection reasons were false, they should be revised, even if the decision does not change. Thanks, pq pgpnixTy5e5lD.pgp Description: OpenPGP digital signature