summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c9
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_bitmap.c72
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_copy.c104
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_copy.c2
5 files changed, 105 insertions, 84 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index ab12aae6c7..2f1639d4a4 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -600,7 +600,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
intel_batchbuffer_require_space( intel->batch,
(8 * 4) +
(3 * 4) +
- dwords,
+ dwords * 4,
REFERENCES_CLIPRECTS );
opcode = XY_SETUP_BLT_CMD;
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index fce5e36b9d..7453b96dc5 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -620,7 +620,14 @@ intel_render_texture(GLcontext * ctx,
ASSERT(newImage);
- if (!irb) {
+ if (newImage->Border != 0) {
+ /* Fallback on drawing to a texture with a border, which won't have a
+ * miptree.
+ */
+ _mesa_reference_renderbuffer(&att->Renderbuffer, NULL);
+ _mesa_render_texture(ctx, fb, att);
+ return;
+ } else if (!irb) {
irb = intel_wrap_texture(ctx, newImage);
if (irb) {
/* bind the wrapper to the attachment point */
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 0565197ea0..e3ce1494e5 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;
+ drm_clip_rect_t *cliprects;
+ int x_off, y_off;
if (!dst)
return GL_FALSE;
@@ -196,49 +200,50 @@ 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);
+ if (num_cliprects != 0) {
drm_clip_rect_t dest_rect;
- GLint nbox = dPriv->numClipRects;
GLint srcx = 0, srcy = 0;
- GLint orig_screen_x1, orig_screen_y2;
GLuint i;
+ GLint orig_dstx = dstx;
+ GLint orig_dsty = dsty;
-
- orig_screen_x1 = dPriv->x + dstx;
- orig_screen_y2 = dPriv->y + (dPriv->h - dsty);
-
- /* Do scissoring in GL coordinates:
- */
- if (ctx->Scissor.Enabled)
- {
- GLint x = ctx->Scissor.X;
- GLint y = ctx->Scissor.Y;
- GLuint w = ctx->Scissor.Width;
- GLuint h = ctx->Scissor.Height;
-
- if (!_mesa_clip_to_region(x, y, x+w-1, y+h-1, &dstx, &dsty, &width, &height))
+ /* Clip to buffer bounds and scissor. */
+ if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
+ fb->_Xmax, fb->_Ymax,
+ &dstx, &dsty, &width, &height))
goto out;
- }
- /* Convert from GL to hardware coordinates:
+ /* 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.
*/
- dsty = dPriv->y + (dPriv->h - dsty - height);
- dstx = dPriv->x + dstx;
+ 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 < 0 ? 0 : dstx;
- dest_rect.y1 = dsty < 0 ? 0 : dsty;
- dest_rect.x2 = dstx + width < 0 ? 0 : dstx + width;
- dest_rect.y2 = dsty + height < 0 ? 0 : dsty + height;
+ dest_rect.x1 = dstx;
+ dest_rect.y1 = dsty;
+ dest_rect.x2 = dstx + width;
+ dest_rect.y2 = dsty + height;
- for (i = 0; i < nbox; i++) {
+ for (i = 0; i < num_cliprects; i++) {
drm_clip_rect_t rect;
int box_w, box_h;
GLint px, py;
GLuint stipple[32];
- if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i]))
+ if (!intel_intersect_cliprects(&rect, &dest_rect, &cliprects[i]))
continue;
/* Now go back to GL coordinates to figure out what subset of
@@ -246,9 +251,8 @@ do_blit_bitmap( GLcontext *ctx,
*/
box_w = rect.x2 - rect.x1;
box_h = rect.y2 - rect.y1;
- srcx = rect.x1 - orig_screen_x1;
- srcy = orig_screen_y2 - rect.y2;
-
+ srcx = rect.x1 - orig_dstx;
+ srcy = rect.y1 - orig_dsty;
#define DY 32
#define DX 32
@@ -275,7 +279,7 @@ do_blit_bitmap( GLcontext *ctx,
srcx + px, srcy + py, w, h,
(GLubyte *)stipple,
8,
- GL_TRUE) == 0)
+ fb->Name == 0 ? GL_TRUE : GL_FALSE) == 0)
continue;
/*
@@ -300,6 +304,8 @@ do_blit_bitmap( GLcontext *ctx,
out:
UNLOCK_HARDWARE(intel);
+ if (INTEL_DEBUG & DEBUG_SYNC)
+ intel_batchbuffer_flush(intel->batch);
if (unpack->BufferObj->Name) {
/* done with PBO so unmap it now */
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
index 1b3cb5adcb..61d1296c26 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
@@ -260,6 +260,11 @@ do_blit_copypixels(GLcontext * ctx,
struct intel_context *intel = intel_context(ctx);
struct intel_region *dst = intel_drawbuf_region(intel);
struct intel_region *src = copypix_src_region(intel, type);
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+ struct gl_framebuffer *read_fb = ctx->ReadBuffer;
+ unsigned int num_cliprects;
+ drm_clip_rect_t *cliprects;
+ int x_off, y_off;
/* Copypixels can be more than a straight copy. Ensure all the
* extra operations are disabled:
@@ -277,71 +282,74 @@ do_blit_copypixels(GLcontext * ctx,
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- __DRIdrawablePrivate *dReadPriv = intel->driReadDrawable;
- drm_clip_rect_t *box = dPriv->pClipRects;
- GLint nbox = dPriv->numClipRects;
- GLint delta_x = 0;
- GLint delta_y = 0;
+ intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
+ if (num_cliprects != 0) {
+ GLint delta_x;
+ GLint delta_y;
+ GLint orig_dstx;
+ GLint orig_dsty;
+ GLint orig_srcx;
+ GLint orig_srcy;
GLuint i;
- /* Do scissoring in GL coordinates:
- */
- if (ctx->Scissor.Enabled)
- {
- GLint x = ctx->Scissor.X;
- GLint y = ctx->Scissor.Y;
- GLuint w = ctx->Scissor.Width;
- GLuint h = ctx->Scissor.Height;
- GLint dx = dstx - srcx;
- GLint dy = dsty - srcy;
-
- if (!_mesa_clip_to_region(x, y, x+w-1, y+h-1, &dstx, &dsty, &width, &height))
- goto out;
-
- srcx = dstx - dx;
- srcy = dsty - dy;
- }
+ /* XXX: We fail to handle different inversion between read and draw framebuffer. */
+
+ /* Clip to destination buffer. */
+ orig_dstx = dstx;
+ orig_dsty = dsty;
+ if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
+ fb->_Xmax, fb->_Ymax,
+ &dstx, &dsty, &width, &height))
+ goto out;
+ /* Adjust src coords for our post-clipped destination origin */
+ srcx += dstx - orig_dstx;
+ srcy += dsty - orig_dsty;
+
+ /* 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,
+ &srcx, &srcy, &width, &height))
+ goto out;
+ /* Adjust dst coords for our post-clipped source origin */
+ dstx += srcx - orig_srcx;
+ dsty += srcy - orig_srcy;
/* Convert from GL to hardware coordinates:
*/
- dsty = dPriv->h - dsty - height;
- srcy = dPriv->h - srcy - height;
- dstx += dPriv->x;
- dsty += dPriv->y;
- srcx += dReadPriv->x;
- srcy += dReadPriv->y;
-
- /* Clip against the source region. This is the only source
- * clipping we do. Dst is clipped with cliprects below.
- */
- {
- delta_x = srcx - dstx;
- delta_y = srcy - dsty;
-
- if (!_mesa_clip_to_region(0, 0, src->pitch, src->height,
- &srcx, &srcy, &width, &height))
- goto out;
+ if (fb->Name == 0) {
+ /* copypixels to a system framebuffer */
+ dstx = x_off + dstx;
+ dsty = y_off + (fb->Height - dsty - height);
+ } else {
+ /* copypixels to a user framebuffer object */
+ dstx = x_off + dstx;
+ dsty = y_off + dsty;
+ }
- dstx = srcx - delta_x;
- dsty = srcy - delta_y;
+ /* Flip source Y if it's a system framebuffer. */
+ if (read_fb->Name == 0) {
+ srcx = intel->driReadDrawable->x + srcx;
+ srcy = intel->driReadDrawable->y + (fb->Height - srcy - height);
}
+ delta_x = srcx - dstx;
+ delta_y = srcy - dsty;
/* Could do slightly more clipping: Eg, take the intersection of
- * the existing set of cliprects and those cliprects translated
- * by delta_x, delta_y:
- *
+ * the destination cliprects and the read drawable cliprects
+ *
* This code will not overwrite other windows, but will
* introduce garbage when copying from obscured window regions.
*/
- for (i = 0; i < nbox; i++) {
+ for (i = 0; i < num_cliprects; i++) {
GLint clip_x = dstx;
GLint clip_y = dsty;
GLint clip_w = width;
GLint clip_h = height;
- if (!_mesa_clip_to_region(box[i].x1, box[i].y1, box[i].x2, box[i].y2,
+ if (!_mesa_clip_to_region(cliprects[i].x1, cliprects[i].y1,
+ cliprects[i].x2, cliprects[i].y2,
&clip_x, &clip_y, &clip_w, &clip_h))
continue;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index dd932aebc9..b893990d27 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -167,7 +167,7 @@ do_copy_texsubimage(struct intel_context *intel,
/* GL_SGIS_generate_mipmap */
if (intelImage->level == texObj->BaseLevel && texObj->GenerateMipmap) {
- intel_generate_mipmap(ctx, target, texObj);
+ ctx->Driver.GenerateMipmap(ctx, target, texObj);
}
return GL_TRUE;