intel: Add a width field to regions, and use it for making miptrees in TFP.
Otherwise, we would use the pitch as width of the texture, and compiz would render the pitch padding on the right hand side.
This commit is contained in:
@@ -301,8 +301,9 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
region = intel_region_alloc_for_handle(intel, buffers[i].cpp,
|
region = intel_region_alloc_for_handle(intel, buffers[i].cpp,
|
||||||
buffers[i].pitch / buffers[i].cpp,
|
drawable->w,
|
||||||
drawable->h,
|
drawable->h,
|
||||||
|
buffers[i].pitch / buffers[i].cpp,
|
||||||
buffers[i].name,
|
buffers[i].name,
|
||||||
region_name);
|
region_name);
|
||||||
|
|
||||||
|
@@ -296,7 +296,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
|||||||
DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width,
|
DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width,
|
||||||
height, pitch);
|
height, pitch);
|
||||||
|
|
||||||
irb->region = intel_region_alloc(intel, cpp, pitch, height);
|
irb->region = intel_region_alloc(intel, cpp, width, height, pitch);
|
||||||
if (!irb->region)
|
if (!irb->region)
|
||||||
return GL_FALSE; /* out of memory? */
|
return GL_FALSE; /* out of memory? */
|
||||||
|
|
||||||
|
@@ -117,7 +117,10 @@ intel_miptree_create(struct intel_context *intel,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
mt->region = intel_region_alloc(intel,
|
mt->region = intel_region_alloc(intel,
|
||||||
mt->cpp, mt->pitch, mt->total_height);
|
mt->cpp,
|
||||||
|
mt->pitch,
|
||||||
|
mt->total_height,
|
||||||
|
mt->pitch);
|
||||||
|
|
||||||
if (!mt->region) {
|
if (!mt->region) {
|
||||||
free(mt);
|
free(mt);
|
||||||
@@ -141,7 +144,7 @@ intel_miptree_create_for_region(struct intel_context *intel,
|
|||||||
|
|
||||||
mt = intel_miptree_create_internal(intel, target, internal_format,
|
mt = intel_miptree_create_internal(intel, target, internal_format,
|
||||||
first_level, last_level,
|
first_level, last_level,
|
||||||
region->pitch, region->height, depth0,
|
region->width, region->height, 1,
|
||||||
region->cpp, compress_byte);
|
region->cpp, compress_byte);
|
||||||
if (!mt)
|
if (!mt)
|
||||||
return mt;
|
return mt;
|
||||||
|
@@ -105,7 +105,8 @@ intel_set_region_tiling_gem(struct intel_context *intel,
|
|||||||
|
|
||||||
static struct intel_region *
|
static struct intel_region *
|
||||||
intel_region_alloc_internal(struct intel_context *intel,
|
intel_region_alloc_internal(struct intel_context *intel,
|
||||||
GLuint cpp, GLuint pitch, GLuint height,
|
GLuint cpp,
|
||||||
|
GLuint width, GLuint height, GLuint pitch,
|
||||||
dri_bo *buffer)
|
dri_bo *buffer)
|
||||||
{
|
{
|
||||||
struct intel_region *region;
|
struct intel_region *region;
|
||||||
@@ -117,8 +118,9 @@ intel_region_alloc_internal(struct intel_context *intel,
|
|||||||
|
|
||||||
region = calloc(sizeof(*region), 1);
|
region = calloc(sizeof(*region), 1);
|
||||||
region->cpp = cpp;
|
region->cpp = cpp;
|
||||||
|
region->width = width;
|
||||||
|
region->height = height;
|
||||||
region->pitch = pitch;
|
region->pitch = pitch;
|
||||||
region->height = height; /* needed? */
|
|
||||||
region->refcount = 1;
|
region->refcount = 1;
|
||||||
region->buffer = buffer;
|
region->buffer = buffer;
|
||||||
|
|
||||||
@@ -131,19 +133,20 @@ intel_region_alloc_internal(struct intel_context *intel,
|
|||||||
|
|
||||||
struct intel_region *
|
struct intel_region *
|
||||||
intel_region_alloc(struct intel_context *intel,
|
intel_region_alloc(struct intel_context *intel,
|
||||||
GLuint cpp, GLuint pitch, GLuint height)
|
GLuint cpp, GLuint width, GLuint height, GLuint pitch)
|
||||||
{
|
{
|
||||||
dri_bo *buffer;
|
dri_bo *buffer;
|
||||||
|
|
||||||
buffer = dri_bo_alloc(intel->bufmgr, "region",
|
buffer = dri_bo_alloc(intel->bufmgr, "region",
|
||||||
pitch * cpp * height, 64);
|
pitch * cpp * height, 64);
|
||||||
|
|
||||||
return intel_region_alloc_internal(intel, cpp, pitch, height, buffer);
|
return intel_region_alloc_internal(intel, cpp, width, height, pitch, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct intel_region *
|
struct intel_region *
|
||||||
intel_region_alloc_for_handle(struct intel_context *intel,
|
intel_region_alloc_for_handle(struct intel_context *intel,
|
||||||
GLuint cpp, GLuint pitch, GLuint height,
|
GLuint cpp,
|
||||||
|
GLuint width, GLuint height, GLuint pitch,
|
||||||
GLuint handle, const char *name)
|
GLuint handle, const char *name)
|
||||||
{
|
{
|
||||||
struct intel_region *region;
|
struct intel_region *region;
|
||||||
@@ -151,7 +154,8 @@ intel_region_alloc_for_handle(struct intel_context *intel,
|
|||||||
|
|
||||||
buffer = intel_bo_gem_create_from_name(intel->bufmgr, name, handle);
|
buffer = intel_bo_gem_create_from_name(intel->bufmgr, name, handle);
|
||||||
|
|
||||||
region = intel_region_alloc_internal(intel, cpp, pitch, height, buffer);
|
region = intel_region_alloc_internal(intel, cpp,
|
||||||
|
width, height, pitch, buffer);
|
||||||
if (region == NULL)
|
if (region == NULL)
|
||||||
return region;
|
return region;
|
||||||
|
|
||||||
|
@@ -55,8 +55,9 @@ struct intel_region
|
|||||||
dri_bo *buffer; /**< buffer manager's buffer */
|
dri_bo *buffer; /**< buffer manager's buffer */
|
||||||
GLuint refcount; /**< Reference count for region */
|
GLuint refcount; /**< Reference count for region */
|
||||||
GLuint cpp; /**< bytes per pixel */
|
GLuint cpp; /**< bytes per pixel */
|
||||||
GLuint pitch; /**< in pixels */
|
GLuint width; /**< in pixels */
|
||||||
GLuint height; /**< in pixels */
|
GLuint height; /**< in pixels */
|
||||||
|
GLuint pitch; /**< in pixels */
|
||||||
GLubyte *map; /**< only non-NULL when region is actually mapped */
|
GLubyte *map; /**< only non-NULL when region is actually mapped */
|
||||||
GLuint map_refcount; /**< Reference count for mapping */
|
GLuint map_refcount; /**< Reference count for mapping */
|
||||||
|
|
||||||
@@ -72,12 +73,13 @@ struct intel_region
|
|||||||
* copied by calling intel_reference_region().
|
* copied by calling intel_reference_region().
|
||||||
*/
|
*/
|
||||||
struct intel_region *intel_region_alloc(struct intel_context *intel,
|
struct intel_region *intel_region_alloc(struct intel_context *intel,
|
||||||
GLuint cpp,
|
GLuint cpp, GLuint width,
|
||||||
GLuint pitch, GLuint height);
|
GLuint height, GLuint pitch);
|
||||||
|
|
||||||
struct intel_region *
|
struct intel_region *
|
||||||
intel_region_alloc_for_handle(struct intel_context *intel,
|
intel_region_alloc_for_handle(struct intel_context *intel,
|
||||||
GLuint cpp, GLuint pitch, GLuint height,
|
GLuint cpp,
|
||||||
|
GLuint width, GLuint height, GLuint pitch,
|
||||||
unsigned int handle, const char *name);
|
unsigned int handle, const char *name);
|
||||||
|
|
||||||
void intel_region_reference(struct intel_region **dst,
|
void intel_region_reference(struct intel_region **dst,
|
||||||
|
@@ -757,7 +757,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
|
|||||||
intelObj->mt = mt;
|
intelObj->mt = mt;
|
||||||
texImage = _mesa_get_tex_image(&intel->ctx, texObj, target, level);
|
texImage = _mesa_get_tex_image(&intel->ctx, texObj, target, level);
|
||||||
_mesa_init_teximage_fields(&intel->ctx, target, texImage,
|
_mesa_init_teximage_fields(&intel->ctx, target, texImage,
|
||||||
rb->region->pitch, rb->region->height, 1,
|
rb->region->width, rb->region->height, 1,
|
||||||
0, internalFormat);
|
0, internalFormat);
|
||||||
|
|
||||||
intelImage = intel_texture_image(texImage);
|
intelImage = intel_texture_image(texImage);
|
||||||
|
Reference in New Issue
Block a user