i915: Prepare for tiled private front and back buffers
authorJakob Bornecrantz <jakob@tungstengraphics.com>
Tue, 27 May 2008 19:15:36 +0000 (21:15 +0200)
committerJakob Bornecrantz <jakob@tungstengraphics.com>
Wed, 28 May 2008 11:44:36 +0000 (13:44 +0200)
src/gallium/drivers/i915simple/i915_state_emit.c
src/gallium/winsys/dri/intel/intel_winsys_pipe.c

index 6f947d4..8bcc26a 100644 (file)
@@ -217,6 +217,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
 
         OUT_BATCH(BUF_3D_ID_COLOR_BACK | 
                   BUF_3D_PITCH(pitch) |  /* pitch in bytes */
+//                BUF_3D_TILED_SURFACE); /* JB: Used to force tileing */
                   BUF_3D_USE_FENCE);
 
         OUT_RELOC(cbuf_surface->buffer,
index fb8f44c..2e6c452 100644 (file)
@@ -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;