Compare commits

...

17 Commits

Author SHA1 Message Date
Keith Whitwell
bcc4804410 When clearing, refresh the cx/y/w/h values as they may have been
invalidated by a new window position or size picked up when we did
LOCK_HARDWARE above.  The values passed by mesa are not reliable.
2006-06-06 11:35:17 +00:00
Keith Whitwell
a03b239041 Add fgl_glxgears to makefile 2006-06-06 11:31:02 +00:00
Brian Paul
4890c7ed87 set per-context GL_DRAW_BUFFER state regardless of currently bound FBO 2006-06-02 12:53:08 +00:00
Brian Paul
17c33d6f04 fix depth-component test to allow rectangular textures 2006-06-02 12:44:36 +00:00
Keith Whitwell
5ab599600e Additional flushing. 2006-05-23 09:36:53 +00:00
Keith Whitwell
db4b6fd759 Copying overlapping rects works if they are in different buffers... 2006-05-23 09:36:16 +00:00
Keith Whitwell
dbb2f30ad3 Fix culling calculations for FBOs 2006-05-23 09:34:09 +00:00
Brian Paul
9c84dfe156 glPopAttrib() GL_DRAW_BUFFER state fix, from trunk 2006-04-18 16:28:16 +00:00
Brian Paul
8d86325516 remove a debug message 2006-04-05 13:29:35 +00:00
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
21 changed files with 218 additions and 76 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

@@ -11,6 +11,7 @@ LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(GLU_LIB_NAME)
PROGS = glthreads \
glxdemo \
glxgears \
fgl_glxgears \
glxgears_fbconfig \
glxcontexts \
glxheads \

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

@@ -395,7 +395,8 @@ static void i915CullFaceFrontFace(GLcontext *ctx, GLenum unused)
GLuint mode;
if (INTEL_DEBUG&DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
fprintf(stderr, "%s %d\n", __FUNCTION__,
ctx->DrawBuffer ? ctx->DrawBuffer->Name : 0);
if (!ctx->Polygon.CullFlag) {
mode = S4_CULLMODE_NONE;
@@ -403,6 +404,8 @@ static void i915CullFaceFrontFace(GLcontext *ctx, GLenum unused)
else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
mode = S4_CULLMODE_CW;
if (ctx->DrawBuffer && ctx->DrawBuffer->Name != 0)
mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
if (ctx->Polygon.CullFaceMode == GL_FRONT)
mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
if (ctx->Polygon.FrontFace != GL_CCW)

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 );
}
@@ -316,6 +323,18 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield mask, GLboolean all,
drm_clip_rect_t clear;
int i;
/* Refresh the cx/y/w/h values as they may have been invalidated
* by a new window position or size picked up when we did
* LOCK_HARDWARE above. The values passed by mesa are not
* reliable.
*/
{
cx = ctx->DrawBuffer->_Xmin;
cy = ctx->DrawBuffer->_Ymin;
ch = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
cw = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
}
if (intel->ctx.DrawBuffer->Name == 0) {
/* clearing a window */

View File

@@ -282,7 +282,20 @@ static void intelClearWithTris(struct intel_context *intel,
intel->vtbl.install_meta_state(intel);
/* note: regardless of 'all', cx, cy, cw, ch are correct */
/* Refresh the cx/y/w/h values as they may have been invalidated
* by a new window position or size picked up when we did
* LOCK_HARDWARE above. The values passed by mesa are not
* reliable.
*/
{
cx = ctx->DrawBuffer->_Xmin;
cy = ctx->DrawBuffer->_Ymin;
ch = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
cw = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
}
/* note: regardless of 'all', cx, cy, cw, ch are now correct */
clear.x1 = cx;
clear.y1 = cy;
clear.x2 = cx + cw;
@@ -558,7 +571,7 @@ intel_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
/* this may occur when we're called by glBindFrameBuffer() during
* the process of someone setting up renderbuffers, etc.
*/
_mesa_debug(ctx, "DrawBuffer: incomplete user FBO\n");
/*_mesa_debug(ctx, "DrawBuffer: incomplete user FBO\n");*/
return;
}
@@ -615,6 +628,14 @@ intel_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
colorRegion = (irb && irb->region) ? irb->region : NULL;
}
/* Update culling direction which changes depending on the
* orientation of the buffer:
*/
if (ctx->Driver.FrontFace)
ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
else
ctx->NewState |= _NEW_POLYGON;
if (!colorRegion) {
FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE );
}

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

@@ -99,24 +99,26 @@ static GLboolean do_texture_copypixels( GLcontext *ctx,
*
* XXX: do a copy to a temporary.
*/
if (src->buffer == dst->buffer)
{
drm_clip_rect_t src;
drm_clip_rect_t dst;
drm_clip_rect_t srcbox;
drm_clip_rect_t dstbox;
drm_clip_rect_t tmp;
src.x1 = srcx;
src.y1 = srcy;
src.x2 = srcx + width;
src.y2 = srcy + height;
srcbox.x1 = srcx;
srcbox.y1 = srcy;
srcbox.x2 = srcx + width;
srcbox.y2 = srcy + height;
dst.x1 = dstx;
dst.y1 = dsty;
dst.x1 = dstx + width * ctx->Pixel.ZoomX;
dst.y2 = dsty + height * ctx->Pixel.ZoomY;
dstbox.x1 = dstx;
dstbox.y1 = dsty;
dstbox.x1 = dstx + width * ctx->Pixel.ZoomX;
dstbox.y2 = dsty + height * ctx->Pixel.ZoomY;
if (intel_intersect_cliprects(&tmp, &src, &dst)) {
_mesa_printf("%s: regions overlap\n", __FUNCTION__);
if (intel_intersect_cliprects(&tmp, &srcbox, &dstbox)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s: regions overlap\n", __FUNCTION__);
return GL_FALSE;
}
}
@@ -339,7 +341,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

View File

@@ -848,8 +848,19 @@ _mesa_PopAttrib(void)
(GLboolean) (color->ColorMask[1] != 0),
(GLboolean) (color->ColorMask[2] != 0),
(GLboolean) (color->ColorMask[3] != 0));
_mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers,
color->DrawBuffer, NULL);
/* Call the API_level functions, not _mesa_drawbuffers() since
* we need to do error checking on the pop'd GL_DRAW_BUFFER.
* Ex: if GL_FRONT were pushed, but we're popping with a user
* FBO bound, GL_FRONT will be illegal and we'll need to
* record that error. Per OpenGL ARB decision.
*/
if (ctx->Extensions.ARB_draw_buffers) {
_mesa_DrawBuffersARB(ctx->Const.MaxDrawBuffers,
color->DrawBuffer);
}
else {
_mesa_DrawBuffer(color->DrawBuffer[0]);
}
_mesa_set_enable(ctx, GL_ALPHA_TEST, color->AlphaEnabled);
_mesa_AlphaFunc(color->AlphaFunc, color->AlphaRef);
_mesa_set_enable(ctx, GL_BLEND, color->BlendEnabled);

View File

@@ -459,16 +459,14 @@ set_color_output(GLcontext *ctx, GLuint output, GLenum buffer,
ASSERT(output < ctx->Const.MaxDrawBuffers);
/* Set per-FBO state */
fb->ColorDrawBuffer[output] = buffer;
fb->_ColorDrawBufferMask[output] = destMask;
if (fb->Name == 0) {
/* Set traditional state var */
ctx->Color.DrawBuffer[output] = buffer;
}
/* not really needed, will be set later */
fb->_NumColorDrawBuffers[output] = 0;
/* Set traditional state var */
ctx->Color.DrawBuffer[output] = buffer;
}

View File

@@ -587,6 +587,11 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
}
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
if (renderbuffer) {
newRb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
@@ -995,6 +1000,11 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
if (framebuffer) {
/* Binding a user-created framebuffer object */
newFb = _mesa_lookup_framebuffer(ctx, framebuffer);
@@ -1079,6 +1089,10 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers)
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
for (i = 0; i < n; i++) {
if (framebuffers[i] > 0) {
@@ -1299,6 +1313,10 @@ framebuffer_texture(GLuint dims, GLenum target, GLenum attachment,
}
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
_glthread_LOCK_MUTEX(fb->Mutex);
if (texObj) {
@@ -1417,6 +1435,10 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment,
}
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
assert(ctx->Driver.FramebufferRenderbuffer);
ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb);
@@ -1480,6 +1502,10 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
}
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
/* The above doesn't fully flush the drivers in the way that a
* glFlush does, but that is required here:
*/
ctx->Driver.Flush(ctx);
switch (pname) {
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:

View File

@@ -1448,11 +1448,13 @@ texture_error_check( GLcontext *ctx, GLenum target,
/* additional checks for depth textures */
if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT) {
/* Only 1D and 2D textures supported */
/* Only 1D, 2D and rectangular textures supported, not 3D or cubes */
if (target != GL_TEXTURE_1D &&
target != GL_PROXY_TEXTURE_1D &&
target != GL_TEXTURE_2D &&
target != GL_PROXY_TEXTURE_2D) {
target != GL_PROXY_TEXTURE_2D &&
target != GL_TEXTURE_RECTANGLE_ARB &&
target != GL_PROXY_TEXTURE_RECTANGLE_ARB) {
if (!isProxy)
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexImage(target/internalFormat)");