Skip to content

Commit

Permalink
drm: Add compatibility #ifdefs for *BSD
Browse files Browse the repository at this point in the history
This let's use use the linux drm headers as the canonical source for
libdrm on all platforms.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Kristian Høgsberg authored and Dave Airlie committed Dec 3, 2009
1 parent 862302f commit 1a95916
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 18 deletions.
29 changes: 19 additions & 10 deletions include/drm/drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,27 @@
#ifndef _DRM_H_
#define _DRM_H_

#if defined(__linux__)

#include <linux/types.h>
#include <asm/ioctl.h> /* For _IO* macros */
#define DRM_IOCTL_NR(n) _IOC_NR(n)
#define DRM_IOC_VOID _IOC_NONE
#define DRM_IOC_READ _IOC_READ
#define DRM_IOC_WRITE _IOC_WRITE
#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE
#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
#include <asm/ioctl.h>
typedef unsigned int drm_handle_t;

#else /* One of the BSDs */

#define DRM_MAJOR 226
#define DRM_MAX_MINOR 15
#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 unsigned long drm_handle_t;

#endif

#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */
#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */
Expand All @@ -59,7 +69,6 @@
#define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT)
#define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))

typedef unsigned int drm_handle_t;
typedef unsigned int drm_context_t;
typedef unsigned int drm_drawable_t;
typedef unsigned int drm_magic_t;
Expand Down
3 changes: 3 additions & 0 deletions include/drm/drmP.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ typedef int drm_ioctl_t(struct drm_device *dev, void *data,
typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
unsigned long arg);

#define DRM_IOCTL_NR(n) _IOC_NR(n)
#define DRM_MAJOR 226

#define DRM_AUTH 0x1
#define DRM_MASTER 0x2
#define DRM_ROOT_ONLY 0x4
Expand Down
3 changes: 0 additions & 3 deletions include/drm/drm_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#ifndef _DRM_MODE_H
#define _DRM_MODE_H

#include <linux/kernel.h>
#include <linux/types.h>

#define DRM_DISPLAY_INFO_LEN 32
#define DRM_CONNECTOR_NAME_LEN 32
#define DRM_DISPLAY_MODE_LEN 32
Expand Down
4 changes: 2 additions & 2 deletions include/drm/i915_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
#ifndef _I915_DRM_H_
#define _I915_DRM_H_

#include "drm.h"

/* Please note that modifications to all structs defined here are
* subject to backwards-compatibility constraints.
*/
#include <linux/types.h>
#include "drm.h"

/* Each region is a minimum of 16k, and there are at most 255 of them.
*/
Expand Down
2 changes: 1 addition & 1 deletion include/drm/mga_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#ifndef __MGA_DRM_H__
#define __MGA_DRM_H__

#include <linux/types.h>
#include "drm.h"

/* WARNING: If you change any of these defines, make sure to change the
* defines in the Xserver file (mga_sarea.h)
Expand Down
2 changes: 1 addition & 1 deletion include/drm/radeon_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#ifndef __RADEON_DRM_H__
#define __RADEON_DRM_H__

#include <linux/types.h>
#include "drm.h"

/* WARNING: If you change any of these defines, make sure to change the
* defines in the X server file (radeon_sarea.h)
Expand Down
2 changes: 1 addition & 1 deletion include/drm/via_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#ifndef _VIA_DRM_H_
#define _VIA_DRM_H_

#include <linux/types.h>
#include "drm.h"

/* WARNING: These defines must be the same as what the Xserver uses.
* if you change them, you must change the defines in the Xserver.
Expand Down

0 comments on commit 1a95916

Please sign in to comment.