diff mbox series

[v2,01/10] drm/fourcc: Add macros to determine the modifier vendor

Message ID 20210326145139.467072-2-thierry.reding@gmail.com
State Rejected
Headers show
Series drm/tegra: Various improvements | expand

Commit Message

Thierry Reding March 26, 2021, 2:51 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

When working with framebuffer modifiers, it can be useful to extract the
vendor identifier or check a modifier against a given vendor identifier.
Add one macro that extracts the vendor identifier and a helper to check
a modifier against a given vendor identifier.

v2: add macro to extract vendor ID from modifier (Simon)

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 include/uapi/drm/drm_fourcc.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Simon Ser March 26, 2021, 2:54 p.m. UTC | #1
LGTM, thanks!

Reviewed-by: Simon Ser <contact@emersion.fr>

Let me know if you need me to push this to drm-misc-next.
Thierry Reding March 26, 2021, 4:29 p.m. UTC | #2
On Fri, Mar 26, 2021 at 02:54:22PM +0000, Simon Ser wrote:
> LGTM, thanks!
> 
> Reviewed-by: Simon Ser <contact@emersion.fr>
> 
> Let me know if you need me to push this to drm-misc-next.

I do have commit access for drm-misc-next, but I was thinking that I
could take this through the drm/tegra tree along with the subsequent
patches because of the dependency.

Anyone willing to provide an Acked-by for that?

Thierry
Daniel Stone June 9, 2021, 4:28 p.m. UTC | #3
Hi Thierry,

On Tue, 27 Apr 2021 at 19:40, Daniel Stone <daniel@fooishbar.org> wrote:
> On Fri, 26 Mar 2021 at 16:29, Thierry Reding <thierry.reding@gmail.com> wrote:
>> On Fri, Mar 26, 2021 at 02:54:22PM +0000, Simon Ser wrote:
>> > LGTM, thanks!
>> >
>> > Reviewed-by: Simon Ser <contact@emersion.fr>
>> >
>> > Let me know if you need me to push this to drm-misc-next.
>>
>> I do have commit access for drm-misc-next, but I was thinking that I
>> could take this through the drm/tegra tree along with the subsequent
>> patches because of the dependency.
>>
>> Anyone willing to provide an Acked-by for that?
>
> Yep, no harm if that makes your life easier, so for both the patch itself and merging through tegra:
> Acked-by: Daniel Stone <daniels@collabora.com>

Is this still in your queue somewhere?

Cheers,
Daniel
Thierry Reding June 10, 2021, 8:58 a.m. UTC | #4
On Wed, Jun 09, 2021 at 05:28:50PM +0100, Daniel Stone wrote:
> Hi Thierry,
> 
> On Tue, 27 Apr 2021 at 19:40, Daniel Stone <daniel@fooishbar.org> wrote:
> > On Fri, 26 Mar 2021 at 16:29, Thierry Reding <thierry.reding@gmail.com> wrote:
> >> On Fri, Mar 26, 2021 at 02:54:22PM +0000, Simon Ser wrote:
> >> > LGTM, thanks!
> >> >
> >> > Reviewed-by: Simon Ser <contact@emersion.fr>
> >> >
> >> > Let me know if you need me to push this to drm-misc-next.
> >>
> >> I do have commit access for drm-misc-next, but I was thinking that I
> >> could take this through the drm/tegra tree along with the subsequent
> >> patches because of the dependency.
> >>
> >> Anyone willing to provide an Acked-by for that?
> >
> > Yep, no harm if that makes your life easier, so for both the patch itself and merging through tegra:
> > Acked-by: Daniel Stone <daniels@collabora.com>
> 
> Is this still in your queue somewhere?

I reverted to an open-coded version at the time because the -rc6 cut-off
was coming up quickly and I wasn't getting a response. But I do have a
set of follow-up patches in a branch somewhere that convert the existing
users to the new helpers.

Let me dig those out and send them out again.

Thierry
Daniel Stone June 10, 2021, 10 a.m. UTC | #5
On Thu, 10 Jun 2021 at 09:56, Thierry Reding <thierry.reding@gmail.com> wrote:
> On Wed, Jun 09, 2021 at 05:28:50PM +0100, Daniel Stone wrote:
> > On Tue, 27 Apr 2021 at 19:40, Daniel Stone <daniel@fooishbar.org> wrote:
> > > On Fri, 26 Mar 2021 at 16:29, Thierry Reding <thierry.reding@gmail.com> wrote:
> > >> I do have commit access for drm-misc-next, but I was thinking that I
> > >> could take this through the drm/tegra tree along with the subsequent
> > >> patches because of the dependency.
> > >>
> > >> Anyone willing to provide an Acked-by for that?
> > >
> > > Yep, no harm if that makes your life easier, so for both the patch itself and merging through tegra:
> > > Acked-by: Daniel Stone <daniels@collabora.com>
> >
> > Is this still in your queue somewhere?
>
> I reverted to an open-coded version at the time because the -rc6 cut-off
> was coming up quickly and I wasn't getting a response. But I do have a
> set of follow-up patches in a branch somewhere that convert the existing
> users to the new helpers.
>
> Let me dig those out and send them out again.

OK, I didn't realise this had been dropped from your queue. That
sounds reasonable, and we'll just open-code as well in libdrm for the
moment, since we want to have the modifier-name API in without having
to wait another few months ...

Cheers,
Daniel
diff mbox series

Patch

diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index f76de49c768f..64f01bc2624c 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -366,6 +366,12 @@  extern "C" {
 
 #define DRM_FORMAT_RESERVED	      ((1ULL << 56) - 1)
 
+#define fourcc_mod_get_vendor(modifier) \
+	(((modifier) >> 56) & 0xff)
+
+#define fourcc_mod_is_vendor(modifier, vendor) \
+	(fourcc_mod_get_vendor(modifier) == DRM_FORMAT_MOD_VENDOR_## vendor)
+
 #define fourcc_mod_code(vendor, val) \
 	((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))