mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-21 19:30:38 +01:00
blend, logicop changes for intelEmitCopyBlit backported to i915
This commit is contained in:
parent
b1c102d37b
commit
f332da515c
9 changed files with 68 additions and 25 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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__);
|
||||
|
|
|
|||
|
|
@ -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__);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue