From: James Park <james.park@lagfreegames.com>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Pekka Paalanen <pekka.paalanen@collabora.com>,
dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/fourcc: introduce DRM_FOURCC_STANDALONE guard
Date: Tue, 2 Feb 2021 17:20:38 -0800 [thread overview]
Message-ID: <CABjik9fqNkHNSx=5=8ETxh4+An5U+zAi57p9k8QZnHgvnGB-Uw@mail.gmail.com> (raw)
In-Reply-To: <CACvgo53wJ2XrLRBy4ysOBfU5TFo7nBwDS_CyrPkB1rotJXW5Nw@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3081 bytes --]
On Tue, Feb 2, 2021 at 4:57 PM Emil Velikov <emil.l.velikov@gmail.com>
wrote:
> On Tue, 2 Feb 2021 at 23:25, James Park <james.park@lagfreegames.com>
> wrote:
> >
> > On Tue, Feb 2, 2021 at 2:47 PM Emil Velikov <emil.l.velikov@gmail.com>
> wrote:
> > >
> > > Currently, the drm_fourcc.h header depends on drm.h for __u32 and
> __u64.
> > > At the same time drm.h pulls a lot of unneeded symbols.
> > >
> > > Add new guard DRM_FOURCC_STANDALONE, which when set will use local
> > > declaration of said symbols.
> > >
> > > When used on linux - this is a trivial but only when building in
> strict c99
> > > mode. One is welcome to ignore the warning, silence it or use c11. If
> neither
> > > of the three is an option, then do _not_ set the new guard.
> > >
> > > Cc: James Park <james.park@lagfreegames.com>
> > > Cc: Pekka Paalanen <pekka.paalanen@collabora.com>
> > > Cc: Simon Ser <contact@emersion.fr>
> > > Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
> > > ---
> > > As mentioned before - there's little point in having yet another header
> > > since keeping those in sync has been a PITA in the past.
> > > ---
> > > include/uapi/drm/drm_fourcc.h | 19 +++++++++++++++++++
> > > 1 file changed, 19 insertions(+)
> > >
> > > diff --git a/include/uapi/drm/drm_fourcc.h
> b/include/uapi/drm/drm_fourcc.h
> > > index 6f0628eb13a6..c1522902f6c9 100644
> > > --- a/include/uapi/drm/drm_fourcc.h
> > > +++ b/include/uapi/drm/drm_fourcc.h
> > > @@ -24,7 +24,26 @@
> > > #ifndef DRM_FOURCC_H
> > > #define DRM_FOURCC_H
> > >
> > > +/*
> > > + * Define DRM_FOURCC_STANDALONE you're interested only FOURCC and do
> not want
> > > + * to pull drm.h into your application.
> > > + */
> > > +#ifdef DRM_FOURCC_STANDALONE
> > > +#if defined(__linux__)
> > > +
> > > +#include <linux/types.h>
> > > +
> > > +#else /* One of the BSDs */
> > > +
> > > +#include <stdint.h>
> > > +typedef uint32_t __u32;
> > > +typedef uint64_t __u64;
> > > +
> > > +#endif /* __linux __ */
> > > +
> > > +#else
> > > #include "drm.h"
> > > +#endif /* DRM_FOURCC_STANDALONE */
> > >
> > > #if defined(__cplusplus)
> > > extern "C" {
> > > --
> > > 2.30.0
> > >
> >
> > One of my earlier solutions similarly would have forced people to deal
> > with duplicate typedefs, and we arrived at the current solution
> > because we didn't want to burden anyone with that.
>
> As summed in the commit message the burden is only applicable when all
> of the following are set:
> - non-linux
> - force DRM_FOURCC_STANDALONE
> - c99 -pedantic
>
> Even then, we're talking about a compilation warning. So yeah - let's
> keep things short and sweet.
>
> Side note: AFAICT MSVC will not trigger a warning so your logs should be
> clean.
>
> -Emil
>
I'm having trouble reading your commit message, this sentence in
particular: "When used on linux - this is a trivial but only when building
in strict c99 mode."
This asymmetric copy/paste grosses me out so much. I don't think a patch
like this should be opinionated about someone's build settings. Am I alone?
Doesn't this bother anyone else?
- James
[-- Attachment #1.2: Type: text/html, Size: 4528 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2021-02-03 8:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-02 22:47 [PATCH] drm/fourcc: introduce DRM_FOURCC_STANDALONE guard Emil Velikov
2021-02-02 23:24 ` James Park
2021-02-03 0:56 ` Emil Velikov
2021-02-03 1:20 ` James Park [this message]
2021-02-03 9:24 ` Simon Ser
2021-02-03 9:27 ` Simon Ser
2021-02-03 10:08 ` Emil Velikov
2021-02-03 10:15 ` Simon Ser
2021-02-03 11:03 ` Emil Velikov
2021-02-03 13:47 ` Simon Ser
2021-02-03 14:13 ` Emil Velikov
2021-02-03 14:20 ` Simon Ser
2021-02-04 4:24 ` James Park
2021-02-04 4:25 ` James Park
2021-02-04 11:52 ` Emil Velikov
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='CABjik9fqNkHNSx=5=8ETxh4+An5U+zAi57p9k8QZnHgvnGB-Uw@mail.gmail.com' \
--to=james.park@lagfreegames.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
--cc=pekka.paalanen@collabora.com \
/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;
as well as URLs for NNTP newsgroup(s).