diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 9d99372..5e25927 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -136,7 +136,7 @@ do_flush_locked(struct intel_batchbuffer *batch, int ret = 0; unsigned int num_cliprects = 0; struct drm_clip_rect *cliprects = NULL; - int x_off = 0, y_off = 0; + int x_off = 0, y_off = 0, width = 0, height = 0; if (batch->buffer) dri_bo_subdata (batch->buf, 0, used, batch->buffer); @@ -148,7 +148,8 @@ do_flush_locked(struct intel_batchbuffer *batch, if (batch->cliprect_mode == LOOP_CLIPRECTS) { - intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off); + intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off, + &width, &height); } /* Dispatch the batchbuffer, if it has some effect (nonzero cliprects). * Can't short-circuit like this once we have hardware contexts, but we diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index ab12aae..b6671d7 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -398,7 +398,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) GLbitfield skipBuffers = 0; unsigned int num_cliprects; struct drm_clip_rect *cliprects; - int x_off, y_off; + int x_off, y_off, draw_width, draw_height; BATCH_LOCALS; /* @@ -423,7 +423,8 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) intelFlush(&intel->ctx); LOCK_HARDWARE(intel); - intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off); + intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off, + &draw_width, &draw_height); if (num_cliprects) { GLint cx, cy, cw, ch; drm_clip_rect_t clear; diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index f8f009c..75e7979 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -127,7 +127,8 @@ void intel_get_cliprects(struct intel_context *intel, struct drm_clip_rect **cliprects, unsigned int *num_cliprects, - int *x_off, int *y_off) + int *x_off, int *y_off, + int *width, int *height) { __DRIdrawablePrivate *dPriv = intel->driDrawable; struct intel_framebuffer *intel_fb = dPriv->driverPrivate; @@ -143,6 +144,8 @@ intel_get_cliprects(struct intel_context *intel, *num_cliprects = 1; *x_off = 0; *y_off = 0; + *width = intel->ctx.DrawBuffer->Width; + *height = intel->ctx.DrawBuffer->Height; } else if (intel->front_cliprects || intel_fb->pf_active || dPriv->numBackClipRects == 0) { /* use the front clip rects */ @@ -150,6 +153,8 @@ intel_get_cliprects(struct intel_context *intel, *num_cliprects = dPriv->numClipRects; *x_off = dPriv->x; *y_off = dPriv->y; + *width = dPriv->w; + *height = dPriv->h; } else { /* use the back clip rects */ @@ -157,6 +162,8 @@ intel_get_cliprects(struct intel_context *intel, *cliprects = dPriv->pBackClipRects; *x_off = dPriv->backX; *y_off = dPriv->backY; + *width = dPriv->w; + *height = dPriv->h; } } diff --git a/src/mesa/drivers/dri/intel/intel_buffers.h b/src/mesa/drivers/dri/intel/intel_buffers.h index e5afb37..42cf6c1 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.h +++ b/src/mesa/drivers/dri/intel/intel_buffers.h @@ -58,6 +58,7 @@ extern void intelInitBufferFuncs(struct dd_function_table *functions); void intel_get_cliprects(struct intel_context *intel, struct drm_clip_rect **cliprects, unsigned int *num_cliprects, - int *x_off, int *y_off); + int *x_off, int *y_off, + int *width, int *height); #endif /* INTEL_BUFFERS_H */ diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 8f4e681..65d9cbd 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -259,10 +259,10 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, const GLint yBias = irb->RenderToTexture ? 0 : irb->Base.Height - 1; \ unsigned int num_cliprects; \ struct drm_clip_rect *cliprects; \ - int x_off, y_off; \ + int x_off, y_off, draw_width, draw_height; \ GLuint p; \ (void) p; \ - intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off); + intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off, &draw_width, &draw_height); /* XXX FBO: this is identical to the macro in spantmp2.h except we get * the cliprect info from the context, not the driDrawable. @@ -396,8 +396,8 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, const GLint yBias = irb->RenderToTexture ? 0 : irb->Base.Height - 1; \ unsigned int num_cliprects; \ struct drm_clip_rect *cliprects; \ - int x_off, y_off; \ - intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off); + int x_off, y_off, draw_width, draw_height; \ + intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off, &draw_width, &draw_height); #define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 0565197..6472a46 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -164,9 +164,13 @@ do_blit_bitmap( GLcontext *ctx, { struct intel_context *intel = intel_context(ctx); struct intel_region *dst = intel_drawbuf_region(intel); + struct gl_framebuffer *fb = ctx->DrawBuffer; GLfloat tmpColor[4]; GLubyte ubcolor[4]; GLuint color8888, color565; + unsigned int num_cliprects; + struct drm_clip_rect *cliprects; + int x_off, y_off, draw_width, draw_height; if (!dst) return GL_FALSE; @@ -196,18 +200,22 @@ do_blit_bitmap( GLcontext *ctx, LOCK_HARDWARE(intel); - if (intel->driDrawable->numClipRects) { - __DRIdrawablePrivate *dPriv = intel->driDrawable; - drm_clip_rect_t *box = dPriv->pClipRects; + intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off, + &draw_width, &draw_height); + if (num_cliprects) { + drm_clip_rect_t *box = cliprects; drm_clip_rect_t dest_rect; - GLint nbox = dPriv->numClipRects; + GLint nbox = num_cliprects; GLint srcx = 0, srcy = 0; GLint orig_screen_x1, orig_screen_y2; GLuint i; - orig_screen_x1 = dPriv->x + dstx; - orig_screen_y2 = dPriv->y + (dPriv->h - dsty); + orig_screen_x1 = x_off + dstx; + if (fb->Name) + orig_screen_y2 = y_off + dsty; + else + orig_screen_y2 = y_off + (draw_height - dsty); /* Do scissoring in GL coordinates: */ @@ -224,8 +232,11 @@ do_blit_bitmap( GLcontext *ctx, /* Convert from GL to hardware coordinates: */ - dsty = dPriv->y + (dPriv->h - dsty - height); - dstx = dPriv->x + dstx; + if (fb->Name) + dsty = y_off + dsty; + else + dsty = y_off + (draw_height - dsty - height); + dstx = x_off + dstx; dest_rect.x1 = dstx < 0 ? 0 : dstx; dest_rect.y1 = dsty < 0 ? 0 : dsty; @@ -270,13 +281,23 @@ 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, - bitmap, - srcx + px, srcy + py, w, h, - (GLubyte *)stipple, - 8, - GL_TRUE) == 0) - continue; + if (fb->Name) { + if (get_bitmap_rect(width, height, unpack, + bitmap, + srcx + px, srcy + py + h, w, h, + (GLubyte *)stipple, + 8, + GL_FALSE) == 0) + continue; + } else { + if (get_bitmap_rect(width, height, unpack, + bitmap, + srcx + px, srcy + py, w, h, + (GLubyte *)stipple, + 8, + GL_TRUE) == 0) + continue; + } /* */