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 __R128_DRM_H__
722851890Sopenharmony_ci#define __R128_DRM_H__
822851890Sopenharmony_ci#include "drm.h"
922851890Sopenharmony_ci#if defined(__cplusplus)
1022851890Sopenharmony_ciextern "C" {
1122851890Sopenharmony_ci#endif
1222851890Sopenharmony_ci#ifndef __R128_SAREA_DEFINES__
1322851890Sopenharmony_ci#define __R128_SAREA_DEFINES__
1422851890Sopenharmony_ci#define R128_UPLOAD_CONTEXT		0x001
1522851890Sopenharmony_ci#define R128_UPLOAD_SETUP		0x002
1622851890Sopenharmony_ci#define R128_UPLOAD_TEX0		0x004
1722851890Sopenharmony_ci#define R128_UPLOAD_TEX1		0x008
1822851890Sopenharmony_ci#define R128_UPLOAD_TEX0IMAGES		0x010
1922851890Sopenharmony_ci#define R128_UPLOAD_TEX1IMAGES		0x020
2022851890Sopenharmony_ci#define R128_UPLOAD_CORE		0x040
2122851890Sopenharmony_ci#define R128_UPLOAD_MASKS		0x080
2222851890Sopenharmony_ci#define R128_UPLOAD_WINDOW		0x100
2322851890Sopenharmony_ci#define R128_UPLOAD_CLIPRECTS		0x200
2422851890Sopenharmony_ci#define R128_REQUIRE_QUIESCENCE		0x400
2522851890Sopenharmony_ci#define R128_UPLOAD_ALL			0x7ff
2622851890Sopenharmony_ci#define R128_FRONT			0x1
2722851890Sopenharmony_ci#define R128_BACK			0x2
2822851890Sopenharmony_ci#define R128_DEPTH			0x4
2922851890Sopenharmony_ci#define R128_POINTS			0x1
3022851890Sopenharmony_ci#define R128_LINES			0x2
3122851890Sopenharmony_ci#define R128_LINE_STRIP			0x3
3222851890Sopenharmony_ci#define R128_TRIANGLES			0x4
3322851890Sopenharmony_ci#define R128_TRIANGLE_FAN		0x5
3422851890Sopenharmony_ci#define R128_TRIANGLE_STRIP		0x6
3522851890Sopenharmony_ci#define R128_BUFFER_SIZE		16384
3622851890Sopenharmony_ci#define R128_INDEX_PRIM_OFFSET		20
3722851890Sopenharmony_ci#define R128_HOSTDATA_BLIT_OFFSET	32
3822851890Sopenharmony_ci#define R128_NR_SAREA_CLIPRECTS		12
3922851890Sopenharmony_ci#define R128_LOCAL_TEX_HEAP		0
4022851890Sopenharmony_ci#define R128_AGP_TEX_HEAP		1
4122851890Sopenharmony_ci#define R128_NR_TEX_HEAPS		2
4222851890Sopenharmony_ci#define R128_NR_TEX_REGIONS		64
4322851890Sopenharmony_ci#define R128_LOG_TEX_GRANULARITY	16
4422851890Sopenharmony_ci#define R128_NR_CONTEXT_REGS		12
4522851890Sopenharmony_ci#define R128_MAX_TEXTURE_LEVELS		11
4622851890Sopenharmony_ci#define R128_MAX_TEXTURE_UNITS		2
4722851890Sopenharmony_ci#endif
4822851890Sopenharmony_citypedef struct {
4922851890Sopenharmony_ci
5022851890Sopenharmony_ci	unsigned int dst_pitch_offset_c;
5122851890Sopenharmony_ci	unsigned int dp_gui_master_cntl_c;
5222851890Sopenharmony_ci	unsigned int sc_top_left_c;
5322851890Sopenharmony_ci	unsigned int sc_bottom_right_c;
5422851890Sopenharmony_ci	unsigned int z_offset_c;
5522851890Sopenharmony_ci	unsigned int z_pitch_c;
5622851890Sopenharmony_ci	unsigned int z_sten_cntl_c;
5722851890Sopenharmony_ci	unsigned int tex_cntl_c;
5822851890Sopenharmony_ci	unsigned int misc_3d_state_cntl_reg;
5922851890Sopenharmony_ci	unsigned int texture_clr_cmp_clr_c;
6022851890Sopenharmony_ci	unsigned int texture_clr_cmp_msk_c;
6122851890Sopenharmony_ci	unsigned int fog_color_c;
6222851890Sopenharmony_ci
6322851890Sopenharmony_ci	unsigned int tex_size_pitch_c;
6422851890Sopenharmony_ci	unsigned int constant_color_c;
6522851890Sopenharmony_ci
6622851890Sopenharmony_ci	unsigned int pm4_vc_fpu_setup;
6722851890Sopenharmony_ci	unsigned int setup_cntl;
6822851890Sopenharmony_ci
6922851890Sopenharmony_ci	unsigned int dp_write_mask;
7022851890Sopenharmony_ci	unsigned int sten_ref_mask_c;
7122851890Sopenharmony_ci	unsigned int plane_3d_mask_c;
7222851890Sopenharmony_ci
7322851890Sopenharmony_ci	unsigned int window_xy_offset;
7422851890Sopenharmony_ci
7522851890Sopenharmony_ci	unsigned int scale_3d_cntl;
7622851890Sopenharmony_ci} drm_r128_context_regs_t;
7722851890Sopenharmony_citypedef struct {
7822851890Sopenharmony_ci	unsigned int tex_cntl;
7922851890Sopenharmony_ci	unsigned int tex_combine_cntl;
8022851890Sopenharmony_ci	unsigned int tex_size_pitch;
8122851890Sopenharmony_ci	unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS];
8222851890Sopenharmony_ci	unsigned int tex_border_color;
8322851890Sopenharmony_ci} drm_r128_texture_regs_t;
8422851890Sopenharmony_citypedef struct drm_r128_sarea {
8522851890Sopenharmony_ci
8622851890Sopenharmony_ci	drm_r128_context_regs_t context_state;
8722851890Sopenharmony_ci	drm_r128_texture_regs_t tex_state[R128_MAX_TEXTURE_UNITS];
8822851890Sopenharmony_ci	unsigned int dirty;
8922851890Sopenharmony_ci	unsigned int vertsize;
9022851890Sopenharmony_ci	unsigned int vc_format;
9122851890Sopenharmony_ci
9222851890Sopenharmony_ci	struct drm_clip_rect boxes[R128_NR_SAREA_CLIPRECTS];
9322851890Sopenharmony_ci	unsigned int nbox;
9422851890Sopenharmony_ci
9522851890Sopenharmony_ci	unsigned int last_frame;
9622851890Sopenharmony_ci	unsigned int last_dispatch;
9722851890Sopenharmony_ci	struct drm_tex_region tex_list[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS + 1];
9822851890Sopenharmony_ci	unsigned int tex_age[R128_NR_TEX_HEAPS];
9922851890Sopenharmony_ci	int ctx_owner;
10022851890Sopenharmony_ci	int pfAllowPageFlip;
10122851890Sopenharmony_ci	int pfCurrentPage;
10222851890Sopenharmony_ci} drm_r128_sarea_t;
10322851890Sopenharmony_ci#define DRM_R128_INIT       0x00
10422851890Sopenharmony_ci#define DRM_R128_CCE_START  0x01
10522851890Sopenharmony_ci#define DRM_R128_CCE_STOP   0x02
10622851890Sopenharmony_ci#define DRM_R128_CCE_RESET  0x03
10722851890Sopenharmony_ci#define DRM_R128_CCE_IDLE   0x04
10822851890Sopenharmony_ci#define DRM_R128_RESET      0x06
10922851890Sopenharmony_ci#define DRM_R128_SWAP       0x07
11022851890Sopenharmony_ci#define DRM_R128_CLEAR      0x08
11122851890Sopenharmony_ci#define DRM_R128_VERTEX     0x09
11222851890Sopenharmony_ci#define DRM_R128_INDICES    0x0a
11322851890Sopenharmony_ci#define DRM_R128_BLIT       0x0b
11422851890Sopenharmony_ci#define DRM_R128_DEPTH      0x0c
11522851890Sopenharmony_ci#define DRM_R128_STIPPLE    0x0d
11622851890Sopenharmony_ci#define DRM_R128_INDIRECT   0x0f
11722851890Sopenharmony_ci#define DRM_R128_FULLSCREEN 0x10
11822851890Sopenharmony_ci#define DRM_R128_CLEAR2     0x11
11922851890Sopenharmony_ci#define DRM_R128_GETPARAM   0x12
12022851890Sopenharmony_ci#define DRM_R128_FLIP       0x13
12122851890Sopenharmony_ci#define DRM_IOCTL_R128_INIT       DRM_IOW( DRM_COMMAND_BASE + DRM_R128_INIT, drm_r128_init_t)
12222851890Sopenharmony_ci#define DRM_IOCTL_R128_CCE_START  DRM_IO(  DRM_COMMAND_BASE + DRM_R128_CCE_START)
12322851890Sopenharmony_ci#define DRM_IOCTL_R128_CCE_STOP   DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CCE_STOP, drm_r128_cce_stop_t)
12422851890Sopenharmony_ci#define DRM_IOCTL_R128_CCE_RESET  DRM_IO(  DRM_COMMAND_BASE + DRM_R128_CCE_RESET)
12522851890Sopenharmony_ci#define DRM_IOCTL_R128_CCE_IDLE   DRM_IO(  DRM_COMMAND_BASE + DRM_R128_CCE_IDLE)
12622851890Sopenharmony_ci#define DRM_IOCTL_R128_RESET      DRM_IO(  DRM_COMMAND_BASE + DRM_R128_RESET)
12722851890Sopenharmony_ci#define DRM_IOCTL_R128_SWAP       DRM_IO(  DRM_COMMAND_BASE + DRM_R128_SWAP)
12822851890Sopenharmony_ci#define DRM_IOCTL_R128_CLEAR      DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CLEAR, drm_r128_clear_t)
12922851890Sopenharmony_ci#define DRM_IOCTL_R128_VERTEX     DRM_IOW( DRM_COMMAND_BASE + DRM_R128_VERTEX, drm_r128_vertex_t)
13022851890Sopenharmony_ci#define DRM_IOCTL_R128_INDICES    DRM_IOW( DRM_COMMAND_BASE + DRM_R128_INDICES, drm_r128_indices_t)
13122851890Sopenharmony_ci#define DRM_IOCTL_R128_BLIT       DRM_IOW( DRM_COMMAND_BASE + DRM_R128_BLIT, drm_r128_blit_t)
13222851890Sopenharmony_ci#define DRM_IOCTL_R128_DEPTH      DRM_IOW( DRM_COMMAND_BASE + DRM_R128_DEPTH, drm_r128_depth_t)
13322851890Sopenharmony_ci#define DRM_IOCTL_R128_STIPPLE    DRM_IOW( DRM_COMMAND_BASE + DRM_R128_STIPPLE, drm_r128_stipple_t)
13422851890Sopenharmony_ci#define DRM_IOCTL_R128_INDIRECT   DRM_IOWR(DRM_COMMAND_BASE + DRM_R128_INDIRECT, drm_r128_indirect_t)
13522851890Sopenharmony_ci#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_R128_FULLSCREEN, drm_r128_fullscreen_t)
13622851890Sopenharmony_ci#define DRM_IOCTL_R128_CLEAR2     DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CLEAR2, drm_r128_clear2_t)
13722851890Sopenharmony_ci#define DRM_IOCTL_R128_GETPARAM   DRM_IOWR( DRM_COMMAND_BASE + DRM_R128_GETPARAM, drm_r128_getparam_t)
13822851890Sopenharmony_ci#define DRM_IOCTL_R128_FLIP       DRM_IO(  DRM_COMMAND_BASE + DRM_R128_FLIP)
13922851890Sopenharmony_citypedef struct drm_r128_init {
14022851890Sopenharmony_ci	enum {
14122851890Sopenharmony_ci		R128_INIT_CCE = 0x01,
14222851890Sopenharmony_ci		R128_CLEANUP_CCE = 0x02
14322851890Sopenharmony_ci	} func;
14422851890Sopenharmony_ci	unsigned long sarea_priv_offset;
14522851890Sopenharmony_ci	int is_pci;
14622851890Sopenharmony_ci	int cce_mode;
14722851890Sopenharmony_ci	int cce_secure;
14822851890Sopenharmony_ci	int ring_size;
14922851890Sopenharmony_ci	int usec_timeout;
15022851890Sopenharmony_ci	unsigned int fb_bpp;
15122851890Sopenharmony_ci	unsigned int front_offset, front_pitch;
15222851890Sopenharmony_ci	unsigned int back_offset, back_pitch;
15322851890Sopenharmony_ci	unsigned int depth_bpp;
15422851890Sopenharmony_ci	unsigned int depth_offset, depth_pitch;
15522851890Sopenharmony_ci	unsigned int span_offset;
15622851890Sopenharmony_ci	unsigned long fb_offset;
15722851890Sopenharmony_ci	unsigned long mmio_offset;
15822851890Sopenharmony_ci	unsigned long ring_offset;
15922851890Sopenharmony_ci	unsigned long ring_rptr_offset;
16022851890Sopenharmony_ci	unsigned long buffers_offset;
16122851890Sopenharmony_ci	unsigned long agp_textures_offset;
16222851890Sopenharmony_ci} drm_r128_init_t;
16322851890Sopenharmony_citypedef struct drm_r128_cce_stop {
16422851890Sopenharmony_ci	int flush;
16522851890Sopenharmony_ci	int idle;
16622851890Sopenharmony_ci} drm_r128_cce_stop_t;
16722851890Sopenharmony_citypedef struct drm_r128_clear {
16822851890Sopenharmony_ci	unsigned int flags;
16922851890Sopenharmony_ci	unsigned int clear_color;
17022851890Sopenharmony_ci	unsigned int clear_depth;
17122851890Sopenharmony_ci	unsigned int color_mask;
17222851890Sopenharmony_ci	unsigned int depth_mask;
17322851890Sopenharmony_ci} drm_r128_clear_t;
17422851890Sopenharmony_citypedef struct drm_r128_vertex {
17522851890Sopenharmony_ci	int prim;
17622851890Sopenharmony_ci	int idx;
17722851890Sopenharmony_ci	int count;
17822851890Sopenharmony_ci	int discard;
17922851890Sopenharmony_ci} drm_r128_vertex_t;
18022851890Sopenharmony_citypedef struct drm_r128_indices {
18122851890Sopenharmony_ci	int prim;
18222851890Sopenharmony_ci	int idx;
18322851890Sopenharmony_ci	int start;
18422851890Sopenharmony_ci	int end;
18522851890Sopenharmony_ci	int discard;
18622851890Sopenharmony_ci} drm_r128_indices_t;
18722851890Sopenharmony_citypedef struct drm_r128_blit {
18822851890Sopenharmony_ci	int idx;
18922851890Sopenharmony_ci	int pitch;
19022851890Sopenharmony_ci	int offset;
19122851890Sopenharmony_ci	int format;
19222851890Sopenharmony_ci	unsigned short x, y;
19322851890Sopenharmony_ci	unsigned short width, height;
19422851890Sopenharmony_ci} drm_r128_blit_t;
19522851890Sopenharmony_citypedef struct drm_r128_depth {
19622851890Sopenharmony_ci	enum {
19722851890Sopenharmony_ci		R128_WRITE_SPAN = 0x01,
19822851890Sopenharmony_ci		R128_WRITE_PIXELS = 0x02,
19922851890Sopenharmony_ci		R128_READ_SPAN = 0x03,
20022851890Sopenharmony_ci		R128_READ_PIXELS = 0x04
20122851890Sopenharmony_ci	} func;
20222851890Sopenharmony_ci	int n;
20322851890Sopenharmony_ci	int __user *x;
20422851890Sopenharmony_ci	int __user *y;
20522851890Sopenharmony_ci	unsigned int __user *buffer;
20622851890Sopenharmony_ci	unsigned char __user *mask;
20722851890Sopenharmony_ci} drm_r128_depth_t;
20822851890Sopenharmony_citypedef struct drm_r128_stipple {
20922851890Sopenharmony_ci	unsigned int __user *mask;
21022851890Sopenharmony_ci} drm_r128_stipple_t;
21122851890Sopenharmony_citypedef struct drm_r128_indirect {
21222851890Sopenharmony_ci	int idx;
21322851890Sopenharmony_ci	int start;
21422851890Sopenharmony_ci	int end;
21522851890Sopenharmony_ci	int discard;
21622851890Sopenharmony_ci} drm_r128_indirect_t;
21722851890Sopenharmony_citypedef struct drm_r128_fullscreen {
21822851890Sopenharmony_ci	enum {
21922851890Sopenharmony_ci		R128_INIT_FULLSCREEN = 0x01,
22022851890Sopenharmony_ci		R128_CLEANUP_FULLSCREEN = 0x02
22122851890Sopenharmony_ci	} func;
22222851890Sopenharmony_ci} drm_r128_fullscreen_t;
22322851890Sopenharmony_ci#define R128_PARAM_IRQ_NR            1
22422851890Sopenharmony_citypedef struct drm_r128_getparam {
22522851890Sopenharmony_ci	int param;
22622851890Sopenharmony_ci	void __user *value;
22722851890Sopenharmony_ci} drm_r128_getparam_t;
22822851890Sopenharmony_ci#if defined(__cplusplus)
22922851890Sopenharmony_ci}
23022851890Sopenharmony_ci#endif
23122851890Sopenharmony_ci#endif
232