2004-03-23 14:08:48 -07:00
|
|
|
/*
|
|
|
|
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
|
|
|
|
* Copyright 2001-2003 S3 Graphics, Inc. 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, sub license,
|
|
|
|
* 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 NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* VIA, S3 GRAPHICS, 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 _VIA_DRM_H_
|
|
|
|
#define _VIA_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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _VIA_DEFINES_
|
|
|
|
#define _VIA_DEFINES_
|
|
|
|
|
2006-02-17 10:25:41 -07:00
|
|
|
|
2005-08-15 12:07:12 -06:00
|
|
|
#if !defined(__KERNEL__) && !defined(_KERNEL)
|
2005-03-14 15:50:21 -07:00
|
|
|
#include "via_drmclient.h"
|
|
|
|
#endif
|
|
|
|
|
2006-01-06 04:57:40 -07:00
|
|
|
/*
|
|
|
|
* With the arrival of libdrm there is a need to version this file.
|
|
|
|
* As usual, bump MINOR for new features, MAJOR for changes that create
|
|
|
|
* backwards incompatibilities, (which should be avoided whenever possible).
|
|
|
|
*/
|
|
|
|
|
2007-02-02 01:15:44 -07:00
|
|
|
#define VIA_DRM_DRIVER_DATE "20070202"
|
2006-02-17 10:25:41 -07:00
|
|
|
|
2006-07-11 08:37:37 -06:00
|
|
|
#define VIA_DRM_DRIVER_MAJOR 2
|
2006-12-27 11:38:33 -07:00
|
|
|
#define VIA_DRM_DRIVER_MINOR 11
|
2007-02-02 01:15:44 -07:00
|
|
|
#define VIA_DRM_DRIVER_PATCHLEVEL 1
|
2006-08-19 01:59:18 -06:00
|
|
|
#define VIA_DRM_DRIVER_VERSION (((VIA_DRM_DRIVER_MAJOR) << 16) | (VIA_DRM_DRIVER_MINOR))
|
2006-01-06 04:57:40 -07:00
|
|
|
|
2007-11-04 19:42:22 -07:00
|
|
|
#define VIA_NR_SAREA_CLIPRECTS 8
|
2006-08-19 01:59:18 -06:00
|
|
|
#define VIA_NR_XVMC_PORTS 10
|
|
|
|
#define VIA_NR_XVMC_LOCKS 5
|
|
|
|
#define VIA_MAX_CACHELINE_SIZE 64
|
2004-03-23 14:08:48 -07:00
|
|
|
#define XVMCLOCKPTR(saPriv,lockNo) \
|
2007-07-15 19:22:15 -06:00
|
|
|
((volatile struct drm_hw_lock *)(((((unsigned long) (saPriv)->XvMCLockArea) + \
|
2005-03-14 15:50:21 -07:00
|
|
|
(VIA_MAX_CACHELINE_SIZE - 1)) & \
|
|
|
|
~(VIA_MAX_CACHELINE_SIZE - 1)) + \
|
|
|
|
VIA_MAX_CACHELINE_SIZE*(lockNo)))
|
2004-03-23 14:08:48 -07:00
|
|
|
#define VIA_NR_TEX_REGIONS 64
|
2007-02-16 12:22:24 -07:00
|
|
|
|
2004-03-23 14:08:48 -07:00
|
|
|
#endif
|
|
|
|
|
2007-02-16 12:22:24 -07:00
|
|
|
#define DRM_VIA_FENCE_TYPE_ACCEL 0x00000002
|
2004-03-23 14:08:48 -07:00
|
|
|
|
|
|
|
/* VIA specific ioctls */
|
2004-09-27 13:51:38 -06:00
|
|
|
#define DRM_VIA_ALLOCMEM 0x00
|
2006-08-19 01:59:18 -06:00
|
|
|
#define DRM_VIA_FREEMEM 0x01
|
2004-09-27 13:51:38 -06:00
|
|
|
#define DRM_VIA_AGP_INIT 0x02
|
2006-08-19 01:59:18 -06:00
|
|
|
#define DRM_VIA_FB_INIT 0x03
|
2004-09-27 13:51:38 -06:00
|
|
|
#define DRM_VIA_MAP_INIT 0x04
|
|
|
|
#define DRM_VIA_DEC_FUTEX 0x05
|
|
|
|
#define NOT_USED
|
|
|
|
#define DRM_VIA_DMA_INIT 0x07
|
|
|
|
#define DRM_VIA_CMDBUFFER 0x08
|
2006-08-19 01:59:18 -06:00
|
|
|
#define DRM_VIA_FLUSH 0x09
|
|
|
|
#define DRM_VIA_PCICMD 0x0a
|
2004-12-13 06:53:12 -07:00
|
|
|
#define DRM_VIA_CMDBUF_SIZE 0x0b
|
2005-03-28 14:21:42 -07:00
|
|
|
#define NOT_USED
|
2006-08-19 01:59:18 -06:00
|
|
|
#define DRM_VIA_WAIT_IRQ 0x0d
|
|
|
|
#define DRM_VIA_DMA_BLIT 0x0e
|
2005-09-25 06:54:12 -06:00
|
|
|
#define DRM_VIA_BLIT_SYNC 0x0f
|
2004-12-13 06:53:12 -07:00
|
|
|
|
|
|
|
#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t)
|
|
|
|
#define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t)
|
|
|
|
#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t)
|
|
|
|
#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t)
|
|
|
|
#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t)
|
|
|
|
#define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t)
|
|
|
|
#define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t)
|
|
|
|
#define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t)
|
|
|
|
#define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH)
|
|
|
|
#define DRM_IOCTL_VIA_PCICMD DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t)
|
|
|
|
#define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \
|
|
|
|
drm_via_cmdbuf_size_t)
|
2005-03-28 14:21:42 -07:00
|
|
|
#define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t)
|
2005-09-25 06:54:12 -06:00
|
|
|
#define DRM_IOCTL_VIA_DMA_BLIT DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_DMA_BLIT, drm_via_dmablit_t)
|
|
|
|
#define DRM_IOCTL_VIA_BLIT_SYNC DRM_IOW(DRM_COMMAND_BASE + DRM_VIA_BLIT_SYNC, drm_via_blitsync_t)
|
2004-09-07 10:48:44 -06:00
|
|
|
|
2004-03-23 14:08:48 -07:00
|
|
|
/* Indices into buf.Setup where various bits of state are mirrored per
|
|
|
|
* context and per buffer. These can be fired at the card as a unit,
|
|
|
|
* or in a piecewise fashion as required.
|
|
|
|
*/
|
2004-09-30 15:12:10 -06:00
|
|
|
|
2004-03-23 14:08:48 -07:00
|
|
|
#define VIA_TEX_SETUP_SIZE 8
|
|
|
|
|
|
|
|
/* Flags for clear ioctl
|
|
|
|
*/
|
|
|
|
#define VIA_FRONT 0x1
|
|
|
|
#define VIA_BACK 0x2
|
|
|
|
#define VIA_DEPTH 0x4
|
|
|
|
#define VIA_STENCIL 0x8
|
2005-10-22 09:12:05 -06:00
|
|
|
|
|
|
|
#define VIA_MEM_VIDEO 0 /* matches drm constant */
|
|
|
|
#define VIA_MEM_AGP 1 /* matches drm constant */
|
2007-11-04 19:42:22 -07:00
|
|
|
#define VIA_MEM_SYSTEM 2
|
2005-10-22 09:12:05 -06:00
|
|
|
#define VIA_MEM_MIXED 3
|
|
|
|
#define VIA_MEM_UNKNOWN 4
|
|
|
|
|
2004-03-23 14:08:48 -07:00
|
|
|
typedef struct {
|
2004-10-08 15:11:02 -06:00
|
|
|
uint32_t offset;
|
|
|
|
uint32_t size;
|
2004-09-30 15:12:10 -06:00
|
|
|
} drm_via_agp_t;
|
2004-03-23 14:08:48 -07:00
|
|
|
|
|
|
|
typedef struct {
|
2004-10-08 15:11:02 -06:00
|
|
|
uint32_t offset;
|
|
|
|
uint32_t size;
|
2004-09-30 15:12:10 -06:00
|
|
|
} drm_via_fb_t;
|
2004-03-23 14:08:48 -07:00
|
|
|
|
|
|
|
typedef struct {
|
2004-10-09 05:12:24 -06:00
|
|
|
uint32_t context;
|
2004-10-08 15:11:02 -06:00
|
|
|
uint32_t type;
|
|
|
|
uint32_t size;
|
2004-09-30 15:12:10 -06:00
|
|
|
unsigned long index;
|
|
|
|
unsigned long offset;
|
|
|
|
} drm_via_mem_t;
|
2004-03-23 14:08:48 -07:00
|
|
|
|
|
|
|
typedef struct _drm_via_init {
|
2004-09-30 15:12:10 -06:00
|
|
|
enum {
|
|
|
|
VIA_INIT_MAP = 0x01,
|
|
|
|
VIA_CLEANUP_MAP = 0x02
|
|
|
|
} func;
|
|
|
|
|
|
|
|
unsigned long sarea_priv_offset;
|
|
|
|
unsigned long fb_offset;
|
|
|
|
unsigned long mmio_offset;
|
|
|
|
unsigned long agpAddr;
|
2004-03-23 14:08:48 -07:00
|
|
|
} drm_via_init_t;
|
|
|
|
|
|
|
|
typedef struct _drm_via_futex {
|
2004-09-30 15:12:10 -06:00
|
|
|
enum {
|
|
|
|
VIA_FUTEX_WAIT = 0x00,
|
|
|
|
VIA_FUTEX_WAKE = 0X01
|
2004-10-08 15:11:02 -06:00
|
|
|
} func;
|
|
|
|
uint32_t ms;
|
|
|
|
uint32_t lock;
|
|
|
|
uint32_t val;
|
2004-03-23 14:08:48 -07:00
|
|
|
} drm_via_futex_t;
|
|
|
|
|
2004-08-23 19:44:37 -06:00
|
|
|
typedef struct _drm_via_dma_init {
|
2004-09-30 15:12:10 -06:00
|
|
|
enum {
|
|
|
|
VIA_INIT_DMA = 0x01,
|
2004-11-27 15:55:31 -07:00
|
|
|
VIA_CLEANUP_DMA = 0x02,
|
2006-08-19 01:59:18 -06:00
|
|
|
VIA_DMA_INITIALIZED = 0x03
|
2004-09-30 15:12:10 -06:00
|
|
|
} func;
|
|
|
|
|
|
|
|
unsigned long offset;
|
|
|
|
unsigned long size;
|
|
|
|
unsigned long reg_pause_addr;
|
2004-08-23 19:44:37 -06:00
|
|
|
} drm_via_dma_init_t;
|
|
|
|
|
|
|
|
typedef struct _drm_via_cmdbuffer {
|
2005-07-15 15:22:51 -06:00
|
|
|
char __user *buf;
|
2004-09-30 15:12:10 -06:00
|
|
|
unsigned long size;
|
2004-08-23 19:44:37 -06:00
|
|
|
} drm_via_cmdbuffer_t;
|
|
|
|
|
2004-03-23 14:08:48 -07:00
|
|
|
/* Warning: If you change the SAREA structure you must change the Xserver
|
|
|
|
* structure as well */
|
|
|
|
|
|
|
|
typedef struct _drm_via_tex_region {
|
2004-09-30 15:12:10 -06:00
|
|
|
unsigned char next, prev; /* indices to form a circular LRU */
|
|
|
|
unsigned char inUse; /* owned by a client, or free? */
|
|
|
|
int age; /* tracked by clients to update local LRU's */
|
2004-03-23 14:08:48 -07:00
|
|
|
} drm_via_tex_region_t;
|
|
|
|
|
|
|
|
typedef struct _drm_via_sarea {
|
2004-09-30 15:12:10 -06:00
|
|
|
unsigned int dirty;
|
|
|
|
unsigned int nbox;
|
2007-07-15 19:22:15 -06:00
|
|
|
struct drm_clip_rect boxes[VIA_NR_SAREA_CLIPRECTS];
|
2004-09-30 15:12:10 -06:00
|
|
|
drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1];
|
|
|
|
int texAge; /* last time texture was uploaded */
|
|
|
|
int ctxOwner; /* last context to upload state */
|
|
|
|
int vertexPrim;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Below is for XvMC.
|
|
|
|
* We want the lock integers alone on, and aligned to, a cache line.
|
|
|
|
* Therefore this somewhat strange construct.
|
|
|
|
*/
|
|
|
|
|
|
|
|
char XvMCLockArea[VIA_MAX_CACHELINE_SIZE * (VIA_NR_XVMC_LOCKS + 1)];
|
|
|
|
|
|
|
|
unsigned int XvMCDisplaying[VIA_NR_XVMC_PORTS];
|
|
|
|
unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS];
|
2007-11-04 19:42:22 -07:00
|
|
|
unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */
|
2005-10-22 09:12:05 -06:00
|
|
|
|
|
|
|
/* Used by the 3d driver only at this point, for pageflipping:
|
|
|
|
*/
|
2006-08-19 01:59:18 -06:00
|
|
|
unsigned int pfCurrentOffset;
|
2004-03-23 14:08:48 -07:00
|
|
|
} drm_via_sarea_t;
|
|
|
|
|
2004-12-13 06:53:12 -07:00
|
|
|
typedef struct _drm_via_cmdbuf_size {
|
|
|
|
enum {
|
|
|
|
VIA_CMDBUF_SPACE = 0x01,
|
|
|
|
VIA_CMDBUF_LAG = 0x02
|
|
|
|
} func;
|
|
|
|
int wait;
|
|
|
|
uint32_t size;
|
|
|
|
} drm_via_cmdbuf_size_t;
|
2004-11-27 15:55:31 -07:00
|
|
|
|
2005-03-28 14:21:42 -07:00
|
|
|
typedef enum {
|
|
|
|
VIA_IRQ_ABSOLUTE = 0x0,
|
|
|
|
VIA_IRQ_RELATIVE = 0x1,
|
|
|
|
VIA_IRQ_SIGNAL = 0x10000000,
|
|
|
|
VIA_IRQ_FORCE_SEQUENCE = 0x20000000
|
|
|
|
} via_irq_seq_type_t;
|
|
|
|
|
|
|
|
#define VIA_IRQ_FLAGS_MASK 0xF0000000
|
|
|
|
|
2007-11-21 23:10:36 -07:00
|
|
|
enum drm_via_irqs {
|
2006-01-01 20:25:49 -07:00
|
|
|
drm_via_irq_hqv0 = 0,
|
|
|
|
drm_via_irq_hqv1,
|
|
|
|
drm_via_irq_dma0_dd,
|
|
|
|
drm_via_irq_dma0_td,
|
|
|
|
drm_via_irq_dma1_dd,
|
|
|
|
drm_via_irq_dma1_td,
|
|
|
|
drm_via_irq_num
|
|
|
|
};
|
2005-09-25 06:54:12 -06:00
|
|
|
|
2007-11-21 23:10:36 -07:00
|
|
|
struct drm_via_wait_irq_request {
|
2005-03-28 14:21:42 -07:00
|
|
|
unsigned irq;
|
|
|
|
via_irq_seq_type_t type;
|
|
|
|
uint32_t sequence;
|
|
|
|
uint32_t signal;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef union drm_via_irqwait {
|
|
|
|
struct drm_via_wait_irq_request request;
|
|
|
|
struct drm_wait_vblank_reply reply;
|
|
|
|
} drm_via_irqwait_t;
|
2004-11-27 15:55:31 -07:00
|
|
|
|
2007-11-04 19:42:22 -07:00
|
|
|
typedef struct drm_via_blitsync {
|
2005-09-25 06:54:12 -06:00
|
|
|
uint32_t sync_handle;
|
|
|
|
unsigned engine;
|
|
|
|
} drm_via_blitsync_t;
|
|
|
|
|
2007-11-04 19:42:22 -07:00
|
|
|
/*
|
2006-01-06 04:57:40 -07:00
|
|
|
* Below,"flags" is currently unused but will be used for possible future
|
2007-11-04 19:42:22 -07:00
|
|
|
* extensions like kernel space bounce buffers for bad alignments and
|
2006-01-06 04:57:40 -07:00
|
|
|
* blit engine busy-wait polling for better latency in the absence of
|
|
|
|
* interrupts.
|
|
|
|
*/
|
|
|
|
|
2005-09-25 06:54:12 -06:00
|
|
|
typedef struct drm_via_dmablit {
|
2006-08-19 01:59:18 -06:00
|
|
|
uint32_t num_lines;
|
|
|
|
uint32_t line_length;
|
2005-09-25 06:54:12 -06:00
|
|
|
|
2006-08-19 01:59:18 -06:00
|
|
|
uint32_t fb_addr;
|
|
|
|
uint32_t fb_stride;
|
2005-09-25 06:54:12 -06:00
|
|
|
|
2006-08-19 01:59:18 -06:00
|
|
|
unsigned char *mem_addr;
|
2007-11-21 23:10:36 -07:00
|
|
|
uint32_t mem_stride;
|
2007-11-04 19:42:22 -07:00
|
|
|
|
2007-11-21 23:10:36 -07:00
|
|
|
uint32_t flags;
|
2006-08-19 01:59:18 -06:00
|
|
|
int to_fb;
|
2005-09-25 06:54:12 -06:00
|
|
|
|
2007-11-04 19:42:22 -07:00
|
|
|
drm_via_blitsync_t sync;
|
2005-09-25 06:54:12 -06:00
|
|
|
} drm_via_dmablit_t;
|
|
|
|
|
|
|
|
|
2004-09-30 15:12:10 -06:00
|
|
|
#endif /* _VIA_DRM_H_ */
|