* [PATCH] drm: DRM_FOURCC_STANDALONE macro support
@ 2021-02-05 2:54 James Park
2021-02-05 22:16 ` James Park
2021-02-08 11:06 ` Simon Ser
0 siblings, 2 replies; 3+ messages in thread
From: James Park @ 2021-02-05 2:54 UTC (permalink / raw)
To: dri-devel; +Cc: James Park
Use DRM_FOURCC_STANDALONE to include drm_fourcc.h without drm.h.
Copy type definitions from drm.h to drm_fourcc.h, and wrap with
DRM_BASIC_TYPED_DEFINED to avoid redundant inclusion.
This will allow code to avoid unnecessary definitions.
Signed-off-by: James Park <jpark37@lagfreegames.com>
---
include/uapi/drm/drm.h | 35 ++++++++++++++++++++++++++++-------
include/uapi/drm/drm_fourcc.h | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 7 deletions(-)
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 808b48a..5640062 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -36,23 +36,25 @@
#ifndef _DRM_H_
#define _DRM_H_
+/**
+ * DRM_BASIC_TYPES_DEFINED section exists in both drm.h and drm_fourcc.h files.
+ * Do not modify the section in one file without updating the other!
+ */
+
+#ifndef DRM_BASIC_TYPES_DEFINED
+#define DRM_BASIC_TYPES_DEFINED
+
#if defined(__KERNEL__)
#include <linux/types.h>
-#include <asm/ioctl.h>
-typedef unsigned int drm_handle_t;
#elif defined(__linux__)
#include <linux/types.h>
-#include <asm/ioctl.h>
-typedef unsigned int drm_handle_t;
-#else /* One of the BSDs */
+#else /* Not Linux */
#include <stdint.h>
-#include <sys/ioccom.h>
-#include <sys/types.h>
typedef int8_t __s8;
typedef uint8_t __u8;
typedef int16_t __s16;
@@ -62,6 +64,25 @@ typedef uint32_t __u32;
typedef int64_t __s64;
typedef uint64_t __u64;
typedef size_t __kernel_size_t;
+
+#endif
+
+#endif /* DRM_BASIC_TYPES_DEFINED */
+
+#if defined(__KERNEL__)
+
+#include <asm/ioctl.h>
+typedef unsigned int drm_handle_t;
+
+#elif defined(__linux__)
+
+#include <asm/ioctl.h>
+typedef unsigned int drm_handle_t;
+
+#else /* One of the BSDs */
+
+#include <sys/ioccom.h>
+#include <sys/types.h>
typedef unsigned long drm_handle_t;
#endif
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 723c8e2..5e5f4cf 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -24,7 +24,42 @@
#ifndef DRM_FOURCC_H
#define DRM_FOURCC_H
+/**
+ * DRM_BASIC_TYPES_DEFINED section exists in both drm.h and drm_fourcc.h files.
+ * Do not modify the section in one file without updating the other!
+ */
+
+#ifndef DRM_BASIC_TYPES_DEFINED
+#define DRM_BASIC_TYPES_DEFINED
+
+#if defined(__KERNEL__)
+
+#include <linux/types.h>
+
+#elif defined(__linux__)
+
+#include <linux/types.h>
+
+#else /* Not Linux */
+
+#include <stdint.h>
+typedef int8_t __s8;
+typedef uint8_t __u8;
+typedef int16_t __s16;
+typedef uint16_t __u16;
+typedef int32_t __s32;
+typedef uint32_t __u32;
+typedef int64_t __s64;
+typedef uint64_t __u64;
+typedef size_t __kernel_size_t;
+
+#endif
+
+#endif /* DRM_BASIC_TYPES_DEFINED */
+
+#ifndef DRM_FOURCC_STANDALONE
#include "drm.h"
+#endif
#if defined(__cplusplus)
extern "C" {
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm: DRM_FOURCC_STANDALONE macro support
2021-02-05 2:54 [PATCH] drm: DRM_FOURCC_STANDALONE macro support James Park
@ 2021-02-05 22:16 ` James Park
2021-02-08 11:06 ` Simon Ser
1 sibling, 0 replies; 3+ messages in thread
From: James Park @ 2021-02-05 22:16 UTC (permalink / raw)
To: James Park, Simon Ser, Emil Velikov; +Cc: dri-devel
On Thu, Feb 4, 2021 at 6:55 PM James Park <jpark37@lagfreegames.com> wrote:
>
> Use DRM_FOURCC_STANDALONE to include drm_fourcc.h without drm.h.
>
> Copy type definitions from drm.h to drm_fourcc.h, and wrap with
> DRM_BASIC_TYPED_DEFINED to avoid redundant inclusion.
>
> This will allow code to avoid unnecessary definitions.
>
> Signed-off-by: James Park <jpark37@lagfreegames.com>
> ---
> include/uapi/drm/drm.h | 35 ++++++++++++++++++++++++++++-------
> include/uapi/drm/drm_fourcc.h | 35 +++++++++++++++++++++++++++++++++++
> 2 files changed, 63 insertions(+), 7 deletions(-)
>
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index 808b48a..5640062 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -36,23 +36,25 @@
> #ifndef _DRM_H_
> #define _DRM_H_
>
> +/**
> + * DRM_BASIC_TYPES_DEFINED section exists in both drm.h and drm_fourcc.h files.
> + * Do not modify the section in one file without updating the other!
> + */
> +
> +#ifndef DRM_BASIC_TYPES_DEFINED
> +#define DRM_BASIC_TYPES_DEFINED
> +
> #if defined(__KERNEL__)
>
> #include <linux/types.h>
> -#include <asm/ioctl.h>
> -typedef unsigned int drm_handle_t;
>
> #elif defined(__linux__)
>
> #include <linux/types.h>
> -#include <asm/ioctl.h>
> -typedef unsigned int drm_handle_t;
>
> -#else /* One of the BSDs */
> +#else /* Not Linux */
>
> #include <stdint.h>
> -#include <sys/ioccom.h>
> -#include <sys/types.h>
> typedef int8_t __s8;
> typedef uint8_t __u8;
> typedef int16_t __s16;
> @@ -62,6 +64,25 @@ typedef uint32_t __u32;
> typedef int64_t __s64;
> typedef uint64_t __u64;
> typedef size_t __kernel_size_t;
> +
> +#endif
> +
> +#endif /* DRM_BASIC_TYPES_DEFINED */
> +
> +#if defined(__KERNEL__)
> +
> +#include <asm/ioctl.h>
> +typedef unsigned int drm_handle_t;
> +
> +#elif defined(__linux__)
> +
> +#include <asm/ioctl.h>
> +typedef unsigned int drm_handle_t;
> +
> +#else /* One of the BSDs */
> +
> +#include <sys/ioccom.h>
> +#include <sys/types.h>
> typedef unsigned long drm_handle_t;
>
> #endif
> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> index 723c8e2..5e5f4cf 100644
> --- a/include/uapi/drm/drm_fourcc.h
> +++ b/include/uapi/drm/drm_fourcc.h
> @@ -24,7 +24,42 @@
> #ifndef DRM_FOURCC_H
> #define DRM_FOURCC_H
>
> +/**
> + * DRM_BASIC_TYPES_DEFINED section exists in both drm.h and drm_fourcc.h files.
> + * Do not modify the section in one file without updating the other!
> + */
> +
> +#ifndef DRM_BASIC_TYPES_DEFINED
> +#define DRM_BASIC_TYPES_DEFINED
> +
> +#if defined(__KERNEL__)
> +
> +#include <linux/types.h>
> +
> +#elif defined(__linux__)
> +
> +#include <linux/types.h>
> +
> +#else /* Not Linux */
> +
> +#include <stdint.h>
> +typedef int8_t __s8;
> +typedef uint8_t __u8;
> +typedef int16_t __s16;
> +typedef uint16_t __u16;
> +typedef int32_t __s32;
> +typedef uint32_t __u32;
> +typedef int64_t __s64;
> +typedef uint64_t __u64;
> +typedef size_t __kernel_size_t;
> +
> +#endif
> +
> +#endif /* DRM_BASIC_TYPES_DEFINED */
> +
> +#ifndef DRM_FOURCC_STANDALONE
> #include "drm.h"
> +#endif
>
> #if defined(__cplusplus)
> extern "C" {
> --
> 2.7.4
>
Forgot to include Emil and Simon.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm: DRM_FOURCC_STANDALONE macro support
2021-02-05 2:54 [PATCH] drm: DRM_FOURCC_STANDALONE macro support James Park
2021-02-05 22:16 ` James Park
@ 2021-02-08 11:06 ` Simon Ser
1 sibling, 0 replies; 3+ messages in thread
From: Simon Ser @ 2021-02-08 11:06 UTC (permalink / raw)
To: James Park; +Cc: dri-devel
Acked-by: Simon Ser <contact@emersion.fr>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-08 11:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 2:54 [PATCH] drm: DRM_FOURCC_STANDALONE macro support James Park
2021-02-05 22:16 ` James Park
2021-02-08 11:06 ` Simon Ser
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.