summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.c35
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.h6
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_read.c40
4 files changed, 19 insertions, 64 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index 45464e45d2..f12a1c6fd3 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -102,7 +102,7 @@ intelEmitCopyBlit(struct intel_context *intel,
return GL_FALSE;
}
- /* do space/cliprects check before going any further */
+ /* do space check before going any further */
do {
aper_array[0] = intel->batch->buf;
aper_array[1] = dst_buffer;
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index 9171bab63a..5bf0bdb963 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -31,41 +31,6 @@
#include "intel_batchbuffer.h"
#include "main/framebuffer.h"
-
-/**
- * XXX move this into a new dri/common/cliprects.c file.
- */
-GLboolean
-intel_intersect_cliprects(drm_clip_rect_t * dst,
- const drm_clip_rect_t * a,
- const drm_clip_rect_t * b)
-{
- GLint bx = b->x1;
- GLint by = b->y1;
- GLint bw = b->x2 - bx;
- GLint bh = b->y2 - by;
-
- if (bx < a->x1)
- bw -= a->x1 - bx, bx = a->x1;
- if (by < a->y1)
- bh -= a->y1 - by, by = a->y1;
- if (bx + bw > a->x2)
- bw = a->x2 - bx;
- if (by + bh > a->y2)
- bh = a->y2 - by;
- if (bw <= 0)
- return GL_FALSE;
- if (bh <= 0)
- return GL_FALSE;
-
- dst->x1 = bx;
- dst->y1 = by;
- dst->x2 = bx + bw;
- dst->y2 = by + bh;
-
- return GL_TRUE;
-}
-
/**
* Return pointer to current color drawing region, or NULL.
*/
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.h b/src/mesa/drivers/dri/intel/intel_buffers.h
index d7800f2ca2..abb86aade6 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.h
+++ b/src/mesa/drivers/dri/intel/intel_buffers.h
@@ -35,12 +35,6 @@
struct intel_context;
struct intel_framebuffer;
-
-extern GLboolean
-intel_intersect_cliprects(drm_clip_rect_t * dest,
- const drm_clip_rect_t * a,
- const drm_clip_rect_t * b);
-
extern struct intel_region *intel_readbuf_region(struct intel_context *intel);
extern struct intel_region *intel_drawbuf_region(struct intel_context *intel);
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c
index a60db52664..80a2b9740f 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c
@@ -169,7 +169,8 @@ do_blit_readpixels(GLcontext * ctx,
GLuint dst_offset;
GLuint rowLength;
drm_intel_bo *dst_buffer;
- drm_clip_rect_t read_bounds, rect, src_rect;
+ GLboolean all;
+ GLint dst_x, dst_y;
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s\n", __FUNCTION__);
@@ -217,38 +218,33 @@ do_blit_readpixels(GLcontext * ctx,
dst_offset = (GLintptr) _mesa_image_address(2, pack, pixels, width, height,
format, type, 0, 0, 0);
- GLboolean all = (width * height * src->cpp == dst->Base.Size &&
- x == 0 && dst_offset == 0);
+ if (!_mesa_clip_copytexsubimage(ctx,
+ &dst_x, &dst_y,
+ &x, &y,
+ &width, &height)) {
+ return GL_TRUE;
+ }
+
+ all = (width * height * src->cpp == dst->Base.Size &&
+ x == 0 && dst_offset == 0);
+
+ dst_x = 0;
+ dst_y = 0;
dst_buffer = intel_bufferobj_buffer(intel, dst,
all ? INTEL_WRITE_FULL :
INTEL_WRITE_PART);
- src_rect.x1 = x;
if (ctx->ReadBuffer->Name == 0)
- src_rect.y1 = ctx->ReadBuffer->Height - (y + height);
- else
- src_rect.y1 = y;
- src_rect.x2 = src_rect.x1 + width;
- src_rect.y2 = src_rect.y1 + height;
-
- read_bounds.x1 = 0;
- read_bounds.y1 = 0;
- read_bounds.x2 = ctx->ReadBuffer->Width;
- read_bounds.y2 = ctx->ReadBuffer->Height;
-
- if (!intel_intersect_cliprects(&rect, &src_rect, &read_bounds))
- return GL_TRUE;
+ y = ctx->ReadBuffer->Height - (y + height);
if (!intelEmitCopyBlit(intel,
src->cpp,
src->pitch, src->buffer, 0, src->tiling,
rowLength, dst_buffer, dst_offset, GL_FALSE,
- rect.x1,
- rect.y1,
- rect.x1 - src_rect.x1,
- rect.y2 - src_rect.y2,
- rect.x2 - rect.x1, rect.y2 - rect.y1,
+ x, y,
+ dst_x, dst_y,
+ width, height,
GL_COPY)) {
return GL_FALSE;
}