122851890Sopenharmony_ci/*
222851890Sopenharmony_ci * This header was generated from the Linux kernel headers by update_headers.py,
322851890Sopenharmony_ci * to provide necessary information from kernel to userspace, such as constants,
422851890Sopenharmony_ci * structures, and macros, and thus, contains no copyrightable information.
522851890Sopenharmony_ci */
622851890Sopenharmony_ci#ifndef _VIA_DRM_H_
722851890Sopenharmony_ci#define _VIA_DRM_H_
822851890Sopenharmony_ci#include "drm.h"
922851890Sopenharmony_ci#if defined(__cplusplus)
1022851890Sopenharmony_ciextern "C" {
1122851890Sopenharmony_ci#endif
1222851890Sopenharmony_ci#ifndef _VIA_DEFINES_
1322851890Sopenharmony_ci#define _VIA_DEFINES_
1422851890Sopenharmony_ci#define VIA_NR_SAREA_CLIPRECTS		8
1522851890Sopenharmony_ci#define VIA_NR_XVMC_PORTS               10
1622851890Sopenharmony_ci#define VIA_NR_XVMC_LOCKS               5
1722851890Sopenharmony_ci#define VIA_MAX_CACHELINE_SIZE          64
1822851890Sopenharmony_ci#define XVMCLOCKPTR(saPriv,lockNo)					\
1922851890Sopenharmony_ci	((volatile struct drm_hw_lock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \
2022851890Sopenharmony_ci				      (VIA_MAX_CACHELINE_SIZE - 1)) &	\
2122851890Sopenharmony_ci				     ~(VIA_MAX_CACHELINE_SIZE - 1)) +	\
2222851890Sopenharmony_ci				    VIA_MAX_CACHELINE_SIZE*(lockNo)))
2322851890Sopenharmony_ci#define VIA_NR_TEX_REGIONS 64
2422851890Sopenharmony_ci#define VIA_LOG_MIN_TEX_REGION_SIZE 16
2522851890Sopenharmony_ci#endif
2622851890Sopenharmony_ci#define VIA_UPLOAD_TEX0IMAGE  0x1
2722851890Sopenharmony_ci#define VIA_UPLOAD_TEX1IMAGE  0x2
2822851890Sopenharmony_ci#define VIA_UPLOAD_CTX        0x4
2922851890Sopenharmony_ci#define VIA_UPLOAD_BUFFERS    0x8
3022851890Sopenharmony_ci#define VIA_UPLOAD_TEX0       0x10
3122851890Sopenharmony_ci#define VIA_UPLOAD_TEX1       0x20
3222851890Sopenharmony_ci#define VIA_UPLOAD_CLIPRECTS  0x40
3322851890Sopenharmony_ci#define VIA_UPLOAD_ALL        0xff
3422851890Sopenharmony_ci#define DRM_VIA_ALLOCMEM	0x00
3522851890Sopenharmony_ci#define DRM_VIA_FREEMEM	        0x01
3622851890Sopenharmony_ci#define DRM_VIA_AGP_INIT	0x02
3722851890Sopenharmony_ci#define DRM_VIA_FB_INIT	        0x03
3822851890Sopenharmony_ci#define DRM_VIA_MAP_INIT	0x04
3922851890Sopenharmony_ci#define DRM_VIA_DEC_FUTEX       0x05
4022851890Sopenharmony_ci#define NOT_USED
4122851890Sopenharmony_ci#define DRM_VIA_DMA_INIT	0x07
4222851890Sopenharmony_ci#define DRM_VIA_CMDBUFFER	0x08
4322851890Sopenharmony_ci#define DRM_VIA_FLUSH	        0x09
4422851890Sopenharmony_ci#define DRM_VIA_PCICMD	        0x0a
4522851890Sopenharmony_ci#define DRM_VIA_CMDBUF_SIZE	0x0b
4622851890Sopenharmony_ci#define NOT_USED
4722851890Sopenharmony_ci#define DRM_VIA_WAIT_IRQ        0x0d
4822851890Sopenharmony_ci#define DRM_VIA_DMA_BLIT        0x0e
4922851890Sopenharmony_ci#define DRM_VIA_BLIT_SYNC       0x0f
5022851890Sopenharmony_ci#define DRM_IOCTL_VIA_ALLOCMEM	  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t)
5122851890Sopenharmony_ci#define DRM_IOCTL_VIA_FREEMEM	  DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t)
5222851890Sopenharmony_ci#define DRM_IOCTL_VIA_AGP_INIT	  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t)
5322851890Sopenharmony_ci#define DRM_IOCTL_VIA_FB_INIT	  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t)
5422851890Sopenharmony_ci#define DRM_IOCTL_VIA_MAP_INIT	  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t)
5522851890Sopenharmony_ci#define DRM_IOCTL_VIA_DEC_FUTEX   DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t)
5622851890Sopenharmony_ci#define DRM_IOCTL_VIA_DMA_INIT	  DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t)
5722851890Sopenharmony_ci#define DRM_IOCTL_VIA_CMDBUFFER	  DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t)
5822851890Sopenharmony_ci#define DRM_IOCTL_VIA_FLUSH	  DRM_IO(  DRM_COMMAND_BASE + DRM_VIA_FLUSH)
5922851890Sopenharmony_ci#define DRM_IOCTL_VIA_PCICMD	  DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t)
6022851890Sopenharmony_ci#define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \
6122851890Sopenharmony_ci					    drm_via_cmdbuf_size_t)
6222851890Sopenharmony_ci#define DRM_IOCTL_VIA_WAIT_IRQ    DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t)
6322851890Sopenharmony_ci#define DRM_IOCTL_VIA_DMA_BLIT    DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t)
6422851890Sopenharmony_ci#define DRM_IOCTL_VIA_BLIT_SYNC   DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t)
6522851890Sopenharmony_ci#define VIA_TEX_SETUP_SIZE 8
6622851890Sopenharmony_ci#define VIA_FRONT   0x1
6722851890Sopenharmony_ci#define VIA_BACK    0x2
6822851890Sopenharmony_ci#define VIA_DEPTH   0x4
6922851890Sopenharmony_ci#define VIA_STENCIL 0x8
7022851890Sopenharmony_ci#define VIA_MEM_VIDEO   0
7122851890Sopenharmony_ci#define VIA_MEM_AGP     1
7222851890Sopenharmony_ci#define VIA_MEM_SYSTEM  2
7322851890Sopenharmony_ci#define VIA_MEM_MIXED   3
7422851890Sopenharmony_ci#define VIA_MEM_UNKNOWN 4
7522851890Sopenharmony_citypedef struct {
7622851890Sopenharmony_ci	__u32 offset;
7722851890Sopenharmony_ci	__u32 size;
7822851890Sopenharmony_ci} drm_via_agp_t;
7922851890Sopenharmony_citypedef struct {
8022851890Sopenharmony_ci	__u32 offset;
8122851890Sopenharmony_ci	__u32 size;
8222851890Sopenharmony_ci} drm_via_fb_t;
8322851890Sopenharmony_citypedef struct {
8422851890Sopenharmony_ci	__u32 context;
8522851890Sopenharmony_ci	__u32 type;
8622851890Sopenharmony_ci	__u32 size;
8722851890Sopenharmony_ci	unsigned long index;
8822851890Sopenharmony_ci	unsigned long offset;
8922851890Sopenharmony_ci} drm_via_mem_t;
9022851890Sopenharmony_citypedef struct _drm_via_init {
9122851890Sopenharmony_ci	enum {
9222851890Sopenharmony_ci		VIA_INIT_MAP = 0x01,
9322851890Sopenharmony_ci		VIA_CLEANUP_MAP = 0x02
9422851890Sopenharmony_ci	} func;
9522851890Sopenharmony_ci	unsigned long sarea_priv_offset;
9622851890Sopenharmony_ci	unsigned long fb_offset;
9722851890Sopenharmony_ci	unsigned long mmio_offset;
9822851890Sopenharmony_ci	unsigned long agpAddr;
9922851890Sopenharmony_ci} drm_via_init_t;
10022851890Sopenharmony_citypedef struct _drm_via_futex {
10122851890Sopenharmony_ci	enum {
10222851890Sopenharmony_ci		VIA_FUTEX_WAIT = 0x00,
10322851890Sopenharmony_ci		VIA_FUTEX_WAKE = 0X01
10422851890Sopenharmony_ci	} func;
10522851890Sopenharmony_ci	__u32 ms;
10622851890Sopenharmony_ci	__u32 lock;
10722851890Sopenharmony_ci	__u32 val;
10822851890Sopenharmony_ci} drm_via_futex_t;
10922851890Sopenharmony_citypedef struct _drm_via_dma_init {
11022851890Sopenharmony_ci	enum {
11122851890Sopenharmony_ci		VIA_INIT_DMA = 0x01,
11222851890Sopenharmony_ci		VIA_CLEANUP_DMA = 0x02,
11322851890Sopenharmony_ci		VIA_DMA_INITIALIZED = 0x03
11422851890Sopenharmony_ci	} func;
11522851890Sopenharmony_ci	unsigned long offset;
11622851890Sopenharmony_ci	unsigned long size;
11722851890Sopenharmony_ci	unsigned long reg_pause_addr;
11822851890Sopenharmony_ci} drm_via_dma_init_t;
11922851890Sopenharmony_citypedef struct _drm_via_cmdbuffer {
12022851890Sopenharmony_ci	char __user *buf;
12122851890Sopenharmony_ci	unsigned long size;
12222851890Sopenharmony_ci} drm_via_cmdbuffer_t;
12322851890Sopenharmony_citypedef struct _drm_via_tex_region {
12422851890Sopenharmony_ci	unsigned char next, prev;
12522851890Sopenharmony_ci	unsigned char inUse;
12622851890Sopenharmony_ci	int age;
12722851890Sopenharmony_ci} drm_via_tex_region_t;
12822851890Sopenharmony_citypedef struct _drm_via_sarea {
12922851890Sopenharmony_ci	unsigned int dirty;
13022851890Sopenharmony_ci	unsigned int nbox;
13122851890Sopenharmony_ci	struct drm_clip_rect boxes[VIA_NR_SAREA_CLIPRECTS];
13222851890Sopenharmony_ci	drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1];
13322851890Sopenharmony_ci	int texAge;
13422851890Sopenharmony_ci	int ctxOwner;
13522851890Sopenharmony_ci	int vertexPrim;
13622851890Sopenharmony_ci
13722851890Sopenharmony_ci	char XvMCLockArea[VIA_MAX_CACHELINE_SIZE * (VIA_NR_XVMC_LOCKS + 1)];
13822851890Sopenharmony_ci	unsigned int XvMCDisplaying[VIA_NR_XVMC_PORTS];
13922851890Sopenharmony_ci	unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS];
14022851890Sopenharmony_ci	unsigned int XvMCCtxNoGrabbed;
14122851890Sopenharmony_ci
14222851890Sopenharmony_ci	unsigned int pfCurrentOffset;
14322851890Sopenharmony_ci} drm_via_sarea_t;
14422851890Sopenharmony_citypedef struct _drm_via_cmdbuf_size {
14522851890Sopenharmony_ci	enum {
14622851890Sopenharmony_ci		VIA_CMDBUF_SPACE = 0x01,
14722851890Sopenharmony_ci		VIA_CMDBUF_LAG = 0x02
14822851890Sopenharmony_ci	} func;
14922851890Sopenharmony_ci	int wait;
15022851890Sopenharmony_ci	__u32 size;
15122851890Sopenharmony_ci} drm_via_cmdbuf_size_t;
15222851890Sopenharmony_citypedef enum {
15322851890Sopenharmony_ci	VIA_IRQ_ABSOLUTE = 0x0,
15422851890Sopenharmony_ci	VIA_IRQ_RELATIVE = 0x1,
15522851890Sopenharmony_ci	VIA_IRQ_SIGNAL = 0x10000000,
15622851890Sopenharmony_ci	VIA_IRQ_FORCE_SEQUENCE = 0x20000000
15722851890Sopenharmony_ci} via_irq_seq_type_t;
15822851890Sopenharmony_ci#define VIA_IRQ_FLAGS_MASK 0xF0000000
15922851890Sopenharmony_cienum drm_via_irqs {
16022851890Sopenharmony_ci	drm_via_irq_hqv0 = 0,
16122851890Sopenharmony_ci	drm_via_irq_hqv1,
16222851890Sopenharmony_ci	drm_via_irq_dma0_dd,
16322851890Sopenharmony_ci	drm_via_irq_dma0_td,
16422851890Sopenharmony_ci	drm_via_irq_dma1_dd,
16522851890Sopenharmony_ci	drm_via_irq_dma1_td,
16622851890Sopenharmony_ci	drm_via_irq_num
16722851890Sopenharmony_ci};
16822851890Sopenharmony_cistruct drm_via_wait_irq_request {
16922851890Sopenharmony_ci	unsigned irq;
17022851890Sopenharmony_ci	via_irq_seq_type_t type;
17122851890Sopenharmony_ci	__u32 sequence;
17222851890Sopenharmony_ci	__u32 signal;
17322851890Sopenharmony_ci};
17422851890Sopenharmony_citypedef union drm_via_irqwait {
17522851890Sopenharmony_ci	struct drm_via_wait_irq_request request;
17622851890Sopenharmony_ci	struct drm_wait_vblank_reply reply;
17722851890Sopenharmony_ci} drm_via_irqwait_t;
17822851890Sopenharmony_citypedef struct drm_via_blitsync {
17922851890Sopenharmony_ci	__u32 sync_handle;
18022851890Sopenharmony_ci	unsigned engine;
18122851890Sopenharmony_ci} drm_via_blitsync_t;
18222851890Sopenharmony_citypedef struct drm_via_dmablit {
18322851890Sopenharmony_ci	__u32 num_lines;
18422851890Sopenharmony_ci	__u32 line_length;
18522851890Sopenharmony_ci	__u32 fb_addr;
18622851890Sopenharmony_ci	__u32 fb_stride;
18722851890Sopenharmony_ci	unsigned char *mem_addr;
18822851890Sopenharmony_ci	__u32 mem_stride;
18922851890Sopenharmony_ci	__u32 flags;
19022851890Sopenharmony_ci	int to_fb;
19122851890Sopenharmony_ci	drm_via_blitsync_t sync;
19222851890Sopenharmony_ci} drm_via_dmablit_t;
19322851890Sopenharmony_ci#if defined(__cplusplus)
19422851890Sopenharmony_ci}
19522851890Sopenharmony_ci#endif
19622851890Sopenharmony_ci#endif
197