summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorJon Smirl <jonsmirl@gmail.com>2004-03-12 03:50:30 +0000
committerJon Smirl <jonsmirl@gmail.com>2004-03-12 03:50:30 +0000
commitba5c49ab427d33915562b2c257db582c84eb7dd0 (patch)
tree9b56fdc34fa42ac45653d6475568fc5ca316224b /src/mesa/drivers/dri
parent5fb0763d2ea6eeb12000f40b96ce556c35fe115f (diff)
Make R128 driver use sarea/defines from DRM. removed r128_common.h
and r128_sarea.h since they are redundant now.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/r128/r128_context.c8
-rw-r--r--src/mesa/drivers/dri/r128/r128_context.h9
-rw-r--r--src/mesa/drivers/dri/r128/r128_ioctl.c60
-rw-r--r--src/mesa/drivers/dri/r128/r128_ioctl.h3
-rw-r--r--src/mesa/drivers/dri/r128/r128_lock.c6
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.c20
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.h1
-rw-r--r--src/mesa/drivers/dri/r128/r128_state.c14
-rw-r--r--src/mesa/drivers/dri/r128/r128_texobj.h3
-rw-r--r--src/mesa/drivers/dri/r128/server/r128_common.h169
-rw-r--r--src/mesa/drivers/dri/r128/server/r128_dri.c30
-rw-r--r--src/mesa/drivers/dri/r128/server/r128_dri.h1
-rw-r--r--src/mesa/drivers/dri/r128/server/r128_sarea.h195
13 files changed, 74 insertions, 445 deletions
diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c
index e5be8000c2..012840effe 100644
--- a/src/mesa/drivers/dri/r128/r128_context.c
+++ b/src/mesa/drivers/dri/r128/r128_context.c
@@ -144,7 +144,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
driParseConfigFiles (&rmesa->optionCache, &r128scrn->optionCache,
r128scrn->driScreen->myNum, "r128");
- rmesa->sarea = (R128SAREAPrivPtr)((char *)sPriv->pSAREA +
+ rmesa->sarea = (drm_r128_sarea_t *)((char *)sPriv->pSAREA +
r128scrn->sarea_priv_offset);
rmesa->CurrentTexObj[0] = NULL;
@@ -159,9 +159,9 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
r128scrn->texSize[i],
12,
R128_NR_TEX_REGIONS,
- rmesa->sarea->texList[i],
- & rmesa->sarea->texAge[i],
- & rmesa->swapped,
+ (drmTextureRegionPtr)rmesa->sarea->tex_list[i],
+ &rmesa->sarea->tex_age[i],
+ &rmesa->swapped,
sizeof( r128TexObj ),
(destroy_texture_object_t *) r128DestroyTexObj );
diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h
index 0a8735fd08..de258da3f5 100644
--- a/src/mesa/drivers/dri/r128/r128_context.h
+++ b/src/mesa/drivers/dri/r128/r128_context.h
@@ -39,9 +39,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef GLX_DIRECT_RENDERING
#include "dri_util.h"
-
-#include "xf86drm.h"
-#include "r128_common.h"
+#include "drm.h"
+#include "r128_drm.h"
#include "mtypes.h"
@@ -121,7 +120,7 @@ struct r128_context {
*/
GLuint new_state;
GLuint dirty; /* Hardware state to be updated */
- r128_context_regs_t setup;
+ drm_r128_context_regs_t setup;
GLuint NewGLState;
GLuint Fallback;
@@ -199,7 +198,7 @@ struct r128_context {
int driFd;
r128ScreenPtr r128Screen; /* Screen private DRI data */
- R128SAREAPrivPtr sarea; /* Private SAREA data */
+ drm_r128_sarea_t *sarea; /* Private SAREA data */
/* Performance counters
*/
diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c
index e1c959b35f..e34173725c 100644
--- a/src/mesa/drivers/dri/r128/r128_ioctl.c
+++ b/src/mesa/drivers/dri/r128/r128_ioctl.c
@@ -112,7 +112,7 @@ void r128FlushVerticesLocked( r128ContextPtr rmesa )
int count = rmesa->num_verts;
int prim = rmesa->hw_primitive;
int fd = rmesa->driScreen->fd;
- drmR128Vertex vertex;
+ drm_r128_vertex_t vertex;
int i;
rmesa->num_verts = 0;
@@ -142,7 +142,7 @@ void r128FlushVerticesLocked( r128ContextPtr rmesa )
vertex.idx = buffer->idx;
vertex.count = count;
vertex.discard = 1;
- drmCommandWrite( fd, DRM_R128_VERTEX, &vertex, sizeof(drmR128Vertex) );
+ drmCommandWrite( fd, DRM_R128_VERTEX, &vertex, sizeof(vertex) );
}
else
{
@@ -168,7 +168,7 @@ void r128FlushVerticesLocked( r128ContextPtr rmesa )
vertex.idx = buffer->idx;
vertex.count = count;
vertex.discard = discard;
- drmCommandWrite( fd, DRM_R128_VERTEX, &vertex, sizeof(drmR128Vertex) );
+ drmCommandWrite( fd, DRM_R128_VERTEX, &vertex, sizeof(vertex) );
}
}
@@ -187,7 +187,7 @@ void r128FireBlitLocked( r128ContextPtr rmesa, drmBufPtr buffer,
GLint offset, GLint pitch, GLint format,
GLint x, GLint y, GLint width, GLint height )
{
- drmR128Blit blit;
+ drm_r128_blit_t blit;
GLint ret;
blit.idx = buffer->idx;
@@ -200,7 +200,7 @@ void r128FireBlitLocked( r128ContextPtr rmesa, drmBufPtr buffer,
blit.height = height;
ret = drmCommandWrite( rmesa->driFd, DRM_R128_BLIT,
- &blit, sizeof(drmR128Blit) );
+ &blit, sizeof(blit) );
if ( ret ) {
UNLOCK_HARDWARE( rmesa );
@@ -410,7 +410,7 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = rmesa->driDrawable;
- drmR128Clear clear;
+ drm_r128_clear_t clear;
GLuint flags = 0;
GLint i;
GLint ret;
@@ -433,17 +433,17 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
if ( mask & DD_FRONT_LEFT_BIT ) {
- flags |= DRM_R128_FRONT_BUFFER;
+ flags |= R128_FRONT;
mask &= ~DD_FRONT_LEFT_BIT;
}
if ( mask & DD_BACK_LEFT_BIT ) {
- flags |= DRM_R128_BACK_BUFFER;
+ flags |= R128_BACK;
mask &= ~DD_BACK_LEFT_BIT;
}
if ( ( mask & DD_DEPTH_BIT ) && ctx->Depth.Mask ) {
- flags |= DRM_R128_DEPTH_BUFFER;
+ flags |= R128_DEPTH;
mask &= ~DD_DEPTH_BIT;
}
#if 0
@@ -520,7 +520,7 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
clear.depth_mask = ~0;
ret = drmCommandWrite( rmesa->driFd, DRM_R128_CLEAR,
- &clear, sizeof(drmR128Clear) );
+ &clear, sizeof(clear) );
if ( ret ) {
UNLOCK_HARDWARE( rmesa );
@@ -549,7 +549,7 @@ void r128WriteDepthSpanLocked( r128ContextPtr rmesa,
const GLubyte mask[] )
{
drm_clip_rect_t *pbox = rmesa->pClipRects;
- drmR128Depth d;
+ drm_r128_depth_t d;
int nbox = rmesa->numClipRects;
int fd = rmesa->driScreen->fd;
int i;
@@ -569,14 +569,14 @@ void r128WriteDepthSpanLocked( r128ContextPtr rmesa,
rmesa->sarea->nbox = nbox;
}
- d.func = DRM_R128_WRITE_SPAN;
+ d.func = R128_WRITE_SPAN;
d.n = n;
d.x = (int*)&x;
d.y = (int*)&y;
d.buffer = (unsigned int *)depth;
d.mask = (unsigned char *)mask;
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
+ drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
}
else
@@ -592,14 +592,14 @@ void r128WriteDepthSpanLocked( r128ContextPtr rmesa,
rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
- d.func = DRM_R128_WRITE_SPAN;
+ d.func = R128_WRITE_SPAN;
d.n = n;
d.x = (int*)&x;
d.y = (int*)&y;
d.buffer = (unsigned int *)depth;
d.mask = (unsigned char *)mask;
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
+ drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
}
}
@@ -612,7 +612,7 @@ void r128WriteDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
const GLubyte mask[] )
{
drm_clip_rect_t *pbox = rmesa->pClipRects;
- drmR128Depth d;
+ drm_r128_depth_t d;
int nbox = rmesa->numClipRects;
int fd = rmesa->driScreen->fd;
int i;
@@ -632,14 +632,14 @@ void r128WriteDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
rmesa->sarea->nbox = nbox;
}
- d.func = DRM_R128_WRITE_PIXELS;
+ d.func = R128_WRITE_PIXELS;
d.n = n;
d.x = (int*)&x;
d.y = (int*)&y;
d.buffer = (unsigned int *)depth;
d.mask = (unsigned char *)mask;
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
+ drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
}
else
{
@@ -654,14 +654,14 @@ void r128WriteDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
- d.func = DRM_R128_WRITE_PIXELS;
+ d.func = R128_WRITE_PIXELS;
d.n = n;
d.x = (int*)&x;
d.y = (int*)&y;
d.buffer = (unsigned int *)depth;
d.mask = (unsigned char *)mask;
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
+ drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
}
}
@@ -672,7 +672,7 @@ void r128ReadDepthSpanLocked( r128ContextPtr rmesa,
GLuint n, GLint x, GLint y )
{
drm_clip_rect_t *pbox = rmesa->pClipRects;
- drmR128Depth d;
+ drm_r128_depth_t d;
int nbox = rmesa->numClipRects;
int fd = rmesa->driScreen->fd;
int i;
@@ -692,14 +692,14 @@ void r128ReadDepthSpanLocked( r128ContextPtr rmesa,
rmesa->sarea->nbox = nbox;
}
- d.func = DRM_R128_READ_SPAN;
+ d.func = R128_READ_SPAN;
d.n = n;
d.x = (int*)&x;
d.y = (int*)&y;
d.buffer = NULL;
d.mask = NULL;
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
+ drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
}
else
{
@@ -714,14 +714,14 @@ void r128ReadDepthSpanLocked( r128ContextPtr rmesa,
rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
- d.func = DRM_R128_READ_SPAN;
+ d.func = R128_READ_SPAN;
d.n = n;
d.x = (int*)&x;
d.y = (int*)&y;
d.buffer = NULL;
d.mask = NULL;
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
+ drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
}
}
@@ -732,7 +732,7 @@ void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
const GLint x[], const GLint y[] )
{
drm_clip_rect_t *pbox = rmesa->pClipRects;
- drmR128Depth d;
+ drm_r128_depth_t d;
int nbox = rmesa->numClipRects;
int fd = rmesa->driScreen->fd;
int i;
@@ -752,14 +752,14 @@ void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
rmesa->sarea->nbox = nbox;
}
- d.func = DRM_R128_READ_PIXELS;
+ d.func = R128_READ_PIXELS;
d.n = n;
d.x = (int*)&x;
d.y = (int*)&y;
d.buffer = NULL;
d.mask = NULL;
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
+ drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
}
else
{
@@ -774,14 +774,14 @@ void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n,
rmesa->sarea->dirty |= R128_UPLOAD_CLIPRECTS;
- d.func = DRM_R128_READ_PIXELS;
+ d.func = R128_READ_PIXELS;
d.n = n;
d.x = (int*)&x;
d.y = (int*)&y;
d.buffer = NULL;
d.mask = NULL;
- drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(drmR128Depth));
+ drmCommandWrite( fd, DRM_R128_DEPTH, &d, sizeof(d));
}
}
diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.h b/src/mesa/drivers/dri/r128/r128_ioctl.h
index d10758feff..db1c4986ee 100644
--- a/src/mesa/drivers/dri/r128/r128_ioctl.h
+++ b/src/mesa/drivers/dri/r128/r128_ioctl.h
@@ -41,9 +41,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r128_reg.h"
#include "r128_lock.h"
-#include "xf86drm.h"
-#include "r128_common.h"
-
#define R128_BUFFER_MAX_DWORDS (R128_BUFFER_SIZE / sizeof(CARD32))
diff --git a/src/mesa/drivers/dri/r128/r128_lock.c b/src/mesa/drivers/dri/r128/r128_lock.c
index 12eb0128b0..47ad1c8246 100644
--- a/src/mesa/drivers/dri/r128/r128_lock.c
+++ b/src/mesa/drivers/dri/r128/r128_lock.c
@@ -85,7 +85,7 @@ void r128GetLock( r128ContextPtr rmesa, GLuint flags )
{
__DRIdrawablePrivate *dPriv = rmesa->driDrawable;
__DRIscreenPrivate *sPriv = rmesa->driScreen;
- R128SAREAPrivPtr sarea = rmesa->sarea;
+ drm_r128_sarea_t *sarea = rmesa->sarea;
int i;
drmGetLock( rmesa->driFd, rmesa->hHWContext, flags );
@@ -112,8 +112,8 @@ void r128GetLock( r128ContextPtr rmesa, GLuint flags )
rmesa->numClipRects = dPriv->numClipRects;
rmesa->pClipRects = dPriv->pClipRects;
- if ( sarea->ctxOwner != rmesa->hHWContext ) {
- sarea->ctxOwner = rmesa->hHWContext;
+ if ( sarea->ctx_owner != rmesa->hHWContext ) {
+ sarea->ctx_owner = rmesa->hHWContext;
rmesa->dirty = R128_UPLOAD_ALL;
}
diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c
index ac8f185a45..f77c325db1 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.c
+++ b/src/mesa/drivers/dri/r128/r128_screen.c
@@ -114,7 +114,7 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
r128Screen->sarea_priv_offset = r128DRIPriv->sarea_priv_offset;
if (sPriv->drmMinor >= 3) {
- drmR128GetParam gp;
+ drm_r128_getparam_t gp;
int ret;
gp.param = R128_PARAM_IRQ_NR;
@@ -190,21 +190,21 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
r128Screen->depthPitch = r128DRIPriv->depthPitch;
r128Screen->spanOffset = r128DRIPriv->spanOffset;
- r128Screen->texOffset[R128_CARD_HEAP] = r128DRIPriv->textureOffset;
- r128Screen->texSize[R128_CARD_HEAP] = r128DRIPriv->textureSize;
- r128Screen->logTexGranularity[R128_CARD_HEAP] = r128DRIPriv->log2TexGran;
+ r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureOffset;
+ r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureSize;
+ r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] = r128DRIPriv->log2TexGran;
if ( r128Screen->IsPCI ) {
r128Screen->numTexHeaps = R128_NR_TEX_HEAPS - 1;
- r128Screen->texOffset[R128_AGP_HEAP] = 0;
- r128Screen->texSize[R128_AGP_HEAP] = 0;
- r128Screen->logTexGranularity[R128_AGP_HEAP] = 0;
+ r128Screen->texOffset[R128_AGP_TEX_HEAP] = 0;
+ r128Screen->texSize[R128_AGP_TEX_HEAP] = 0;
+ r128Screen->logTexGranularity[R128_AGP_TEX_HEAP] = 0;
} else {
r128Screen->numTexHeaps = R128_NR_TEX_HEAPS;
- r128Screen->texOffset[R128_AGP_HEAP] =
+ r128Screen->texOffset[R128_AGP_TEX_HEAP] =
r128DRIPriv->agpTexOffset + R128_AGP_TEX_OFFSET;
- r128Screen->texSize[R128_AGP_HEAP] = r128DRIPriv->agpTexMapSize;
- r128Screen->logTexGranularity[R128_AGP_HEAP] =
+ r128Screen->texSize[R128_AGP_TEX_HEAP] = r128DRIPriv->agpTexMapSize;
+ r128Screen->logTexGranularity[R128_AGP_TEX_HEAP] =
r128DRIPriv->log2AGPTexGran;
}
diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h
index affe9e69ef..1fac0a7f49 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.h
+++ b/src/mesa/drivers/dri/r128/r128_screen.h
@@ -38,7 +38,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef GLX_DIRECT_RENDERING
-#include "r128_sarea.h"
#include "xmlconfig.h"
typedef struct {
diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c
index 8ed63dafe9..ec3a7965e5 100644
--- a/src/mesa/drivers/dri/r128/r128_state.c
+++ b/src/mesa/drivers/dri/r128/r128_state.c
@@ -724,7 +724,7 @@ static void r128DDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint stipple[32], i;
- drmR128Stipple stippleRec;
+ drm_r128_stipple_t stippleRec;
for (i = 0; i < 32; i++) {
stipple[31 - i] = ((mask[i*4+0] << 24) |
@@ -738,7 +738,7 @@ static void r128DDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
stippleRec.mask = stipple;
drmCommandWrite( rmesa->driFd, DRM_R128_STIPPLE,
- &stippleRec, sizeof(drmR128Stipple) );
+ &stippleRec, sizeof(stippleRec) );
UNLOCK_HARDWARE( rmesa );
@@ -906,8 +906,8 @@ static void r128DDPrintDirty( const char *msg, GLuint state )
*/
void r128EmitHwStateLocked( r128ContextPtr rmesa )
{
- R128SAREAPrivPtr sarea = rmesa->sarea;
- r128_context_regs_t *regs = &(rmesa->setup);
+ drm_r128_sarea_t *sarea = rmesa->sarea;
+ drm_r128_context_regs_t *regs = &(rmesa->setup);
const r128TexObjPtr t0 = rmesa->CurrentTexObj[0];
const r128TexObjPtr t1 = rmesa->CurrentTexObj[1];
@@ -920,11 +920,11 @@ void r128EmitHwStateLocked( r128ContextPtr rmesa )
R128_UPLOAD_MASKS |
R128_UPLOAD_WINDOW |
R128_UPLOAD_CORE) ) {
- memcpy( &sarea->ContextState, regs, sizeof(sarea->ContextState) );
+ memcpy( &sarea->context_state, regs, sizeof(sarea->context_state) );
}
if ( (rmesa->dirty & R128_UPLOAD_TEX0) && t0 ) {
- r128_texture_regs_t *tex = &sarea->TexState[0];
+ drm_r128_texture_regs_t *tex = &sarea->tex_state[0];
tex->tex_cntl = t0->setup.tex_cntl;
tex->tex_combine_cntl = rmesa->tex_combine[0];
@@ -935,7 +935,7 @@ void r128EmitHwStateLocked( r128ContextPtr rmesa )
}
if ( (rmesa->dirty & R128_UPLOAD_TEX1) && t1 ) {
- r128_texture_regs_t *tex = &sarea->TexState[1];
+ drm_r128_texture_regs_t *tex = &sarea->tex_state[1];
tex->tex_cntl = t1->setup.tex_cntl;
tex->tex_combine_cntl = rmesa->tex_combine[1];
diff --git a/src/mesa/drivers/dri/r128/r128_texobj.h b/src/mesa/drivers/dri/r128/r128_texobj.h
index e2ff1ac24d..057602d0a0 100644
--- a/src/mesa/drivers/dri/r128/r128_texobj.h
+++ b/src/mesa/drivers/dri/r128/r128_texobj.h
@@ -36,7 +36,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef _R128_TEXOBJ_H_
#define _R128_TEXOBJ_H_
-#include "r128_sarea.h"
#include "mm.h"
/* Individual texture image information.
@@ -63,7 +62,7 @@ struct r128_tex_obj {
CARD32 textureFormat; /* Actual hardware format */
- r128_texture_regs_t setup; /* Setup regs for texture */
+ drm_r128_texture_regs_t setup; /* Setup regs for texture */
};
#endif /* _R128_TEXOBJ_H_ */
diff --git a/src/mesa/drivers/dri/r128/server/r128_common.h b/src/mesa/drivers/dri/r128/server/r128_common.h
deleted file mode 100644
index fa81360ea5..0000000000
--- a/src/mesa/drivers/dri/r128/server/r128_common.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* r128_common.h -- common header definitions for R128 2D/3D/DRM suite
- * Created: Sun Apr 9 18:16:28 2000 by kevin@precisioninsight.com
- *
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
- * 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, sublicense,
- * 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 NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT 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.
- *
- * Author:
- * Gareth Hughes <gareth@valinux.com>
- * Kevin E. Martin <martin@valinux.com>
- *
- * Converted to common header format:
- * Jens Owen <jens@tungstengraphics.com>
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.11 2001/04/16 15:02:13 tsi Exp $
- *
- */
-
-#ifndef _R128_COMMON_H_
-#define _R128_COMMON_H_
-
-/*
- * WARNING: If you change any of these defines, make sure to change
- * the kernel include file as well (r128_drm.h)
- */
-
-/* Driver specific DRM command indices
- * NOTE: these are not OS specific, but they are driver specific
- */
-#define DRM_R128_INIT 0x00
-#define DRM_R128_CCE_START 0x01
-#define DRM_R128_CCE_STOP 0x02
-#define DRM_R128_CCE_RESET 0x03
-#define DRM_R128_CCE_IDLE 0x04
-#define DRM_R128_UNDEFINED1 0x05
-#define DRM_R128_RESET 0x06
-#define DRM_R128_SWAP 0x07
-#define DRM_R128_CLEAR 0x08
-#define DRM_R128_VERTEX 0x09
-#define DRM_R128_INDICES 0x0a
-#define DRM_R128_BLIT 0x0b
-#define DRM_R128_DEPTH 0x0c
-#define DRM_R128_STIPPLE 0x0d
-#define DRM_R128_UNDEFINED2 0x0e
-#define DRM_R128_INDIRECT 0x0f
-#define DRM_R128_FULLSCREEN 0x10
-#define DRM_R128_CLEAR2 0x11
-#define DRM_R128_GETPARAM 0x12
-#define DRM_R128_FLIP 0x13
-
-#define DRM_R128_FRONT_BUFFER 0x1
-#define DRM_R128_BACK_BUFFER 0x2
-#define DRM_R128_DEPTH_BUFFER 0x4
-
-typedef struct {
- enum {
- DRM_R128_INIT_CCE = 0x01,
- DRM_R128_CLEANUP_CCE = 0x02
- } func;
- unsigned long sarea_priv_offset;
- int is_pci;
- int cce_mode;
- int cce_secure; /* FIXME: Deprecated, we should remove this */
- int ring_size;
- int usec_timeout;
-
- unsigned int fb_bpp;
- unsigned int front_offset, front_pitch;
- unsigned int back_offset, back_pitch;
- unsigned int depth_bpp;
- unsigned int depth_offset, depth_pitch;
- unsigned int span_offset;
-
- unsigned long fb_offset;
- unsigned long mmio_offset;
- unsigned long ring_offset;
- unsigned long ring_rptr_offset;
- unsigned long buffers_offset;
- unsigned long agp_textures_offset;
-} drmR128Init;
-
-typedef struct {
- int flush;
- int idle;
-} drmR128CCEStop;
-
-typedef struct {
- int idx;
- int start;
- int end;
- int discard;
-} drmR128Indirect;
-
-typedef struct {
- int idx;
- int pitch;
- int offset;
- int format;
- unsigned short x, y;
- unsigned short width, height;
-} drmR128Blit;
-
-typedef struct {
- enum {
- DRM_R128_WRITE_SPAN = 0x01,
- DRM_R128_WRITE_PIXELS = 0x02,
- DRM_R128_READ_SPAN = 0x03,
- DRM_R128_READ_PIXELS = 0x04
- } func;
- int n;
- int *x;
- int *y;
- unsigned int *buffer;
- unsigned char *mask;
-} drmR128Depth;
-
-typedef struct {
- int prim;
- int idx; /* Index of vertex buffer */
- int count; /* Number of vertices in buffer */
- int discard; /* Client finished with buffer? */
-} drmR128Vertex;
-
-typedef struct {
- unsigned int *mask;
-} drmR128Stipple;
-
-typedef struct {
- unsigned int flags;
- unsigned int clear_color;
- unsigned int clear_depth;
- unsigned int color_mask;
- unsigned int depth_mask;
-} drmR128Clear;
-
-typedef struct {
- enum {
- DRM_R128_INIT_FULLSCREEN = 0x01,
- DRM_R128_CLEANUP_FULLSCREEN = 0x02
- } func;
-} drmR128Fullscreen;
-
-typedef struct drm_r128_getparam {
- int param;
- void *value;
-} drmR128GetParam;
-
-#define R128_PARAM_IRQ_NR 1
-
-#endif
diff --git a/src/mesa/drivers/dri/r128/server/r128_dri.c b/src/mesa/drivers/dri/r128/server/r128_dri.c
index 8fd6b6e77d..b62f375966 100644
--- a/src/mesa/drivers/dri/r128/server/r128_dri.c
+++ b/src/mesa/drivers/dri/r128/server/r128_dri.c
@@ -52,8 +52,8 @@
#include "r128_dri.h"
#include "r128_macros.h"
#include "r128_reg.h"
-#include "r128_sarea.h"
#include "r128_version.h"
+#include "r128_drm.h"
/* ?? HACK - for now, put this here... */
@@ -458,11 +458,11 @@ static GLboolean R128DRIMapInit(const DRIDriverContext *ctx)
static int R128DRIKernelInit(const DRIDriverContext *ctx)
{
R128InfoPtr info = ctx->driverPrivate;
- drmR128Init drmInfo;
+ drm_r128_init_t drmInfo;
- memset( &drmInfo, 0, sizeof(drmR128Init) );
+ memset( &drmInfo, 0, sizeof(&drmInfo) );
- drmInfo.func = DRM_R128_INIT_CCE;
+ drmInfo.func = R128_INIT_CCE;
drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
drmInfo.is_pci = info->IsPCI;
drmInfo.cce_mode = info->CCEMode;
@@ -491,7 +491,7 @@ static int R128DRIKernelInit(const DRIDriverContext *ctx)
drmInfo.agp_textures_offset = info->agpTexHandle;
if (drmCommandWrite(ctx->drmFD, DRM_R128_INIT,
- &drmInfo, sizeof(drmR128Init)) < 0)
+ &drmInfo, sizeof(drmInfo)) < 0)
return GL_FALSE;
return GL_TRUE;
@@ -569,14 +569,14 @@ static void R128DRIIrqInit(const DRIDriverContext *ctx)
static int R128CCEStop(const DRIDriverContext *ctx)
{
R128InfoPtr info = ctx->driverPrivate;
- drmR128CCEStop stop;
+ drm_r128_cce_stop_t stop;
int ret, i;
stop.flush = 1;
stop.idle = 1;
ret = drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
- &stop, sizeof(drmR128CCEStop) );
+ &stop, sizeof(stop) );
if ( ret == 0 ) {
return 0;
@@ -589,7 +589,7 @@ static int R128CCEStop(const DRIDriverContext *ctx)
i = 0;
do {
ret = drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
- &stop, sizeof(drmR128CCEStop) );
+ &stop, sizeof(stop) );
} while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY );
if ( ret == 0 ) {
@@ -601,7 +601,7 @@ static int R128CCEStop(const DRIDriverContext *ctx)
stop.idle = 0;
if ( drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
- &stop, sizeof(drmR128CCEStop) )) {
+ &stop, sizeof(stop) )) {
return -errno;
} else {
return 0;
@@ -884,8 +884,8 @@ static GLboolean R128DRIScreenInit(DRIDriverContext *ctx)
0,
info->backPitch * ctx->cpp * ctx->shared.virtualHeight );
- R128SAREAPrivPtr pSAREAPriv;
- pSAREAPriv = (R128SAREAPrivPtr)(((char*)ctx->pSAREA) +
+ drm_r128_sarea_t *pSAREAPriv;
+ pSAREAPriv = (drm_r128_sarea_t *)(((char*)ctx->pSAREA) +
sizeof(drm_sarea_t));
memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
@@ -931,7 +931,7 @@ static GLboolean R128DRIScreenInit(DRIDriverContext *ctx)
void R128DRICloseScreen(const DRIDriverContext *ctx)
{
R128InfoPtr info = ctx->driverPrivate;
- drmR128Init drmInfo;
+ drm_r128_init_t drmInfo;
/* Stop the CCE if it is still in use */
R128CCE_STOP(ctx, info);
@@ -948,10 +948,10 @@ void R128DRICloseScreen(const DRIDriverContext *ctx)
}
/* De-allocate all kernel resources */
- memset(&drmInfo, 0, sizeof(drmR128Init));
- drmInfo.func = DRM_R128_CLEANUP_CCE;
+ memset(&drmInfo, 0, sizeof(drmInfo));
+ drmInfo.func = R128_CLEANUP_CCE;
drmCommandWrite(ctx->drmFD, DRM_R128_INIT,
- &drmInfo, sizeof(drmR128Init));
+ &drmInfo, sizeof(drmInfo));
/* De-allocate all AGP resources */
if (info->agpTex) {
diff --git a/src/mesa/drivers/dri/r128/server/r128_dri.h b/src/mesa/drivers/dri/r128/server/r128_dri.h
index 80f94ded68..45a2773605 100644
--- a/src/mesa/drivers/dri/r128/server/r128_dri.h
+++ b/src/mesa/drivers/dri/r128/server/r128_dri.h
@@ -40,7 +40,6 @@
#define _R128_DRI_
#include "xf86drm.h"
-#include "r128_common.h"
/* DRI Driver defaults */
#define R128_DEFAULT_CCE_PIO_MODE R128_PM4_64PIO_64VCBM_64INDBM
diff --git a/src/mesa/drivers/dri/r128/server/r128_sarea.h b/src/mesa/drivers/dri/r128/server/r128_sarea.h
deleted file mode 100644
index d5f431f12e..0000000000
--- a/src/mesa/drivers/dri/r128/server/r128_sarea.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.7 2002/02/16 21:26:35 herrb Exp $ */
-/*
- * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
- * Precision Insight, Inc., Cedar Park, Texas, and
- * VA Linux Systems Inc., Fremont, California.
- *
- * 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 on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, 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 ATI, PRECISION INSIGHT, VA LINUX
- * SYSTEMS AND/OR THEIR 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.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#ifndef _R128_SAREA_H_
-#define _R128_SAREA_H_
-
-/* WARNING: If you change any of these defines, make sure to change the
- * defines in the kernel file (r128_drm.h)
- */
-#ifndef __R128_SAREA_DEFINES__
-#define __R128_SAREA_DEFINES__
-
-/* What needs to be changed for the current vertex buffer?
- */
-#define R128_UPLOAD_CONTEXT 0x001
-#define R128_UPLOAD_SETUP 0x002
-#define R128_UPLOAD_TEX0 0x004
-#define R128_UPLOAD_TEX1 0x008
-#define R128_UPLOAD_TEX0IMAGES 0x010
-#define R128_UPLOAD_TEX1IMAGES 0x020
-#define R128_UPLOAD_CORE 0x040
-#define R128_UPLOAD_MASKS 0x080
-#define R128_UPLOAD_WINDOW 0x100
-#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */
-#define R128_REQUIRE_QUIESCENCE 0x400
-#define R128_UPLOAD_ALL 0x7ff
-
-#define R128_FRONT 0x1
-#define R128_BACK 0x2
-#define R128_DEPTH 0x4
-
-/* Primitive types
- */
-#define R128_POINTS 0x1
-#define R128_LINES 0x2
-#define R128_LINE_STRIP 0x3
-#define R128_TRIANGLES 0x4
-#define R128_TRIANGLE_FAN 0x5
-#define R128_TRIANGLE_STRIP 0x6
-
-/* Vertex/indirect buffer size
- */
-#define R128_BUFFER_SIZE 16384
-
-/* Byte offsets for indirect buffer data
- */
-#define R128_INDEX_PRIM_OFFSET 20
-#define R128_HOSTDATA_BLIT_OFFSET 32
-
-/* Keep these small for testing
- */
-#define R128_NR_SAREA_CLIPRECTS 12
-
-/* There are 2 heaps (local/AGP). Each region within a heap is a
- * minimum of 64k, and there are at most 64 of them per heap.
- */
-#define R128_CARD_HEAP 0
-#define R128_AGP_HEAP 1
-#define R128_NR_TEX_HEAPS 2
-#define R128_NR_TEX_REGIONS 64
-#define R128_LOG_TEX_GRANULARITY 16
-
-#define R128_NR_CONTEXT_REGS 12
-
-#define R128_MAX_TEXTURE_LEVELS 11
-#define R128_MAX_TEXTURE_UNITS 2
-
-#endif /* __R128_SAREA_DEFINES__ */
-
-typedef struct {
- /* Context state - can be written in one large chunk */
- unsigned int dst_pitch_offset_c;
- unsigned int dp_gui_master_cntl_c;
- unsigned int sc_top_left_c;
- unsigned int sc_bottom_right_c;
- unsigned int z_offset_c;
- unsigned int z_pitch_c;
- unsigned int z_sten_cntl_c;
- unsigned int tex_cntl_c;
- unsigned int misc_3d_state_cntl_reg;
- unsigned int texture_clr_cmp_clr_c;
- unsigned int texture_clr_cmp_msk_c;
- unsigned int fog_color_c;
-
- /* Texture state */
- unsigned int tex_size_pitch_c;
- unsigned int constant_color_c;
-
- /* Setup state */
- unsigned int pm4_vc_fpu_setup;
- unsigned int setup_cntl;
-
- /* Mask state */
- unsigned int dp_write_mask;
- unsigned int sten_ref_mask_c;
- unsigned int plane_3d_mask_c;
-
- /* Window state */
- unsigned int window_xy_offset;
-
- /* Core state */
- unsigned int scale_3d_cntl;
-} r128_context_regs_t;
-
-/* Setup registers for each texture unit
- */
-typedef struct {
- unsigned int tex_cntl;
- unsigned int tex_combine_cntl;
- unsigned int tex_size_pitch;
- unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS];
- unsigned int tex_border_color;
-} r128_texture_regs_t;
-
-typedef struct {
- /* The channel for communication of state information to the kernel
- * on firing a vertex buffer.
- */
- r128_context_regs_t ContextState;
- r128_texture_regs_t TexState[R128_MAX_TEXTURE_UNITS];
- unsigned int dirty;
- unsigned int vertsize;
- unsigned int vc_format;
-
-#if defined(XF86DRI) | defined(_SOLO)
- /* The current cliprects, or a subset thereof.
- */
- drm_clip_rect_t boxes[R128_NR_SAREA_CLIPRECTS];
- unsigned int nbox;
-#endif
-
- /* Counters for throttling of rendering clients.
- */
- unsigned int last_frame;
- unsigned int last_dispatch;
-
- /* Maintain an LRU of contiguous regions of texture space. If you
- * think you own a region of texture memory, and it has an age
- * different to the one you set, then you are mistaken and it has
- * been stolen by another client. If global texAge hasn't changed,
- * there is no need to walk the list.
- *
- * These regions can be used as a proxy for the fine-grained texture
- * information of other clients - by maintaining them in the same
- * lru which is used to age their own textures, clients have an
- * approximate lru for the whole of global texture space, and can
- * make informed decisions as to which areas to kick out. There is
- * no need to choose whether to kick out your own texture or someone
- * else's - simply eject them all in LRU order.
- */
- /* Last elt is sentinal */
- drmTextureRegion texList[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1];
- /* last time texture was uploaded */
- unsigned int texAge[R128_NR_TEX_HEAPS];
-
- int ctxOwner; /* last context to upload state */
- int pfAllowPageFlip; /* set by the 2d driver, read by the client */
- int pfCurrentPage; /* set by kernel, read by others */
-} R128SAREAPriv, *R128SAREAPrivPtr;
-
-#endif