Compare commits

...

8 Commits

Author SHA1 Message Date
Keith Whitwell
8ecd83f6cd silence debug messages 2006-03-29 21:27:09 +00:00
Brian Paul
cff7e025ed fix ReadBuffer mapping bugs 2006-03-29 21:22:05 +00:00
Thomas Hellström
3de9a9bd1d Bump driver date.
Keep the lock mutex locked while we hold the heavyweight lock.
2006-03-29 21:21:54 +00:00
Keith Whitwell
e6cae6e6f6 Turn compiler optimizations back on. 2006-03-29 21:09:14 +00:00
Thomas Hellström
9cf5945b83 Age the last_swap_fence properly.
Should be safe unless the client idles without rendering for some
time, while another client renders.
2006-03-29 13:20:50 +00:00
Keith Whitwell
d6ddc33f07 Protect the DRI __driUtilUpdateDrawable code and other "complex" code
inside intelGetLock() with a mutex.  Fixes problems with multithreaded
applications dying when moving windows, etc.  There seem to be multiple
traps for threaded apps in that code, this is a bandaid on those.
2006-03-27 18:31:27 +00:00
Brian Paul
ec32d129b7 remove a temporary FBO test in intel_map_unmap_buffers() - fixes flickering in tunnel demo 2006-03-27 14:48:22 +00:00
Thomas Hellström
cd41c27446 zero-valued fences are not considered retired for a system that has been
running for a day or so. Initialize to a better value.
2006-03-27 13:55:45 +00:00
14 changed files with 119 additions and 52 deletions

View File

@@ -13,7 +13,8 @@ CXX = g++
#MKDEP = gcc -M
#MKDEP_OPTIONS = -MF depend
OPT_FLAGS = -g -march=pentium4 -fprefetch-loop-arrays
#OPT_FLAGS = -g -march=pentium4 -fprefetch-loop-arrays
OPT_FLAGS = -O2
PIC_FLAGS = -fPIC
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.

View File

@@ -109,7 +109,7 @@ GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
if (!i915) return GL_FALSE;
_mesa_printf( "\ntexmem branch (i915, drop2)\n\n");
_mesa_printf( "\ntexmem branch (i915, drop3)\n\n");
i915InitVtbl( i915 );
i915InitMetaFuncs( i915 );

View File

@@ -118,6 +118,7 @@ struct intel_batchbuffer *intel_batchbuffer_alloc( struct intel_context *intel )
batch->bm = intel->bm;
bmGenBuffers(intel->bm, 1, &batch->buffer, BM_BATCHBUFFER);
batch->last_fence = bmInitFence(batch->bm);
intel_batchbuffer_reset( batch );
return batch;
}
@@ -174,6 +175,17 @@ static void do_flush_locked( struct intel_batchbuffer *batch,
allow_unlock);
#endif
batch->last_fence = bmFenceBufferList(batch->bm, batch->list);
if (!batch->intel->last_swap_fence_retired) {
int retired;
drmFence dFence = {0,batch->intel->last_swap_fence};
/*FIXME: Temporary fix for fence ageing
*
*/
if (!drmTestFence(batch->intel->driFd, dFence, 0, &retired)) {
batch->intel->last_swap_fence_retired = retired;
}
}
}

View File

@@ -67,7 +67,13 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv )
}
intel = (struct intel_context *) ctx;
bmFinishFence(intel->bm, intel->last_swap_fence);
/* FIXME: Temporary fix for fence ageing.
*
*/
if (!intel->last_swap_fence_retired) {
bmFinishFence(intel->bm, intel->last_swap_fence);
}
/* The LOCK_HARDWARE is required for the cliprects. Buffer offsets
* should work regardless.
@@ -138,6 +144,7 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv )
}
intel->last_swap_fence = intel_batchbuffer_flush( intel->batch );
intel->last_swap_fence_retired = GL_FALSE;
}
UNLOCK_HARDWARE( intel );
}

View File

@@ -58,7 +58,7 @@ static struct bufmgr
unsigned buf_nr; /* for generating ids */
drmMMPool batchPool;
drmFence initFence;
} bufmgr_pool[BM_MAX];
static int nr_bms;
@@ -126,6 +126,8 @@ bm_intel_Attach(struct intel_context *intel)
BM_BATCHBUFFER, 1024 * 1024, 4096,
&bm->batchPool));
BM_CKFATAL(drmEmitFence(bm->driFd, 0, &bm->initFence));
drmUnlock(bm->driFd, intel->hHWContext);
return bm;
}
@@ -441,4 +443,11 @@ bmFinishFence(struct bufmgr *bm, unsigned fence)
dFence.fenceType = 0;
dFence.fenceSeq = fence;
BM_CKFATAL(drmWaitFence(bm->driFd, dFence));
bm->initFence = dFence;
}
unsigned
bmInitFence(struct bufmgr *bm)
{
return bm->initFence.fenceSeq;
}

View File

@@ -119,7 +119,7 @@ int bmScanBufferList(struct bufmgr *bm,
unsigned bmSetFence(struct bufmgr *);
int bmTestFence(struct bufmgr *, unsigned fence);
void bmFinishFence(struct bufmgr *, unsigned fence);
unsigned bmInitFence(struct bufmgr *bm);
void bmSetShared(struct bufmgr *bm, unsigned buffer,
unsigned flags, unsigned long offset, void *virtual);

View File

@@ -86,7 +86,11 @@ int INTEL_DEBUG = (0);
#include "extension_helper.h"
#define DRIVER_DATE "20060212"
#define DRIVER_DATE "20060329"
_glthread_Mutex lockMutex;
static GLboolean lockMutexInit = GL_FALSE;
static const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
{
@@ -303,6 +307,10 @@ GLboolean intelInitContext( struct intel_context *intel,
intel->driScreen = sPriv;
intel->sarea = saPriv;
if (!lockMutexInit) {
lockMutexInit = GL_TRUE;
_glthread_INIT_MUTEX(lockMutex);
}
ctx->Const.MaxTextureMaxAnisotropy = 2.0;
@@ -422,6 +430,8 @@ GLboolean intelInitContext( struct intel_context *intel,
intelScreen->height);
intel->batch = intel_batchbuffer_alloc( intel );
intel->last_swap_fence_retired = GL_TRUE;
intel->last_swap_fence = bmInitFence(intel->bm);
intel_bufferobj_init( intel );
intel_fbo_init( intel );
@@ -475,7 +485,8 @@ void intelDestroyContext(__DRIcontextPrivate *driContextPriv)
/* This share group is about to go away, free our private
* texture object data.
*/
fprintf(stderr, "do something to free texture heaps\n");
if (INTEL_DEBUG & DEBUG_TEXTURE)
fprintf(stderr, "do something to free texture heaps\n");
}
/* free the Mesa context */
@@ -550,6 +561,7 @@ void intelGetLock( struct intel_context *intel, GLuint flags )
drmGetLock(intel->driFd, intel->hHWContext, flags);
/* If the window moved, may need to set a new cliprect now.
*
* NOTE: This releases and regains the hw lock, so all state

View File

@@ -172,6 +172,7 @@ struct intel_context
GLuint last_fence;
GLuint last_swap_fence;
GLboolean last_swap_fence_retired;
struct intel_batchbuffer *batch;
@@ -265,7 +266,7 @@ struct intel_context
};
#define DEBUG_LOCKING 1
#define DEBUG_LOCKING 1
#if DEBUG_LOCKING
@@ -311,7 +312,7 @@ struct intel_context
#endif
extern _glthread_Mutex lockMutex;
/* Lock the hardware and validate our state.
@@ -319,6 +320,7 @@ struct intel_context
#define LOCK_HARDWARE( intel ) \
do { \
char __ret=0; \
_glthread_LOCK_MUTEX(lockMutex); \
DEBUG_CHECK_LOCK(); \
assert(!(intel)->locked); \
DRM_CAS((intel)->driHwLock, (intel)->hHWContext, \
@@ -341,6 +343,7 @@ do { \
} \
DRM_UNLOCK((intel)->driFd, (intel)->driHwLock, (intel)->hHWContext); \
DEBUG_RESET(); \
_glthread_UNLOCK_MUTEX(lockMutex); \
} while (0)

View File

@@ -100,11 +100,12 @@ GLboolean intel_check_blit_format( struct intel_region *region,
format == GL_BGR ) {
return GL_TRUE;
}
fprintf(stderr, "%s: bad format for blit (cpp %d, type %s format %s)\n",
__FUNCTION__, region->cpp,
_mesa_lookup_enum_by_nr(type),
_mesa_lookup_enum_by_nr(format));
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: bad format for blit (cpp %d, type %s format %s)\n",
__FUNCTION__, region->cpp,
_mesa_lookup_enum_by_nr(type),
_mesa_lookup_enum_by_nr(format));
return GL_FALSE;
}

View File

@@ -116,7 +116,8 @@ static GLboolean do_texture_copypixels( GLcontext *ctx,
if (intel_intersect_cliprects(&tmp, &src, &dst)) {
_mesa_printf("%s: regions overlap\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: regions overlap\n", __FUNCTION__);
return GL_FALSE;
}
}
@@ -339,7 +340,9 @@ void intelCopyPixels( GLcontext *ctx,
if (do_texture_copypixels( ctx, srcx, srcy, width, height, destx, desty, type))
return;
_mesa_printf("fallback to _swrast_CopyPixels\n");
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("fallback to _swrast_CopyPixels\n");
_swrast_CopyPixels( ctx, srcx, srcy, width, height, destx, desty, type);
}

View File

@@ -74,7 +74,6 @@ static GLboolean do_texture_drawpixels( GLcontext *ctx,
if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
_mesa_printf("%s - _mesa_validate_pbo_access\n", __FUNCTION__);
return GL_TRUE;
}
}
@@ -96,7 +95,8 @@ static GLboolean do_texture_drawpixels( GLcontext *ctx,
* possible.
*/
if (!intel_check_meta_tex_fragment_ops(ctx)) {
_mesa_printf("%s - bad GL fragment state for metaops texture\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad GL fragment state for metaops texture\n", __FUNCTION__);
return GL_FALSE;
}
@@ -163,7 +163,8 @@ static GLboolean do_texture_drawpixels( GLcontext *ctx,
}
_mesa_printf("draw %d,%d %dx%d\n", dstx,dsty,width,height);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("draw %d,%d %dx%d\n", dstx,dsty,width,height);
/* Must use the regular cliprect mechanism in order to get the
* drawing origin set correctly. Otherwise scissor state is in
@@ -183,7 +184,6 @@ static GLboolean do_texture_drawpixels( GLcontext *ctx,
intel_batchbuffer_flush(intel->batch);
}
UNLOCK_HARDWARE( intel );
_mesa_printf("%s - DONE\n", __FUNCTION__);
return GL_TRUE;
}
@@ -218,14 +218,15 @@ static GLboolean do_blit_drawpixels( GLcontext *ctx,
struct intel_buffer_object *src = intel_buffer_object(unpack->BufferObj);
GLuint src_offset;
GLuint rowLength;
GLuint fence = 0;
GLuint fence = bmInitFence(intel->bm);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s\n", __FUNCTION__);
if (!dest) {
_mesa_printf("%s - no dest\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - no dest\n", __FUNCTION__);
return GL_FALSE;
}
@@ -235,30 +236,32 @@ static GLboolean do_blit_drawpixels( GLcontext *ctx,
if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
_mesa_printf("%s - _mesa_validate_pbo_access\n", __FUNCTION__);
return GL_TRUE;
}
}
else {
/* PBO only for now:
*/
_mesa_printf("%s - not PBO\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - not PBO\n", __FUNCTION__);
return GL_FALSE;
}
if (!intel_check_blit_format(dest, format, type)) {
_mesa_printf("%s - bad format for blit\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad format for blit\n", __FUNCTION__);
return GL_FALSE;
}
if (!intel_check_meta_tex_fragment_ops(ctx)) {
_mesa_printf("%s - bad GL fragment state for meta tex\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad GL fragment state for meta tex\n", __FUNCTION__);
return GL_FALSE;
}
if (ctx->Pixel.ZoomX != 1.0F) {
_mesa_printf("%s - bad PixelZoomX for blit\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad PixelZoomX for blit\n", __FUNCTION__);
return GL_FALSE;
}
@@ -269,7 +272,8 @@ static GLboolean do_blit_drawpixels( GLcontext *ctx,
rowLength = width;
if (ctx->Pixel.ZoomY == -1.0F) {
_mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__);
return GL_FALSE; /* later */
y -= height;
}
@@ -277,7 +281,8 @@ static GLboolean do_blit_drawpixels( GLcontext *ctx,
rowLength = -rowLength;
}
else {
_mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad PixelZoomY for blit\n", __FUNCTION__);
return GL_FALSE;
}
@@ -326,7 +331,8 @@ static GLboolean do_blit_drawpixels( GLcontext *ctx,
if (intel->driDrawable->numClipRects)
bmFinishFence(intel->bm, fence);
_mesa_printf("%s - DONE\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - DONE\n", __FUNCTION__);
return GL_TRUE;
}
@@ -350,7 +356,8 @@ void intelDrawPixels( GLcontext *ctx,
return;
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
_swrast_DrawPixels( ctx, x, y, width, height, format, type,
unpack, pixels );

View File

@@ -93,7 +93,8 @@ do_texture_readpixels( GLcontext *ctx,
pack->SwapBytes ||
pack->LsbFirst ||
!pack->Invert) {
fprintf(stderr, "%s: check_color failed\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: check_color failed\n", __FUNCTION__);
return GL_FALSE;
}
@@ -103,10 +104,11 @@ do_texture_readpixels( GLcontext *ctx,
dest_region,
type, format))
{
fprintf(stderr, "%s: couldn't set dest %s/%s\n",
__FUNCTION__,
_mesa_lookup_enum_by_nr(type),
_mesa_lookup_enum_by_nr(format));
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: couldn't set dest %s/%s\n",
__FUNCTION__,
_mesa_lookup_enum_by_nr(type),
_mesa_lookup_enum_by_nr(format));
return GL_FALSE;
}
@@ -120,7 +122,8 @@ do_texture_readpixels( GLcontext *ctx,
if (!driClipRectToFramebuffer(ctx->ReadBuffer, &x, &y, &width, &height)) {
UNLOCK_HARDWARE( intel );
SET_STATE(i830, state);
fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s: cliprect failed\n", __FUNCTION__);
return GL_TRUE;
}
@@ -181,7 +184,7 @@ static GLboolean do_blit_readpixels( GLcontext *ctx,
struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj);
GLuint dst_offset;
GLuint rowLength;
GLuint fence = 0;
GLuint fence = bmInitFence(intel->bm);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s\n", __FUNCTION__);
@@ -195,27 +198,28 @@ static GLboolean do_blit_readpixels( GLcontext *ctx,
if (!_mesa_validate_pbo_access(2, pack, width, height, 1,
format, type, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
_mesa_printf("%s - _mesa_validate_pbo_access\n", __FUNCTION__);
return GL_TRUE;
}
}
else {
/* PBO only for now:
*/
_mesa_printf("%s - not PBO\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - not PBO\n", __FUNCTION__);
return GL_FALSE;
}
if (ctx->_ImageTransferState ||
!intel_check_blit_format(src, format, type)) {
_mesa_printf("%s - bad format for blit\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad format for blit\n", __FUNCTION__);
return GL_FALSE;
}
if (pack->Alignment != 1 || pack->SwapBytes || pack->LsbFirst) {
_mesa_printf("%s: bad packing params\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: bad packing params\n", __FUNCTION__);
return GL_FALSE;
}
@@ -225,7 +229,8 @@ static GLboolean do_blit_readpixels( GLcontext *ctx,
rowLength = width;
if (pack->Invert) {
_mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: MESA_PACK_INVERT not done yet\n", __FUNCTION__);
return GL_FALSE;
}
else {
@@ -308,7 +313,8 @@ intelReadPixels( GLcontext *ctx,
if (do_texture_readpixels(ctx, x, y, width, height, format, type, pack, pixels))
return;
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
_swrast_ReadPixels( ctx, x, y, width, height, format, type, pack, pixels);
}

View File

@@ -190,7 +190,7 @@ intel_map_unmap_buffers(struct intel_context *intel, GLboolean map)
for (j = 0; j < ctx->DrawBuffer->_NumColorDrawBuffers[i]; j++) {
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i][j];
irb = intel_renderbuffer(rb);
if (irb && irb->Base.Name != 0) { /* XXX FBO temporary test */
if (irb) {
/* this is a user-created intel_renderbuffer */
if (irb->region) {
if (map)
@@ -224,11 +224,13 @@ intel_map_unmap_buffers(struct intel_context *intel, GLboolean map)
/* color read buffers */
irb = intel_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
if (irb && irb->region && irb->Base.Name != 0) {
if (irb && irb->region) {
if (map)
intel_region_map(intel, irb->region);
else
intel_region_unmap(intel, irb->region);
irb->pfMap = irb->region->map;
irb->pfPitch = irb->region->pitch;
}
/* Account for front/back color page flipping.

View File

@@ -247,8 +247,10 @@ static void intelTexImage(GLcontext *ctx,
if (!intelObj->mt) {
guess_and_alloc_mipmap_tree(intel, intelObj, intelImage);
if (!intelObj->mt)
_mesa_printf("guess_and_alloc_mipmap_tree: failed\n");
if (!intelObj->mt) {
if (INTEL_DEBUG & DEBUG_TEXTURE)
_mesa_printf("guess_and_alloc_mipmap_tree: failed\n");
}
}
@@ -265,8 +267,10 @@ static void intelTexImage(GLcontext *ctx,
assert(intelImage->mt);
}
if (!intelImage->mt)
_mesa_printf("XXX: Image did not fit into tree - storing in local memory!\n");
if (!intelImage->mt) {
if (INTEL_DEBUG & DEBUG_TEXTURE)
_mesa_printf("XXX: Image did not fit into tree - storing in local memory!\n");
}
/* intelCopyTexImage calls this function with pixels == NULL, with
* the expectation that the mipmap tree will be set up but nothing