From 4a1d7d6641ab9e66edce9d98456b978fe90a0617 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 22 Feb 2007 19:33:50 +1100 Subject: r300: get rid of CB_DPATH legacy --- src/mesa/drivers/dri/r300/r300_context.h | 1 - src/mesa/drivers/dri/r300/r300_ioctl.c | 181 ------------------------------- src/mesa/drivers/dri/r300/r300_state.c | 6 - 3 files changed, 188 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 48b50bca65..a339b2f9c1 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -60,7 +60,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif //#define OPTIMIZE_ELTS -#define CB_DPATH struct r300_context; typedef struct r300_context r300ContextRec; diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 0774a2af6b..c5ad026045 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -70,10 +70,6 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) drm_radeon_cmd_header_t *cmd = NULL; r300ContextPtr rmesa=r300; -#ifndef CB_DPATH - int i; -#endif - if (RADEON_DEBUG & DEBUG_IOCTL) fprintf(stderr, "%s: %s buffer (%i,%i %ix%i)\n", __FUNCTION__, buffer ? "back" : "front", @@ -89,168 +85,8 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) cboffset += r300->radeon.radeonScreen->fbLocation; -#ifndef CB_DPATH - R300_STATECHANGE(r300, vir[0]); - ((drm_r300_cmd_header_t*)r300->hw.vir[0].cmd)->packet0.count = 1; - r300->hw.vir[0].cmd[1] = 0x21030003; - - R300_STATECHANGE(r300, vir[1]); - ((drm_r300_cmd_header_t*)r300->hw.vir[1].cmd)->packet0.count = 1; - r300->hw.vir[1].cmd[1] = 0xF688F688; - - R300_STATECHANGE(r300, vic); - r300->hw.vic.cmd[R300_VIC_CNTL_0] = 0x00000001; - r300->hw.vic.cmd[R300_VIC_CNTL_1] = 0x00000405; - - R300_STATECHANGE(r300, vof); - r300->hw.vof.cmd[R300_VOF_CNTL_0] = R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT - | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT; - r300->hw.vof.cmd[R300_VOF_CNTL_1] = 0; /* no textures */ - - R300_STATECHANGE(r300, txe); - r300->hw.txe.cmd[R300_TXE_ENABLE] = 0; - - R300_STATECHANGE(r300, vpt); - r300->hw.vpt.cmd[R300_VPT_XSCALE] = r300PackFloat32(1.0); - r300->hw.vpt.cmd[R300_VPT_XOFFSET] = r300PackFloat32(dPriv->x); - r300->hw.vpt.cmd[R300_VPT_YSCALE] = r300PackFloat32(1.0); - r300->hw.vpt.cmd[R300_VPT_YOFFSET] = r300PackFloat32(dPriv->y); - r300->hw.vpt.cmd[R300_VPT_ZSCALE] = r300PackFloat32(1.0); - r300->hw.vpt.cmd[R300_VPT_ZOFFSET] = r300PackFloat32(0.0); - - R300_STATECHANGE(r300, at); - r300->hw.at.cmd[R300_AT_ALPHA_TEST] = 0; - - R300_STATECHANGE(r300, bld); - r300->hw.bld.cmd[R300_BLD_CBLEND] = 0; - r300->hw.bld.cmd[R300_BLD_ABLEND] = 0; - - if (r300->radeon.radeonScreen->cpp == 4) - cbpitch |= R300_COLOR_FORMAT_ARGB8888; - else - cbpitch |= R300_COLOR_FORMAT_RGB565; - - if (r300->radeon.sarea->tiling_enabled) - cbpitch |= R300_COLOR_TILE_ENABLE; - - R300_STATECHANGE(r300, cb); - r300->hw.cb.cmd[R300_CB_OFFSET] = cboffset; - r300->hw.cb.cmd[R300_CB_PITCH] = cbpitch; - - R300_STATECHANGE(r300, unk221C); - r300->hw.unk221C.cmd[1] = R300_221C_CLEAR; - - R300_STATECHANGE(r300, ps); - r300->hw.ps.cmd[R300_PS_POINTSIZE] = - ((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) | - ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT); - - R300_STATECHANGE(r300, ri); - for(i = 1; i <= 8; ++i) - r300->hw.ri.cmd[i] = R300_RS_INTERP_USED; - - R300_STATECHANGE(r300, rc); - /* The second constant is needed to get glxgears display anything .. */ - r300->hw.rc.cmd[1] = (1 << R300_RS_CNTL_CI_CNT_SHIFT) | R300_RS_CNTL_0_UNKNOWN_18; - r300->hw.rc.cmd[2] = 0; - - R300_STATECHANGE(r300, rr); - ((drm_r300_cmd_header_t*)r300->hw.rr.cmd)->packet0.count = 1; - r300->hw.rr.cmd[1] = 0x00004000; - - R300_STATECHANGE(r300, cmk); - if (flags & CLEARBUFFER_COLOR) { - r300->hw.cmk.cmd[R300_CMK_COLORMASK] = - (ctx->Color.ColorMask[BCOMP] ? R300_COLORMASK0_B : 0) | - (ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) | - (ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) | - (ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0); - } else { - r300->hw.cmk.cmd[R300_CMK_COLORMASK] = 0; - } - - R300_STATECHANGE(r300, fp); - r300->hw.fp.cmd[R300_FP_CNTL0] = 0; /* 1 pass, no textures */ - r300->hw.fp.cmd[R300_FP_CNTL1] = 0; /* no temporaries */ - r300->hw.fp.cmd[R300_FP_CNTL2] = 0; /* no offset, one ALU instr */ - r300->hw.fp.cmd[R300_FP_NODE0] = 0; - r300->hw.fp.cmd[R300_FP_NODE1] = 0; - r300->hw.fp.cmd[R300_FP_NODE2] = 0; - r300->hw.fp.cmd[R300_FP_NODE3] = R300_PFS_NODE_OUTPUT_COLOR; - - R300_STATECHANGE(r300, fpi[0]); - R300_STATECHANGE(r300, fpi[1]); - R300_STATECHANGE(r300, fpi[2]); - R300_STATECHANGE(r300, fpi[3]); - ((drm_r300_cmd_header_t*)r300->hw.fpi[0].cmd)->packet0.count = 1; - ((drm_r300_cmd_header_t*)r300->hw.fpi[1].cmd)->packet0.count = 1; - ((drm_r300_cmd_header_t*)r300->hw.fpi[2].cmd)->packet0.count = 1; - ((drm_r300_cmd_header_t*)r300->hw.fpi[3].cmd)->packet0.count = 1; - - /* MOV o0, t0 */ - r300->hw.fpi[0].cmd[1] = FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)); - r300->hw.fpi[1].cmd[1] = FP_SELC(0,NO,XYZ,FP_TMP(0),0,0); - r300->hw.fpi[2].cmd[1] = FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)); - r300->hw.fpi[3].cmd[1] = FP_SELA(0,NO,W,FP_TMP(0),0,0); - - R300_STATECHANGE(r300, pvs); - r300->hw.pvs.cmd[R300_PVS_CNTL_1] = - (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) | - (0 << R300_PVS_CNTL_1_POS_END_SHIFT) | - (1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT); - r300->hw.pvs.cmd[R300_PVS_CNTL_2] = 0; /* no parameters */ - r300->hw.pvs.cmd[R300_PVS_CNTL_3] = - (1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT); - - R300_STATECHANGE(r300, vpi); - ((drm_r300_cmd_header_t*)r300->hw.vpi.cmd)->packet0.count = 8; - - /* MOV o0, i0; */ - r300->hw.vpi.cmd[1] = VP_OUT(ADD,OUT,0,XYZW); - r300->hw.vpi.cmd[2] = VP_IN(IN,0); - r300->hw.vpi.cmd[3] = VP_ZERO(); - r300->hw.vpi.cmd[4] = 0; - - /* MOV o1, i1; */ - r300->hw.vpi.cmd[5] = VP_OUT(ADD,OUT,1,XYZW); - r300->hw.vpi.cmd[6] = VP_IN(IN,1); - r300->hw.vpi.cmd[7] = VP_ZERO(); - r300->hw.vpi.cmd[8] = 0; - - R300_STATECHANGE(r300, zs); - r300->hw.zs.cmd[R300_ZS_CNTL_0] = 0; - r300->hw.zs.cmd[R300_ZS_CNTL_1] = 0; - if (flags & CLEARBUFFER_DEPTH) { - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_WRITE_ONLY; - r300->hw.zs.cmd[R300_ZS_CNTL_1] |= (R300_ZS_ALWAYS<hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_Z_DISABLED_1; // disable - } - - R300_STATECHANGE(r300, zs); - if (flags & CLEARBUFFER_STENCIL) { - r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_RB3D_STENCIL_ENABLE; - r300->hw.zs.cmd[R300_ZS_CNTL_1] |= - (R300_ZS_ALWAYS<hw.zs.cmd[R300_ZS_CNTL_2] = r300->state.stencil.clear; - } - - /* Make sure we have enough space */ - r300EnsureCmdBufSpace(r300, r300->hw.max_state_size + 9+8, __FUNCTION__); - - r300EmitState(r300); -#else -#if 1 cp_wait(r300, R300_WAIT_3D | R300_WAIT_3D_CLEAN); end_3d(rmesa); -#endif R300_STATECHANGE(r300, cb); reg_start(R300_RB3D_COLOROFFSET0, 0); @@ -313,8 +149,6 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) e32(r300->state.stencil.clear); } -#endif - cmd2 = (drm_r300_cmd_header_t*)r300AllocCmdBuf(r300, 9, __FUNCTION__); cmd2[0].packet3.cmd_type = R300_CMD_PACKET3; cmd2[0].packet3.packet = R300_CMD_PACKET3_CLEAR; @@ -327,7 +161,6 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) cmd2[7].u = r300PackFloat32(ctx->Color.ClearColor[2]); cmd2[8].u = r300PackFloat32(ctx->Color.ClearColor[3]); -#if 1 reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); e32(0x0000000a); @@ -335,10 +168,8 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer) reg_start(0x4f18,0); e32(0x00000003); cp_wait(rmesa, R300_WAIT_3D | R300_WAIT_3D_CLEAN); -#endif } -#ifdef CB_DPATH static void r300EmitClearState(GLcontext * ctx) { r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -472,7 +303,6 @@ static void r300EmitClearState(GLcontext * ctx) /*reg_start(0x4500,0); e32(2560-1);*/ } -#endif /** * Buffer clear @@ -524,12 +354,10 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask) swapped = r300->radeon.doPageFlip && (r300->radeon.sarea->pfCurrentPage == 1); -#ifdef CB_DPATH /* Make sure it fits there. */ r300EnsureCmdBufSpace(r300, 421*3, __FUNCTION__); if(flags || bits) r300EmitClearState(ctx); -#endif if (flags & BUFFER_BIT_FRONT_LEFT) { r300ClearBuffer(r300, bits | CLEARBUFFER_COLOR, swapped); @@ -544,15 +372,6 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask) if (bits) r300ClearBuffer(r300, bits, 0); -#ifndef CB_DPATH - /* Recalculate the hardware state. This could be done more efficiently, - * but do keep it like this for now. - */ - r300ResetHwState(r300); - - /* r300ClearBuffer has trampled all over the hardware state.. */ - r300->hw.all_dirty=GL_TRUE; -#endif } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 906dfceb48..b30ece160a 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1768,9 +1768,7 @@ void r300UpdateShaderStates(r300ContextPtr rmesa) GLcontext *ctx; ctx = rmesa->radeon.glCtx; -#ifdef CB_DPATH r300UpdateTextureState(ctx); -#endif r300SetupPixelShader(rmesa); r300_setup_textures(ctx); @@ -1895,10 +1893,6 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state) r300UpdateStateParameters(ctx, new_state); -#ifndef CB_DPATH - /* Go inefficiency! */ - r300ResetHwState(r300); -#endif #ifdef HW_VBOS if(new_state & _NEW_ARRAY) r300->state.VB.lock_uptodate = GL_FALSE; -- cgit v1.2.3 From 5e66843733c8123e73cadc1bc5c6111d64abaf25 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 23 Feb 2007 01:43:13 +0100 Subject: r200 fix broken (by new input handling) fogcoord --- src/mesa/drivers/dri/r200/r200_maos_arrays.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index 6a6c30a2b0..3162b508c2 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -420,14 +420,14 @@ void r200EmitArrays( GLcontext *ctx, GLubyte *vimap_rev ) if (!rmesa->tcl.vertex_data[i].buf) { if (ctx->VertexProgram._Enabled) emit_vector( ctx, - &(rmesa->tcl.vertex_data[attrib]), + &(rmesa->tcl.vertex_data[i]), (char *)VB->AttribPtr[attrib]->data, 1, VB->AttribPtr[attrib]->stride, count); else emit_vecfog( ctx, - &(rmesa->tcl.vertex_data[attrib]), + &(rmesa->tcl.vertex_data[i]), (char *)VB->AttribPtr[attrib]->data, VB->AttribPtr[attrib]->stride, count); -- cgit v1.2.3 From 5cd30a2b202d12240eac60825f9882838fd66779 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 24 Feb 2007 18:10:41 -0700 Subject: make src ptr const --- src/mesa/drivers/dri/i915tex/intel_regions.c | 5 +++-- src/mesa/drivers/dri/i915tex/intel_regions.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i915tex/intel_regions.c b/src/mesa/drivers/dri/i915tex/intel_regions.c index 1205b180ca..a114bdf896 100644 --- a/src/mesa/drivers/dri/i915tex/intel_regions.c +++ b/src/mesa/drivers/dri/i915tex/intel_regions.c @@ -217,7 +217,8 @@ _mesa_copy_rect(GLubyte * dst, GLuint dst_y, GLuint width, GLuint height, - GLubyte * src, GLuint src_pitch, GLuint src_x, GLuint src_y) + const GLubyte * src, + GLuint src_pitch, GLuint src_x, GLuint src_y) { GLuint i; @@ -253,7 +254,7 @@ intel_region_data(intelScreenPrivate *intelScreen, struct intel_region *dst, GLuint dst_offset, GLuint dstx, GLuint dsty, - void *src, GLuint src_pitch, + const void *src, GLuint src_pitch, GLuint srcx, GLuint srcy, GLuint width, GLuint height) { struct intel_context *intel = intelScreenContext(intelScreen); diff --git a/src/mesa/drivers/dri/i915tex/intel_regions.h b/src/mesa/drivers/dri/i915tex/intel_regions.h index 1415bace69..d938c107a4 100644 --- a/src/mesa/drivers/dri/i915tex/intel_regions.h +++ b/src/mesa/drivers/dri/i915tex/intel_regions.h @@ -103,7 +103,7 @@ void intel_region_data(intelScreenPrivate *intelScreen, struct intel_region *dest, GLuint dest_offset, GLuint destx, GLuint desty, - void *src, GLuint src_stride, + const void *src, GLuint src_stride, GLuint srcx, GLuint srcy, GLuint width, GLuint height); /* Copy rectangular sub-regions -- cgit v1.2.3 From aeaad937b92ac0f5286343ed75c5c9f6876e2650 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 24 Feb 2007 18:11:09 -0700 Subject: clean-up, comment code --- src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c index 2b1077aee0..93372f4dcc 100644 --- a/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c @@ -309,8 +309,13 @@ intel_miptree_image_data(struct intel_context *intel, height = dst->level[level].height; if(dst->compressed) height /= 4; - intel_region_data(intel->intelScreen, dst->region, dst_offset + dst_depth_offset[i], 0, 0, src, src_row_pitch, 0, 0, /* source x,y */ - dst->level[level].width, height); + intel_region_data(intel->intelScreen, dst->region, + dst_offset + dst_depth_offset[i], /* dst_offset */ + 0, 0, /* dstx, dsty */ + src, + src_row_pitch, + 0, 0, /* source x, y */ + dst->level[level].width, height); /* width, height */ src += src_image_pitch; } -- cgit v1.2.3 From 53170942e37ccdf58e06a2cfbfeef6c0ec086ee6 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 24 Feb 2007 18:14:53 -0700 Subject: Fix broken cubemap mipmap layout (the cubemap.c demo was segfaulting). In i915_miptree_layout() change the width, height parameters that are passed to intel_miptree_set_level_info(). As it was, the width, height values were larger than the source image dimensions and we segfaulted in memcpy() when copying the original texture data into the texture buffer region. This fix should probably be checked by someone more familiar with the code (Keith?) --- src/mesa/drivers/dri/i915tex/i915_tex_layout.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i915tex/i915_tex_layout.c b/src/mesa/drivers/dri/i915tex/i915_tex_layout.c index 333fefef85..c844f5351d 100644 --- a/src/mesa/drivers/dri/i915tex/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915tex/i915_tex_layout.c @@ -62,15 +62,23 @@ i915_miptree_layout(struct intel_mipmap_tree * mt) case GL_TEXTURE_CUBE_MAP:{ const GLuint dim = mt->width0; GLuint face; + GLuint lvlWidth = mt->width0, lvlHeight = mt->height0; + + assert(lvlWidth == lvlHeight); /* cubemap images are square */ /* double pitch for cube layouts */ mt->pitch = ((dim * mt->cpp * 2 + 3) & ~3) / mt->cpp; mt->total_height = dim * 4; - for (level = mt->first_level; level <= mt->last_level; level++) + for (level = mt->first_level; level <= mt->last_level; level++) { intel_miptree_set_level_info(mt, level, 6, 0, 0, - mt->pitch, mt->total_height, 1); + /*OLD: mt->pitch, mt->total_height,*/ + lvlWidth, lvlHeight, + 1); + lvlWidth /= 2; + lvlHeight /= 2; + } for (face = 0; face < 6; face++) { GLuint x = initial_offsets[face][0] * dim; -- cgit v1.2.3 From 3528d61820e9ae1aafb12fb90849155f3cab6d2c Mon Sep 17 00:00:00 2001 From: Panagiotis Papadakos Date: Mon, 26 Feb 2007 07:57:31 -0700 Subject: add missing param to _mesa_warning() --- src/mesa/drivers/dri/common/dri_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index cc3dcf9d8d..3e27052afc 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -420,7 +420,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) psp = pdp->driScreenPriv; if (!psp) { /* ERROR!!! */ - _mesa_problem("Warning! Possible infinite loop due to bug " + _mesa_problem(NULL, "Warning! Possible infinite loop due to bug " "in file %s, line %d\n", __FILE__, __LINE__); return; -- cgit v1.2.3 From 1a72c8ed3ff6ffc4a301f3c4a107d2693719edb8 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadakos Date: Mon, 26 Feb 2007 07:59:14 -0700 Subject: s/pdp/prp/ in DoBindContext() --- src/mesa/drivers/dri/common/dri_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 3e27052afc..07ac4c7cd5 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -340,7 +340,7 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy, DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); } - if ((pdp != prp) && (!pdp->pStamp || *pdp->pStamp != pdp->lastStamp)) { + if ((pdp != prp) && (!prp->pStamp || *prp->pStamp != prp->lastStamp)) { DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); __driUtilUpdateDrawableInfo(prp); DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); -- cgit v1.2.3 From 928a70e4354d4884e2918ec67ddc6d8baf942c8a Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 26 Feb 2007 11:39:17 -0700 Subject: Rewrite code related to buffer destruction. Do proper reference counting so that we don't wind up with dangling references to deleted windows/framebuffers. Should help with bug 7205. --- src/mesa/drivers/x11/xm_api.c | 100 ++++++++++----------------------------- src/mesa/drivers/x11/xm_buffer.c | 68 ++++++++++++++++++++++++++ src/mesa/drivers/x11/xmesaP.h | 7 +++ 3 files changed, 101 insertions(+), 74 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index b0ef422de2..2cd7d8a6ca 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -345,7 +345,7 @@ xmesa_get_window_size(XMesaDisplay *dpy, XMesaBuffer b, /***** Linked list of XMesaBuffers *****/ /**********************************************************************/ -static XMesaBuffer XMesaBufferList = NULL; +XMesaBuffer XMesaBufferList = NULL; /** @@ -378,6 +378,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, b->cmap = cmap; _mesa_initialize_framebuffer(&b->mesa_buffer, &vis->mesa_visual); + b->mesa_buffer.Delete = xmesa_delete_framebuffer; /* * Front renderbuffer @@ -451,8 +452,8 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, * Find an XMesaBuffer by matching X display and colormap but NOT matching * the notThis buffer. */ -static XMesaBuffer -find_xmesa_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis) +XMesaBuffer +xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis) { XMesaBuffer b; for (b=XMesaBufferList; b; b=b->Next) { @@ -465,38 +466,27 @@ find_xmesa_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis) /** - * Free an XMesaBuffer, remove from linked list, perhaps free X colormap - * entries. + * Remove buffer from linked list, delete if no longer referenced. */ static void -free_xmesa_buffer(int client, XMesaBuffer buffer) +xmesa_free_buffer(XMesaBuffer buffer) { XMesaBuffer prev = NULL, b; - (void) client; - for (b=XMesaBufferList; b; b=b->Next) { - if (b==buffer) { - /* unlink bufer from list */ + + for (b = XMesaBufferList; b; b = b->Next) { + if (b == buffer) { + struct gl_framebuffer *fb = &buffer->mesa_buffer; + + /* unlink buffer from list */ if (prev) prev->Next = buffer->Next; else XMesaBufferList = buffer->Next; - /* Check to free X colors */ - if (buffer->num_alloced>0) { - /* If no other buffer uses this X colormap then free the colors. */ - if (!find_xmesa_buffer(buffer->display, buffer->cmap, buffer)) { -#ifdef XFree86Server - (void)FreeColors(buffer->cmap, client, - buffer->num_alloced, buffer->alloced_colors, - 0); -#else - XFreeColors(buffer->display, buffer->cmap, - buffer->alloced_colors, buffer->num_alloced, 0); -#endif - } - } - _mesa_free_framebuffer_data(&buffer->mesa_buffer); - _mesa_free(buffer); + /* mark as delete pending */ + fb->DeletePending = GL_TRUE; + /* Dereference. If count = zero we'll really delete the buffer */ + _mesa_dereference_framebuffer(&fb); return; } @@ -504,7 +494,7 @@ free_xmesa_buffer(int client, XMesaBuffer buffer) prev = b; } /* buffer not found in XMesaBufferList */ - _mesa_problem(NULL,"free_xmesa_buffer() - buffer not found\n"); + _mesa_problem(NULL,"xmesa_free_buffer() - buffer not found\n"); } @@ -686,7 +676,7 @@ setup_grayscale(int client, XMesaVisual v, return GL_FALSE; } - prevBuffer = find_xmesa_buffer(v->display, cmap, buffer); + prevBuffer = xmesa_find_buffer(v->display, cmap, buffer); if (prevBuffer && (buffer->xm_visual->mesa_visual.rgbMode == prevBuffer->xm_visual->mesa_visual.rgbMode)) { @@ -775,7 +765,7 @@ setup_dithered_color(int client, XMesaVisual v, return GL_FALSE; } - prevBuffer = find_xmesa_buffer(v->display, cmap, buffer); + prevBuffer = xmesa_find_buffer(v->display, cmap, buffer); if (prevBuffer && (buffer->xm_visual->mesa_visual.rgbMode == prevBuffer->xm_visual->mesa_visual.rgbMode)) { @@ -1666,7 +1656,7 @@ XMesaCreateWindowBuffer2(XMesaVisual v, XMesaWindow w, XMesaContext c) if (!initialize_visual_and_buffer( client, v, b, v->mesa_visual.rgbMode, (XMesaDrawable) w, cmap )) { - free_xmesa_buffer(client, b); + xmesa_free_buffer(b); return NULL; } @@ -1787,7 +1777,7 @@ XMesaCreatePixmapBuffer(XMesaVisual v, XMesaPixmap p, XMesaColormap cmap) if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode, (XMesaDrawable) p, cmap)) { - free_xmesa_buffer(client, b); + xmesa_free_buffer(b); return NULL; } @@ -1821,7 +1811,7 @@ XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap, if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode, drawable, cmap)) { - free_xmesa_buffer(client, b); + xmesa_free_buffer(b); return NULL; } @@ -1834,48 +1824,10 @@ XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap, /* * Deallocate an XMesaBuffer structure and all related info. */ -void XMesaDestroyBuffer( XMesaBuffer b ) +void +XMesaDestroyBuffer(XMesaBuffer b) { - int client = 0; - -#ifdef XFree86Server - if (b->frontxrb->drawable) - client = CLIENT_ID(b->frontxrb->drawable->id); -#endif - - if (b->gc) XMesaFreeGC( b->xm_visual->display, b->gc ); - if (b->cleargc) XMesaFreeGC( b->xm_visual->display, b->cleargc ); - if (b->swapgc) XMesaFreeGC( b->xm_visual->display, b->swapgc ); - - if (b->xm_visual->mesa_visual.doubleBufferMode) - { - if (b->backxrb->ximage) { -#if defined(USE_XSHM) && !defined(XFree86Server) - if (b->shm) { - XShmDetach( b->xm_visual->display, &b->shminfo ); - XDestroyImage( b->backxrb->ximage ); - shmdt( b->shminfo.shmaddr ); - } - else -#endif - XMesaDestroyImage( b->backxrb->ximage ); - } - if (b->backxrb->pixmap) { - XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap ); - if (b->xm_visual->hpcr_clear_flag) { - XMesaFreePixmap( b->xm_visual->display, - b->xm_visual->hpcr_clear_pixmap ); - XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage ); - } - } - } - if (b->rowimage) { - _mesa_free( b->rowimage->data ); - b->rowimage->data = NULL; - XMesaDestroyImage( b->rowimage ); - } - - free_xmesa_buffer(client, b); + xmesa_free_buffer(b); } @@ -2436,7 +2388,7 @@ void xmesa_destroy_buffers_on_display(XMesaDisplay *dpy) for (b = XMesaBufferList; b; b = next) { next = b->Next; if (b->display == dpy) { - free_xmesa_buffer(0, b); + xmesa_free_buffer(b); } } } diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 490c479676..187ae516cf 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -33,6 +33,7 @@ #include "GL/xmesa.h" #include "xmesaP.h" #include "imports.h" +#include "framebuffer.h" #include "renderbuffer.h" @@ -352,5 +353,72 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, } +/** + * Called via gl_framebuffer::Delete() method when this buffer + * is _really_ being + * deleted. + */ +void +xmesa_delete_framebuffer(struct gl_framebuffer *fb) +{ + XMesaBuffer b = XMESA_BUFFER(fb); +#ifdef XFree86Server + int client = 0; + if (b->frontxrb->drawable) + client = CLIENT_ID(b->frontxrb->drawable->id); +#endif + if (b->num_alloced > 0) { + /* If no other buffer uses this X colormap then free the colors. */ + if (!xmesa_find_buffer(b->display, b->cmap, b)) { +#ifdef XFree86Server + (void)FreeColors(b->cmap, client, + b->num_alloced, b->alloced_colors, 0); +#else + XFreeColors(b->display, b->cmap, + b->alloced_colors, b->num_alloced, 0); +#endif + } + } + + if (b->gc) + XMesaFreeGC(b->xm_visual->display, b->gc); + if (b->cleargc) + XMesaFreeGC(b->xm_visual->display, b->cleargc); + if (b->swapgc) + XMesaFreeGC(b->xm_visual->display, b->swapgc); + + if (b->xm_visual->mesa_visual.doubleBufferMode) { + /* free back ximage/pixmap/shmregion */ + if (b->backxrb->ximage) { +#if defined(USE_XSHM) && !defined(XFree86Server) + if (b->shm) { + XShmDetach( b->xm_visual->display, &b->shminfo ); + XDestroyImage( b->backxrb->ximage ); + shmdt( b->shminfo.shmaddr ); + } + else +#endif + XMesaDestroyImage( b->backxrb->ximage ); + b->backxrb->ximage = NULL; + } + if (b->backxrb->pixmap) { + XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap ); + if (b->xm_visual->hpcr_clear_flag) { + XMesaFreePixmap( b->xm_visual->display, + b->xm_visual->hpcr_clear_pixmap ); + XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage ); + } + } + } + + if (b->rowimage) { + _mesa_free( b->rowimage->data ); + b->rowimage->data = NULL; + XMesaDestroyImage( b->rowimage ); + } + + _mesa_free_framebuffer_data(fb); + _mesa_free(fb); +} diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index e332fb5480..5516031ffe 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -42,6 +42,7 @@ extern _glthread_Mutex _xmesa_lock; +extern XMesaBuffer XMesaBufferList; /* for PF_8R8G8B24 pixel format */ typedef struct { @@ -489,6 +490,12 @@ extern struct xmesa_renderbuffer * xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, GLboolean backBuffer); +extern void +xmesa_delete_framebuffer(struct gl_framebuffer *fb); + +extern XMesaBuffer +xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis); + extern unsigned long xmesa_color_to_pixel( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a, -- cgit v1.2.3 From 59e56ee3e5c8f9aa9ec74e1817065a7ae14012ea Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 27 Feb 2007 11:09:48 -0700 Subject: fix comment --- src/mesa/drivers/x11/xm_buffer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 187ae516cf..a358ec25ae 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -355,8 +355,7 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, /** * Called via gl_framebuffer::Delete() method when this buffer - * is _really_ being - * deleted. + * is _really_ being deleted. */ void xmesa_delete_framebuffer(struct gl_framebuffer *fb) -- cgit v1.2.3 From afa780c09d8e48c1c9ecaa4bce1bbe7e8e9c5e2c Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Wed, 28 Feb 2007 15:31:28 +1100 Subject: nouveau: drm interface changes --- src/mesa/drivers/dri/nouveau/nouveau_context.c | 6 +++ src/mesa/drivers/dri/nouveau/nouveau_context.h | 2 + src/mesa/drivers/dri/nouveau/nouveau_object.c | 68 ++++++++++++++++---------- src/mesa/drivers/dri/nouveau/nouveau_object.h | 13 +++-- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 6 ++- src/mesa/drivers/dri/nouveau/nouveau_sync.c | 7 ++- 6 files changed, 64 insertions(+), 38 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index f811dc1b72..aec7b19771 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -141,9 +141,15 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual, if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_FB_PHYSICAL, &nmesa->vram_phys)) return GL_FALSE; + if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_FB_SIZE, + &nmesa->vram_size)) + return GL_FALSE; if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_AGP_PHYSICAL, &nmesa->agp_phys)) return GL_FALSE; + if (!nouveauDRMGetParam(nmesa, NOUVEAU_GETPARAM_AGP_SIZE, + &nmesa->agp_size)) + return GL_FALSE; if (!nouveauFifoInit(nmesa)) return GL_FALSE; nouveauObjectInit(nmesa); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index f61fcbb48c..f79a8675f4 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -100,7 +100,9 @@ typedef struct nouveau_context { /* Physical addresses of AGP/VRAM apertures */ uint64_t vram_phys; + uint64_t vram_size; uint64_t agp_phys; + uint64_t agp_size; /* Channel synchronisation */ nouveau_notifier *syncNotifier; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.c b/src/mesa/drivers/dri/nouveau/nouveau_object.c index 302009c8b1..468b18e6d9 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_object.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_object.c @@ -4,17 +4,14 @@ #include "nouveau_reg.h" -GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa, int handle, int class, uint32_t flags, uint32_t dma_in, uint32_t dma_out, uint32_t dma_notifier) +GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa, + uint32_t handle, int class) { drm_nouveau_object_init_t cto; int ret; cto.handle = handle; cto.class = class; - cto.flags = flags; - cto.dma0= dma_in; - cto.dma1= dma_out; - cto.dma_notifier = dma_notifier; ret = drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_OBJECT_INIT, &cto, sizeof(cto)); return ret == 0; @@ -22,6 +19,7 @@ GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa, int handle, int cl GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa, uint32_t handle, + int class, uint32_t offset, uint32_t size, int target, @@ -30,6 +28,7 @@ GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa, drm_nouveau_dma_object_init_t dma; int ret; + dma.class = class; dma.handle = handle; dma.target = target; dma.access = access; @@ -40,6 +39,27 @@ GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa, return ret == 0; } +GLboolean nouveauCreateDmaObjectFromMem(nouveauContextPtr nmesa, + uint32_t handle, int class, + nouveau_mem *mem, + int access) +{ + uint32_t offset = mem->offset; + int target = mem->type & (NOUVEAU_MEM_FB | NOUVEAU_MEM_AGP); + + if (!target) + return GL_FALSE; + + if (target & NOUVEAU_MEM_FB) + offset -= nmesa->vram_phys; + else if (target & NOUVEAU_MEM_AGP) + offset -= nmesa->agp_phys; + + return nouveauCreateDmaObject(nmesa, handle, class, + offset, mem->size, + target, access); +} + void nouveauObjectOnSubchannel(nouveauContextPtr nmesa, int subchannel, int handle) { BEGIN_RING_SIZE(subchannel, 0, 1); @@ -53,31 +73,25 @@ void nouveauObjectInit(nouveauContextPtr nmesa) #endif /* We need to know vram size.. and AGP size (and even if the card is AGP..) */ - nouveauCreateDmaObject( nmesa, NvDmaFB, - 0, (256*1024*1024), - 0 /*NV_DMA_TARGET_FB*/, 0 /*NV_DMA_ACCESS_RW*/); - nouveauCreateDmaObject( nmesa, NvDmaAGP, - nmesa->agp_phys, (128*1024*1024), - 3 /* AGP */, 0 /* RW */); - - nouveauCreateContextObject(nmesa, Nv3D, nmesa->screen->card->class_3d, - 0, 0, 0, 0); + nouveauCreateDmaObject( nmesa, NvDmaFB, NV_DMA_IN_MEMORY, + 0, nmesa->vram_size, + NOUVEAU_MEM_FB, + NOUVEAU_MEM_ACCESS_RW); + nouveauCreateDmaObject( nmesa, NvDmaAGP, NV_DMA_IN_MEMORY, + 0, nmesa->agp_size, + NOUVEAU_MEM_AGP, + NOUVEAU_MEM_ACCESS_RW); + + nouveauCreateContextObject(nmesa, Nv3D, nmesa->screen->card->class_3d); if (nmesa->screen->card->type>=NV_10) { - nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV10_CONTEXT_SURFACES_2D, - 0, 0, 0, 0); - nouveauCreateContextObject(nmesa, NvImageBlit, NV10_IMAGE_BLIT, - NV_DMA_CONTEXT_FLAGS_PATCH_SRCCOPY, 0, 0, 0); + nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV10_CONTEXT_SURFACES_2D); + nouveauCreateContextObject(nmesa, NvImageBlit, NV10_IMAGE_BLIT); } else { - nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV04_CONTEXT_SURFACES_2D, - 0, 0, 0, 0); - nouveauCreateContextObject(nmesa, NvCtxSurf3D, NV04_CONTEXT_SURFACES_3D, - 0, 0, 0, 0); - nouveauCreateContextObject(nmesa, NvImageBlit, NV_IMAGE_BLIT, - NV_DMA_CONTEXT_FLAGS_PATCH_SRCCOPY, 0, 0, 0); + nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV04_CONTEXT_SURFACES_2D); + nouveauCreateContextObject(nmesa, NvCtxSurf3D, NV04_CONTEXT_SURFACES_3D); + nouveauCreateContextObject(nmesa, NvImageBlit, NV_IMAGE_BLIT); } - nouveauCreateContextObject(nmesa, NvMemFormat, - NV_MEMORY_TO_MEMORY_FORMAT, - 0, 0, 0, 0); + nouveauCreateContextObject(nmesa, NvMemFormat, NV_MEMORY_TO_MEMORY_FORMAT); #ifdef ALLOW_MULTI_SUBCHANNEL nouveauObjectOnSubchannel(nmesa, NvSubCtxSurf2D, NvCtxSurf2D); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.h b/src/mesa/drivers/dri/nouveau/nouveau_object.h index daad281029..0be9b4309c 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_object.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_object.h @@ -30,15 +30,18 @@ enum DMASubchannel { extern void nouveauObjectOnSubchannel(nouveauContextPtr nmesa, int subchannel, int handle); extern GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa, - int handle, int class, - uint32_t flags, - uint32_t dma_in, - uint32_t dma_out, - uint32_t dma_notifier); + uint32_t handle, int class); extern GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa, uint32_t handle, + int class, uint32_t offset, uint32_t size, int target, int access); +extern GLboolean nouveauCreateDmaObjectFromMem(nouveauContextPtr nmesa, + uint32_t handle, + int class, + nouveau_mem *mem, + int access); + #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 881b20149f..24e77750f9 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -327,8 +327,10 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 2, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; - static const __DRIversion drm_expected = { 0, 0, 3 }; - + static const __DRIversion drm_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL }; +#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 4 +#error nouveau_drm.h version doesn't match expected version +#endif dri_interface = interface; if (!driCheckDriDdxDrmVersions2("nouveau", diff --git a/src/mesa/drivers/dri/nouveau/nouveau_sync.c b/src/mesa/drivers/dri/nouveau/nouveau_sync.c index c47ff3a985..428b19b46e 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_sync.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_sync.c @@ -58,10 +58,9 @@ nouveau_notifier_new(GLcontext *ctx, GLuint handle, GLuint count) return NULL; } - if (!nouveauCreateDmaObject(nmesa, handle, notifier->mem->offset, - notifier->mem->size, - 0 /* NV_DMA_TARGET_FB */, - 0 /* NV_DMA_ACCESS_RW */)) { + if (!nouveauCreateDmaObjectFromMem(nmesa, handle, NV_DMA_IN_MEMORY, + notifier->mem, + NOUVEAU_MEM_ACCESS_RW)) { nouveau_mem_free(ctx, notifier->mem); FREE(notifier); return NULL; -- cgit v1.2.3 From 5cb01764f647be7ca3cb5e891af9fe012914a93d Mon Sep 17 00:00:00 2001 From: Rune Petersen Date: Thu, 1 Mar 2007 20:36:19 +0100 Subject: Optimize cos&sin instruction a bit more. --- src/mesa/drivers/dri/r300/r300_fragprog.c | 314 ++++++++++++++---------------- 1 file changed, 146 insertions(+), 168 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 8e45bd5403..a1c634a54d 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -1214,8 +1214,8 @@ static void make_sin_const(struct r300_fragment_program *rp) cnstv[3] = 0.2225; // weight rp->const_sin[0] = emit_const4fv(rp, cnstv); - cnstv[0] = 0.5; - cnstv[1] = -1.5; + cnstv[0] = 0.75; + cnstv[1] = 0.0; cnstv[2] = 0.159154943; // 1/(2*PI) cnstv[3] = 6.283185307; // 2*PI rp->const_sin[1] = emit_const4fv(rp, cnstv); @@ -1227,7 +1227,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp) struct gl_fragment_program *mp = &rp->mesa_program; const struct prog_instruction *inst = mp->Base.Instructions; struct prog_instruction *fpi; - GLuint src[3], dest, temp; + GLuint src[3], dest, temp[2]; GLuint cnst; int flags, mask = 0; GLfloat cnstv[4] = {0.0, 0.0, 0.0, 0.0}; @@ -1277,70 +1277,63 @@ static GLboolean parse_program(struct r300_fragment_program *rp) /* * cos using a parabola (see SIN): * cos(x): - * x += PI/2 - * x = (x/(2*PI))+0.5 + * x = (x/(2*PI))+0.75 * x = frac(x) * x = (x*2*PI)-PI * result = sin(x) */ - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); make_sin_const(rp); src[0] = t_scalar_src(rp, fpi->SrcReg[0]); /* add 0.5*PI and do range reduction */ - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - swizzle(rp->const_sin[0], Z, Z, Z, Z), //PI - pfs_half, - swizzle(keep(src[0]), X, X, X, X), - 0); - - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X, + swizzle(src[0], X, X, X, X), swizzle(rp->const_sin[1], Z, Z, Z, Z), - pfs_half, + swizzle(rp->const_sin[1], X, X, X, X), 0); - emit_arith(rp, PFS_OP_FRC, temp, WRITEMASK_X, - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_FRC, temp[0], WRITEMASK_X, + swizzle(temp[0], X, X, X, X), undef, undef, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_Z, - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Z, + swizzle(temp[0], X, X, X, X), swizzle(rp->const_sin[1], W, W, W, W), //2*PI negate(swizzle(rp->const_sin[0], Z, Z, Z, Z)), //-PI 0); /* SIN */ - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X | WRITEMASK_Y, - swizzle(temp, Z, Z, Z, Z), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y, + swizzle(temp[0], Z, Z, Z, Z), rp->const_sin[0], pfs_zero, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - swizzle(temp, Y, Y, Y, Y), - absolute(swizzle(temp, Z, Z, Z, Z)), - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X, + swizzle(temp[0], Y, Y, Y, Y), + absolute(swizzle(temp[0], Z, Z, Z, Z)), + swizzle(temp[0], X, X, X, X), 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_Y, - swizzle(temp, X, X, X, X), - absolute(swizzle(temp, X, X, X, X)), - negate(swizzle(temp, X, X, X, X)), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Y, + swizzle(temp[0], X, X, X, X), + absolute(swizzle(temp[0], X, X, X, X)), + negate(swizzle(temp[0], X, X, X, X)), 0); emit_arith(rp, PFS_OP_MAD, dest, mask, - swizzle(temp, Y, Y, Y, Y), + swizzle(temp[0], Y, Y, Y, Y), swizzle(rp->const_sin[0], W, W, W, W), - swizzle(temp, X, X, X, X), + swizzle(temp[0], X, X, X, X), flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_DP3: src[0] = t_src(rp, fpi->SrcReg[0]); @@ -1363,15 +1356,15 @@ static GLboolean parse_program(struct r300_fragment_program *rp) * DP4 dest, temp, src1 */ #if 0 - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); src[0].s_swz = SWIZZLE_ONE; - emit_arith(rp, PFS_OP_MAD, temp, mask, + emit_arith(rp, PFS_OP_MAD, temp[0], mask, src[0], pfs_one, pfs_zero, 0); emit_arith(rp, PFS_OP_DP4, dest, mask, - temp, src[1], undef, + temp[0], src[1], undef, flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); #else emit_arith(rp, PFS_OP_DP4, dest, mask, swizzle(src[0], X, Y, Z, ONE), src[1], @@ -1408,17 +1401,17 @@ static GLboolean parse_program(struct r300_fragment_program *rp) break; case OPCODE_FLR: src[0] = t_src(rp, fpi->SrcReg[0]); - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); /* FRC temp, src0 * MAD dest, src0, 1.0, -temp */ - emit_arith(rp, PFS_OP_FRC, temp, mask, + emit_arith(rp, PFS_OP_FRC, temp[0], mask, keep(src[0]), undef, undef, 0); emit_arith(rp, PFS_OP_MAD, dest, mask, - src[0], pfs_one, negate(temp), + src[0], pfs_one, negate(temp[0]), flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_FRC: src[0] = t_src(rp, fpi->SrcReg[0]); @@ -1450,44 +1443,44 @@ static GLboolean parse_program(struct r300_fragment_program *rp) */ cnstv[0] = cnstv[1] = cnstv[2] = cnstv[3] = 0.50001; src[0] = t_src(rp, fpi->SrcReg[0]); - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); cnst = emit_const4fv(rp, cnstv); - emit_arith(rp, PFS_OP_CMP, temp, + emit_arith(rp, PFS_OP_CMP, temp[0], WRITEMASK_X | WRITEMASK_Y, src[0], pfs_zero, src[0], flags); - emit_arith(rp, PFS_OP_MIN, temp, WRITEMASK_Z, + emit_arith(rp, PFS_OP_MIN, temp[0], WRITEMASK_Z, swizzle(keep(src[0]), W, W, W, W), cnst, undef, flags); - emit_arith(rp, PFS_OP_LG2, temp, WRITEMASK_W, - swizzle(temp, Y, Y, Y, Y), + emit_arith(rp, PFS_OP_LG2, temp[0], WRITEMASK_W, + swizzle(temp[0], Y, Y, Y, Y), undef, undef, flags); - emit_arith(rp, PFS_OP_MAX, temp, WRITEMASK_Z, - temp, negate(cnst), undef, flags); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W, - temp, swizzle(temp, Z, Z, Z, Z), + emit_arith(rp, PFS_OP_MAX, temp[0], WRITEMASK_Z, + temp[0], negate(cnst), undef, flags); + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_W, + temp[0], swizzle(temp[0], Z, Z, Z, Z), pfs_zero, flags); - emit_arith(rp, PFS_OP_EX2, temp, WRITEMASK_W, - temp, undef, undef, flags); + emit_arith(rp, PFS_OP_EX2, temp[0], WRITEMASK_W, + temp[0], undef, undef, flags); emit_arith(rp, PFS_OP_MAD, dest, WRITEMASK_Y, - swizzle(keep(temp), X, X, X, X), + swizzle(keep(temp[0]), X, X, X, X), pfs_one, pfs_zero, flags); #if 0 - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - temp, pfs_one, pfs_half, flags); - emit_arith(rp, PFS_OP_CMPH, temp, WRITEMASK_Z, - swizzle(keep(temp), W, W, W, W), - pfs_zero, swizzle(keep(temp), X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X, + temp[0], pfs_one, pfs_half, flags); + emit_arith(rp, PFS_OP_CMPH, temp[0], WRITEMASK_Z, + swizzle(keep(temp[0]), W, W, W, W), + pfs_zero, swizzle(keep(temp[0]), X, X, X, X), flags); #else - emit_arith(rp, PFS_OP_CMP, temp, WRITEMASK_Z, + emit_arith(rp, PFS_OP_CMP, temp[0], WRITEMASK_Z, pfs_zero, - swizzle(keep(temp), W, W, W, W), - negate(swizzle(keep(temp), X, X, X, X)), + swizzle(keep(temp[0]), W, W, W, W), + negate(swizzle(keep(temp[0]), X, X, X, X)), flags); #endif emit_arith(rp, PFS_OP_CMP, dest, WRITEMASK_Z, - pfs_zero, temp, - negate(swizzle(keep(temp), Y, Y, Y, Y)), + pfs_zero, temp[0], + negate(swizzle(keep(temp[0]), Y, Y, Y, Y)), flags); emit_arith(rp, PFS_OP_MAD, dest, WRITEMASK_X | WRITEMASK_W, @@ -1495,7 +1488,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp) pfs_one, pfs_zero, flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_LRP: src[0] = t_src(rp, fpi->SrcReg[0]); @@ -1506,14 +1499,14 @@ static GLboolean parse_program(struct r300_fragment_program *rp) * MAD temp, -tmp0, tmp2, tmp2 * MAD result, tmp0, tmp1, temp */ - temp = get_temp_reg(rp); - emit_arith(rp, PFS_OP_MAD, temp, mask, + temp[0] = get_temp_reg(rp); + emit_arith(rp, PFS_OP_MAD, temp[0], mask, negate(keep(src[0])), keep(src[2]), src[2], 0); emit_arith(rp, PFS_OP_MAD, dest, mask, - src[0], src[1], temp, + src[0], src[1], temp[0], flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_MAD: src[0] = t_src(rp, fpi->SrcReg[0]); @@ -1554,17 +1547,17 @@ static GLboolean parse_program(struct r300_fragment_program *rp) case OPCODE_POW: src[0] = t_scalar_src(rp, fpi->SrcReg[0]); src[1] = t_scalar_src(rp, fpi->SrcReg[1]); - temp = get_temp_reg(rp); - emit_arith(rp, PFS_OP_LG2, temp, WRITEMASK_W, + temp[0] = get_temp_reg(rp); + emit_arith(rp, PFS_OP_LG2, temp[0], WRITEMASK_W, src[0], undef, undef, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W, - temp, src[1], pfs_zero, + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_W, + temp[0], src[1], pfs_zero, 0); emit_arith(rp, PFS_OP_EX2, dest, fpi->DstReg.WriteMask, - temp, undef, undef, + temp[0], undef, undef, 0); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_RCP: src[0] = t_scalar_src(rp, fpi->SrcReg[0]); @@ -1580,107 +1573,91 @@ static GLboolean parse_program(struct r300_fragment_program *rp) break; case OPCODE_SCS: /* - * cos using a parabola (see SIN): - * cos(x): - * x += PI/2 - * x = (x/(2*PI))+0.5 - * x = frac(x) - * x = (x*2*PI)-PI - * result = sin(x) + * scs using a parabola : + * scs(x): + * result.x = sin(-abs(x)+0.5*PI) (cos) + * result.y = sin(x) (sin) + * */ - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); + temp[1] = get_temp_reg(rp); make_sin_const(rp); src[0] = t_scalar_src(rp, fpi->SrcReg[0]); - /* add 0.5*PI and do range reduction */ + /* x = -abs(x)+0.5*PI */ + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Z, + swizzle(rp->const_sin[0], Z, Z, Z, Z), //PI + pfs_half, + negate(abs(swizzle(keep(src[0]), X, X, X, X))), + 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X|WRITEMASK_Y, - swizzle(rp->const_sin[0], Z, Z, Z, Z), - rp->const_sin[1], + /* C*x (sin) */ + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_W, + swizzle(rp->const_sin[0], Y, Y, Y, Y), swizzle(keep(src[0]), X, X, X, X), + pfs_zero, 0); - emit_arith(rp, PFS_OP_CMP, temp, WRITEMASK_W, - swizzle(rp->const_sin[0], Z, Z, Z, Z), - negate(pfs_half), - swizzle(keep(src[0]), X, X, X, X), + /* B*x, C*x (cos) */ + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y, + swizzle(temp[0], Z, Z, Z, Z), + rp->const_sin[0], + pfs_zero, 0); - emit_arith(rp, PFS_OP_CMP, temp, WRITEMASK_Z, - swizzle(temp, X, X, X, X), - swizzle(temp, Y, Y, Y, Y), - swizzle(temp, W, W, W, W), + /* B*x (sin) */ + emit_arith(rp, PFS_OP_MAD, temp[1], WRITEMASK_W, + swizzle(rp->const_sin[0], X, X, X, X), + keep(src[0]), + pfs_zero, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X | WRITEMASK_Y, - swizzle(temp, Z, Z, Z, Z), - rp->const_sin[0], - pfs_zero, + /* y = B*x + C*x*abs(x) (sin)*/ + emit_arith(rp, PFS_OP_MAD, temp[1], WRITEMASK_Z, + absolute(src[0]), + swizzle(temp[0], W, W, W, W), + swizzle(temp[1], W, W, W, W), 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W, - swizzle(temp, Y, Y, Y, Y), - absolute(swizzle(temp, Z, Z, Z, Z)), - swizzle(temp, X, X, X, X), + /* y = B*x + C*x*abs(x) (cos)*/ + emit_arith(rp, PFS_OP_MAD, temp[1], WRITEMASK_W, + swizzle(temp[0], Y, Y, Y, Y), + absolute(swizzle(temp[0], Z, Z, Z, Z)), + swizzle(temp[0], X, X, X, X), 0); - if(mask & WRITEMASK_Y) - { - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X | WRITEMASK_Y, - swizzle(keep(src[0]), X, X, X, X), - rp->const_sin[0], - pfs_zero, - 0); - - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - swizzle(temp, Y, Y, Y, Y), - absolute(swizzle(keep(src[0]), X, X, X, X)), - swizzle(temp, X, X, X, X), - 0); - } + /* y*abs(y) - y (cos), y*abs(y) - y (sin) */ + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y, + swizzle(temp[1], W, Z, Y, X), + absolute(swizzle(temp[1], W, Z, Y, X)), + negate(swizzle(temp[1], W, Z, Y, X)), - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_Z, - swizzle(temp, W, W, W, W), - absolute(swizzle(temp, W, W, W, W)), - negate(swizzle(temp, W, W, W, W)), 0); - emit_arith(rp, PFS_OP_MAD, dest, WRITEMASK_X, - swizzle(temp, Z, Z, Z, Z), + /* dest.xy = mad(temp.xy, P, temp2.wz) */ + emit_arith(rp, PFS_OP_MAD, dest, mask & (WRITEMASK_X | WRITEMASK_Y), + temp[0], swizzle(rp->const_sin[0], W, W, W, W), - swizzle(temp, W, W, W, W), + swizzle(temp[1], W, Z, Y, X), flags); - if(mask & WRITEMASK_Y) - { - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W, - swizzle(temp, X, X, X, X), - absolute(swizzle(temp, X, X, X, X)), - negate(swizzle(temp, X, X, X, X)), - 0); - - emit_arith(rp, PFS_OP_MAD, dest, WRITEMASK_Y, - swizzle(temp, W, W, W, W), - swizzle(rp->const_sin[0], W, W, W, W), - swizzle(temp, X, X, X, X), - flags); - } - free_temp(rp, temp); + free_temp(rp, temp[0]); + free_temp(rp, temp[1]); break; case OPCODE_SGE: src[0] = t_src(rp, fpi->SrcReg[0]); src[1] = t_src(rp, fpi->SrcReg[1]); - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); /* temp = src0 - src1 * dest.c = (temp.c < 0.0) ? 0 : 1 */ - emit_arith(rp, PFS_OP_MAD, temp, mask, + emit_arith(rp, PFS_OP_MAD, temp[0], mask, src[0], pfs_one, negate(src[1]), 0); emit_arith(rp, PFS_OP_CMP, dest, mask, - pfs_one, pfs_zero, temp, + pfs_one, pfs_zero, temp[0], 0); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_SIN: /* @@ -1690,73 +1667,74 @@ static GLboolean parse_program(struct r300_fragment_program *rp) * itself squared. */ - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); make_sin_const(rp); src[0] = t_scalar_src(rp, fpi->SrcReg[0]); + /* do range reduction */ - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X, swizzle(keep(src[0]), X, X, X, X), swizzle(rp->const_sin[1], Z, Z, Z, Z), pfs_half, 0); - emit_arith(rp, PFS_OP_FRC, temp, WRITEMASK_X, - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_FRC, temp[0], WRITEMASK_X, + swizzle(temp[0], X, X, X, X), undef, undef, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_Z, - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Z, + swizzle(temp[0], X, X, X, X), swizzle(rp->const_sin[1], W, W, W, W), //2*PI negate(swizzle(rp->const_sin[0], Z, Z, Z, Z)), //PI 0); /* SIN */ - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X | WRITEMASK_Y, - swizzle(temp, Z, Z, Z, Z), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y, + swizzle(temp[0], Z, Z, Z, Z), rp->const_sin[0], pfs_zero, 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X, - swizzle(temp, Y, Y, Y, Y), - absolute(swizzle(temp, Z, Z, Z, Z)), - swizzle(temp, X, X, X, X), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X, + swizzle(temp[0], Y, Y, Y, Y), + absolute(swizzle(temp[0], Z, Z, Z, Z)), + swizzle(temp[0], X, X, X, X), 0); - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_Y, - swizzle(temp, X, X, X, X), - absolute(swizzle(temp, X, X, X, X)), - negate(swizzle(temp, X, X, X, X)), + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Y, + swizzle(temp[0], X, X, X, X), + absolute(swizzle(temp[0], X, X, X, X)), + negate(swizzle(temp[0], X, X, X, X)), 0); emit_arith(rp, PFS_OP_MAD, dest, mask, - swizzle(temp, Y, Y, Y, Y), + swizzle(temp[0], Y, Y, Y, Y), swizzle(rp->const_sin[0], W, W, W, W), - swizzle(temp, X, X, X, X), + swizzle(temp[0], X, X, X, X), flags); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_SLT: src[0] = t_src(rp, fpi->SrcReg[0]); src[1] = t_src(rp, fpi->SrcReg[1]); - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); /* temp = src0 - src1 * dest.c = (temp.c < 0.0) ? 1 : 0 */ - emit_arith(rp, PFS_OP_MAD, temp, mask, + emit_arith(rp, PFS_OP_MAD, temp[0], mask, src[0], pfs_one, negate(src[1]), 0); emit_arith(rp, PFS_OP_CMP, dest, mask, - pfs_zero, pfs_one, temp, + pfs_zero, pfs_one, temp[0], 0); - free_temp(rp, temp); + free_temp(rp, temp[0]); break; case OPCODE_SUB: src[0] = t_src(rp, fpi->SrcReg[0]); @@ -1777,9 +1755,9 @@ static GLboolean parse_program(struct r300_fragment_program *rp) case OPCODE_XPD: { src[0] = t_src(rp, fpi->SrcReg[0]); src[1] = t_src(rp, fpi->SrcReg[1]); - temp = get_temp_reg(rp); + temp[0] = get_temp_reg(rp); /* temp = src0.zxy * src1.yzx */ - emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_XYZ, + emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_XYZ, swizzle(keep(src[0]), Z, X, Y, W), swizzle(keep(src[1]), Y, Z, X, W), pfs_zero, @@ -1790,10 +1768,10 @@ static GLboolean parse_program(struct r300_fragment_program *rp) emit_arith(rp, PFS_OP_MAD, dest, mask & WRITEMASK_XYZ, swizzle(src[0], Y, Z, X, W), swizzle(src[1], Z, X, Y, W), - negate(temp), + negate(temp[0]), flags); /* cleanup */ - free_temp(rp, temp); + free_temp(rp, temp[0]); break; } default: -- cgit v1.2.3 From ad3f2107ed698e794871e0a2bd996260b263b46a Mon Sep 17 00:00:00 2001 From: Christoph Bill Date: Thu, 1 Mar 2007 20:40:25 +0100 Subject: Add early register descritpion. This need more work on case where we can disable or enable early (stencil, alpha might need it to be disable). --- src/mesa/drivers/dri/r300/r300_reg.h | 4 ++++ src/mesa/drivers/dri/r300/r300_state.c | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 9f636ec1d2..6abcfa4569 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -1378,6 +1378,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* 16 bit format or some aditional bit ? */ # define R300_DEPTH_FORMAT_UNK32 (32 << 0) +#define R300_RB3D_EARLY_Z 0x4F14 +# define R300_EARLY_Z_DISABLE (0 << 0) +# define R300_EARLY_Z_ENABLE (1 << 0) + /* gap */ #define R300_RB3D_DEPTHOFFSET 0x4F20 diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index b30ece160a..0e33e51ef3 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -328,24 +328,24 @@ static void r300UpdateCulling(GLcontext* ctx) static void update_early_z(GLcontext *ctx) { - /* updates register 0x4f14 - if depth test is not enabled it should be 0x00000000 - if depth is enabled and alpha not it should be 0x00000001 - if depth and alpha is enabled it should be 0x00000000 + /* updates register R300_RB3D_EARLY_Z (0x4F14) + if depth test is not enabled it should be R300_EARLY_Z_DISABLE + if depth is enabled and alpha not it should be R300_EARLY_Z_ENABLE + if depth and alpha is enabled it should be R300_EARLY_Z_DISABLE */ r300ContextPtr r300 = R300_CONTEXT(ctx); R300_STATECHANGE(r300, unk4F10); if (ctx->Color.AlphaEnabled && ctx->Color.AlphaFunc != GL_ALWAYS) /* disable early Z */ - r300->hw.unk4F10.cmd[2] = 0x00000000; + r300->hw.unk4F10.cmd[2] = R300_EARLY_Z_DISABLE; else { if (ctx->Depth.Test && ctx->Depth.Func != GL_NEVER) /* enable early Z */ - r300->hw.unk4F10.cmd[2] = 0x00000001; + r300->hw.unk4F10.cmd[2] = R300_EARLY_Z_ENABLE; else /* disable early Z */ - r300->hw.unk4F10.cmd[2] = 0x00000000; + r300->hw.unk4F10.cmd[2] = R300_EARLY_Z_DISABLE; } } -- cgit v1.2.3 From 0d2a68fc61ed6e47a7a8ae4197596b96bb11f886 Mon Sep 17 00:00:00 2001 From: Christoph Bill Date: Thu, 1 Mar 2007 20:45:04 +0100 Subject: r300: Use reg definition when available & add missing reg definition. --- src/mesa/drivers/dri/r300/r300_ioctl.c | 2 +- src/mesa/drivers/dri/r300/r300_reg.h | 8 +++++++- src/mesa/drivers/dri/r300/radeon_mm.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index c5ad026045..6fa34ee482 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -228,7 +228,7 @@ static void r300EmitClearState(GLcontext * ctx) e32(0); R300_STATECHANGE(r300, unk221C); - reg_start(0x221C, 0); + reg_start(R300_VAP_UNKNOWN_221C, 0); e32(R300_221C_CLEAR); R300_STATECHANGE(r300, ps); diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 6abcfa4569..9de4c4d68b 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -63,6 +63,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R300_SE_VPORT_ZOFFSET 0x1DAC +/* + * Vertex Array Processing (VAP) Control + * Stolen from r200 code from Christoph Brill (It's a guess!) + */ +#define R300_VAP_CNTL 0x2080 + /* This register is written directly and also starts data section * in many 3d CP_PACKET3's */ @@ -135,7 +141,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* gap */ -#define R300_VAP_CNTL 0x2140 +#define R300_VAP_CNTL_STATUS 0x2140 # define R300_VC_NO_SWAP (0 << 0) # define R300_VC_16BIT_SWAP (1 << 0) # define R300_VC_32BIT_SWAP (2 << 0) diff --git a/src/mesa/drivers/dri/r300/radeon_mm.c b/src/mesa/drivers/dri/r300/radeon_mm.c index f86a1b4e72..32ed1f4393 100644 --- a/src/mesa/drivers/dri/r300/radeon_mm.c +++ b/src/mesa/drivers/dri/r300/radeon_mm.c @@ -283,7 +283,7 @@ static void emit_lin_cp(r300ContextPtr rmesa, unsigned long dst, unsigned long s size -= cp_size; } - reg_start(0x4e4c,0); + reg_start(R300_RB3D_DSTCACHE_CTLSTAT,0); e32(0x0000000a); reg_start(0x342c,0); -- cgit v1.2.3 From 95577064040ceeaaf7b0a460f91eac951cf8af18 Mon Sep 17 00:00:00 2001 From: Christoph Bill Date: Thu, 1 Mar 2007 21:11:45 +0100 Subject: r300: Use register name & add a register about shading. --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 18 +++++++++--------- src/mesa/drivers/dri/r300/r300_reg.h | 4 ++++ 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index ace9b66724..2c7b5aa011 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -292,13 +292,13 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( vpt, always, R300_VPT_CMDSIZE, "vpt", 0 ); r300->hw.vpt.cmd[R300_VPT_CMD_0] = cmdpacket0(R300_SE_VPORT_XSCALE, 6); ALLOC_STATE( unk2080, always, 2, "unk2080", 0 ); - r300->hw.unk2080.cmd[0] = cmdpacket0(0x2080, 1); + r300->hw.unk2080.cmd[0] = cmdpacket0(R300_VAP_CNTL, 1); ALLOC_STATE( vte, always, 3, "vte", 0 ); r300->hw.vte.cmd[0] = cmdpacket0(R300_SE_VTE_CNTL, 2); ALLOC_STATE( unk2134, always, 3, "unk2134", 0 ); r300->hw.unk2134.cmd[0] = cmdpacket0(0x2134, 2); ALLOC_STATE( unk2140, always, 2, "unk2140", 0 ); - r300->hw.unk2140.cmd[0] = cmdpacket0(0x2140, 1); + r300->hw.unk2140.cmd[0] = cmdpacket0(R300_VAP_CNTL_STATUS, 1); ALLOC_STATE( vir[0], variable, R300_VIR_CMDSIZE, "vir/0", 0 ); r300->hw.vir[0].cmd[R300_VIR_CMD_0] = cmdpacket0(R300_VAP_INPUT_ROUTE_0_0, 1); ALLOC_STATE( vir[1], variable, R300_VIR_CMDSIZE, "vir/1", 1 ); @@ -308,11 +308,11 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( unk21DC, always, 2, "unk21DC", 0 ); r300->hw.unk21DC.cmd[0] = cmdpacket0(0x21DC, 1); ALLOC_STATE( unk221C, always, 2, "unk221C", 0 ); - r300->hw.unk221C.cmd[0] = cmdpacket0(0x221C, 1); + r300->hw.unk221C.cmd[0] = cmdpacket0(R300_VAP_UNKNOWN_221C, 1); ALLOC_STATE( unk2220, always, 5, "unk2220", 0 ); r300->hw.unk2220.cmd[0] = cmdpacket0(0x2220, 4); ALLOC_STATE( unk2288, always, 2, "unk2288", 0 ); - r300->hw.unk2288.cmd[0] = cmdpacket0(0x2288, 1); + r300->hw.unk2288.cmd[0] = cmdpacket0(R300_VAP_UNKNOWN_2288, 1); ALLOC_STATE( vof, always, R300_VOF_CMDSIZE, "vof", 0 ); r300->hw.vof.cmd[R300_VOF_CMD_0] = cmdpacket0(R300_VAP_OUTPUT_VTX_FMT_0, 2); ALLOC_STATE( pvs, always, R300_PVS_CMDSIZE, "pvs", 0 ); @@ -336,9 +336,9 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( unk4260, always, 4, "unk4260", 0 ); r300->hw.unk4260.cmd[0] = cmdpacket0(0x4260, 3); ALLOC_STATE( unk4274, always, 5, "unk4274", 0 ); - r300->hw.unk4274.cmd[0] = cmdpacket0(0x4274, 4); + r300->hw.unk4274.cmd[0] = cmdpacket0(R300_RE_SHADE, 4); ALLOC_STATE( unk4288, always, 4, "unk4288", 0 ); - r300->hw.unk4288.cmd[0] = cmdpacket0(0x4288, 3); + r300->hw.unk4288.cmd[0] = cmdpacket0(R300_RE_POLYGON_MODE, 3); ALLOC_STATE( fogp, always, 3, "fogp", 0 ); r300->hw.fogp.cmd[0] = cmdpacket0(R300_RE_FOG_SCALE, 2); ALLOC_STATE( unk42A0, always, 2, "unk42A0", 0 ); @@ -346,7 +346,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( zbs, always, R300_ZBS_CMDSIZE, "zbs", 0 ); r300->hw.zbs.cmd[R300_ZBS_CMD_0] = cmdpacket0(R300_RE_ZBIAS_T_FACTOR, 4); ALLOC_STATE( unk42B4, always, 2, "unk42B4", 0 ); - r300->hw.unk42B4.cmd[0] = cmdpacket0(0x42B4, 1); + r300->hw.unk42B4.cmd[0] = cmdpacket0(R300_RE_OCCLUSION_CNTL, 1); ALLOC_STATE( cul, always, R300_CUL_CMDSIZE, "cul", 0 ); r300->hw.cul.cmd[R300_CUL_CMD_0] = cmdpacket0(R300_RE_CULL_CNTL, 1); ALLOC_STATE( unk42C0, always, 3, "unk42C0", 0 ); @@ -393,7 +393,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( cmk, always, R300_CMK_CMDSIZE, "cmk", 0 ); r300->hw.cmk.cmd[R300_CMK_CMD_0] = cmdpacket0(R300_RB3D_COLORMASK, 1); ALLOC_STATE( unk4E10, always, 4, "unk4E10", 0 ); - r300->hw.unk4E10.cmd[0] = cmdpacket0(0x4E10, 3); + r300->hw.unk4E10.cmd[0] = cmdpacket0(R300_RB3D_BLEND_COLOR, 3); ALLOC_STATE( cb, always, R300_CB_CMDSIZE, "cb", 0 ); r300->hw.cb.cmd[R300_CB_CMD_0] = cmdpacket0(R300_RB3D_COLOROFFSET0, 1); r300->hw.cb.cmd[R300_CB_CMD_1] = cmdpacket0(R300_RB3D_COLORPITCH0, 1); @@ -406,7 +406,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE( zs, always, R300_ZS_CMDSIZE, "zstencil", 0 ); r300->hw.zs.cmd[R300_ZS_CMD_0] = cmdpacket0(R300_RB3D_ZSTENCIL_CNTL_0, 3); ALLOC_STATE( unk4F10, always, 5, "unk4F10", 0 ); - r300->hw.unk4F10.cmd[0] = cmdpacket0(0x4F10, 4); + r300->hw.unk4F10.cmd[0] = cmdpacket0(R300_RB3D_ZSTENCIL_FORMAT, 4); ALLOC_STATE( zb, always, R300_ZB_CMDSIZE, "zb", 0 ); r300->hw.zb.cmd[R300_ZB_CMD_0] = cmdpacket0(R300_RB3D_DEPTHOFFSET, 2); ALLOC_STATE( unk4F28, always, 2, "unk4F28", 0 ); diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 9de4c4d68b..69bc994cf6 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -544,6 +544,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Some sort of scale or clamp value for texcoordless textures. */ #define R300_RE_UNK4238 0x4238 +/* Something shade related */ +#define R300_RE_SHADE 0x4274 + #define R300_RE_SHADE_MODEL 0x4278 # define R300_RE_SHADE_MODEL_SMOOTH 0x3aaaa # define R300_RE_SHADE_MODEL_FLAT 0x39595 @@ -1279,6 +1282,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_BLEND_MASK (63) # define R300_SRC_BLEND_SHIFT (16) # define R300_DST_BLEND_SHIFT (24) +#define R300_RB3D_BLEND_COLOR 0x4E10 #define R300_RB3D_COLORMASK 0x4E0C # define R300_COLORMASK0_B (1<<0) # define R300_COLORMASK0_G (1<<1) -- cgit v1.2.3 From a783713432a1aed168688ace7d03bc11abf9b406 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Mon, 5 Mar 2007 22:18:21 +0800 Subject: fix for bug#9971 call swsetup_Wakeup before falling back to software rendering --- src/mesa/drivers/dri/i965/brw_draw.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 092c6bafc2..4eb2eedd42 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -458,6 +458,7 @@ void brw_draw_prims( GLcontext *ctx, * swrast to do the drawing. */ if (!retval) { + _swsetup_Wakeup(ctx); _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); } -- cgit v1.2.3 From 1c70cde8881f794782780cbd695da0882f78c769 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Tue, 6 Mar 2007 15:47:37 +0800 Subject: fix for bug#10182 call _mesa_dereference_framebuffer instead of _mesa_dereference_framebuffer in i810, i915, i915tex, i965 drivers. --- src/mesa/drivers/dri/i810/i810screen.c | 3 ++- src/mesa/drivers/dri/i915/intel_screen.c | 3 ++- src/mesa/drivers/dri/i915tex/intel_screen.c | 3 ++- src/mesa/drivers/dri/i965/intel_screen.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index d0e58f667c..ebe2615fe8 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -398,7 +398,8 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv, static void i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */ + _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 107cf137ff..942e1e9c22 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -449,7 +449,8 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */ + _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c index efa1b014a6..bc538902b4 100644 --- a/src/mesa/drivers/dri/i915tex/intel_screen.c +++ b/src/mesa/drivers/dri/i915tex/intel_screen.c @@ -609,7 +609,8 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, static void intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */ + _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 08f0bb340f..06e5d0c5bd 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -457,7 +457,8 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */ + _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } -- cgit v1.2.3 From 6f9b1afc862851532e4820705c412388b497ad58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 6 Mar 2007 13:22:35 +0100 Subject: r300: Call radeonSetCliprects from radeonMakeCurrent. Based on a patch by Panagiotis Papadakos. Among other things, this makes sure the framebuffer object associated with the drawable has the correct size when _mesa_make_current is called, so the default viewport is set up correctly. Also update radeon->lastStamp in radeonSetCliprects. --- src/mesa/drivers/dri/r300/radeon_context.c | 3 +++ src/mesa/drivers/dri/r300/radeon_lock.c | 1 - src/mesa/drivers/dri/r300/radeon_state.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index 3a6bde8fc3..d66f1dc49e 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -51,6 +51,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_macros.h" #include "radeon_reg.h" +#include "radeon_state.h" #include "r300_state.h" #include "utils.h" @@ -279,6 +280,8 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, r300UpdateWindow(radeon->glCtx); r300UpdateViewportOffset(radeon->glCtx); + + radeonSetCliprects(radeon); } _mesa_make_current(radeon->glCtx, diff --git a/src/mesa/drivers/dri/r300/radeon_lock.c b/src/mesa/drivers/dri/r300/radeon_lock.c index a00da6c8bc..1a2dfca7b0 100644 --- a/src/mesa/drivers/dri/r300/radeon_lock.c +++ b/src/mesa/drivers/dri/r300/radeon_lock.c @@ -90,7 +90,6 @@ static void r300RegainedLock(radeonContextPtr radeon) #else radeonUpdateScissor(radeon->glCtx); #endif - radeon->lastStamp = drawable->lastStamp; } if (sarea->ctx_owner != radeon->dri.hwContext) { diff --git a/src/mesa/drivers/dri/r300/radeon_state.c b/src/mesa/drivers/dri/r300/radeon_state.c index ddadf83a00..902e9583a6 100644 --- a/src/mesa/drivers/dri/r300/radeon_state.c +++ b/src/mesa/drivers/dri/r300/radeon_state.c @@ -185,6 +185,8 @@ void radeonSetCliprects(radeonContextPtr radeon) if (radeon->state.scissor.enabled) radeonRecalcScissorRects(radeon); + + radeon->lastStamp = drawable->lastStamp; } -- cgit v1.2.3 From a510bc3ee1a696da120c09ee4ec33dc033f671ac Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 6 Mar 2007 10:07:59 -0700 Subject: Fix/improve framebuffer object reference counting. Use _mesa_reference_framebuffer() and _mesa_unreference_framebuffer() functions to be sure reference counting is done correctly. Additional assertions are done too. Note _mesa_dereference_framebuffer() renamed to "unreference" as that's more accurate. --- src/mesa/drivers/allegro/amesa.c | 2 +- src/mesa/drivers/dri/fb/fb_dri.c | 6 +----- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 2 +- src/mesa/drivers/dri/gamma/gamma_xmesa.c | 2 +- src/mesa/drivers/dri/i810/i810screen.c | 3 +-- src/mesa/drivers/dri/i915/intel_screen.c | 3 +-- src/mesa/drivers/dri/i915tex/intel_screen.c | 3 +-- src/mesa/drivers/dri/i965/intel_screen.c | 3 +-- src/mesa/drivers/dri/mach64/mach64_screen.c | 2 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 2 +- src/mesa/drivers/dri/r128/r128_screen.c | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 2 +- src/mesa/drivers/dri/s3v/s3v_xmesa.c | 2 +- src/mesa/drivers/dri/savage/savage_xmesa.c | 2 +- src/mesa/drivers/dri/sis/sis_screen.c | 2 +- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 2 +- src/mesa/drivers/dri/trident/trident_context.c | 2 +- src/mesa/drivers/dri/unichrome/via_screen.c | 2 +- src/mesa/drivers/glide/fxapi.c | 4 ++-- src/mesa/drivers/osmesa/osmesa.c | 3 ++- src/mesa/drivers/svga/svgamesa.c | 1 - src/mesa/drivers/x11/xm_api.c | 4 ++-- 23 files changed, 25 insertions(+), 33 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/allegro/amesa.c b/src/mesa/drivers/allegro/amesa.c index 594668affd..518211ccf4 100644 --- a/src/mesa/drivers/allegro/amesa.c +++ b/src/mesa/drivers/allegro/amesa.c @@ -338,7 +338,7 @@ void AMesaDestroyBuffer(AMesaBuffer buffer) { if (buffer->Screen) destroy_bitmap(buffer->Screen); if (buffer->Background) destroy_bitmap(buffer->Background); - _mesa_destroy_framebuffer(buffer->GLBuffer); + _mesa_unreference_framebuffer(&buffer->GLBuffer); free(buffer); } diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c index 08b52b4d8f..a6d7590eff 100644 --- a/src/mesa/drivers/dri/fb/fb_dri.c +++ b/src/mesa/drivers/dri/fb/fb_dri.c @@ -480,11 +480,7 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void fbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - struct gl_framebuffer *mesa_framebuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate; - - _mesa_free(mesa_framebuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer->Data); - _mesa_destroy_framebuffer(mesa_framebuffer); - driDrawPriv->driverPrivate = NULL; + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 215aaf8ffb..4c5323d230 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -392,7 +392,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv, static void ffbDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/gamma/gamma_xmesa.c b/src/mesa/drivers/dri/gamma/gamma_xmesa.c index e8922b1503..f41682cea7 100644 --- a/src/mesa/drivers/dri/gamma/gamma_xmesa.c +++ b/src/mesa/drivers/dri/gamma/gamma_xmesa.c @@ -97,7 +97,7 @@ gammaCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void gammaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } static void diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index ebe2615fe8..f64c10a9ae 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -398,8 +398,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv, static void i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */ - _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 942e1e9c22..67e176a1c6 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -449,8 +449,7 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */ - _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c index bc538902b4..ac83254593 100644 --- a/src/mesa/drivers/dri/i915tex/intel_screen.c +++ b/src/mesa/drivers/dri/i915tex/intel_screen.c @@ -609,8 +609,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, static void intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv) { - /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */ - _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 06e5d0c5bd..5dac50df32 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -457,8 +457,7 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void intelDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - /* _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); */ - _mesa_dereference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 1014b8acd5..4e9e216e7d 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -435,7 +435,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv, static void mach64DestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index f024f73eb6..67a6f8bdf0 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -831,7 +831,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void mgaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } static void diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 24e77750f9..e00080fce1 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -202,7 +202,7 @@ nouveauCreateBuffer(__DRIscreenPrivate *driScrnPriv, static void nouveauDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } static int diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 4f1b20aadd..880dee85c2 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -357,7 +357,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv, static void r128DestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index fc5aa11462..abb14faaa1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -901,7 +901,7 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void radeonDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c index c451f7452b..c66fd6dac3 100644 --- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c +++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c @@ -131,7 +131,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void s3vDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } static void diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index ad79b9235c..f859217069 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -710,7 +710,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void savageDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } #if 0 diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 8f52cfe098..89d734ba78 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -233,7 +233,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void sisDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } static void sisCopyBuffer( __DRIdrawablePrivate *dPriv ) diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 646f5126eb..1f9ff4e30c 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -233,7 +233,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void tdfxDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index dbbd1ac0c6..8dc7f0dc78 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -279,7 +279,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, static void tridentDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *) (driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } static void diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 28e1f9451e..90f76be44d 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -320,7 +320,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, static void viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) { - _mesa_destroy_framebuffer((GLframebuffer *)(driDrawPriv->driverPrivate)); + _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); } diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c index e535e739b3..00b9d29fac 100644 --- a/src/mesa/drivers/glide/fxapi.c +++ b/src/mesa/drivers/glide/fxapi.c @@ -728,7 +728,7 @@ errorhandler: FREE(fxMesa->fogTable); } if (fxMesa->glBuffer) { - _mesa_destroy_framebuffer(fxMesa->glBuffer); + _mesa_unreference_framebuffer(&fxMesa->glBuffer); } if (fxMesa->glVis) { _mesa_destroy_visual(fxMesa->glVis); @@ -828,7 +828,7 @@ fxMesaDestroyContext(fxMesaContext fxMesa) fxDDDestroyFxMesaContext(fxMesa); /* must be before _mesa_destroy_context */ _mesa_destroy_visual(fxMesa->glVis); _mesa_destroy_context(fxMesa->glCtx); - _mesa_destroy_framebuffer(fxMesa->glBuffer); + _mesa_unreference_framebuffer(&fxMesa->glBuffer); fxTMClose(fxMesa); /* must be after _mesa_destroy_context */ FREE(fxMesa); diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index c4fc8821e5..96b9b5c174 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1303,7 +1303,8 @@ OSMesaDestroyContext( OSMesaContext osmesa ) _swrast_DestroyContext( &osmesa->mesa ); _mesa_destroy_visual( osmesa->gl_visual ); - _mesa_destroy_framebuffer( osmesa->gl_buffer ); + _mesa_unreference_framebuffer( &osmesa->gl_buffer ); + _mesa_free_context_data( &osmesa->mesa ); _mesa_free( osmesa ); } diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c index 0dd9a144fe..d138587569 100644 --- a/src/mesa/drivers/svga/svgamesa.c +++ b/src/mesa/drivers/svga/svgamesa.c @@ -433,7 +433,6 @@ void SVGAMesaDestroyContext( SVGAMesaContext ctx ) if (ctx) { _mesa_destroy_visual( ctx->gl_vis ); _mesa_destroy_context( ctx->gl_ctx ); - _mesa_destroy_framebuffer( ctx->gl_buffer ); free( ctx ); if (ctx==SVGAMesa) { SVGAMesa = NULL; diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 2cd7d8a6ca..a42de72827 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -485,8 +485,8 @@ xmesa_free_buffer(XMesaBuffer buffer) /* mark as delete pending */ fb->DeletePending = GL_TRUE; - /* Dereference. If count = zero we'll really delete the buffer */ - _mesa_dereference_framebuffer(&fb); + /* Unreference. If count = zero we'll really delete the buffer */ + _mesa_unreference_framebuffer(&fb); return; } -- cgit v1.2.3 From 37fd6be41134df46cb9dad7f9201188ff9707629 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 6 Mar 2007 16:24:48 -0700 Subject: formatting fix --- src/mesa/drivers/x11/xm_api.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index a42de72827..776928dec4 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -383,8 +383,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, /* * Front renderbuffer */ - b->frontxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, - GL_FALSE); + b->frontxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_FALSE); if (!b->frontxrb) { _mesa_free(b); return NULL; @@ -399,8 +398,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type, * Back renderbuffer */ if (vis->mesa_visual.doubleBufferMode) { - b->backxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, - GL_TRUE); + b->backxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_TRUE); if (!b->backxrb) { /* XXX free front xrb too */ _mesa_free(b); -- cgit v1.2.3 From 955906aa647d0d233b422c979e1ee81dc32abb87 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 6 Mar 2007 16:25:07 -0700 Subject: fix renderbuffer mem leak --- src/mesa/drivers/x11/xm_buffer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index a358ec25ae..747971a6c3 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -418,6 +418,18 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb) XMesaDestroyImage( b->rowimage ); } + /* Note that XMesaBuffer renderbuffers normally have a refcount of 2 + * (creation + binding) so we need to explicitly delete/unbind them here. + */ + if (b->frontxrb) { + _mesa_unreference_renderbuffer((struct gl_renderbuffer **) &b->frontxrb); + ASSERT(b->frontxrb == NULL); + } + if (b->backxrb) { + _mesa_unreference_renderbuffer((struct gl_renderbuffer **) &b->backxrb); + ASSERT(b->backxrb == NULL); + } + _mesa_free_framebuffer_data(fb); _mesa_free(fb); } -- cgit v1.2.3 From 9adf6e9d6c0fe420f648bf3f57c22df72dea485f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 7 Mar 2007 17:52:44 +0100 Subject: i945_miptree_layout: Adapt cubemap fixes from i915_miptree_layout. Cubemaps aren't working fully correctly yet, but at least they don't seem to cause crashes anymore. --- src/mesa/drivers/dri/i915tex/i915_tex_layout.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i915tex/i915_tex_layout.c b/src/mesa/drivers/dri/i915tex/i915_tex_layout.c index c844f5351d..2e1600cfdf 100644 --- a/src/mesa/drivers/dri/i915tex/i915_tex_layout.c +++ b/src/mesa/drivers/dri/i915tex/i915_tex_layout.c @@ -190,6 +190,9 @@ i945_miptree_layout(struct intel_mipmap_tree * mt) case GL_TEXTURE_CUBE_MAP:{ const GLuint dim = mt->width0; GLuint face; + GLuint lvlWidth = mt->width0, lvlHeight = mt->height0; + + assert(lvlWidth == lvlHeight); /* cubemap images are square */ /* Depending on the size of the largest images, pitch can be * determined either by the old-style packing of cubemap faces, @@ -204,11 +207,13 @@ i945_miptree_layout(struct intel_mipmap_tree * mt) /* Set all the levels to effectively occupy the whole rectangular region. */ - for (level = mt->first_level; level <= mt->last_level; level++) + for (level = mt->first_level; level <= mt->last_level; level++) { intel_miptree_set_level_info(mt, level, 6, 0, 0, - mt->pitch, mt->total_height, 1); - + lvlWidth, lvlHeight, 1); + lvlWidth /= 2; + lvlHeight /= 2; + } for (face = 0; face < 6; face++) { -- cgit v1.2.3 From 4d9901a1cab8e0d55b1b2309cf3ffec235e53149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 9 Mar 2007 09:43:17 +0100 Subject: r300: Also update window state when it's already bound but its stamp changed. And set new cliprects before deriving other state from them. This ensures cliprects aren't accessed after having been freed. Thanks to Panagiotis Papadakos for testing various iterations of this. --- src/mesa/drivers/dri/r300/radeon_context.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index d66f1dc49e..66d1b153b3 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -273,15 +273,15 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, &radeon->vbl_seq); } + radeon->dri.readable = driReadPriv; + if (radeon->dri.drawable != driDrawPriv || - radeon->dri.readable != driReadPriv) { + radeon->lastStamp != driDrawPriv->lastStamp) { radeon->dri.drawable = driDrawPriv; - radeon->dri.readable = driReadPriv; + radeonSetCliprects(radeon); r300UpdateWindow(radeon->glCtx); r300UpdateViewportOffset(radeon->glCtx); - - radeonSetCliprects(radeon); } _mesa_make_current(radeon->glCtx, -- cgit v1.2.3