From: Ian Romanick Date: Wed, 3 Jan 2018 20:03:58 +0000 (-0800) Subject: i965: Use enum color_logic_ops for blits X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=21be331401f32b9cde8b4514e5bec322b16a88f8;p=mesa.git 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 Reviewed-by: Samuel Iglesias Gonsálvez [v1] --- diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c index 46945b29953..96e5aba85df 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.c +++ b/src/mesa/drivers/dri/i965/intel_blit.c @@ -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); diff --git a/src/mesa/drivers/dri/i965/intel_blit.h b/src/mesa/drivers/dri/i965/intel_blit.h index 0a0c57de9bc..ce36b2609b0 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.h +++ b/src/mesa/drivers/dri/i965/intel_blit.h @@ -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, diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index 056f494e2f9..ca4008f8a03 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -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; diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index c480eade93b..f27d559149d 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -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)); diff --git a/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c b/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c index 8d467adc56e..5bc341bfc0a 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c @@ -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); diff --git a/src/mesa/drivers/dri/i965/intel_pixel_copy.c b/src/mesa/drivers/dri/i965/intel_pixel_copy.c index 3f8df3002f5..a23c5b18ac6 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_copy.c @@ -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; } diff --git a/src/mesa/drivers/dri/i965/intel_pixel_draw.c b/src/mesa/drivers/dri/i965/intel_pixel_draw.c index e72c8babc81..82dca4a2ebc 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_draw.c @@ -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; diff --git a/src/mesa/drivers/dri/i965/intel_tex_copy.c b/src/mesa/drivers/dri/i965/intel_tex_copy.c index 4fe3585296d..5a0e09f2551 100644 --- a/src/mesa/drivers/dri/i965/intel_tex_copy.c +++ b/src/mesa/drivers/dri/i965/intel_tex_copy.c @@ -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); }