projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dri: use BorderColor instead of _BorderChan
[mesa.git]
/
src
/
mesa
/
drivers
/
dri
/
r200
/
r200_ioctl.c
diff --git
a/src/mesa/drivers/dri/r200/r200_ioctl.c
b/src/mesa/drivers/dri/r200/r200_ioctl.c
index bf2d091759148baca0060f54c2708da42c132356..0741e57af717dcfd599f5e21f08d7ddb53225f2b 100644
(file)
--- a/
src/mesa/drivers/dri/r200/r200_ioctl.c
+++ b/
src/mesa/drivers/dri/r200/r200_ioctl.c
@@
-1,4
+1,3
@@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c,v 1.4 2002/12/17 00:32:56 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
@@
-36,10
+35,10
@@
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <sched.h>
#include <errno.h>
#include <sched.h>
#include <errno.h>
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
-#include "context.h"
+#include "
main/
glheader.h"
+#include "
main/
imports.h"
+#include "ma
in/ma
cros.h"
+#include "
main/
context.h"
#include "swrast/swrast.h"
#include "r200_context.h"
#include "swrast/swrast.h"
#include "r200_context.h"
@@
-49,9
+48,9
@@
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_sanity.h"
#include "radeon_reg.h"
#include "r200_sanity.h"
#include "radeon_reg.h"
+#include "drirenderbuffer.h"
#include "vblank.h"
#include "vblank.h"
-
#define R200_TIMEOUT 512
#define R200_IDLE_RETRY 16
#define R200_TIMEOUT 512
#define R200_IDLE_RETRY 16
@@
-330,24
+329,15
@@
void r200AllocDmaRegion( r200ContextPtr rmesa,
assert( rmesa->dma.current.ptr <= rmesa->dma.current.end );
}
assert( rmesa->dma.current.ptr <= rmesa->dma.current.end );
}
-void r200AllocDmaRegionVerts( r200ContextPtr rmesa,
- struct r200_dma_region *region,
- int numverts,
- int vertsize,
- int alignment )
-{
- r200AllocDmaRegion( rmesa, region, vertsize * numverts, alignment );
-}
-
/* ================================================================
* SwapBuffers with client-side throttling
*/
/* ================================================================
* SwapBuffers with client-side throttling
*/
-static u
_
int32_t r200GetLastFrame(r200ContextPtr rmesa)
+static uint32_t r200GetLastFrame(r200ContextPtr rmesa)
{
drm_radeon_getparam_t gp;
int ret;
{
drm_radeon_getparam_t gp;
int ret;
- u
_
int32_t frame;
+ uint32_t frame;
gp.param = RADEON_PARAM_LAST_FRAME;
gp.value = (int *)&frame;
gp.param = RADEON_PARAM_LAST_FRAME;
gp.value = (int *)&frame;
@@
-383,7
+373,7
@@
static void r200WaitIrq( r200ContextPtr rmesa )
do {
ret = drmCommandWrite( rmesa->dri.fd, DRM_RADEON_IRQ_WAIT,
&rmesa->iw, sizeof(rmesa->iw) );
do {
ret = drmCommandWrite( rmesa->dri.fd, DRM_RADEON_IRQ_WAIT,
&rmesa->iw, sizeof(rmesa->iw) );
- } while (ret && (errno == EINTR || errno == E
AGAIN
));
+ } while (ret && (errno == EINTR || errno == E
BUSY
));
if ( ret ) {
fprintf( stderr, "%s: drmRadeonIrqWait: %d\n", __FUNCTION__, ret );
if ( ret ) {
fprintf( stderr, "%s: drmRadeonIrqWait: %d\n", __FUNCTION__, ret );
@@
-429,12
+419,14
@@
static void r200WaitForFrameCompletion( r200ContextPtr rmesa )
/* Copy the back color buffer to the front color buffer.
*/
/* Copy the back color buffer to the front color buffer.
*/
-void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
+void r200CopyBuffer( __DRIdrawablePrivate *dPriv,
+ const drm_clip_rect_t *rect)
{
r200ContextPtr rmesa;
GLint nbox, i, ret;
GLboolean missed_target;
int64_t ust;
{
r200ContextPtr rmesa;
GLint nbox, i, ret;
GLboolean missed_target;
int64_t ust;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
assert(dPriv);
assert(dPriv->driContextPriv);
assert(dPriv);
assert(dPriv->driContextPriv);
@@
-455,9
+447,12
@@
void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
* request at a time.
*/
r200WaitForFrameCompletion( rmesa );
* request at a time.
*/
r200WaitForFrameCompletion( rmesa );
- UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target );
- LOCK_HARDWARE( rmesa );
+ if (!rect)
+ {
+ UNLOCK_HARDWARE( rmesa );
+ driWaitForVBlank( dPriv, & missed_target );
+ LOCK_HARDWARE( rmesa );
+ }
nbox = dPriv->numClipRects; /* must be in locked region */
nbox = dPriv->numClipRects; /* must be in locked region */
@@
-468,11
+463,32
@@
void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
GLint n = 0;
for ( ; i < nr ; i++ ) {
GLint n = 0;
for ( ; i < nr ; i++ ) {
- *b++ = box[i];
- n++;
+
+ *b = box[i];
+
+ if (rect)
+ {
+ if (rect->x1 > b->x1)
+ b->x1 = rect->x1;
+ if (rect->y1 > b->y1)
+ b->y1 = rect->y1;
+ if (rect->x2 < b->x2)
+ b->x2 = rect->x2;
+ if (rect->y2 < b->y2)
+ b->y2 = rect->y2;
+
+ if (b->x1 >= b->x2 || b->y1 >= b->y2)
+ continue;
+ }
+
+ b++;
+ n++;
}
rmesa->sarea->nbox = n;
}
rmesa->sarea->nbox = n;
+ if (!n)
+ continue;
+
ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_SWAP );
if ( ret ) {
ret = drmCommandNone( rmesa->dri.fd, DRM_RADEON_SWAP );
if ( ret ) {
@@
-483,25
+499,29
@@
void r200CopyBuffer( const __DRIdrawablePrivate *dPriv )
}
UNLOCK_HARDWARE( rmesa );
}
UNLOCK_HARDWARE( rmesa );
- rmesa->hw.all_dirty = GL_TRUE;
+ if (!rect)
+ {
+ rmesa->hw.all_dirty = GL_TRUE;
- rmesa->swap_count++;
-
(*dri_interfac
e->getUST)( & ust );
- if ( missed_target ) {
- rmesa->swap_missed_count++;
- rmesa->swap_missed_ust = ust - rmesa->swap_ust;
- }
+
rmesa->swap_count++;
+
(*psp->systemTim
e->getUST)( & ust );
+
if ( missed_target ) {
+
rmesa->swap_missed_count++;
+
rmesa->swap_missed_ust = ust - rmesa->swap_ust;
+
}
- rmesa->swap_ust = ust;
+
rmesa->swap_ust = ust;
- sched_yield();
+ sched_yield();
+ }
}
}
-void r200PageFlip(
const
__DRIdrawablePrivate *dPriv )
+void r200PageFlip( __DRIdrawablePrivate *dPriv )
{
r200ContextPtr rmesa;
GLint ret;
GLboolean missed_target;
{
r200ContextPtr rmesa;
GLint ret;
GLboolean missed_target;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
assert(dPriv);
assert(dPriv->driContextPriv);
assert(dPriv);
assert(dPriv->driContextPriv);
@@
-537,10
+557,10
@@
void r200PageFlip( const __DRIdrawablePrivate *dPriv )
*/
r200WaitForFrameCompletion( rmesa );
UNLOCK_HARDWARE( rmesa );
*/
r200WaitForFrameCompletion( rmesa );
UNLOCK_HARDWARE( rmesa );
- driWaitForVBlank( dPriv, &
rmesa->vbl_seq, rmesa->vblank_flags, &
missed_target );
+ driWaitForVBlank( dPriv, & missed_target );
if ( missed_target ) {
rmesa->swap_missed_count++;
if ( missed_target ) {
rmesa->swap_missed_count++;
- (void) (*
dri_interfac
e->getUST)( & rmesa->swap_missed_ust );
+ (void) (*
psp->systemTim
e->getUST)( & rmesa->swap_missed_ust );
}
LOCK_HARDWARE( rmesa );
}
LOCK_HARDWARE( rmesa );
@@
-554,7
+574,7
@@
void r200PageFlip( const __DRIdrawablePrivate *dPriv )
}
rmesa->swap_count++;
}
rmesa->swap_count++;
- (void) (*
dri_interfac
e->getUST)( & rmesa->swap_ust );
+ (void) (*
psp->systemTim
e->getUST)( & rmesa->swap_ust );
#if 000
if ( rmesa->sarea->pfCurrentPage == 1 ) {
#if 000
if ( rmesa->sarea->pfCurrentPage == 1 ) {
@@
-573,6
+593,13
@@
void r200PageFlip( const __DRIdrawablePrivate *dPriv )
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
}
#else
rmesa->hw.ctx.cmd[CTX_RB3D_COLORPITCH] |= R200_COLOR_TILE_ENABLE;
}
#else
+ /* Get ready for drawing next frame. Update the renderbuffers'
+ * flippedOffset/Pitch fields so we draw into the right place.
+ */
+ driFlipRenderbuffers(rmesa->glCtx->WinSysDrawBuffer,
+ rmesa->sarea->pfCurrentPage);
+
+
r200UpdateDrawBuffer(rmesa->glCtx);
#endif
}
r200UpdateDrawBuffer(rmesa->glCtx);
#endif
}
@@
-581,18
+608,17
@@
void r200PageFlip( const __DRIdrawablePrivate *dPriv )
/* ================================================================
* Buffer clear
*/
/* ================================================================
* Buffer clear
*/
-static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
- GLint cx, GLint cy, GLint cw, GLint ch )
+static void r200Clear( GLcontext *ctx, GLbitfield mask )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
GLuint flags = 0;
GLuint color_mask = 0;
GLint ret, i;
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
GLuint flags = 0;
GLuint color_mask = 0;
GLint ret, i;
+ GLint cx, cy, cw, ch;
if ( R200_DEBUG & DEBUG_IOCTL ) {
if ( R200_DEBUG & DEBUG_IOCTL ) {
- fprintf( stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n",
- __FUNCTION__, all, cx, cy, cw, ch );
+ fprintf( stderr, "r200Clear\n");
}
{
}
{
@@
-629,7
+655,7
@@
static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
if ( mask ) {
if (R200_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "%s: swrast clear, mask: %x\n", __FUNCTION__, mask);
if ( mask ) {
if (R200_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "%s: swrast clear, mask: %x\n", __FUNCTION__, mask);
- _swrast_Clear( ctx, mask
, all, cx, cy, cw, ch
);
+ _swrast_Clear( ctx, mask );
}
if ( !flags )
}
if ( !flags )
@@
-637,7
+663,7
@@
static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
if (rmesa->using_hyperz) {
flags |= RADEON_USE_COMP_ZBUF;
if (rmesa->using_hyperz) {
flags |= RADEON_USE_COMP_ZBUF;
-/* if (rmesa->r200Screen->chip
set & R200_CHIPSET_REAL
_R200)
+/* if (rmesa->r200Screen->chip
_family == CHIP_FAMILY
_R200)
flags |= RADEON_USE_HIERZ; */
if (!(rmesa->state.stencil.hwBuffer) ||
((flags & RADEON_DEPTH) && (flags & RADEON_STENCIL) &&
flags |= RADEON_USE_HIERZ; */
if (!(rmesa->state.stencil.hwBuffer) ||
((flags & RADEON_DEPTH) && (flags & RADEON_STENCIL) &&
@@
-646,12
+672,18
@@
static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
}
}
}
}
+ LOCK_HARDWARE( rmesa );
+
+ /* compute region after locking: */
+ cx = ctx->DrawBuffer->_Xmin;
+ cy = ctx->DrawBuffer->_Ymin;
+ cw = ctx->DrawBuffer->_Xmax - cx;
+ ch = ctx->DrawBuffer->_Ymax - cy;
+
/* Flip top to bottom */
cx += dPriv->x;
cy = dPriv->y + dPriv->h - cy - ch;
/* Flip top to bottom */
cx += dPriv->x;
cy = dPriv->y + dPriv->h - cy - ch;
- LOCK_HARDWARE( rmesa );
-
/* Throttle the number of clear ioctls we do.
*/
while ( 1 ) {
/* Throttle the number of clear ioctls we do.
*/
while ( 1 ) {
@@
-693,7
+725,8
@@
static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS];
GLint n = 0;
drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS];
GLint n = 0;
- if ( !all ) {
+ if (cw != dPriv->w || ch != dPriv->h) {
+ /* clear subregion */
for ( ; i < nr ; i++ ) {
GLint x = box[i].x1;
GLint y = box[i].y1;
for ( ; i < nr ; i++ ) {
GLint x = box[i].x1;
GLint y = box[i].y1;
@@
-715,6
+748,7
@@
static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
n++;
}
} else {
n++;
}
} else {
+ /* clear whole window */
for ( ; i < nr ; i++ ) {
*b++ = box[i];
n++;
for ( ; i < nr ; i++ ) {
*b++ = box[i];
n++;
@@
-827,7
+861,7
@@
void r200Finish( GLcontext *ctx )
* the kernel data structures, and the current context to get the
* device fd.
*/
* the kernel data structures, and the current context to get the
* device fd.
*/
-void *r200AllocateMemoryMESA(__DRI
nativeDisplay *dpy, int scr
n, GLsizei size,
+void *r200AllocateMemoryMESA(__DRI
screen *scree
n, GLsizei size,
GLfloat readfreq, GLfloat writefreq,
GLfloat priority)
{
GLfloat readfreq, GLfloat writefreq,
GLfloat priority)
{
@@
-846,10
+880,7
@@
void *r200AllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLsizei size,
if (getenv("R200_NO_ALLOC"))
return NULL;
if (getenv("R200_NO_ALLOC"))
return NULL;
-
- if (rmesa->dri.drmMinor < 6)
- return NULL;
-
+
alloc.region = RADEON_MEM_REGION_GART;
alloc.alignment = 0;
alloc.size = size;
alloc.region = RADEON_MEM_REGION_GART;
alloc.alignment = 0;
alloc.size = size;
@@
-872,7
+903,7
@@
void *r200AllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLsizei size,
/* Called via glXFreeMemoryMESA() */
/* Called via glXFreeMemoryMESA() */
-void r200FreeMemoryMESA(__DRI
nativeDisplay *dpy, int scr
n, GLvoid *pointer)
+void r200FreeMemoryMESA(__DRI
screen *scree
n, GLvoid *pointer)
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa;
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa;
@@
-888,9
+919,6
@@
void r200FreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer)
return;
}
return;
}
- if (rmesa->dri.drmMinor < 6)
- return;
-
region_offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map;
if (region_offset < 0 ||
region_offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map;
if (region_offset < 0 ||
@@
-912,7
+940,7
@@
void r200FreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer)
}
/* Called via glXGetMemoryOffsetMESA() */
}
/* Called via glXGetMemoryOffsetMESA() */
-GLuint r200GetMemoryOffsetMESA(__DRI
nativeDisplay *dpy, int scr
n, const GLvoid *pointer)
+GLuint r200GetMemoryOffsetMESA(__DRI
screen *scree
n, const GLvoid *pointer)
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa;
{
GET_CURRENT_CONTEXT(ctx);
r200ContextPtr rmesa;
@@
-926,9
+954,6
@@
GLuint r200GetMemoryOffsetMESA(__DRInativeDisplay *dpy, int scrn, const GLvoid *
if (!r200IsGartMemory( rmesa, pointer, 0 ))
return ~0;
if (!r200IsGartMemory( rmesa, pointer, 0 ))
return ~0;
- if (rmesa->dri.drmMinor < 6)
- return ~0;
-
card_offset = r200GartOffsetFromVirtual( rmesa, pointer );
return card_offset - rmesa->r200Screen->gart_base;
card_offset = r200GartOffsetFromVirtual( rmesa, pointer );
return card_offset - rmesa->r200Screen->gart_base;