All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/fourcc: introduce DRM_FOURCC_STANDALONE guard
@ 2021-02-02 22:47 Emil Velikov
  2021-02-02 23:24 ` James Park
  0 siblings, 1 reply; 15+ messages in thread
From: Emil Velikov @ 2021-02-02 22:47 UTC (permalink / raw)
  To: dri-devel; +Cc: Pekka Paalanen, emil.l.velikov, James Park

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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-02-04 11:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.