Skip to content

Commit

Permalink
drm: drm_basic_types.h, DRM_FOURCC_STANDALONE
Browse files Browse the repository at this point in the history
Create drm_basic_types.h to define types previously defined by drm.h.

Use DRM_FOURCC_STANDALONE to include drm_fourcc.h, replacing drm.h
dependency with drm_basic_types.h.

This will allow Mesa to port code to Windows more easily.

Signed-off-by: James Park <jpark37@lagfreegames.com>
  • Loading branch information
James Park authored and intel-lab-lkp committed Dec 7, 2020
1 parent 9d8fddf commit c614dbd
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 12 deletions.
14 changes: 2 additions & 12 deletions include/uapi/drm/drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,22 @@
#ifndef _DRM_H_
#define _DRM_H_

#include "drm_basic_types.h"

#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 */

#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
Expand Down
52 changes: 52 additions & 0 deletions include/uapi/drm/drm_basic_types.h
Original file line number Diff line number Diff line change
@@ -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 /* One of the BSDs */

#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
4 changes: 4 additions & 0 deletions include/uapi/drm/drm_fourcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
#ifndef DRM_FOURCC_H
#define DRM_FOURCC_H

#ifdef DRM_FOURCC_STANDALONE
#include "drm_basic_types.h"
#else
#include "drm.h"
#endif

#if defined(__cplusplus)
extern "C" {
Expand Down

0 comments on commit c614dbd

Please sign in to comment.