summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@tungstengraphics.com>2008-05-27 21:15:36 +0200
committerJakob Bornecrantz <jakob@tungstengraphics.com>2008-05-28 13:44:36 +0200
commitce56bcb640072496809d2aefede5a32fe9256ace (patch)
tree0bc2319df325205afc7b61166ba42a6dd04d8d08 /src/gallium/winsys
parentcb5e05d99c40d4f7ab1ecbb42a6390caf3966ba4 (diff)
i915: Prepare for tiled private front and back buffers
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/dri/intel/intel_winsys_pipe.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/gallium/winsys/dri/intel/intel_winsys_pipe.c b/src/gallium/winsys/dri/intel/intel_winsys_pipe.c
index fb8f44c845..2e6c452cd1 100644
--- a/src/gallium/winsys/dri/intel/intel_winsys_pipe.c
+++ b/src/gallium/winsys/dri/intel/intel_winsys_pipe.c
@@ -212,6 +212,15 @@ round_up(unsigned n, unsigned multiple)
return (n + multiple - 1) & ~(multiple - 1);
}
+static unsigned
+power_of_two(unsigned x)
+{
+ int value = 1;
+ while (value <= x)
+ value = value << 1;
+ return value;
+}
+ /*pipe_buffer_reference(winsys, &i915_render->vbo, NULL);*/
/**
* Copied from xm_winsys.c
*/
@@ -224,18 +233,31 @@ intel_i915_surface_alloc_storage(struct pipe_winsys *winsys,
unsigned tex_usage)
{
const unsigned alignment = 64;
+ assert(!surf->buffer);
+#if 0
+ surf->width = width;
+ surf->height = round_up(height, 8);
+ surf->format = format;
+ surf->cpp = pf_get_size(format);
+ surf->pitch = power_of_two(MAX2(width * surf->cpp, 512));
+ surf->buffer = winsys->buffer_create(winsys, 2*4096,
+ PIPE_BUFFER_USAGE_PIXEL,
+ surf->pitch * surf->height);
+
+ surf->pitch = surf->pitch / surf->cpp;
+ surf->height = height;
+#else
surf->width = width;
surf->height = height;
surf->format = format;
surf->cpp = pf_get_size(format);
surf->pitch = round_up(width, alignment / surf->cpp);
- assert(!surf->buffer);
surf->buffer = winsys->buffer_create(winsys, alignment,
PIPE_BUFFER_USAGE_PIXEL,
surf->pitch * surf->cpp * surf->height);
-
+#endif
if(!surf->buffer)
return -1;