summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/i915simple
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/i915simple')
-rw-r--r--src/mesa/pipe/i915simple/i915_regions.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mesa/pipe/i915simple/i915_regions.c b/src/mesa/pipe/i915simple/i915_regions.c
index e2b807f959a..b3bcae547d1 100644
--- a/src/mesa/pipe/i915simple/i915_regions.c
+++ b/src/mesa/pipe/i915simple/i915_regions.c
@@ -31,6 +31,7 @@
* - refcounting of buffer mappings.
*/
+#include "pipe/p_defines.h"
#include "i915_context.h"
#include "i915_winsys.h"
#include "i915_blit.h"
@@ -70,7 +71,7 @@ i915_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
static struct pipe_region *
i915_region_alloc(struct pipe_context *pipe,
- GLuint cpp, GLuint width, GLuint height)
+ GLuint cpp, GLuint width, GLuint height, GLbitfield flags)
{
struct i915_context *i915 = i915_context( pipe );
struct pipe_region *region = calloc(sizeof(*region), 1);
@@ -82,7 +83,13 @@ i915_region_alloc(struct pipe_context *pipe,
* clearly want to be able to render to textures under some
* circumstances, but maybe not always a requirement.
*/
- unsigned pitch = ((cpp * width + 63) & ~63) / cpp;
+ unsigned pitch;
+
+ /* XXX is the pitch different for textures vs. drawables? */
+ if (flags & PIPE_SURFACE_FLAG_TEXTURE) /* or PIPE_SURFACE_FLAG_RENDER? */
+ pitch = ((cpp * width + 63) & ~63) / cpp;
+ else
+ pitch = ((cpp * width + 63) & ~63) / cpp;
region->cpp = cpp;
region->pitch = pitch;