i965: Use enum color_logic_ops for blits

v2: sed --in-place -e 's/color_logic_ops/gl_logicop_mode/g' $(grep -lr
color_logic_ops src/) suggested by Brian.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> [v1]
This commit is contained in:
Ian Romanick 2018-01-03 12:03:58 -08:00
parent 0aaa27f291
commit 21be331401
8 changed files with 20 additions and 37 deletions

View File

@ -44,27 +44,9 @@ intel_miptree_set_alpha_to_one(struct brw_context *brw,
struct intel_mipmap_tree *mt,
int x, int y, int width, int height);
static GLuint translate_raster_op(GLenum logicop)
static GLuint translate_raster_op(enum gl_logicop_mode 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;
}
return logicop | (logicop << 4);
}
static uint32_t
@ -227,7 +209,7 @@ emit_miptree_blit(struct brw_context *brw,
struct intel_mipmap_tree *dst_mt,
uint32_t dst_x, uint32_t dst_y,
uint32_t width, uint32_t height,
bool reverse, GLenum logicop)
bool reverse, enum gl_logicop_mode logicop)
{
/* According to the Ivy Bridge PRM, Vol1 Part4, section 1.2.1.2 (Graphics
* Data Size Limitations):
@ -319,7 +301,7 @@ intel_miptree_blit(struct brw_context *brw,
int dst_level, int dst_slice,
uint32_t dst_x, uint32_t dst_y, bool dst_flip,
uint32_t width, uint32_t height,
GLenum logicop)
enum gl_logicop_mode logicop)
{
/* The blitter doesn't understand multisampling at all. */
if (src_mt->surf.samples > 1 || dst_mt->surf.samples > 1)
@ -463,7 +445,7 @@ intel_miptree_copy(struct brw_context *brw,
return emit_miptree_blit(brw, src_mt, src_x, src_y,
dst_mt, dst_x, dst_y,
src_width, src_height, false, GL_COPY);
src_width, src_height, false, COLOR_LOGICOP_COPY);
}
static bool
@ -527,7 +509,7 @@ intelEmitCopyBlit(struct brw_context *brw,
GLshort src_x, GLshort src_y,
GLshort dst_x, GLshort dst_y,
GLshort w, GLshort h,
GLenum logic_op)
enum gl_logicop_mode logic_op)
{
const struct gen_device_info *devinfo = &brw->screen->devinfo;
GLuint CMD, BR13;
@ -654,7 +636,7 @@ intelEmitImmediateColorExpandBlit(struct brw_context *brw,
enum isl_tiling dst_tiling,
GLshort x, GLshort y,
GLshort w, GLshort h,
GLenum logic_op)
enum gl_logicop_mode logic_op)
{
const struct gen_device_info *devinfo = &brw->screen->devinfo;
int dwords = ALIGN(src_size, 8) / 4;
@ -667,7 +649,7 @@ intelEmitImmediateColorExpandBlit(struct brw_context *brw,
return false;
}
assert((logic_op >= GL_CLEAR) && (logic_op <= (GL_CLEAR + 0x0f)));
assert((unsigned) logic_op <= 0x0f);
assert(dst_pitch > 0);
if (w < 0 || h < 0)
@ -763,7 +745,7 @@ intel_emit_linear_blit(struct brw_context *brw,
src_x, 0, /* src x/y */
dst_x, 0, /* dst x/y */
MIN2(size, pitch), height, /* w, h */
GL_COPY);
COLOR_LOGICOP_COPY);
if (!ok) {
_mesa_problem(ctx, "Failed to linear blit %dx%d\n",
MIN2(size, pitch), height);

View File

@ -42,7 +42,7 @@ intelEmitCopyBlit(struct brw_context *brw,
GLshort srcx, GLshort srcy,
GLshort dstx, GLshort dsty,
GLshort w, GLshort h,
GLenum logicop);
enum gl_logicop_mode logicop);
bool intel_miptree_blit_compatible_formats(mesa_format src, mesa_format dst);
@ -54,7 +54,7 @@ bool intel_miptree_blit(struct brw_context *brw,
int dst_level, int dst_slice,
uint32_t dst_x, uint32_t dst_y, bool dst_flip,
uint32_t width, uint32_t height,
GLenum logicop);
enum gl_logicop_mode logicop);
bool intel_miptree_copy(struct brw_context *brw,
struct intel_mipmap_tree *src_mt,
@ -76,7 +76,7 @@ intelEmitImmediateColorExpandBlit(struct brw_context *brw,
enum isl_tiling dst_tiling,
GLshort x, GLshort y,
GLshort w, GLshort h,
GLenum logic_op);
enum gl_logicop_mode logic_op);
void intel_emit_linear_blit(struct brw_context *brw,
struct brw_bo *dst_bo,
unsigned int dst_offset,

View File

@ -849,7 +849,8 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
dst_irb->mt,
dst_irb->mt_level, dst_irb->mt_layer,
dstX0, dstY0, dst_rb->Name == 0,
dstX1 - dstX0, dstY1 - dstY0, GL_COPY)) {
dstX1 - dstX0, dstY1 - dstY0,
COLOR_LOGICOP_COPY)) {
perf_debug("glBlitFramebuffer(): unknown blit failure. "
"Falling back to software rendering.\n");
return mask;

View File

@ -1584,7 +1584,7 @@ intel_miptree_copy_slice(struct brw_context *brw,
if (!intel_miptree_blit(brw,
src_mt, src_level, src_layer, 0, 0, false,
dst_mt, dst_level, dst_layer, 0, 0, false,
width, height, GL_COPY)) {
width, height, COLOR_LOGICOP_COPY)) {
perf_debug("miptree validate blit for %s failed\n",
_mesa_get_format_name(format));

View File

@ -264,8 +264,8 @@ do_blit_bitmap( struct gl_context *ctx,
int h = MIN2(DY, height - py);
int w = MIN2(DX, width - px);
GLuint sz = ALIGN(ALIGN(w,8) * h, 64)/8;
GLenum logic_op = ctx->Color.ColorLogicOpEnabled ?
ctx->Color.LogicOp : GL_COPY;
const enum gl_logicop_mode logic_op = ctx->Color.ColorLogicOpEnabled ?
ctx->Color._LogicOp : COLOR_LOGICOP_COPY;
assert(sz <= sizeof(stipple));
memset(stipple, 0, sz);

View File

@ -178,7 +178,7 @@ do_blit_copypixels(struct gl_context * ctx,
dstx, dsty, _mesa_is_winsys_fbo(fb),
width, height,
(ctx->Color.ColorLogicOpEnabled ?
ctx->Color.LogicOp : GL_COPY))) {
ctx->Color._LogicOp : COLOR_LOGICOP_COPY))) {
DBG("%s: blit failure\n", __func__);
return false;
}

View File

@ -128,7 +128,7 @@ do_blit_drawpixels(struct gl_context * ctx,
0, 0, src_flip,
irb->mt, irb->mt_level, irb->mt_layer,
x, y, _mesa_is_winsys_fbo(ctx->DrawBuffer),
width, height, GL_COPY)) {
width, height, COLOR_LOGICOP_COPY)) {
DBG("%s: blit failed\n", __func__);
intel_miptree_release(&pbo_mt);
return false;

View File

@ -88,7 +88,7 @@ intel_copy_texsubimage(struct brw_context *brw,
x, y, irb->Base.Base.Name == 0,
intelImage->mt, dst_level, dst_slice,
dstx, dsty, false,
width, height, GL_COPY);
width, height, COLOR_LOGICOP_COPY);
}