{
struct intel_context *intel = intel_context(ctx);
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
- int cpp, tiling;
+ int cpp;
ASSERT(rb->Name != 0);
rb->Height = height;
rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);
rb->DataType = intel_mesa_format_to_rb_datatype(rb->Format);
- cpp = _mesa_get_format_bytes(rb->Format);
intel_flush(ctx);
_mesa_lookup_enum_by_nr(internalFormat),
_mesa_get_format_name(rb->Format), width, height);
- tiling = I915_TILING_NONE;
- if (intel->use_texture_tiling) {
- GLenum base_format = _mesa_get_format_base_format(rb->Format);
-
- if (intel->gen >= 4 && (base_format == GL_DEPTH_COMPONENT ||
- base_format == GL_STENCIL_INDEX ||
- base_format == GL_DEPTH_STENCIL))
- tiling = I915_TILING_Y;
- else
- tiling = I915_TILING_X;
- }
-
- if (irb->Base.Format == MESA_FORMAT_S8) {
- /*
- * The stencil buffer is W tiled. However, we request from the kernel a
- * non-tiled buffer because the GTT is incapable of W fencing.
- *
- * The stencil buffer has quirky pitch requirements. From Vol 2a,
- * 11.5.6.2.1 3DSTATE_STENCIL_BUFFER, field "Surface Pitch":
- * The pitch must be set to 2x the value computed based on width, as
- * the stencil buffer is stored with two rows interleaved.
- * To accomplish this, we resort to the nasty hack of doubling the drm
- * region's cpp and halving its height.
- *
- * If we neglect to double the pitch, then render corruption occurs.
- */
- irb->mt = intel_miptree_create_for_renderbuffer(
- intel,
- rb->Format,
- I915_TILING_NONE,
- cpp * 2,
- ALIGN(width, 64),
- ALIGN((height + 1) / 2, 64));
- if (!irb->mt)
- return false;
-
- } else if (irb->Base.Format == MESA_FORMAT_S8_Z24
- && intel->has_separate_stencil) {
-
+ if (irb->Base.Format == MESA_FORMAT_S8_Z24 && intel->has_separate_stencil) {
bool ok = true;
struct gl_renderbuffer *depth_rb;
struct gl_renderbuffer *stencil_rb;
} else {
irb->mt = intel_miptree_create_for_renderbuffer(intel, rb->Format,
- tiling, cpp,
width, height);
if (!irb->mt)
return false;
(base_format == GL_DEPTH_COMPONENT ||
base_format == GL_DEPTH_STENCIL_EXT))
tiling = I915_TILING_Y;
- else if (format == MESA_FORMAT_S8)
- tiling = I915_TILING_NONE;
else if (width0 >= 64)
tiling = I915_TILING_X;
}
+ if (format == MESA_FORMAT_S8) {
+ /* The stencil buffer is W tiled. However, we request from the kernel a
+ * non-tiled buffer because the GTT is incapable of W fencing.
+ *
+ * The stencil buffer has quirky pitch requirements. From Vol 2a,
+ * 11.5.6.2.1 3DSTATE_STENCIL_BUFFER, field "Surface Pitch":
+ * The pitch must be set to 2x the value computed based on width, as
+ * the stencil buffer is stored with two rows interleaved.
+ * To accomplish this, we resort to the nasty hack of doubling the drm
+ * region's cpp and halving its height.
+ *
+ * If we neglect to double the pitch, then render corruption occurs.
+ */
+ tiling = I915_TILING_NONE;
+ width0 = ALIGN(width0, 64);
+ height0 = ALIGN((height0 + 1) / 2, 64);
+ }
+
mt = intel_miptree_create_internal(intel, target, format,
first_level, last_level, width0,
height0, depth0);
struct intel_mipmap_tree*
intel_miptree_create_for_renderbuffer(struct intel_context *intel,
gl_format format,
- uint32_t tiling,
- uint32_t cpp,
uint32_t width,
uint32_t height)
{
- struct intel_region *region;
struct intel_mipmap_tree *mt;
- region = intel_region_alloc(intel->intelScreen,
- tiling, cpp, width, height, true);
- if (!region)
- return NULL;
+ mt = intel_miptree_create(intel, GL_TEXTURE_2D, format, 0, 0,
+ width, height, 1, true);
- mt = intel_miptree_create_for_region(intel, GL_TEXTURE_2D, format, region);
- intel_region_release(®ion);
return mt;
}