diff options
Diffstat (limited to 'include/drm/drm.h')
-rw-r--r-- | include/drm/drm.h | 65 |
1 files changed, 53 insertions, 12 deletions
diff --git a/include/drm/drm.h b/include/drm/drm.h index 7cb50bdde46d..e3f46e0cb7dc 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h | |||
@@ -36,17 +36,27 @@ | |||
36 | #ifndef _DRM_H_ | 36 | #ifndef _DRM_H_ |
37 | #define _DRM_H_ | 37 | #define _DRM_H_ |
38 | 38 | ||
39 | #if defined(__linux__) | ||
40 | |||
39 | #include <linux/types.h> | 41 | #include <linux/types.h> |
40 | #include <asm/ioctl.h> /* For _IO* macros */ | 42 | #include <asm/ioctl.h> |
41 | #define DRM_IOCTL_NR(n) _IOC_NR(n) | 43 | typedef unsigned int drm_handle_t; |
42 | #define DRM_IOC_VOID _IOC_NONE | ||
43 | #define DRM_IOC_READ _IOC_READ | ||
44 | #define DRM_IOC_WRITE _IOC_WRITE | ||
45 | #define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE | ||
46 | #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) | ||
47 | 44 | ||
48 | #define DRM_MAJOR 226 | 45 | #else /* One of the BSDs */ |
49 | #define DRM_MAX_MINOR 15 | 46 | |
47 | #include <sys/ioccom.h> | ||
48 | #include <sys/types.h> | ||
49 | typedef int8_t __s8; | ||
50 | typedef uint8_t __u8; | ||
51 | typedef int16_t __s16; | ||
52 | typedef uint16_t __u16; | ||
53 | typedef int32_t __s32; | ||
54 | typedef uint32_t __u32; | ||
55 | typedef int64_t __s64; | ||
56 | typedef uint64_t __u64; | ||
57 | typedef unsigned long drm_handle_t; | ||
58 | |||
59 | #endif | ||
50 | 60 | ||
51 | #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ | 61 | #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ |
52 | #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ | 62 | #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ |
@@ -59,7 +69,6 @@ | |||
59 | #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) | 69 | #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) |
60 | #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) | 70 | #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) |
61 | 71 | ||
62 | typedef unsigned int drm_handle_t; | ||
63 | typedef unsigned int drm_context_t; | 72 | typedef unsigned int drm_context_t; |
64 | typedef unsigned int drm_drawable_t; | 73 | typedef unsigned int drm_drawable_t; |
65 | typedef unsigned int drm_magic_t; | 74 | typedef unsigned int drm_magic_t; |
@@ -454,6 +463,7 @@ struct drm_irq_busid { | |||
454 | enum drm_vblank_seq_type { | 463 | enum drm_vblank_seq_type { |
455 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ | 464 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ |
456 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ | 465 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ |
466 | _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ | ||
457 | _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ | 467 | _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ |
458 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ | 468 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ |
459 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ | 469 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ |
@@ -461,8 +471,8 @@ enum drm_vblank_seq_type { | |||
461 | }; | 471 | }; |
462 | 472 | ||
463 | #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) | 473 | #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) |
464 | #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \ | 474 | #define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ |
465 | _DRM_VBLANK_NEXTONMISS) | 475 | _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS) |
466 | 476 | ||
467 | struct drm_wait_vblank_request { | 477 | struct drm_wait_vblank_request { |
468 | enum drm_vblank_seq_type type; | 478 | enum drm_vblank_seq_type type; |
@@ -686,6 +696,8 @@ struct drm_gem_open { | |||
686 | #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) | 696 | #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) |
687 | #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) | 697 | #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) |
688 | #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) | 698 | #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) |
699 | #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) | ||
700 | #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) | ||
689 | 701 | ||
690 | /** | 702 | /** |
691 | * Device specific ioctls should only be in their respective headers | 703 | * Device specific ioctls should only be in their respective headers |
@@ -698,6 +710,35 @@ struct drm_gem_open { | |||
698 | #define DRM_COMMAND_BASE 0x40 | 710 | #define DRM_COMMAND_BASE 0x40 |
699 | #define DRM_COMMAND_END 0xA0 | 711 | #define DRM_COMMAND_END 0xA0 |
700 | 712 | ||
713 | /** | ||
714 | * Header for events written back to userspace on the drm fd. The | ||
715 | * type defines the type of event, the length specifies the total | ||
716 | * length of the event (including the header), and user_data is | ||
717 | * typically a 64 bit value passed with the ioctl that triggered the | ||
718 | * event. A read on the drm fd will always only return complete | ||
719 | * events, that is, if for example the read buffer is 100 bytes, and | ||
720 | * there are two 64 byte events pending, only one will be returned. | ||
721 | * | ||
722 | * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and | ||
723 | * up are chipset specific. | ||
724 | */ | ||
725 | struct drm_event { | ||
726 | __u32 type; | ||
727 | __u32 length; | ||
728 | }; | ||
729 | |||
730 | #define DRM_EVENT_VBLANK 0x01 | ||
731 | #define DRM_EVENT_FLIP_COMPLETE 0x02 | ||
732 | |||
733 | struct drm_event_vblank { | ||
734 | struct drm_event base; | ||
735 | __u64 user_data; | ||
736 | __u32 tv_sec; | ||
737 | __u32 tv_usec; | ||
738 | __u32 sequence; | ||
739 | __u32 reserved; | ||
740 | }; | ||
741 | |||
701 | /* typedef area */ | 742 | /* typedef area */ |
702 | #ifndef __KERNEL__ | 743 | #ifndef __KERNEL__ |
703 | typedef struct drm_clip_rect drm_clip_rect_t; | 744 | typedef struct drm_clip_rect drm_clip_rect_t; |