mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 12:30:11 +01:00
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 <ian.d.romanick@intel.com> Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> [v1]
This commit is contained in:
parent
21be331401
commit
4e9e964de6
10 changed files with 22 additions and 40 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue