DRI_CONF_ALWAYS_FLUSH_BATCH(false)
DRI_CONF_ALWAYS_FLUSH_CACHE(false)
DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(false)
+ DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(false)
DRI_CONF_OPT_BEGIN(stub_occlusion_query, bool, false)
DRI_CONF_DESC(en, "Enable stub ARB_occlusion_query support on 915/945.")
DRI_CONF_SECTION_END
DRI_CONF_END;
-const GLuint __driNConfigOptions = 14;
+const GLuint __driNConfigOptions = 15;
#include "intel_batchbuffer.h"
#include "intel_buffers.h"
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
#endif /*USE_NEW_INTERFACE */
+void
+aub_dump_bmp(struct gl_context *ctx)
+{
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+ for (int i = 0; i < fb->_NumColorDrawBuffers; i++) {
+ struct intel_renderbuffer *irb =
+ intel_renderbuffer(fb->_ColorDrawBuffers[i]);
+
+ if (irb && irb->mt) {
+ enum aub_dump_bmp_format format;
+
+ switch (irb->Base.Base.Format) {
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_XRGB8888:
+ format = AUB_DUMP_BMP_FORMAT_ARGB_8888;
+ break;
+ default:
+ continue;
+ }
+
+ drm_intel_gem_bo_aub_dump_bmp(irb->mt->region->bo,
+ irb->draw_x,
+ irb->draw_y,
+ irb->Base.Base.Width,
+ irb->Base.Base.Height,
+ format,
+ irb->mt->region->pitch *
+ irb->mt->region->cpp,
+ 0);
+ }
+ }
+}
+
static const __DRItexBufferExtension intelTexBufferExtension = {
{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
intelSetTexBuffer,
intel_batchbuffer_flush(intel);
if (INTEL_DEBUG & DEBUG_AUB) {
- struct gl_framebuffer *fb = ctx->DrawBuffer;
-
- for (int i = 0; i < fb->_NumColorDrawBuffers; i++) {
- struct intel_renderbuffer *irb =
- intel_renderbuffer(fb->_ColorDrawBuffers[i]);
-
- if (irb && irb->mt) {
- enum aub_dump_bmp_format format;
-
- switch (irb->Base.Base.Format) {
- case MESA_FORMAT_ARGB8888:
- case MESA_FORMAT_XRGB8888:
- format = AUB_DUMP_BMP_FORMAT_ARGB_8888;
- break;
- default:
- continue;
- }
-
- drm_intel_gem_bo_aub_dump_bmp(irb->mt->region->bo,
- irb->draw_x,
- irb->draw_y,
- irb->Base.Base.Width,
- irb->Base.Base.Height,
- format,
- irb->mt->region->pitch *
- irb->mt->region->cpp,
- 0);
- }
- }
+ aub_dump_bmp(ctx);
}
}
};
static __DRIimage *
-intel_create_image_from_name(__DRIscreen *screen,
- int width, int height, int format,
- int name, int pitch, void *loaderPrivate)
+intel_allocate_image(int dri_format, void *loaderPrivate)
{
- struct intel_screen *intelScreen = screen->driverPrivate;
__DRIimage *image;
- int cpp;
image = CALLOC(sizeof *image);
if (image == NULL)
return NULL;
- switch (format) {
+ image->dri_format = dri_format;
+ image->offset = 0;
+
+ switch (dri_format) {
case __DRI_IMAGE_FORMAT_RGB565:
image->format = MESA_FORMAT_RGB565;
- image->internal_format = GL_RGB;
- image->data_type = GL_UNSIGNED_BYTE;
break;
case __DRI_IMAGE_FORMAT_XRGB8888:
image->format = MESA_FORMAT_XRGB8888;
- image->internal_format = GL_RGB;
- image->data_type = GL_UNSIGNED_BYTE;
break;
case __DRI_IMAGE_FORMAT_ARGB8888:
image->format = MESA_FORMAT_ARGB8888;
- image->internal_format = GL_RGBA;
- image->data_type = GL_UNSIGNED_BYTE;
break;
case __DRI_IMAGE_FORMAT_ABGR8888:
image->format = MESA_FORMAT_RGBA8888_REV;
- image->internal_format = GL_RGBA;
- image->data_type = GL_UNSIGNED_BYTE;
+ break;
+ case __DRI_IMAGE_FORMAT_XBGR8888:
+ image->format = MESA_FORMAT_RGBX8888_REV;
+ break;
+ case __DRI_IMAGE_FORMAT_R8:
+ image->format = MESA_FORMAT_R8;
+ break;
+ case __DRI_IMAGE_FORMAT_GR88:
+ image->format = MESA_FORMAT_GR88;
+ break;
+ case __DRI_IMAGE_FORMAT_NONE:
+ image->format = MESA_FORMAT_NONE;
break;
default:
free(image);
return NULL;
}
+ image->internal_format = _mesa_get_format_base_format(image->format);
image->data = loaderPrivate;
- cpp = _mesa_get_format_bytes(image->format);
+ return image;
+}
+
+static __DRIimage *
+intel_create_image_from_name(__DRIscreen *screen,
+ int width, int height, int format,
+ int name, int pitch, void *loaderPrivate)
+{
+ struct intel_screen *intelScreen = screen->driverPrivate;
+ __DRIimage *image;
+ int cpp;
+
+ image = intel_allocate_image(format, loaderPrivate);
+ if (image->format == MESA_FORMAT_NONE)
+ cpp = 0;
+ else
+ cpp = _mesa_get_format_bytes(image->format);
image->region = intel_region_alloc_for_handle(intelScreen,
cpp, width, height,
pitch, name, "image");
image->internal_format = rb->InternalFormat;
image->format = rb->Format;
- image->data_type = GL_UNSIGNED_BYTE;
+ image->offset = 0;
image->data = loaderPrivate;
intel_region_reference(&image->region, irb->mt->region);
+ switch (image->format) {
+ case MESA_FORMAT_RGB565:
+ image->dri_format = __DRI_IMAGE_FORMAT_RGB565;
+ break;
+ case MESA_FORMAT_XRGB8888:
+ image->dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
+ break;
+ case MESA_FORMAT_ARGB8888:
+ image->dri_format = __DRI_IMAGE_FORMAT_ARGB8888;
+ break;
+ case MESA_FORMAT_RGBA8888_REV:
+ image->dri_format = __DRI_IMAGE_FORMAT_ABGR8888;
+ break;
+ case MESA_FORMAT_R8:
+ image->dri_format = __DRI_IMAGE_FORMAT_R8;
+ break;
+ case MESA_FORMAT_RG88:
+ image->dri_format = __DRI_IMAGE_FORMAT_GR88;
+ break;
+ }
+
return image;
}
tiling = I915_TILING_NONE;
}
- image = CALLOC(sizeof *image);
- if (image == NULL)
- return NULL;
-
- image->dri_format = format;
-
- switch (format) {
- case __DRI_IMAGE_FORMAT_RGB565:
- image->format = MESA_FORMAT_RGB565;
- image->internal_format = GL_RGB;
- image->data_type = GL_UNSIGNED_BYTE;
- break;
- case __DRI_IMAGE_FORMAT_XRGB8888:
- image->format = MESA_FORMAT_XRGB8888;
- image->internal_format = GL_RGB;
- image->data_type = GL_UNSIGNED_BYTE;
- break;
- case __DRI_IMAGE_FORMAT_ARGB8888:
- image->format = MESA_FORMAT_ARGB8888;
- image->internal_format = GL_RGBA;
- image->data_type = GL_UNSIGNED_BYTE;
- break;
- case __DRI_IMAGE_FORMAT_ABGR8888:
- image->format = MESA_FORMAT_RGBA8888_REV;
- image->internal_format = GL_RGBA;
- image->data_type = GL_UNSIGNED_BYTE;
- break;
- default:
- free(image);
+ /* We only support write for cursor drm images */
+ if ((use & __DRI_IMAGE_USE_WRITE) &&
+ use != (__DRI_IMAGE_USE_WRITE | __DRI_IMAGE_USE_CURSOR))
return NULL;
- }
- image->data = loaderPrivate;
+ image = intel_allocate_image(format, loaderPrivate);
+ image->usage = use;
cpp = _mesa_get_format_bytes(image->format);
-
image->region =
- intel_region_alloc(intelScreen, tiling,
- cpp, width, height, true);
+ intel_region_alloc(intelScreen, tiling, cpp, width, height, true);
if (image->region == NULL) {
FREE(image);
return NULL;
case __DRI_IMAGE_ATTRIB_NAME:
return intel_region_flink(image->region, (uint32_t *) value);
case __DRI_IMAGE_ATTRIB_FORMAT:
- return image->dri_format;
- default:
+ *value = image->dri_format;
+ return true;
+ case __DRI_IMAGE_ATTRIB_WIDTH:
+ *value = image->region->width;
+ return true;
+ case __DRI_IMAGE_ATTRIB_HEIGHT:
+ *value = image->region->height;
+ return true;
+ default:
return false;
}
}
}
image->internal_format = orig_image->internal_format;
+ image->usage = orig_image->usage;
+ image->dri_format = orig_image->dri_format;
image->format = orig_image->format;
- image->data_type = orig_image->data_type;
+ image->offset = orig_image->offset;
image->data = loaderPrivate;
return image;
return GL_FALSE;
}
+ /* We only support write for cursor drm images */
+ if ((use & __DRI_IMAGE_USE_WRITE) &&
+ use != (__DRI_IMAGE_USE_WRITE | __DRI_IMAGE_USE_CURSOR))
+ return GL_FALSE;
+
return GL_TRUE;
}
+static int
+intel_image_write(__DRIimage *image, const void *buf, size_t count)
+{
+ if (image->region->map_refcount)
+ return -1;
+ if (!(image->usage & __DRI_IMAGE_USE_WRITE))
+ return -1;
+
+ drm_intel_bo_map(image->region->bo, true);
+ memcpy(image->region->bo->virtual, buf, count);
+ drm_intel_bo_unmap(image->region->bo);
+
+ return 0;
+}
+
+static __DRIimage *
+intel_create_sub_image(__DRIimage *parent,
+ int width, int height, int dri_format,
+ int offset, int pitch, void *loaderPrivate)
+{
+ __DRIimage *image;
+ int cpp;
+ uint32_t mask_x, mask_y;
+
+ image = intel_allocate_image(dri_format, loaderPrivate);
+ cpp = _mesa_get_format_bytes(image->format);
+ if (offset + height * cpp * pitch > parent->region->bo->size) {
+ _mesa_warning(NULL, "intel_create_sub_image: subimage out of bounds");
+ FREE(image);
+ return NULL;
+ }
+
+ image->region = calloc(sizeof(*image->region), 1);
+ if (image->region == NULL) {
+ FREE(image);
+ return NULL;
+ }
+
+ image->region->cpp = _mesa_get_format_bytes(image->format);
+ image->region->width = width;
+ image->region->height = height;
+ image->region->pitch = pitch;
+ image->region->refcount = 1;
+ image->region->bo = parent->region->bo;
+ drm_intel_bo_reference(image->region->bo);
+ image->region->tiling = parent->region->tiling;
+ image->region->screen = parent->region->screen;
+ image->offset = offset;
+
+ intel_region_get_tile_masks(image->region, &mask_x, &mask_y);
+ if (offset & mask_x)
+ _mesa_warning(NULL,
+ "intel_create_sub_image: offset not on tile boundary");
+
+ return image;
+}
+
static struct __DRIimageExtensionRec intelImageExtension = {
- { __DRI_IMAGE, 3 },
+ { __DRI_IMAGE, 5 },
intel_create_image_from_name,
intel_create_image_from_renderbuffer,
intel_destroy_image,
intel_create_image,
intel_query_image,
intel_dup_image,
- intel_validate_usage
+ intel_validate_usage,
+ intel_image_write,
+ intel_create_sub_image
};
static const __DRIextension *intelScreenExtensions[] = {
{
struct intel_renderbuffer *rb;
struct intel_screen *screen = (struct intel_screen*) driScrnPriv->driverPrivate;
+ gl_format rgbFormat;
+ struct gl_framebuffer *fb;
- if (isPixmap) {
- return false; /* not implemented */
- }
- else {
- gl_format rgbFormat;
+ if (isPixmap)
+ return false;
- struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer);
+ fb = CALLOC_STRUCT(gl_framebuffer);
+ if (!fb)
+ return false;
- if (!fb)
- return false;
+ _mesa_initialize_window_framebuffer(fb, mesaVis);
- _mesa_initialize_window_framebuffer(fb, mesaVis);
+ if (mesaVis->redBits == 5)
+ rgbFormat = MESA_FORMAT_RGB565;
+ else if (mesaVis->alphaBits == 0)
+ rgbFormat = MESA_FORMAT_XRGB8888;
+ else
+ rgbFormat = MESA_FORMAT_ARGB8888;
- if (mesaVis->redBits == 5)
- rgbFormat = MESA_FORMAT_RGB565;
- else if (mesaVis->alphaBits == 0)
- rgbFormat = MESA_FORMAT_XRGB8888;
- else
- rgbFormat = MESA_FORMAT_ARGB8888;
+ /* setup the hardware-based renderbuffers */
+ rb = intel_create_renderbuffer(rgbFormat);
+ _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
- /* setup the hardware-based renderbuffers */
+ if (mesaVis->doubleBufferMode) {
rb = intel_create_renderbuffer(rgbFormat);
- _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
-
- if (mesaVis->doubleBufferMode) {
- rb = intel_create_renderbuffer(rgbFormat);
- _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
- }
+ _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
+ }
- /*
- * Assert here that the gl_config has an expected depth/stencil bit
- * combination: one of d24/s8, d16/s0, d0/s0. (See intelInitScreen2(),
- * which constructs the advertised configs.)
- */
- if (mesaVis->depthBits == 24) {
- assert(mesaVis->stencilBits == 8);
-
- if (screen->hw_has_separate_stencil
- && screen->dri2_has_hiz != INTEL_DRI2_HAS_HIZ_FALSE) {
- /*
- * Request a separate stencil buffer even if we do not yet know if
- * the screen supports it. (See comments for
- * enum intel_dri2_has_hiz).
- */
- rb = intel_create_renderbuffer(MESA_FORMAT_X8_Z24);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
- rb = intel_create_renderbuffer(MESA_FORMAT_S8);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
- } else {
- /*
- * Use combined depth/stencil. Note that the renderbuffer is
- * attached to two attachment points.
- */
- rb = intel_create_renderbuffer(MESA_FORMAT_S8_Z24);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
- }
- }
- else if (mesaVis->depthBits == 16) {
- assert(mesaVis->stencilBits == 0);
- /* just 16-bit depth buffer, no hw stencil */
- struct intel_renderbuffer *depthRb
- = intel_create_renderbuffer(MESA_FORMAT_Z16);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base.Base);
- }
- else {
- assert(mesaVis->depthBits == 0);
- assert(mesaVis->stencilBits == 0);
+ /*
+ * Assert here that the gl_config has an expected depth/stencil bit
+ * combination: one of d24/s8, d16/s0, d0/s0. (See intelInitScreen2(),
+ * which constructs the advertised configs.)
+ */
+ if (mesaVis->depthBits == 24) {
+ assert(mesaVis->stencilBits == 8);
+
+ if (screen->hw_has_separate_stencil) {
+ rb = intel_create_private_renderbuffer(MESA_FORMAT_X8_Z24);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
+ rb = intel_create_private_renderbuffer(MESA_FORMAT_S8);
+ _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
+ } else {
+ /*
+ * Use combined depth/stencil. Note that the renderbuffer is
+ * attached to two attachment points.
+ */
+ rb = intel_create_private_renderbuffer(MESA_FORMAT_S8_Z24);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
+ _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
}
+ }
+ else if (mesaVis->depthBits == 16) {
+ assert(mesaVis->stencilBits == 0);
+ rb = intel_create_private_renderbuffer(MESA_FORMAT_Z16);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
+ }
+ else {
+ assert(mesaVis->depthBits == 0);
+ assert(mesaVis->stencilBits == 0);
+ }
- /* now add any/all software-based renderbuffers we may need */
- _swrast_add_soft_renderbuffers(fb,
- false, /* never sw color */
- false, /* never sw depth */
- false, /* never sw stencil */
- mesaVis->accumRedBits > 0,
- false, /* never sw alpha */
- false /* never sw aux */ );
- driDrawPriv->driverPrivate = fb;
+ /* now add any/all software-based renderbuffers we may need */
+ _swrast_add_soft_renderbuffers(fb,
+ false, /* never sw color */
+ false, /* never sw depth */
+ false, /* never sw stencil */
+ mesaVis->accumRedBits > 0,
+ false, /* never sw alpha */
+ false /* never sw aux */ );
+ driDrawPriv->driverPrivate = fb;
- return true;
- }
+ return true;
}
static void
if (ctx->VersionMajor > major_version
|| (ctx->VersionMajor == major_version
&& ctx->VersionMinor >= minor_version)) {
- *error = __DRI_CTX_ERROR_BAD_VERSION;
return true;
}
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
intelDestroyContext(driContextPriv);
} else {
*error = __DRI_CTX_ERROR_NO_MEMORY;
__DRIscreen *spriv = intelScreen->driScrnPriv;
int num_fences = 0;
- intelScreen->no_hw = (getenv("INTEL_NO_HW") != NULL ||
- getenv("INTEL_DEVID_OVERRIDE") != NULL);
+ intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL;
intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ);
if (intelScreen->bufmgr == NULL) {
GLenum fb_format[3];
GLenum fb_type[3];
unsigned int api_mask;
- char *devid_override;
static const GLenum back_buffer_modes[] = {
GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
int color;
__DRIconfig **configs = NULL;
+ if (psp->dri2.loader->base.version <= 2 ||
+ psp->dri2.loader->getBuffersWithFormat == NULL) {
+ fprintf(stderr,
+ "\nERROR! DRI2 loader with getBuffersWithFormat() "
+ "support required\n");
+ return false;
+ }
+
/* Allocate the private area */
intelScreen = CALLOC(sizeof *intelScreen);
if (!intelScreen) {
intelScreen->driScrnPriv = psp;
psp->driverPrivate = (void *) intelScreen;
- /* Determine chipset ID */
- if (!intel_get_param(psp, I915_PARAM_CHIPSET_ID,
- &intelScreen->deviceID))
- return false;
+ if (!intel_init_bufmgr(intelScreen))
+ return false;
- /* Allow an override of the device ID for the purpose of making the
- * driver produce dumps for debugging of new chipset enablement.
- * This implies INTEL_NO_HW, to avoid programming your actual GPU
- * incorrectly.
- */
- devid_override = getenv("INTEL_DEVID_OVERRIDE");
- if (devid_override) {
- intelScreen->deviceID = strtod(devid_override, NULL);
- }
+ intelScreen->deviceID = drm_intel_bufmgr_gem_get_devid(intelScreen->bufmgr);
intelScreen->kernel_has_gen7_sol_reset =
intel_get_boolean(intelScreen->driScrnPriv,
intelScreen->hw_has_separate_stencil = intelScreen->gen >= 6;
intelScreen->hw_must_use_separate_stencil = intelScreen->gen >= 7;
- intelScreen->dri2_has_hiz = INTEL_DRI2_HAS_HIZ_UNKNOWN;
-#if defined(I915_PARAM_HAS_LLC)
- intelScreen->hw_has_llc =
- intel_get_boolean(intelScreen->driScrnPriv,
- I915_PARAM_HAS_LLC);
-#else
- intelScreen->hw_has_llc = intelScreen->gen >= 6;
-#endif
+ int has_llc = 0;
+ bool success = intel_get_param(intelScreen->driScrnPriv, I915_PARAM_HAS_LLC,
+ &has_llc);
+ if (success && has_llc)
+ intelScreen->hw_has_llc = true;
+ else if (!success && intelScreen->gen >= 6)
+ intelScreen->hw_has_llc = true;
intel_override_separate_stencil(intelScreen);
if (IS_9XX(intelScreen->deviceID) || IS_965(intelScreen->deviceID))
psp->api_mask = api_mask;
- if (!intel_init_bufmgr(intelScreen))
- return false;
-
intelScreen->hw_has_swizzling = intel_detect_swizzling(intelScreen);
psp->extensions = intelScreenExtensions;
struct intel_region *region;
};
-/**
- * \brief Get tiling format for a DRI buffer.
- *
- * \param attachment is the buffer's attachmet point, such as
- * __DRI_BUFFER_DEPTH.
- * \param out_tiling is the returned tiling format for buffer.
- * \return false if attachment is unrecognized or is incompatible with screen.
- */
-static bool
-intel_get_dri_buffer_tiling(struct intel_screen *screen,
- uint32_t attachment,
- uint32_t *out_tiling)
-{
- if (screen->gen < 4) {
- *out_tiling = I915_TILING_X;
- return true;
- }
-
- switch (attachment) {
- case __DRI_BUFFER_DEPTH:
- case __DRI_BUFFER_DEPTH_STENCIL:
- case __DRI_BUFFER_HIZ:
- *out_tiling = I915_TILING_Y;
- return true;
- case __DRI_BUFFER_ACCUM:
- case __DRI_BUFFER_FRONT_LEFT:
- case __DRI_BUFFER_FRONT_RIGHT:
- case __DRI_BUFFER_BACK_LEFT:
- case __DRI_BUFFER_BACK_RIGHT:
- case __DRI_BUFFER_FAKE_FRONT_LEFT:
- case __DRI_BUFFER_FAKE_FRONT_RIGHT:
- *out_tiling = I915_TILING_X;
- return true;
- case __DRI_BUFFER_STENCIL:
- /* The stencil buffer is W tiled. However, we request from the kernel
- * a non-tiled buffer because the GTT is incapable of W fencing.
- */
- *out_tiling = I915_TILING_NONE;
- return true;
- default:
- if(unlikely(INTEL_DEBUG & DEBUG_DRI)) {
- fprintf(stderr, "error: %s: unrecognized DRI buffer attachment 0x%x\n",
- __FUNCTION__, attachment);
- }
- return false;
- }
-}
-
static __DRIbuffer *
intelAllocateBuffer(__DRIscreen *screen,
unsigned attachment, unsigned format,
struct intel_buffer *intelBuffer;
struct intel_screen *intelScreen = screen->driverPrivate;
- uint32_t tiling;
- uint32_t region_width;
- uint32_t region_height;
- uint32_t region_cpp;
-
- bool ok = true;
-
- ok = intel_get_dri_buffer_tiling(intelScreen, attachment, &tiling);
- if (!ok)
- return NULL;
+ assert(attachment == __DRI_BUFFER_FRONT_LEFT ||
+ attachment == __DRI_BUFFER_BACK_LEFT);
intelBuffer = CALLOC(sizeof *intelBuffer);
if (intelBuffer == NULL)
return NULL;
- if (attachment == __DRI_BUFFER_STENCIL) {
- /* 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
- * region's cpp and halving its height.
- */
- region_width = ALIGN(width, 64);
- region_height = ALIGN(ALIGN(height, 2) / 2, 64);
- region_cpp = format / 4;
- } else {
- region_width = width;
- region_height = height;
- region_cpp = format / 8;
- }
-
+ /* The front and back buffers are color buffers, which are X tiled. */
intelBuffer->region = intel_region_alloc(intelScreen,
- tiling,
- region_cpp,
- region_width,
- region_height,
+ I915_TILING_X,
+ format / 8,
+ width,
+ height,
true);
if (intelBuffer->region == NULL) {