intel: Avoid trying to do blits to Y tiled regions.
This is somewhat nasty, but we need to do Y-tiled depth for FBO support. May help with corruption and hangs since enabling texture tiling, and since switching depth textures to Y tiled. Fixes piglit depthtex.c on 965.
This commit is contained in:
@@ -108,6 +108,8 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
|
||||
CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
|
||||
}
|
||||
|
||||
assert(src->tiling != I915_TILING_Y);
|
||||
assert(dst->tiling != I915_TILING_Y);
|
||||
#ifndef I915
|
||||
if (src->tiling != I915_TILING_NONE) {
|
||||
CMD |= XY_SRC_TILED;
|
||||
@@ -201,7 +203,7 @@ static GLuint translate_raster_op(GLenum logicop)
|
||||
|
||||
/* Copy BitBlt
|
||||
*/
|
||||
void
|
||||
GLboolean
|
||||
intelEmitCopyBlit(struct intel_context *intel,
|
||||
GLuint cpp,
|
||||
GLshort src_pitch,
|
||||
@@ -223,6 +225,11 @@ intelEmitCopyBlit(struct intel_context *intel,
|
||||
dri_bo *aper_array[3];
|
||||
BATCH_LOCALS;
|
||||
|
||||
if (dst_tiling == I915_TILING_Y)
|
||||
return GL_FALSE;
|
||||
if (src_tiling == I915_TILING_Y)
|
||||
return GL_FALSE;
|
||||
|
||||
/* do space/cliprects check before going any further */
|
||||
do {
|
||||
aper_array[0] = intel->batch->buf;
|
||||
@@ -260,7 +267,7 @@ intelEmitCopyBlit(struct intel_context *intel,
|
||||
if (locked)
|
||||
UNLOCK_HARDWARE(intel);
|
||||
|
||||
return;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
intel_batchbuffer_require_space(intel->batch, 8 * 4, NO_LOOP_CLIPRECTS);
|
||||
@@ -287,7 +294,7 @@ intelEmitCopyBlit(struct intel_context *intel,
|
||||
CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
#ifndef I915
|
||||
@@ -302,7 +309,7 @@ intelEmitCopyBlit(struct intel_context *intel,
|
||||
#endif
|
||||
|
||||
if (dst_y2 <= dst_y || dst_x2 <= dst_x) {
|
||||
return;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
assert(dst_x < dst_x2);
|
||||
@@ -324,6 +331,8 @@ intelEmitCopyBlit(struct intel_context *intel,
|
||||
ADVANCE_BATCH();
|
||||
|
||||
intel_batchbuffer_emit_mi_flush(intel->batch);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -536,7 +545,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
|
||||
UNLOCK_HARDWARE(intel);
|
||||
}
|
||||
|
||||
void
|
||||
GLboolean
|
||||
intelEmitImmediateColorExpandBlit(struct intel_context *intel,
|
||||
GLuint cpp,
|
||||
GLubyte *src_bits, GLuint src_size,
|
||||
@@ -552,11 +561,14 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
|
||||
int dwords = ALIGN(src_size, 8) / 4;
|
||||
uint32_t opcode, br13, blit_cmd;
|
||||
|
||||
if (dst_tiling == I915_TILING_Y)
|
||||
return GL_FALSE;
|
||||
|
||||
assert( logic_op - GL_CLEAR >= 0 );
|
||||
assert( logic_op - GL_CLEAR < 0x10 );
|
||||
|
||||
if (w < 0 || h < 0)
|
||||
return;
|
||||
return GL_TRUE;
|
||||
|
||||
dst_pitch *= cpp;
|
||||
|
||||
@@ -613,4 +625,6 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel,
|
||||
REFERENCES_CLIPRECTS );
|
||||
|
||||
intel_batchbuffer_emit_mi_flush(intel->batch);
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ extern void intelCopyBuffer(const __DRIdrawablePrivate * dpriv,
|
||||
|
||||
extern void intelClearWithBlit(GLcontext * ctx, GLbitfield mask);
|
||||
|
||||
extern void intelEmitCopyBlit(struct intel_context *intel,
|
||||
GLboolean
|
||||
intelEmitCopyBlit(struct intel_context *intel,
|
||||
GLuint cpp,
|
||||
GLshort src_pitch,
|
||||
dri_bo *src_buffer,
|
||||
@@ -50,7 +51,7 @@ extern void intelEmitCopyBlit(struct intel_context *intel,
|
||||
GLshort w, GLshort h,
|
||||
GLenum logicop );
|
||||
|
||||
void
|
||||
GLboolean
|
||||
intelEmitImmediateColorExpandBlit(struct intel_context *intel,
|
||||
GLuint cpp,
|
||||
GLubyte *src_bits, GLuint src_size,
|
||||
|
||||
@@ -498,6 +498,7 @@ intel_miptree_image_copy(struct intel_context *intel,
|
||||
const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level);
|
||||
const GLuint *src_depth_offset = intel_miptree_depth_offsets(src, level);
|
||||
GLuint i;
|
||||
GLboolean success;
|
||||
|
||||
if (dst->compressed) {
|
||||
GLuint alignment = intel_compressed_alignment(dst->internal_format);
|
||||
@@ -506,12 +507,26 @@ intel_miptree_image_copy(struct intel_context *intel,
|
||||
}
|
||||
|
||||
for (i = 0; i < depth; i++) {
|
||||
intel_region_copy(intel,
|
||||
dst->region, dst_offset + dst_depth_offset[i],
|
||||
0,
|
||||
0,
|
||||
src->region, src_offset + src_depth_offset[i],
|
||||
0, 0, width, height, GL_COPY);
|
||||
}
|
||||
success = intel_region_copy(intel,
|
||||
dst->region, dst_offset + dst_depth_offset[i],
|
||||
0, 0,
|
||||
src->region, src_offset + src_depth_offset[i],
|
||||
0, 0, width, height, GL_COPY);
|
||||
if (!success) {
|
||||
GLubyte *src_ptr, *dst_ptr;
|
||||
|
||||
src_ptr = intel_region_map(intel, src->region);
|
||||
dst_ptr = intel_region_map(intel, dst->region);
|
||||
|
||||
_mesa_copy_rect(dst_ptr + dst_offset + dst_depth_offset[i],
|
||||
dst->cpp,
|
||||
dst->pitch,
|
||||
0, 0, width, height,
|
||||
src_ptr + src_offset + src_depth_offset[i],
|
||||
src->pitch,
|
||||
0, 0);
|
||||
intel_region_unmap(intel, src->region);
|
||||
intel_region_unmap(intel, dst->region);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ do_blit_bitmap( GLcontext *ctx,
|
||||
struct gl_framebuffer *fb = ctx->DrawBuffer;
|
||||
GLfloat tmpColor[4];
|
||||
GLubyte ubcolor[4];
|
||||
GLuint color8888, color565;
|
||||
GLuint color;
|
||||
unsigned int num_cliprects;
|
||||
drm_clip_rect_t *cliprects;
|
||||
int x_off, y_off;
|
||||
@@ -232,8 +232,11 @@ do_blit_bitmap( GLcontext *ctx,
|
||||
UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[2], tmpColor[2]);
|
||||
UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[3], tmpColor[3]);
|
||||
|
||||
color8888 = INTEL_PACKCOLOR8888(ubcolor[0], ubcolor[1], ubcolor[2], ubcolor[3]);
|
||||
color565 = INTEL_PACKCOLOR565(ubcolor[0], ubcolor[1], ubcolor[2]);
|
||||
if (dst->cpp == 2)
|
||||
color = INTEL_PACKCOLOR565(ubcolor[0], ubcolor[1], ubcolor[2]);
|
||||
else
|
||||
color = INTEL_PACKCOLOR8888(ubcolor[0], ubcolor[1],
|
||||
ubcolor[2], ubcolor[3]);
|
||||
|
||||
if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F))
|
||||
return GL_FALSE;
|
||||
@@ -307,21 +310,21 @@ do_blit_bitmap( GLcontext *ctx,
|
||||
fb->Name == 0 ? GL_TRUE : GL_FALSE) == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
*/
|
||||
intelEmitImmediateColorExpandBlit( intel,
|
||||
dst->cpp,
|
||||
(GLubyte *)stipple,
|
||||
sz,
|
||||
(dst->cpp == 2) ? color565 : color8888,
|
||||
dst->pitch,
|
||||
dst->buffer,
|
||||
0,
|
||||
dst->tiling,
|
||||
box_x + px,
|
||||
box_y + py,
|
||||
w, h,
|
||||
logic_op);
|
||||
if (!intelEmitImmediateColorExpandBlit(intel,
|
||||
dst->cpp,
|
||||
(GLubyte *)stipple,
|
||||
sz,
|
||||
color,
|
||||
dst->pitch,
|
||||
dst->buffer,
|
||||
0,
|
||||
dst->tiling,
|
||||
box_x + px,
|
||||
box_y + py,
|
||||
w, h,
|
||||
logic_op)) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,12 +362,16 @@ do_blit_copypixels(GLcontext * ctx,
|
||||
&clip_x, &clip_y, &clip_w, &clip_h))
|
||||
continue;
|
||||
|
||||
intel_region_copy(intel,
|
||||
dst, 0, clip_x, clip_y,
|
||||
src, 0, clip_x + delta_x, clip_y + delta_y,
|
||||
clip_w, clip_h,
|
||||
ctx->Color.ColorLogicOpEnabled ?
|
||||
ctx->Color.LogicOp : GL_COPY);
|
||||
if (!intel_region_copy(intel,
|
||||
dst, 0, clip_x, clip_y,
|
||||
src, 0, clip_x + delta_x, clip_y + delta_y,
|
||||
clip_w, clip_h,
|
||||
ctx->Color.ColorLogicOpEnabled ?
|
||||
ctx->Color.LogicOp : GL_COPY)) {
|
||||
DBG("%s: blit failure\n", __FUNCTION__);
|
||||
UNLOCK_HARDWARE(intel);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
out:
|
||||
|
||||
@@ -261,16 +261,19 @@ do_blit_readpixels(GLcontext * ctx,
|
||||
if (!intel_intersect_cliprects(&rect, &src_rect, &box[i]))
|
||||
continue;
|
||||
|
||||
intelEmitCopyBlit(intel,
|
||||
src->cpp,
|
||||
src->pitch, src->buffer, 0, src->tiling,
|
||||
rowLength, dst_buffer, dst_offset, GL_FALSE,
|
||||
rect.x1,
|
||||
rect.y1,
|
||||
rect.x1 - src_rect.x1,
|
||||
rect.y2 - src_rect.y2,
|
||||
rect.x2 - rect.x1, rect.y2 - rect.y1,
|
||||
GL_COPY);
|
||||
if (!intelEmitCopyBlit(intel,
|
||||
src->cpp,
|
||||
src->pitch, src->buffer, 0, src->tiling,
|
||||
rowLength, dst_buffer, dst_offset, GL_FALSE,
|
||||
rect.x1,
|
||||
rect.y1,
|
||||
rect.x1 - src_rect.x1,
|
||||
rect.y2 - src_rect.y2,
|
||||
rect.x2 - rect.x1, rect.y2 - rect.y1,
|
||||
GL_COPY)) {
|
||||
UNLOCK_HARDWARE(intel);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
UNLOCK_HARDWARE(intel);
|
||||
|
||||
@@ -360,7 +360,7 @@ intel_region_data(struct intel_context *intel,
|
||||
/* Copy rectangular sub-regions. Need better logic about when to
|
||||
* push buffers into AGP - will currently do so whenever possible.
|
||||
*/
|
||||
void
|
||||
GLboolean
|
||||
intel_region_copy(struct intel_context *intel,
|
||||
struct intel_region *dst,
|
||||
GLuint dst_offset,
|
||||
@@ -373,7 +373,7 @@ intel_region_copy(struct intel_context *intel,
|
||||
_DBG("%s\n", __FUNCTION__);
|
||||
|
||||
if (intel == NULL)
|
||||
return;
|
||||
return GL_FALSE;
|
||||
|
||||
if (dst->pbo) {
|
||||
if (dstx == 0 &&
|
||||
@@ -385,12 +385,12 @@ intel_region_copy(struct intel_context *intel,
|
||||
|
||||
assert(src->cpp == dst->cpp);
|
||||
|
||||
intelEmitCopyBlit(intel,
|
||||
dst->cpp,
|
||||
src->pitch, src->buffer, src_offset, src->tiling,
|
||||
dst->pitch, dst->buffer, dst_offset, dst->tiling,
|
||||
srcx, srcy, dstx, dsty, width, height,
|
||||
logicop);
|
||||
return intelEmitCopyBlit(intel,
|
||||
dst->cpp,
|
||||
src->pitch, src->buffer, src_offset, src->tiling,
|
||||
dst->pitch, dst->buffer, dst_offset, dst->tiling,
|
||||
srcx, srcy, dstx, dsty, width, height,
|
||||
logicop);
|
||||
}
|
||||
|
||||
/* Attach to a pbo, discarding our data. Effectively zero-copy upload
|
||||
@@ -477,13 +477,13 @@ intel_region_cow(struct intel_context *intel, struct intel_region *region)
|
||||
if (!was_locked)
|
||||
LOCK_HARDWARE(intel);
|
||||
|
||||
intelEmitCopyBlit(intel,
|
||||
region->cpp,
|
||||
region->pitch, pbo->buffer, 0, region->tiling,
|
||||
region->pitch, region->buffer, 0, region->tiling,
|
||||
0, 0, 0, 0,
|
||||
region->pitch, region->height,
|
||||
GL_COPY);
|
||||
assert(intelEmitCopyBlit(intel,
|
||||
region->cpp,
|
||||
region->pitch, pbo->buffer, 0, region->tiling,
|
||||
region->pitch, region->buffer, 0, region->tiling,
|
||||
0, 0, 0, 0,
|
||||
region->pitch, region->height,
|
||||
GL_COPY));
|
||||
|
||||
if (!was_locked)
|
||||
UNLOCK_HARDWARE(intel);
|
||||
|
||||
@@ -110,14 +110,15 @@ void intel_region_data(struct intel_context *intel,
|
||||
|
||||
/* Copy rectangular sub-regions
|
||||
*/
|
||||
void intel_region_copy(struct intel_context *intel,
|
||||
struct intel_region *dest,
|
||||
GLuint dest_offset,
|
||||
GLuint destx, GLuint desty,
|
||||
struct intel_region *src,
|
||||
GLuint src_offset,
|
||||
GLuint srcx, GLuint srcy, GLuint width, GLuint height,
|
||||
GLenum logicop);
|
||||
GLboolean
|
||||
intel_region_copy(struct intel_context *intel,
|
||||
struct intel_region *dest,
|
||||
GLuint dest_offset,
|
||||
GLuint destx, GLuint desty,
|
||||
struct intel_region *src,
|
||||
GLuint src_offset,
|
||||
GLuint srcx, GLuint srcy, GLuint width, GLuint height,
|
||||
GLenum logicop);
|
||||
|
||||
/* Helpers for zerocopy uploads, particularly texture image uploads:
|
||||
*/
|
||||
|
||||
@@ -147,18 +147,21 @@ do_copy_texsubimage(struct intel_context *intel,
|
||||
src_pitch = src->pitch;
|
||||
}
|
||||
|
||||
intelEmitCopyBlit(intel,
|
||||
intelImage->mt->cpp,
|
||||
src_pitch,
|
||||
src->buffer,
|
||||
0,
|
||||
src->tiling,
|
||||
intelImage->mt->pitch,
|
||||
dst_bo,
|
||||
image_offset,
|
||||
intelImage->mt->region->tiling,
|
||||
x, y, dstx, dsty, width, height,
|
||||
GL_COPY);
|
||||
if (!intelEmitCopyBlit(intel,
|
||||
intelImage->mt->cpp,
|
||||
src_pitch,
|
||||
src->buffer,
|
||||
0,
|
||||
src->tiling,
|
||||
intelImage->mt->pitch,
|
||||
dst_bo,
|
||||
image_offset,
|
||||
intelImage->mt->region->tiling,
|
||||
x, y, dstx, dsty, width, height,
|
||||
GL_COPY)) {
|
||||
UNLOCK_HARDWARE(intel);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
UNLOCK_HARDWARE(intel);
|
||||
|
||||
@@ -235,12 +235,15 @@ try_pbo_upload(struct intel_context *intel,
|
||||
INTEL_WRITE_FULL);
|
||||
|
||||
|
||||
intelEmitCopyBlit(intel,
|
||||
intelImage->mt->cpp,
|
||||
src_stride, src_buffer, src_offset, GL_FALSE,
|
||||
dst_stride, dst_buffer, dst_offset, GL_FALSE,
|
||||
0, 0, 0, 0, width, height,
|
||||
GL_COPY);
|
||||
if (!intelEmitCopyBlit(intel,
|
||||
intelImage->mt->cpp,
|
||||
src_stride, src_buffer, src_offset, GL_FALSE,
|
||||
dst_stride, dst_buffer, dst_offset, GL_FALSE,
|
||||
0, 0, 0, 0, width, height,
|
||||
GL_COPY)) {
|
||||
UNLOCK_HARDWARE(intel);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
UNLOCK_HARDWARE(intel);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user