Create drm_basic_types.h to define types previously defined by drm.h. Use DRM_FOURCC_STANDALONE to include drm_fourcc.h without drm.h. This will allow Mesa to port code to Windows more easily. Signed-off-by: James Park <jpark37@xxxxxxxxxxxxxxxx> Acked-by: Simon Ser <contact@xxxxxxxxxxx> Reviewed-by: Pekka Paalanen <pekka.paalanen@xxxxxxxxxxxxx> --- include/uapi/drm/drm.h | 12 ++------- include/uapi/drm/drm_basic_types.h | 52 ++++++++++++++++++++++++++++++++++++++ include/uapi/drm/drm_fourcc.h | 4 +++ 3 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 include/uapi/drm/drm_basic_types.h diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 808b48a..d9ba922 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -36,6 +36,8 @@ #ifndef _DRM_H_ #define _DRM_H_ +#include "drm_basic_types.h" + #if defined(__KERNEL__) #include <linux/types.h> @@ -50,18 +52,8 @@ typedef unsigned int drm_handle_t; #else /* One of the BSDs */ -#include <stdint.h> #include <sys/ioccom.h> #include <sys/types.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; typedef unsigned long drm_handle_t; #endif diff --git a/include/uapi/drm/drm_basic_types.h b/include/uapi/drm/drm_basic_types.h new file mode 100644 index 0000000..da1f2c0 --- /dev/null +++ b/include/uapi/drm/drm_basic_types.h @@ -0,0 +1,52 @@ +/* + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _DRM_BASIC_TYPES_H_ +#define _DRM_BASIC_TYPES_H_ + +#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 diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 82f3278..539870f 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -24,7 +24,11 @@ #ifndef DRM_FOURCC_H #define DRM_FOURCC_H +#include "drm_basic_types.h" + +#ifndef DRM_FOURCC_STANDALONE #include "drm.h" +#endif #if defined(__cplusplus) extern "C" { -- 2.7.4 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel