dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: James Park <jpark37@lagfreegames.com>
To: dri-devel@lists.freedesktop.org
Cc: James Park <jpark37@lagfreegames.com>
Subject: [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Date: Thu, 10 Dec 2020 01:12:54 -0800	[thread overview]
Message-ID: <1607591574-949-2-git-send-email-jpark37@lagfreegames.com> (raw)
In-Reply-To: <1607591574-949-1-git-send-email-jpark37@lagfreegames.com>

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@lagfreegames.com>
Acked-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-12-10 14:48 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 10:01 drm: Fix drm.h uapi header for Windows James Park
2020-12-01 10:01 ` [PATCH] " James Park
2020-12-02  8:46   ` Simon Ser
2020-12-02  9:07     ` James Park
2020-12-02  9:07       ` James Park
2020-12-02 11:42   ` Michel Dänzer
2020-12-02 12:46     ` Daniel Vetter
2020-12-02 18:06       ` Michel Dänzer
2020-12-02 19:47         ` James Park
2020-12-02 22:25           ` Daniel Vetter
2020-12-03  1:24             ` James Park
2020-12-03  9:05             ` Pekka Paalanen
2020-12-03 12:54             ` Ville Syrjälä
2020-12-03 13:13               ` Simon Ser
2020-12-03  8:18           ` Michel Dänzer
2020-12-03 14:52             ` Daniel Vetter
2020-12-03 18:55               ` James Park
2020-12-03 20:45                 ` Daniel Vetter
2020-12-04  4:53                   ` [PATCH] drm: Allow drm_fourcc.h without including drm.h James Park
2020-12-04  4:53                     ` James Park
2020-12-04  8:53                       ` Simon Ser
2020-12-04  9:47                         ` James Park
2020-12-04 10:08                           ` James Park
2020-12-04 14:46                       ` kernel test robot
2020-12-04 22:29                       ` kernel test robot
2020-12-04  8:11                   ` [PATCH] drm: Fix drm.h uapi header for Windows Pekka Paalanen
2020-12-04 15:58                     ` Daniel Vetter
2020-12-04 19:07                       ` James Park
2020-12-06  0:39                         ` [PATCH] drm: drm_basic_types.h, DRM_FOURCC_STANDALONE James Park
2020-12-06  0:39                           ` James Park
2020-12-07  9:45                             ` Simon Ser
2020-12-07  9:55                               ` James Park
2020-12-07  9:59                                 ` Simon Ser
2020-12-07 10:05                                   ` James Park
2020-12-07 10:15                                     ` Simon Ser
2020-12-07 17:25                             ` kernel test robot
2020-12-07 18:15                               ` James Park
2020-12-07 18:15                                 ` James Park
2020-12-08 12:31                                   ` Simon Ser
2020-12-08 18:32                                     ` James Park
2020-12-09 10:15                                       ` Simon Ser
2020-12-09 10:18                                   ` Simon Ser
2020-12-09 11:03                                     ` James Park
2020-12-09 11:03                                       ` James Park
2020-12-10  8:35                                         ` Pekka Paalanen
2020-12-10  9:12                                           ` James Park
2020-12-10  9:12                                             ` James Park [this message]
2021-02-01 21:45                                               ` James Park
2021-02-02 17:28                                                 ` Emil Velikov
2021-02-02 18:14                                                   ` James Park
2021-02-02 22:48                                                     ` Emil Velikov
2021-02-02 23:05                                                       ` Simon Ser
2021-02-02  8:51                                               ` Simon Ser
2021-02-02  8:52                                                 ` Simon Ser
2020-12-07  8:51                         ` [PATCH] drm: Fix drm.h uapi header for Windows Pekka Paalanen
2020-12-07  9:08                           ` James Park
2020-12-07 10:35                             ` Pekka Paalanen
2020-12-07 10:44                               ` Pekka Paalanen
2020-12-07 10:47                                 ` Simon Ser
2020-12-07 10:49                                   ` James Park
2020-12-07 10:53                                     ` Simon Ser
2020-12-07 11:01                                       ` James Park
2020-12-07 11:14                                       ` Pekka Paalanen
2020-12-08  1:08                                         ` James Park
2021-08-17 17:21                                           ` Jason Ekstrand
2020-12-07  9:48                         ` Simon Ser
2020-12-07 10:00                           ` James Park
2020-12-07 10:02                             ` Simon Ser

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=1607591574-949-2-git-send-email-jpark37@lagfreegames.com \
    --to=jpark37@lagfreegames.com \
    --cc=dri-devel@lists.freedesktop.org \
    /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).