summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2006-11-21 14:43:30 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2006-11-21 14:43:30 +0000
commitf332da515cdb8cacc3fdba8a74267d015b7c08be (patch)
tree1c453c2d58ee71b87785109f91ed59c2e6de321d /src
parentb1c102d37bb3c273a2623358cb8ebff00bdfb65e (diff)
blend, logicop changes for intelEmitCopyBlit backported to i915
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_blit.c35
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_blit.h3
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel.c5
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_copy.c11
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_draw.c14
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_read.c8
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_regions.c11
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_tex_copy.c3
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_tex_image.c3
9 files changed, 68 insertions, 25 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c
index b6b6543908..550669ab0c 100644
--- a/src/mesa/drivers/dri/i915tex/intel_blit.c
+++ b/src/mesa/drivers/dri/i915tex/intel_blit.c
@@ -277,6 +277,30 @@ intelEmitFillBlit(struct intel_context *intel,
}
+static GLuint translate_raster_op(GLenum logicop)
+{
+ switch(logicop) {
+ case GL_CLEAR: return 0x00;
+ case GL_AND: return 0x88;
+ case GL_AND_REVERSE: return 0x44;
+ case GL_COPY: return 0xCC;
+ case GL_AND_INVERTED: return 0x22;
+ case GL_NOOP: return 0xAA;
+ case GL_XOR: return 0x66;
+ case GL_OR: return 0xEE;
+ case GL_NOR: return 0x11;
+ case GL_EQUIV: return 0x99;
+ case GL_INVERT: return 0x55;
+ case GL_OR_REVERSE: return 0xDD;
+ case GL_COPY_INVERTED: return 0x33;
+ case GL_OR_INVERTED: return 0xBB;
+ case GL_NAND: return 0x77;
+ case GL_SET: return 0xFF;
+ default: return 0;
+ }
+}
+
+
/* Copy BitBlt
*/
void
@@ -289,7 +313,9 @@ intelEmitCopyBlit(struct intel_context *intel,
struct _DriBufferObject *dst_buffer,
GLuint dst_offset,
GLshort src_x, GLshort src_y,
- GLshort dst_x, GLshort dst_y, GLshort w, GLshort h)
+ GLshort dst_x, GLshort dst_y,
+ GLshort w, GLshort h,
+ GLenum logic_op)
{
GLuint CMD, BR13;
int dst_y2 = dst_y + h;
@@ -309,13 +335,14 @@ intelEmitCopyBlit(struct intel_context *intel,
case 1:
case 2:
case 3:
- BR13 = (((GLint) dst_pitch) & 0xffff) | (0xCC << 16) | (1 << 24);
+ BR13 = (((GLint) dst_pitch) & 0xffff) |
+ (translate_raster_op(logic_op) << 16) | (1 << 24);
CMD = XY_SRC_COPY_BLT_CMD;
break;
case 4:
BR13 =
- (((GLint) dst_pitch) & 0xffff) | (0xCC << 16) | (1 << 24) | (1 <<
- 25);
+ (((GLint) dst_pitch) & 0xffff) |
+ (translate_raster_op(logic_op) << 16) | (1 << 24) | (1 << 25);
CMD =
(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
XY_SRC_COPY_BLT_WRITE_RGB);
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.h b/src/mesa/drivers/dri/i915tex/intel_blit.h
index ee85c62633..e7bc280f58 100644
--- a/src/mesa/drivers/dri/i915tex/intel_blit.h
+++ b/src/mesa/drivers/dri/i915tex/intel_blit.h
@@ -47,7 +47,8 @@ extern void intelEmitCopyBlit(struct intel_context *intel,
GLuint dst_offset,
GLshort srcx, GLshort srcy,
GLshort dstx, GLshort dsty,
- GLshort w, GLshort h);
+ GLshort w, GLshort h,
+ GLenum logicop );
extern void intelEmitFillBlit(struct intel_context *intel,
GLuint cpp,
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel.c b/src/mesa/drivers/dri/i915tex/intel_pixel.c
index 4fe128deea..9018e3daef 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel.c
@@ -56,8 +56,9 @@ intel_check_blit_fragment_ops(GLcontext * ctx)
!ctx->Color.ColorMask[1] ||
!ctx->Color.ColorMask[2] ||
!ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits || ctx->FragmentProgram._Enabled);
+ ctx->Texture._EnabledUnits ||
+ ctx->FragmentProgram._Enabled ||
+ ctx->Color.BlendEnabled);
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c b/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
index 5eb021f008..9d478283e4 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
@@ -95,9 +95,9 @@ intel_check_copypixel_blit_fragment_ops(GLcontext * ctx)
!ctx->Color.ColorMask[1] ||
!ctx->Color.ColorMask[2] ||
!ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
ctx->Texture._EnabledUnits ||
- ctx->FragmentProgram._Enabled);
+ ctx->FragmentProgram._Enabled ||
+ ctx->Color.BlendEnabled);
}
/* Doesn't work for overlapping regions. Could do a double copy or
@@ -344,9 +344,12 @@ do_blit_copypixels(GLcontext * ctx,
intelEmitCopyBlit(intel, dst->cpp,
src->pitch, src->buffer, 0,
dst->pitch, dst->buffer, 0,
- rect.x1 + delta_x, rect.y1 + delta_y, /* srcx, srcy */
+ rect.x1 + delta_x,
+ rect.y1 + delta_y, /* srcx, srcy */
rect.x1, rect.y1, /* dstx, dsty */
- rect.x2 - rect.x1, rect.y2 - rect.y1);
+ rect.x2 - rect.x1, rect.y2 - rect.y1,
+ ctx->Color.ColorLogicOpEnabled ?
+ ctx->Color.LogicOp : GL_COPY);
}
out:
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
index 616101aef9..10a079896a 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
@@ -252,9 +252,9 @@ do_blit_drawpixels(GLcontext * ctx,
return GL_FALSE;
}
- if (!intel_check_meta_tex_fragment_ops(ctx)) {
+ if (!intel_check_blit_fragment_ops(ctx)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - bad GL fragment state for meta tex\n",
+ _mesa_printf("%s - bad GL fragment state for blitter\n",
__FUNCTION__);
return GL_FALSE;
}
@@ -320,17 +320,19 @@ do_blit_drawpixels(GLcontext * ctx,
rect.x1 - dest_rect.x1,
rect.y2 - dest_rect.y2,
rect.x1,
- rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1);
+ rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1,
+ ctx->Color.ColorLogicOpEnabled ?
+ ctx->Color.LogicOp : GL_COPY);
}
fence = intel_batchbuffer_flush(intel->batch);
driFenceReference(fence);
}
UNLOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects)
+ if (fence) {
driFenceFinish(fence, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW, GL_FALSE);
-
- driFenceUnReference(fence);
+ driFenceUnReference(fence);
+ }
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - DONE\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_read.c b/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
index c1cc65674d..24e49ae066 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
@@ -271,7 +271,8 @@ do_blit_readpixels(GLcontext * ctx,
rect.y1,
rect.x1 - src_rect.x1,
rect.y2 - src_rect.y2,
- rect.x2 - rect.x1, rect.y2 - rect.y1);
+ rect.x2 - rect.x1, rect.y2 - rect.y1,
+ GL_COPY);
}
fence = intel_batchbuffer_flush(intel->batch);
@@ -280,11 +281,12 @@ do_blit_readpixels(GLcontext * ctx,
}
UNLOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects)
+ if (fence) {
driFenceFinish(fence, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
GL_FALSE);
+ driFenceUnReference(fence);
+ }
- driFenceUnReference(fence);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - DONE\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/i915tex/intel_regions.c b/src/mesa/drivers/dri/i915tex/intel_regions.c
index 064a34cda8..1205b180ca 100644
--- a/src/mesa/drivers/dri/i915tex/intel_regions.c
+++ b/src/mesa/drivers/dri/i915tex/intel_regions.c
@@ -318,7 +318,8 @@ intel_region_copy(intelScreenPrivate *intelScreen,
dst->cpp,
src->pitch, src->buffer, src_offset,
dst->pitch, dst->buffer, dst_offset,
- srcx, srcy, dstx, dsty, width, height);
+ srcx, srcy, dstx, dsty, width, height,
+ GL_COPY);
}
/* Fill a rectangular sub-region. Need better logic about when to
@@ -433,7 +434,9 @@ intel_region_cow(intelScreenPrivate *intelScreen, struct intel_region *region)
region->buffer, 0,
region->pitch,
pbo->buffer, 0,
- 0, 0, 0, 0, region->pitch, region->height);
+ 0, 0, 0, 0,
+ region->pitch, region->height,
+ GL_COPY);
intel_batchbuffer_flush(intel->batch);
UNLOCK_HARDWARE(intel);
@@ -445,7 +448,9 @@ intel_region_cow(intelScreenPrivate *intelScreen, struct intel_region *region)
region->buffer, 0,
region->pitch,
pbo->buffer, 0,
- 0, 0, 0, 0, region->pitch, region->height);
+ 0, 0, 0, 0,
+ region->pitch, region->height,
+ GL_COPY);
intel_batchbuffer_flush(intel->batch);
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_tex_copy.c b/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
index 88b62e781c..b85a25642a 100644
--- a/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
@@ -145,7 +145,8 @@ do_copy_texsubimage(struct intel_context *intel,
intelImage->mt->pitch,
intelImage->mt->region->buffer,
image_offset,
- x, y + height, dstx, dsty, width, height);
+ x, y + height, dstx, dsty, width, height,
+ GL_COPY); /* ? */
intel_batchbuffer_flush(intel->batch);
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_tex_image.c b/src/mesa/drivers/dri/i915tex/intel_tex_image.c
index 79f377a4b7..22221e7322 100644
--- a/src/mesa/drivers/dri/i915tex/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i915tex/intel_tex_image.c
@@ -232,7 +232,8 @@ try_pbo_upload(struct intel_context *intel,
intelImage->mt->cpp,
src_stride, src_buffer, src_offset,
dst_stride, dst_buffer, dst_offset,
- 0, 0, 0, 0, width, height);
+ 0, 0, 0, 0, width, height,
+ GL_COPY);
intel_batchbuffer_flush(intel->batch);
}