drm: DRM_FOURCC_STANDALONE macro support
Subsystems (2)
PATCH 1/1 drm: DRM_FOURCC_STANDALONE macro support
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.
--- include/uapi/drm/drm.h | 35 ++++++++++++++++++++++++++++------- include/uapi/drm/drm_fourcc.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 7 deletions(-)
include/uapi/drm/drm.h +28 -7
@@ -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
include/uapi/drm/drm_fourcc.h +35 -0
@@ -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" {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 125 lines · James Park
Use
DRM_FOURCC_STANDALONEto includedrm_fourcc.hwithoutdrm.h.Copy type definitions from
drm.htodrm_fourcc.h, and wrap withDRM_BASIC_TYPED_DEFINEDto avoid redundant inclusion.This will allow code to avoid unnecessary definitions.
Signed-off-by James Park <[email protected]>--- include/uapi/drm/drm.h | 35 ++++++++++++++++++++++++++++------- include/uapi/drm/drm_fourcc.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 7 deletions(-)include/uapi/drm/drm.h +28
-7@@ -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 include/uapi/drm/drm_fourcc.h +35
-1@@ -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" { --
Quoted 2 lines
2.7.4
Forgot to include Emil and Simon.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel