From df73363ed1aa34cc0dc5feefb3933309591fa015 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Thu, 18 Dec 2008 10:07:45 +0800 Subject: i915: fix abort issue. (bug #19147) --- src/mesa/drivers/dri/i915/i830_vtbl.c | 15 +++++++++++++-- src/mesa/drivers/dri/i915/i915_vtbl.c | 13 +++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 3b3ff2bced..8fc8aa5f90 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -297,7 +297,7 @@ i830_emit_invarient_state(struct intel_context *intel) { BATCH_LOCALS; - BEGIN_BATCH(40, IGNORE_CLIPRECTS); + BEGIN_BATCH(30, IGNORE_CLIPRECTS); OUT_BATCH(_3DSTATE_DFLT_DIFFUSE_CMD); OUT_BATCH(0); @@ -491,8 +491,17 @@ i830_emit_state(struct intel_context *intel) } if (dirty & I830_UPLOAD_BUFFERS) { + GLuint count = 9; + DBG("I830_UPLOAD_BUFFERS:\n"); - BEGIN_BATCH(I830_DEST_SETUP_SIZE + 2, IGNORE_CLIPRECTS); + + if (state->depth_region) + count += 3; + + if (intel->constant_cliprect) + count += 6; + + BEGIN_BATCH(count, IGNORE_CLIPRECTS); OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR0]); OUT_BATCH(state->Buffer[I830_DESTREG_CBUFADDR1]); OUT_RELOC(state->draw_region->buffer, @@ -557,6 +566,8 @@ i830_emit_state(struct intel_context *intel) OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S4]); OUT_BATCH(state->Tex[i][I830_TEXREG_MCS]); OUT_BATCH(state->Tex[i][I830_TEXREG_CUBE]); + + ADVANCE_BATCH(); } if (dirty & I830_UPLOAD_TEXBLEND(i)) { diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index e79c955d64..3f6d282d34 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -173,7 +173,7 @@ i915_emit_invarient_state(struct intel_context *intel) { BATCH_LOCALS; - BEGIN_BATCH(200, IGNORE_CLIPRECTS); + BEGIN_BATCH(20, IGNORE_CLIPRECTS); OUT_BATCH(_3DSTATE_AA_CMD | AA_LINE_ECAAR_WIDTH_ENABLE | @@ -376,9 +376,18 @@ i915_emit_state(struct intel_context *intel) } if (dirty & I915_UPLOAD_BUFFERS) { + GLuint count = 9; + if (INTEL_DEBUG & DEBUG_STATE) fprintf(stderr, "I915_UPLOAD_BUFFERS:\n"); - BEGIN_BATCH(I915_DEST_SETUP_SIZE + 2, IGNORE_CLIPRECTS); + + if (state->depth_region) + count += 3; + + if (intel->constant_cliprect) + count += 6; + + BEGIN_BATCH(count, IGNORE_CLIPRECTS); OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR0]); OUT_BATCH(state->Buffer[I915_DESTREG_CBUFADDR1]); OUT_RELOC(state->draw_region->buffer, -- cgit v1.2.3 From cb453244caa15342bf229ee5ae16a78d038b8bdc Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Thu, 18 Dec 2008 12:57:41 +0800 Subject: i915: check WRAP_T instead of WRAP_R for cube map texture. --- src/mesa/drivers/dri/i915/i915_texstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index d53e2cbd5a..adbb52a3a3 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -300,7 +300,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) */ if (tObj->Target == GL_TEXTURE_CUBE_MAP_ARB && (((ws != GL_CLAMP) && (ws != GL_CLAMP_TO_EDGE)) || - ((wr != GL_CLAMP) && (wr != GL_CLAMP_TO_EDGE)))) + ((wt != GL_CLAMP) && (wt != GL_CLAMP_TO_EDGE)))) return GL_FALSE; state[I915_TEXREG_SS3] = ss3; /* SS3_NORMALIZED_COORDS */ -- cgit v1.2.3 From 1e7785fe0721f66ca9523da0dc338d26256736bb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 18 Dec 2008 18:42:06 -0800 Subject: intel: Move copyteximage source clipping out of copytexsubimage. glCopyTexSubImage already gets the (correct) clipping for us, so it doesn't need the path. While moving the clipping out, replace the code with the mesa path to do the same job. --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 109 ++++++++++++++++------------ 1 file changed, 61 insertions(+), 48 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index b893990d27..08437aa0e2 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -112,56 +112,47 @@ do_copy_texsubimage(struct intel_context *intel, intelImage->level); const GLint orig_x = x; const GLint orig_y = y; - const struct gl_framebuffer *fb = ctx->DrawBuffer; - - if (_mesa_clip_to_region(fb->_Xmin, fb->_Ymin, fb->_Xmax, fb->_Ymax, - &x, &y, &width, &height)) { - GLshort src_pitch; - - /* Update dst for clipped src. Need to also clip the source rect. - */ - dstx += x - orig_x; - dsty += y - orig_y; - - /* image_offset may be non-page-aligned, but that's illegal for tiling. + GLshort src_pitch; + + /* Update dst for clipped src. Need to also clip the source rect. */ + dstx += x - orig_x; + dsty += y - orig_y; + + /* image_offset may be non-page-aligned, but that's illegal for tiling. */ + assert(intelImage->mt->region->tiling == I915_TILING_NONE); + + if (ctx->ReadBuffer->Name == 0) { + /* reading from a window, adjust x, y */ + __DRIdrawablePrivate *dPriv = intel->driDrawable; + y = dPriv->y + (dPriv->h - (y + height)); + x += dPriv->x; + + /* Invert the data coming from the source rectangle due to GL + * and hardware disagreeing on where y=0 is. + * + * It appears that our offsets and pitches get mangled + * appropriately by the hardware, and we don't need to adjust them + * on our own. */ - assert(intelImage->mt->region->tiling == I915_TILING_NONE); - - if (ctx->ReadBuffer->Name == 0) { - /* reading from a window, adjust x, y */ - __DRIdrawablePrivate *dPriv = intel->driDrawable; - y = dPriv->y + (dPriv->h - (y + height)); - x += dPriv->x; - - /* Invert the data coming from the source rectangle due to GL - * and hardware disagreeing on where y=0 is. - * - * It appears that our offsets and pitches get mangled - * appropriately by the hardware, and we don't need to adjust them - * on our own. - */ - src_pitch = -src->pitch; - } - else { - /* reading from a FBO, y is already oriented the way we like */ - src_pitch = src->pitch; - } - - intelEmitCopyBlit(intel, - intelImage->mt->cpp, - src_pitch, - src->buffer, - 0, - src->tiling, - intelImage->mt->pitch, - intelImage->mt->region->buffer, - image_offset, - intelImage->mt->region->tiling, - x, y, dstx, dsty, width, height, - GL_COPY); + src_pitch = -src->pitch; + } else { + /* reading from a FBO, y is already oriented the way we like */ + src_pitch = src->pitch; } - } + intelEmitCopyBlit(intel, + intelImage->mt->cpp, + src_pitch, + src->buffer, + 0, + src->tiling, + intelImage->mt->pitch, + intelImage->mt->region->buffer, + image_offset, + intelImage->mt->region->tiling, + x, y, dstx, dsty, width, height, + GL_COPY); + } UNLOCK_HARDWARE(intel); @@ -188,6 +179,7 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, _mesa_select_tex_object(ctx, texUnit, target); struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texObj, target, level); + int srcx, srcy, dstx, dsty, height; if (border) goto fail; @@ -199,10 +191,20 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, width, border, GL_RGBA, CHAN_TYPE, NULL, &ctx->DefaultPacking, texObj, texImage); + srcx = x; + srcy = y; + dstx = 0; + dsty = 0; + height = 1; + if (!_mesa_clip_copytexsubimage(ctx, + &dstx, &dsty, + &srcx, &srcy, + &width, &height)) + return; if (!do_copy_texsubimage(intel_context(ctx), target, intel_texture_image(texImage), - internalFormat, 0, 0, x, y, width, 1)) + internalFormat, 0, 0, x, y, width, height)) goto fail; return; @@ -224,10 +226,21 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, _mesa_select_tex_object(ctx, texUnit, target); struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texObj, target, level); + int srcx, srcy, dstx, dsty; if (border) goto fail; + srcx = x; + srcy = y; + dstx = 0; + dsty = 0; + if (!_mesa_clip_copytexsubimage(ctx, + &dstx, &dsty, + &srcx, &srcy, + &width, &height)) + return; + /* Setup or redefine the texture object, mipmap tree and texture * image. Don't populate yet. */ -- cgit v1.2.3 From d091ebd4e41c88fe53db9d52842aaa20d23b995d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 17 Dec 2008 21:18:00 -0800 Subject: intel: don't clip to scissor-clipped read framebuffer bounds in copypixels. --- src/mesa/drivers/dri/intel/intel_pixel_copy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index 61d1296c26..1505af2286 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -308,8 +308,8 @@ do_blit_copypixels(GLcontext * ctx, /* Clip to source buffer. */ orig_srcx = srcx; orig_srcy = srcy; - if (!_mesa_clip_to_region(read_fb->_Xmin, read_fb->_Ymin, - read_fb->_Xmax, read_fb->_Ymax, + if (!_mesa_clip_to_region(0, 0, + read_fb->Width, read_fb->Height, &srcx, &srcy, &width, &height)) goto out; /* Adjust dst coords for our post-clipped source origin */ -- cgit v1.2.3 From b9752a2bd615d136369af63ed3d45cc10adf21e7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 17 Dec 2008 21:18:20 -0800 Subject: intel: Update mesa state in blit operations that want post-scissor draw bounds. --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 4 ++++ src/mesa/drivers/dri/intel/intel_pixel_copy.c | 3 +++ 2 files changed, 7 insertions(+) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index e3ce1494e5..fd2ea7989e 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -32,6 +32,7 @@ #include "main/mtypes.h" #include "main/macros.h" #include "main/bufferobj.h" +#include "main/state.h" #include "swrast/swrast.h" #include "intel_screen.h" @@ -172,6 +173,9 @@ do_blit_bitmap( GLcontext *ctx, drm_clip_rect_t *cliprects; int x_off, y_off; + /* Update draw buffer bounds */ + _mesa_update_state(ctx); + if (!dst) return GL_FALSE; diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index 1505af2286..447c6494e7 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -266,6 +266,9 @@ do_blit_copypixels(GLcontext * ctx, drm_clip_rect_t *cliprects; int x_off, y_off; + /* Update draw buffer bounds */ + _mesa_update_state(ctx); + /* Copypixels can be more than a straight copy. Ensure all the * extra operations are disabled: */ -- cgit v1.2.3 From e67350da34c6009edff50c160df27493cb363e1b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 17 Dec 2008 22:10:57 -0800 Subject: intel: Don't forget the source bitmap size when clipping the size we draw. --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index fd2ea7989e..f6713dbc7b 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -172,6 +172,8 @@ do_blit_bitmap( GLcontext *ctx, unsigned int num_cliprects; drm_clip_rect_t *cliprects; int x_off, y_off; + GLsizei bitmap_width = width; + GLsizei bitmap_height = height; /* Update draw buffer bounds */ _mesa_update_state(ctx); @@ -278,7 +280,7 @@ do_blit_bitmap( GLcontext *ctx, /* May need to adjust this when padding has been introduced in * sz above: */ - if (get_bitmap_rect(width, height, unpack, + if (get_bitmap_rect(bitmap_width, bitmap_height, unpack, bitmap, srcx + px, srcy + py, w, h, (GLubyte *)stipple, -- cgit v1.2.3 From 1db63713046efd49071aae448105df8a80e1e83d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 18 Dec 2008 16:00:09 -0800 Subject: intel: Fix glBitmap top/bottom clipping. Bug #19139. --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 75 ++++++++++++------------- 1 file changed, 35 insertions(+), 40 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index f6713dbc7b..fb1a051cdc 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -150,8 +150,18 @@ static GLuint get_bitmap_rect(GLsizei width, GLsizei height, return count; } - - +/** + * Returns the low Y value of the vertical range given, flipped according to + * whether the framebuffer is or not. + */ +static inline int +y_flip(struct gl_framebuffer *fb, int y, int height) +{ + if (fb->Name != 0) + return y; + else + return fb->Height - y - height; +} /* * Render a bitmap. @@ -208,8 +218,6 @@ do_blit_bitmap( GLcontext *ctx, intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off); if (num_cliprects != 0) { - drm_clip_rect_t dest_rect; - GLint srcx = 0, srcy = 0; GLuint i; GLint orig_dstx = dstx; GLint orig_dsty = dsty; @@ -220,45 +228,26 @@ do_blit_bitmap( GLcontext *ctx, &dstx, &dsty, &width, &height)) goto out; - /* Convert from GL to hardware coordinates. Transform original points - * along with it so that we can look at cliprects in hw coordinates and - * map back to points in the source space. - */ - if (fb->Name == 0) { - /* bitmap to a system framebuffer */ - dstx = x_off + dstx; - dsty = y_off + (fb->Height - dsty - height); - orig_dstx = x_off + orig_dstx; - orig_dsty = y_off + (fb->Height - orig_dsty - height); - } else { - /* bitmap to a user framebuffer object */ - dstx = x_off + dstx; - dsty = y_off + dsty; - orig_dstx = x_off + orig_dstx; - orig_dsty = y_off + orig_dsty; - } - - dest_rect.x1 = dstx; - dest_rect.y1 = dsty; - dest_rect.x2 = dstx + width; - dest_rect.y2 = dsty + height; + dstx = x_off + dstx; + dsty = y_off + y_flip(fb, dsty, height); for (i = 0; i < num_cliprects; i++) { - drm_clip_rect_t rect; - int box_w, box_h; + int box_x, box_y, box_w, box_h; GLint px, py; GLuint stipple[32]; - if (!intel_intersect_cliprects(&rect, &dest_rect, &cliprects[i])) - continue; + box_x = dstx; + box_y = dsty; + box_w = width; + box_h = height; - /* Now go back to GL coordinates to figure out what subset of - * the bitmap we are uploading for this cliprect: - */ - box_w = rect.x2 - rect.x1; - box_h = rect.y2 - rect.y1; - srcx = rect.x1 - orig_dstx; - srcy = rect.y1 - orig_dsty; + /* Clip to drawable cliprect */ + if (!_mesa_clip_to_region(cliprects[i].x1, + cliprects[i].y1, + cliprects[i].x2 - cliprects[i].x1, + cliprects[i].y2 - cliprects[i].y1, + &box_x, &box_y, &box_w, &box_h)) + continue; #define DY 32 #define DX 32 @@ -279,10 +268,16 @@ do_blit_bitmap( GLcontext *ctx, /* May need to adjust this when padding has been introduced in * sz above: + * + * Have to translate destination coordinates back into source + * coordinates. */ if (get_bitmap_rect(bitmap_width, bitmap_height, unpack, bitmap, - srcx + px, srcy + py, w, h, + -orig_dstx + (box_x + px - x_off), + -orig_dsty + y_flip(fb, + box_y + py - y_off, h), + w, h, (GLubyte *)stipple, 8, fb->Name == 0 ? GL_TRUE : GL_FALSE) == 0) @@ -299,8 +294,8 @@ do_blit_bitmap( GLcontext *ctx, dst->buffer, 0, dst->tiling, - rect.x1 + px, - rect.y2 - (py + h), + box_x + px, + box_y + py, w, h, logic_op); } -- cgit v1.2.3 From 7e04272690e8d9deecc0bf71c37bfa4c321ae6ab Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 18 Dec 2008 14:13:26 -0800 Subject: 965 / GLSL: Use full precision for EXP instruction The partial precision mode doesn't have quite enough bits of precision to pass conformance tests. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 25b4ee85cb..4a9541378f 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -420,7 +420,7 @@ static void emit_exp_noalias( struct brw_vs_compile *c, BRW_MATH_FUNCTION_EXP, brw_writemask(dst, WRITEMASK_Z), brw_swizzle1(arg0, 0), - BRW_MATH_PRECISION_PARTIAL); + BRW_MATH_PRECISION_FULL); } if (dst.dw1.bits.writemask & WRITEMASK_W) { -- cgit v1.2.3