aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2018-01-03 12:33:20 -0800
committerIan Romanick <[email protected]>2018-01-26 11:21:46 +0800
commit4e9e964de6cbf540f15b481d37b310f514331d1b (patch)
tree7a04c3c6d5a388bd6839a6f7b87f6380aa2375e0 /src/mesa
parent21be331401f32b9cde8b4514e5bec322b16a88f8 (diff)
i915: 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 <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> [v1]
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i915/intel_blit.c34
-rw-r--r--src/mesa/drivers/dri/i915/intel_blit.h6
-rw-r--r--src/mesa/drivers/dri/i915/intel_fbo.c2
-rw-r--r--src/mesa/drivers/dri/i915/intel_mipmap_tree.c6
-rw-r--r--src/mesa/drivers/dri/i915/intel_pixel_bitmap.c4
-rw-r--r--src/mesa/drivers/dri/i915/intel_pixel_copy.c2
-rw-r--r--src/mesa/drivers/dri/i915/intel_pixel_read.c2
-rw-r--r--src/mesa/drivers/dri/i915/intel_tex_copy.c2
-rw-r--r--src/mesa/drivers/dri/i915/intel_tex_image.c2
-rw-r--r--src/mesa/drivers/dri/i915/intel_tex_subimage.c2
10 files changed, 22 insertions, 40 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_blit.c b/src/mesa/drivers/dri/i915/intel_blit.c
index 279db28b7eb..551f18ffd2e 100644
--- a/src/mesa/drivers/dri/i915/intel_blit.c
+++ b/src/mesa/drivers/dri/i915/intel_blit.c
@@ -48,27 +48,9 @@ intel_miptree_set_alpha_to_one(struct intel_context *intel,
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
@@ -114,7 +96,7 @@ intel_miptree_blit(struct intel_context *intel,
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)
{
/* No sRGB decode or encode is done by the hardware blitter, which is
* consistent with what we want in the callers (glCopyTexSubImage(),
@@ -227,7 +209,7 @@ intelEmitCopyBlit(struct intel_context *intel,
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)
{
GLuint CMD, BR13, pass = 0;
int dst_y2 = dst_y + h;
@@ -523,7 +505,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
uint32_t dst_tiling,
GLshort x, GLshort y,
GLshort w, GLshort h,
- GLenum logic_op)
+ enum gl_logicop_mode logic_op)
{
int dwords = ALIGN(src_size, 8) / 4;
uint32_t opcode, br13, blit_cmd;
@@ -535,7 +517,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
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)
@@ -613,7 +595,7 @@ intel_emit_linear_blit(struct intel_context *intel,
0, 0, /* src x/y */
0, 0, /* dst x/y */
pitch, height, /* w, h */
- GL_COPY);
+ COLOR_LOGICOP_COPY);
if (!ok)
_mesa_problem(ctx, "Failed to linear blit %dx%d\n", pitch, height);
@@ -629,7 +611,7 @@ intel_emit_linear_blit(struct intel_context *intel,
0, 0, /* src x/y */
0, 0, /* dst x/y */
size, 1, /* w, h */
- GL_COPY);
+ COLOR_LOGICOP_COPY);
if (!ok)
_mesa_problem(ctx, "Failed to linear blit %dx%d\n", size, 1);
}
diff --git a/src/mesa/drivers/dri/i915/intel_blit.h b/src/mesa/drivers/dri/i915/intel_blit.h
index 1e76126aad9..5c0d3597f16 100644
--- a/src/mesa/drivers/dri/i915/intel_blit.h
+++ b/src/mesa/drivers/dri/i915/intel_blit.h
@@ -49,7 +49,7 @@ intelEmitCopyBlit(struct intel_context *intel,
GLshort srcx, GLshort srcy,
GLshort dstx, GLshort dsty,
GLshort w, GLshort h,
- GLenum logicop );
+ enum gl_logicop_mode logicop);
bool intel_miptree_blit(struct intel_context *intel,
struct intel_mipmap_tree *src_mt,
@@ -59,7 +59,7 @@ bool intel_miptree_blit(struct intel_context *intel,
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
intelEmitImmediateColorExpandBlit(struct intel_context *intel,
@@ -72,7 +72,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
uint32_t 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 intel_context *intel,
drm_intel_bo *dst_bo,
unsigned int dst_offset,
diff --git a/src/mesa/drivers/dri/i915/intel_fbo.c b/src/mesa/drivers/dri/i915/intel_fbo.c
index 8750c601b84..0fb2fcdda0c 100644
--- a/src/mesa/drivers/dri/i915/intel_fbo.c
+++ b/src/mesa/drivers/dri/i915/intel_fbo.c
@@ -714,7 +714,7 @@ 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/i915/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c
index b0ebff593a2..9a9f08b0a4a 100644
--- a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c
@@ -620,7 +620,7 @@ intel_miptree_copy_slice(struct intel_context *intel,
if (!intel_miptree_blit(intel,
src_mt, level, slice, 0, 0, false,
dst_mt, level, slice, 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));
@@ -757,7 +757,7 @@ intel_miptree_map_blit(struct intel_context *intel,
map->x, map->y, false,
map->mt, 0, 0,
0, 0, false,
- map->w, map->h, GL_COPY)) {
+ map->w, map->h, COLOR_LOGICOP_COPY)) {
fprintf(stderr, "Failed to blit\n");
goto fail;
}
@@ -795,7 +795,7 @@ intel_miptree_unmap_blit(struct intel_context *intel,
0, 0, false,
mt, level, slice,
map->x, map->y, false,
- map->w, map->h, GL_COPY);
+ map->w, map->h, COLOR_LOGICOP_COPY);
WARN_ONCE(!ok, "Failed to blit from linear temporary mapping");
}
diff --git a/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c b/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c
index a41b6929c62..8dee0bea9f2 100644
--- a/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/i915/intel_pixel_bitmap.c
@@ -262,8 +262,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/i915/intel_pixel_copy.c b/src/mesa/drivers/dri/i915/intel_pixel_copy.c
index b4f94666035..0dea8f9c796 100644
--- a/src/mesa/drivers/dri/i915/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/i915/intel_pixel_copy.c
@@ -176,7 +176,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/i915/intel_pixel_read.c b/src/mesa/drivers/dri/i915/intel_pixel_read.c
index e6fa8f2dce8..3560963c8b8 100644
--- a/src/mesa/drivers/dri/i915/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i915/intel_pixel_read.c
@@ -141,7 +141,7 @@ do_blit_readpixels(struct gl_context * ctx,
x, y, _mesa_is_winsys_fbo(ctx->ReadBuffer),
pbo_mt, 0, 0,
0, 0, dst_flip,
- width, height, GL_COPY)) {
+ width, height, COLOR_LOGICOP_COPY)) {
intel_miptree_release(&pbo_mt);
return false;
}
diff --git a/src/mesa/drivers/dri/i915/intel_tex_copy.c b/src/mesa/drivers/dri/i915/intel_tex_copy.c
index a5d00af3b9d..4b087b61629 100644
--- a/src/mesa/drivers/dri/i915/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/i915/intel_tex_copy.c
@@ -70,7 +70,7 @@ intel_copy_texsubimage(struct intel_context *intel,
intelImage->mt, intelImage->base.Base.Level,
intelImage->base.Base.Face + slice,
dstx, dsty, false,
- width, height, GL_COPY)) {
+ width, height, COLOR_LOGICOP_COPY)) {
return false;
}
diff --git a/src/mesa/drivers/dri/i915/intel_tex_image.c b/src/mesa/drivers/dri/i915/intel_tex_image.c
index 3308e377566..a06b1423452 100644
--- a/src/mesa/drivers/dri/i915/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i915/intel_tex_image.c
@@ -163,7 +163,7 @@ try_pbo_upload(struct gl_context *ctx,
0, 0, false,
intelImage->mt, image->Level, image->Face,
0, 0, false,
- image->Width, image->Height, GL_COPY)) {
+ image->Width, image->Height, COLOR_LOGICOP_COPY)) {
DBG("%s: blit failed\n", __func__);
intel_miptree_release(&pbo_mt);
return false;
diff --git a/src/mesa/drivers/dri/i915/intel_tex_subimage.c b/src/mesa/drivers/dri/i915/intel_tex_subimage.c
index 4083d696b82..b372e114fa2 100644
--- a/src/mesa/drivers/dri/i915/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i915/intel_tex_subimage.c
@@ -111,7 +111,7 @@ intel_blit_texsubimage(struct gl_context * ctx,
0, 0, false,
intelImage->mt, texImage->Level, texImage->Face,
xoffset, yoffset, false,
- width, height, GL_COPY);
+ width, height, COLOR_LOGICOP_COPY);
assert(ret);
intel_miptree_release(&temp_mt);