summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/unichrome/Makefile3
-rw-r--r--src/mesa/drivers/dri/unichrome/server/via_dri.c194
-rw-r--r--src/mesa/drivers/dri/unichrome/via_common.h215
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_dri.h2
-rw-r--r--src/mesa/drivers/dri/unichrome/via_fb.c4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c6
-rw-r--r--src/mesa/drivers/dri/unichrome/xf86drmVIA.c143
-rw-r--r--src/mesa/drivers/dri/unichrome/xf86drmVIA.h101
9 files changed, 333 insertions, 336 deletions
diff --git a/src/mesa/drivers/dri/unichrome/Makefile b/src/mesa/drivers/dri/unichrome/Makefile
index b08a239e08..3e2f813f95 100644
--- a/src/mesa/drivers/dri/unichrome/Makefile
+++ b/src/mesa/drivers/dri/unichrome/Makefile
@@ -29,8 +29,7 @@ DRIVER_SOURCES = \
via_texmem.c \
via_texstate.c \
via_tris.c \
- via_texcombine.c \
- xf86drmVIA.c
+ via_texcombine.c
C_SOURCES = \
$(COMMON_SOURCES) \
diff --git a/src/mesa/drivers/dri/unichrome/server/via_dri.c b/src/mesa/drivers/dri/unichrome/server/via_dri.c
index ea53c6adf8..2d69c4d7a4 100644
--- a/src/mesa/drivers/dri/unichrome/server/via_dri.c
+++ b/src/mesa/drivers/dri/unichrome/server/via_dri.c
@@ -77,7 +77,7 @@ static int VIADRIFinishScreenInit(DRIDriverContext * ctx);
#define AGP_PAGE_SIZE 4096
#define AGP_PAGES 8192
#define AGP_SIZE (AGP_PAGE_SIZE * AGP_PAGES)
-#define AGP_CMDBUF_PAGES 256
+#define AGP_CMDBUF_PAGES 512
#define AGP_CMDBUF_SIZE (AGP_PAGE_SIZE * AGP_CMDBUF_PAGES)
static char VIAKernelDriverName[] = "via";
@@ -89,6 +89,119 @@ static int VIADRIFBInit(DRIDriverContext * ctx, VIAPtr pVia);
static int VIADRIKernelInit(DRIDriverContext * ctx, VIAPtr pVia);
static int VIADRIMapInit(DRIDriverContext * ctx, VIAPtr pVia);
+static void VIADRIIrqInit( DRIDriverContext *ctx )
+{
+ VIAPtr pVia = VIAPTR(ctx);
+ VIADRIPtr pVIADRI = pVia->devPrivate;
+
+ pVIADRI->irqEnabled = drmGetInterruptFromBusID(pVia->drmFD,
+ ctx->pciBus,
+ ctx->pciDevice,
+ ctx->pciFunc);
+
+ if ((drmCtlInstHandler(pVia->drmFD, pVIADRI->irqEnabled))) {
+ xf86DrvMsg(pScreen->myNum, X_WARNING,
+ "[drm] Failure adding irq handler. "
+ "Falling back to irq-free operation.\n");
+ pVIADRI->irqEnabled = 0;
+ }
+
+ if (pVIADRI->irqEnabled)
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] Irq handler installed, using IRQ %d.\n",
+ pVIADRI->irqEnabled);
+}
+
+static void VIADRIIrqExit( DRIDriverContext *ctx ) {
+ VIAPtr pVia = VIAPTR(ctx);
+ VIADRIPtr pVIADRI = pVia->devPrivate;
+
+ if (pVIADRI->irqEnabled) {
+ if (drmCtlUninstHandler(pVia->drmFD)) {
+ xf86DrvMsg(pScreen-myNum, X_INFO,"[drm] Irq handler uninstalled.\n");
+ } else {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] Could not uninstall irq handler.\n");
+ }
+ }
+}
+
+
+/* Locks up engine - FIXME
+#define ENABLE_AGP_RINGBUF
+*/
+
+#ifdef ENABLE_AGP_RINGBUF
+
+static void VIADRIRingBufferCleanup(DRIDriverContext *ctx)
+{
+ VIAPtr pVia = VIAPTR(ctx);
+ VIADRIPtr pVIADRI = pVia->devPrivate;
+ drmVIADMAInit ringBufInit;
+
+ if (pVIADRI->ringBufActive) {
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] Cleaning up DMA ring-buffer.\n");
+ ringBufInit.func = VIA_CLEANUP_DMA;
+ if (drmCommandWrite(pVia->drmFD, DRM_VIA_DMA_INIT, &ringBufInit,
+ sizeof(ringBufInit))) {
+ xf86DrvMsg(pScreen->myNum, X_WARNING,
+ "[drm] Failed to clean up DMA ring-buffer: %d\n", errno);
+ }
+ pVIADRI->ringBufActive = 0;
+ }
+}
+
+static int VIADRIRingBufferInit(DRIDriverContext *ctx)
+{
+ VIAPtr pVia = VIAPTR(ctx);
+ VIADRIPtr pVIADRI = pVia->devPrivate;
+ drmVIADMAInit ringBufInit;
+ drmVersionPtr drmVer;
+
+ pVIADRI->ringBufActive = 0;
+
+ if (NULL == (drmVer = drmGetVersion(pVia->drmFD))) {
+ return GL_FALSE;
+ }
+
+ if (((drmVer->version_major <= 1) && (drmVer->version_minor <= 3))) {
+ return GL_FALSE;
+ }
+
+ /*
+ * Info frome code-snippet on DRI-DEVEL list; Erdi Chen.
+ */
+
+ switch (pVia->ChipId) {
+ case PCI_CHIP_VT3259:
+ ringBufInit.reg_pause_addr = 0x40c;
+ break;
+ default:
+ ringBufInit.reg_pause_addr = 0x418;
+ break;
+ }
+
+ ringBufInit.offset = pVia->agpSize;
+ ringBufInit.size = AGP_CMDBUF_SIZE;
+ ringBufInit.func = VIA_INIT_DMA;
+ if (drmCommandWrite(pVia->drmFD, DRM_VIA_DMA_INIT, &ringBufInit,
+ sizeof(ringBufInit))) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] Failed to initialize DMA ring-buffer: %d\n", errno);
+ return GL_FALSE;
+ }
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] Initialized AGP ring-buffer, size 0x%lx at AGP offset 0x%lx.\n",
+ ringBufInit.size, ringBufInit.offset);
+
+ pVIADRI->ringBufActive = 1;
+ return GL_TRUE;
+}
+
+#endif
+
+
static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia)
{
unsigned long agp_phys;
@@ -125,7 +238,12 @@ static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia)
return GL_FALSE;
}
- pVia->agpSize = AGP_SIZE;
+ /*
+ * Place the ring-buffer last in the AGP region, and restrict the
+ * public map not to include the buffer for security reasons.
+ */
+
+ pVia->agpSize = AGP_SIZE - AGP_CMDBUF_SIZE;
pVia->agpAddr = drmAgpBase(pVia->drmFD);
xf86DrvMsg(pScreen->myNum, X_INFO,
"[drm] agpAddr = 0x%08lx\n",pVia->agpAddr);
@@ -154,9 +272,22 @@ static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia)
xf86DrvMsg(pScreen->myNum, X_INFO,
"[drm] agp physical addr = 0x%08lx\n", agp_phys);
- drmVIAAgpInit(pVia->drmFD, 0, AGP_SIZE);
- return GL_TRUE;
+ {
+ drm_via_agp_t agp;
+ agp.offset = 0;
+ agp.size = AGP_SIZE-AGP_CMDBUF_SIZE;
+ if (drmCommandWrite(pVia->drmFD, DRM_VIA_AGP_INIT, &agp,
+ sizeof(drm_via_agp_t)) < 0) {
+ drmUnmap(&agpaddr,pVia->agpSize);
+ drmRmMap(pVia->drmFD,pVIADRI->agp.handle);
+ drmAgpUnbind(pVia->drmFD, pVia->agpHandle);
+ drmAgpFree(pVia->drmFD, pVia->agpHandle);
+ drmAgpRelease(pVia->drmFD);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
}
static int VIADRIFBInit(DRIDriverContext * ctx, VIAPtr pVia)
@@ -167,13 +298,23 @@ static int VIADRIFBInit(DRIDriverContext * ctx, VIAPtr pVia)
pVIADRI->fbOffset = FBOffset;
pVIADRI->fbSize = pVia->videoRambytes;
- if (drmVIAFBInit(pVia->drmFD, FBOffset, FBSize) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,"[drm] failed to init frame buffer area\n");
- return GL_FALSE;
- }
- else {
- xf86DrvMsg(pScreen->myNum, X_INFO,"[drm] FBFreeStart= 0x%08lx FBFreeEnd= 0x%08lx FBSize= 0x%08lx\n", pVia->FBFreeStart, pVia->FBFreeEnd, FBSize);
- return GL_TRUE;
+ {
+ drm_via_fb_t fb;
+ fb.offset = FBOffset;
+ fb.size = FBSize;
+
+ if (drmCommandWrite(pVia->drmFD, DRM_VIA_FB_INIT, &fb,
+ sizeof(drm_via_fb_t)) < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[drm] failed to init frame buffer area\n");
+ return GL_FALSE;
+ } else {
+ xf86DrvMsg(pScreen->myNum, X_INFO,
+ "[drm] FBFreeStart= 0x%08x FBFreeEnd= 0x%08x "
+ "FBSize= 0x%08x\n",
+ pVia->FBFreeStart, pVia->FBFreeEnd, FBSize);
+ return GL_TRUE;
+ }
}
}
@@ -274,7 +415,7 @@ static int VIADRIScreenInit(DRIDriverContext * ctx)
if (!(VIADRIFBInit(ctx, pVia))) {
VIADRICloseScreen(ctx);
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[dri] frame buffer initialize fial .\n" );
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[dri] frame buffer initialize fail .\n" );
return GL_FALSE;
}
@@ -315,6 +456,10 @@ VIADRICloseScreen(DRIDriverContext * ctx)
VIAPtr pVia = VIAPTR(ctx);
VIADRIPtr pVIADRI=(VIADRIPtr)pVia->devPrivate;
+#ifdef ENABLE_AGP_RINGBUF
+ VIADRIRingBufferCleanup(ctx);
+#endif
+
if (pVia->MapBase) {
xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Unmapping MMIO registers\n");
drmUnmap(pVia->MapBase, pVIADRI->regs.size);
@@ -326,6 +471,11 @@ VIADRICloseScreen(DRIDriverContext * ctx)
xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Releasing agp module\n");
drmAgpRelease(pVia->drmFD);
}
+
+#if 0
+ if (pVia->DRIIrqEnable)
+#endif
+ VIADRIIrqExit(ctx);
}
static int
@@ -371,15 +521,27 @@ VIADRIFinishScreenInit(DRIDriverContext * ctx)
pVIADRI->scrnX=pVIADRI->width;
pVIADRI->scrnY=pVIADRI->height;
+ /* Initialize IRQ */
+#if 0
+ if (pVia->DRIIrqEnable)
+#endif
+ VIADRIIrqInit(ctx);
+
+#ifdef ENABLE_AGP_RINGBUF
+ pVIADRI->ringBufActive = 0;
+ VIADRIRingBufferInit(ctx);
+#endif
+
return GL_TRUE;
}
/* Initialize the kernel data structures. */
static int VIADRIKernelInit(DRIDriverContext * ctx, VIAPtr pVia)
{
- drmVIAInit drmInfo;
- memset(&drmInfo, 0, sizeof(drmVIAInit));
+ drm_via_init_t drmInfo;
+ memset(&drmInfo, 0, sizeof(drm_via_init_t));
drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
+ drmInfo.func = VIA_INIT_MAP;
drmInfo.fb_offset = pVia->FrameBufferBase;
drmInfo.mmio_offset = pVia->registerHandle;
if (pVia->IsPCI)
@@ -387,7 +549,9 @@ static int VIADRIKernelInit(DRIDriverContext * ctx, VIAPtr pVia)
else
drmInfo.agpAddr = (u_int32_t)pVia->agpAddr;
- if (drmVIAInitMAP(pVia->drmFD, &drmInfo) < 0) return GL_FALSE;
+ if ((drmCommandWrite(pVia->drmFD, DRM_VIA_MAP_INIT,&drmInfo,
+ sizeof(drm_via_init_t))) < 0)
+ return GL_FALSE;
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/unichrome/via_common.h b/src/mesa/drivers/dri/unichrome/via_common.h
index 52d25c786e..bf2fd6455d 100644
--- a/src/mesa/drivers/dri/unichrome/via_common.h
+++ b/src/mesa/drivers/dri/unichrome/via_common.h
@@ -35,23 +35,66 @@
#define VIA_DMA_BUF_SZ (1 << VIA_DMA_BUF_ORDER)
#define VIA_DMA_BUF_NR 256
#define VIA_NR_SAREA_CLIPRECTS 8
-
+#define VIA_NR_XVMC_PORTS 10
+#define VIA_NR_XVMC_LOCKS 5
+#define VIA_MAX_CACHELINE_SIZE 64
+#define XVMCLOCKPTR(saPriv,lockNo) \
+ ((volatile int *)(((((unsigned long) (saPriv)->XvMCLockArea) + \
+ (VIA_MAX_CACHELINE_SIZE - 1)) & \
+ ~(VIA_MAX_CACHELINE_SIZE - 1)) + \
+ VIA_MAX_CACHELINE_SIZE*(lockNo)))
+
+/* Each region is a minimum of 64k, and there are at most 64 of them.
+ */
#define VIA_NR_TEX_REGIONS 64
#define VIA_LOG_MIN_TEX_REGION_SIZE 16
#endif
+#define VIA_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */
+#define VIA_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */
+#define VIA_UPLOAD_CTX 0x4
+#define VIA_UPLOAD_BUFFERS 0x8
+#define VIA_UPLOAD_TEX0 0x10
+#define VIA_UPLOAD_TEX1 0x20
+#define VIA_UPLOAD_CLIPRECTS 0x40
+#define VIA_UPLOAD_ALL 0xff
/* VIA specific ioctls */
-#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(0x40, drm_via_mem_t)
-#define DRM_IOCTL_VIA_FREEMEM DRM_IOW(0x41, drm_via_mem_t)
-#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(0x42, drm_via_agp_t)
-#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(0x43, drm_via_fb_t)
-#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(0x44, drm_via_init_t)
-#define DRM_IOCTL_VIA_FLUSH_AGP DRM_IOW(0x45, drm_via_flush_agp_t)
-#define DRM_IOCTL_VIA_FLUSH_SYS DRM_IOW(0x46, drm_via_flush_sys_t)
+#define DRM_VIA_ALLOCMEM 0x00
+#define DRM_VIA_FREEMEM 0x01
+#define DRM_VIA_AGP_INIT 0x02
+#define DRM_VIA_FB_INIT 0x03
+#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
+#define DRM_VIA_FLUSH 0x09
+#define DRM_VIA_PCICMD 0x0a
+#define DRM_VIA_CMDBUF_SIZE 0x0b
+
+#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)
+
+/* 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.
+ */
#define VIA_TEX_SETUP_SIZE 8
+/* Flags for clear ioctl
+ */
#define VIA_FRONT 0x1
#define VIA_BACK 0x2
#define VIA_DEPTH 0x4
@@ -59,83 +102,117 @@
#define VIDEO 0
#define AGP 1
typedef struct {
- unsigned int offset;
- unsigned int size;
-} drm_via_agp_t;
+ u_int32_t offset;
+ u_int32_t size;
+} drm_via_agp_t;
typedef struct {
- unsigned int offset;
- unsigned int size;
-} drm_via_fb_t;
+ u_int32_t offset;
+ u_int32_t size;
+} drm_via_fb_t;
typedef struct {
- unsigned int context;
- unsigned int type;
- unsigned int size;
- unsigned long index;
- unsigned long offset;
-} drm_via_mem_t;
+ u_int32_t context;
+ u_int32_t type;
+ u_int32_t size;
+ unsigned long index;
+ unsigned long offset;
+} drm_via_mem_t;
typedef struct _drm_via_init {
- 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;
+ 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;
} drm_via_init_t;
+typedef struct _drm_via_futex {
+ enum {
+ VIA_FUTEX_WAIT = 0x00,
+ VIA_FUTEX_WAKE = 0X01
+ } func;
+ u_int32_t ms;
+ u_int32_t lock;
+ u_int32_t val;
+} drm_via_futex_t;
+
+typedef struct _drm_via_dma_init {
+ enum {
+ VIA_INIT_DMA = 0x01,
+ VIA_CLEANUP_DMA = 0x02,
+ VIA_DMA_INITIALIZED = 0x03
+ } func;
+
+ unsigned long offset;
+ unsigned long size;
+ unsigned long reg_pause_addr;
+} drm_via_dma_init_t;
+
+typedef struct _drm_via_cmdbuffer {
+ char *buf;
+ unsigned long size;
+} drm_via_cmdbuffer_t;
+
+/* Warning: If you change the SAREA structure you must change the Xserver
+ * structure as well */
typedef struct _drm_via_tex_region {
- unsigned char next, prev;
- unsigned char inUse;
- int age;
+ 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 */
} drm_via_tex_region_t;
typedef struct _drm_via_sarea {
- unsigned int dirty;
- unsigned int nbox;
- drm_clip_rect_t boxes[VIA_NR_SAREA_CLIPRECTS];
- drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1];
- int texAge;
- int ctxOwner;
- int vertexPrim;
+ unsigned int dirty;
+ unsigned int nbox;
+ drm_clip_rect_t boxes[VIA_NR_SAREA_CLIPRECTS];
+ 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];
+ unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */
+
} drm_via_sarea_t;
-typedef struct _drm_via_flush_agp {
- unsigned int offset;
- unsigned int size;
- unsigned int index;
- int discard;
-} drm_via_flush_agp_t;
+typedef struct _drm_via_cmdbuf_size {
+ enum {
+ VIA_CMDBUF_SPACE = 0x01,
+ VIA_CMDBUF_LAG = 0x02
+ } func;
+ int wait;
+ u_int32_t size;
+} drm_via_cmdbuf_size_t;
-typedef struct _drm_via_flush_sys {
- unsigned int offset;
- unsigned int size;
- unsigned long index;
- int discard;
-} drm_via_flush_sys_t;
#ifdef __KERNEL__
-int via_fb_init(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int via_mem_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int via_mem_free(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int via_agp_init(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int via_dma_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int via_dma_free(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int via_map_init(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int via_flush_agp(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
-int via_flush_sys(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg);
+
+int via_fb_init(DRM_IOCTL_ARGS);
+int via_mem_alloc(DRM_IOCTL_ARGS);
+int via_mem_free(DRM_IOCTL_ARGS);
+int via_agp_init(DRM_IOCTL_ARGS);
+int via_map_init(DRM_IOCTL_ARGS);
+int via_decoder_futex(DRM_IOCTL_ARGS);
+int via_dma_init(DRM_IOCTL_ARGS);
+int via_cmdbuffer(DRM_IOCTL_ARGS);
+int via_flush_ioctl(DRM_IOCTL_ARGS);
+int via_pci_cmdbuffer(DRM_IOCTL_ARGS);
+int via_cmdbuf_size(DRM_IOCTL_ARGS);
+
#endif
-#endif /* _VIA_DRM_H_ */
+#endif /* _VIA_DRM_H_ */
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index 84367847ea..c6b3265b10 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -40,7 +40,6 @@ typedef struct via_texture_object_t *viaTextureObjectPtr;
#include "via_screen.h"
#include "via_tex.h"
#include "via_common.h"
-#include "xf86drmVIA.h"
#define VIA_FALLBACK_TEXTURE 0x1
#define VIA_FALLBACK_DRAW_BUFFER 0x2
diff --git a/src/mesa/drivers/dri/unichrome/via_dri.h b/src/mesa/drivers/dri/unichrome/via_dri.h
index 01ca0ea55b..a624398f1a 100644
--- a/src/mesa/drivers/dri/unichrome/via_dri.h
+++ b/src/mesa/drivers/dri/unichrome/via_dri.h
@@ -38,6 +38,8 @@ typedef struct {
int sarea_priv_offset;
/*=* John Sheng [2003.12.9] Tuxracer & VQ *=*/
int VQEnable;
+ int DRIIrqEnable;
+ int ringBufActive;
} VIADRIRec, *VIADRIPtr;
typedef struct {
diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c
index 39d43e7278..122d3b17cc 100644
--- a/src/mesa/drivers/dri/unichrome/via_fb.c
+++ b/src/mesa/drivers/dri/unichrome/via_fb.c
@@ -66,7 +66,7 @@ via_free_draw_buffer(viaContextPtr vmesa, viaBuffer *buf)
GLboolean
via_alloc_dma_buffer(viaContextPtr vmesa)
{
- drmVIADMAInit init;
+ drm_via_dma_init_t init;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
vmesa->dma = (GLubyte *) malloc(VIA_DMA_BUFSIZ);
@@ -76,7 +76,7 @@ via_alloc_dma_buffer(viaContextPtr vmesa)
*/
init.func = VIA_DMA_INITIALIZED;
vmesa->useAgp =
- ( 0 == drmCommandWrite(vmesa->driFd, DRM_VIA_DMA_INIT,
+ ( 0 == drmCommandWrite(vmesa->driFd, VIA_INIT_DMA,
&init, sizeof(init)));
if (vmesa->useAgp)
printf("unichrome_dri.so: Using AGP.\n");
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index 15f3991cae..579e3004b0 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -424,14 +424,14 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv)
static int fire_buffer(viaContextPtr vmesa)
{
- drmVIACommandBuffer bufI;
+ drm_via_cmdbuffer_t bufI;
int ret;
bufI.buf = (char *)vmesa->dma;
bufI.size = vmesa->dmaLow;
if (vmesa->useAgp) {
- drmVIACmdBufSize bSiz;
+ drm_via_cmdbuf_size_t bSiz;
/* Do the CMDBUF_SIZE ioctl:
*/
@@ -448,7 +448,7 @@ static int fire_buffer(viaContextPtr vmesa)
return ret;
}
- /* Acutally fire the buffer:
+ /* Actually fire the buffer:
*/
do {
ret = drmCommandWrite(vmesa->driFd, DRM_VIA_CMDBUFFER,
diff --git a/src/mesa/drivers/dri/unichrome/xf86drmVIA.c b/src/mesa/drivers/dri/unichrome/xf86drmVIA.c
deleted file mode 100644
index ebe368b2b7..0000000000
--- a/src/mesa/drivers/dri/unichrome/xf86drmVIA.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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.
- */
-
-#ifdef XFree86Server
-# include "xf86.h"
-# include "xf86_OSproc.h"
-# include "xf86_ansic.h"
-# define _DRM_MALLOC xalloc
-# define _DRM_FREE xfree
-# ifndef XFree86LOADER
-# include <sys/mman.h>
-# endif
-#else
-# include <stdio.h>
-# include <stdlib.h>
-# include <unistd.h>
-# include <string.h>
-# include <ctype.h>
-# include <fcntl.h>
-# include <errno.h>
-# include <signal.h>
-# include <sys/types.h>
-# include <sys/ioctl.h>
-# include <sys/mman.h>
-# include <sys/time.h>
-#include "imports.h"
-#define _DRM_MALLOC MALLOC
-#define _DRM_FREE FREE
-#endif
-
-/* Not all systems have MAP_FAILED defined */
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-#ifdef __linux__
-#include <sys/sysmacros.h> /* for makedev() */
-#endif
-#include "xf86drm.h"
-#include "xf86drmVIA.h"
-#include "drm.h"
-#include "via_common.h"
-int drmVIAAgpInit(int fd, int offset, int size)
-{
- drm_via_agp_t agp;
- agp.offset = offset;
- agp.size = size;
-
- if (ioctl(fd, DRM_IOCTL_VIA_AGP_INIT, &agp) < 0) {
- return -errno;
- }
- else {
- return 0;
- }
-}
-
-int drmVIAFBInit(int fd, int offset, int size)
-{
- drm_via_fb_t fb;
- fb.offset = offset;
- fb.size = size;
-
- if (ioctl(fd, DRM_IOCTL_VIA_FB_INIT, &fb) < 0) {
- return -errno;
- }
- else
- return 0;
-}
-
-int drmVIAInitMAP(int fd, drmVIAInit *info)
-{
- drm_via_init_t init;
-
- memset(&init, 0, sizeof(drm_via_init_t));
- init.func = VIA_INIT_MAP;
- init.sarea_priv_offset = info->sarea_priv_offset;
- init.fb_offset = info->fb_offset;
- init.mmio_offset = info->mmio_offset;
- init.agpAddr = info->agpAddr;
-
- if (ioctl(fd, DRM_IOCTL_VIA_MAP_INIT, &init ) < 0) {
- return -errno;
- }
- else
- return 0;
-}
-
-int drmVIAAllocateDMA(int fd, drmVIADMABuf *buf)
-{
- if (drmAddMap(fd, 0, buf->size,
- DRM_SHM, 0,
- &buf->index) < 0) {
- return -errno;
- }
-
- if (drmMap(fd,(drm_handle_t)buf->index,
- buf->size,(drmAddressPtr)(&buf->address)) < 0) {
- return -errno;
- }
-
- memset(buf->address, 0, buf->size);
-
- return 0;
-}
-
-int drmVIAReleaseDMA(int fd, drmVIADMABuf *buf)
-{
- if (drmUnmap((drmAddress)(buf->address), buf->size) < 0)
- return -errno;
-
- return 0;
-}
-
-int drmVIACmdBuffer(int fd, drmVIACommandBuffer *buf)
-{
- if (ioctl(fd, 0x48, buf ) < 0) {
- return -errno;
- }
- else
- return 0;
-}
-
diff --git a/src/mesa/drivers/dri/unichrome/xf86drmVIA.h b/src/mesa/drivers/dri/unichrome/xf86drmVIA.h
deleted file mode 100644
index e8c62bf4a7..0000000000
--- a/src/mesa/drivers/dri/unichrome/xf86drmVIA.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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 __XF86DRI_VIA_H__
-#define __XF86DRI_VIA_H__
-
-#define DRM_VIA_ALLOCMEM 0x00
-#define DRM_VIA_FREEMEM 0x01
-#define DRM_VIA_AGP_INIT 0x02
-#define DRM_VIA_FB_INIT 0x03
-#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
-#define DRM_VIA_FLUSH 0x09
-#define DRM_VIA_PCICMD 0x0a
-#define DRM_VIA_CMDBUF_SIZE 0x0b
-
-typedef struct {
- unsigned long sarea_priv_offset;
- unsigned long fb_offset;
- unsigned long mmio_offset;
- unsigned long agpAddr;
-} drmVIAInit;
-
-typedef struct {
- unsigned int offset;
- unsigned int size;
- unsigned int index;
-} drmVIAAGPBuf;
-
-typedef struct {
- unsigned int offset;
- unsigned int size;
- unsigned long index;
- unsigned long *address;
-} drmVIADMABuf;
-
-typedef struct {
- char *buf;
- unsigned long size;
-} drmVIACommandBuffer;
-
-typedef struct {
- enum {
- VIA_CMDBUF_SPACE = 0x01,
- VIA_CMDBUF_LAG = 0x02
- } func;
- int wait;
- unsigned size;
-} drmVIACmdBufSize;
-
-typedef struct {
- unsigned int offset;
- unsigned int size;
- unsigned long index;
- int discard; /* client is finished with the buffer? */
-} drmVIAFlush;
-
-typedef struct{
- enum {
- VIA_INIT_DMA = 0x01,
- VIA_CLEANUP_DMA = 0x02,
- VIA_DMA_INITIALIZED = 0x03
- } func;
-
- unsigned long offset;
- unsigned long size;
- unsigned long reg_pause_addr;
-} drmVIADMAInit;
-
-extern int drmVIAAgpInit(int fd, int offset, int size);
-extern int drmVIAFBInit(int fd, int offset, int size);
-extern int drmVIAInitMAP(int fd, drmVIAInit *info);
-extern int drmVIAAllocateDMA(int fd, drmVIADMABuf *buf);
-extern int drmVIAReleaseDMA(int fd, drmVIADMABuf *buf);
-
-
-#endif