cell: fix up assorted compilation problems
authorBrian Paul <brianp@vmware.com>
Tue, 9 Mar 2010 15:12:47 +0000 (08:12 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 9 Mar 2010 15:14:06 +0000 (08:14 -0700)
The driver is pretty much totally broken though.

src/gallium/drivers/cell/ppu/cell_buffer.c
src/gallium/drivers/cell/ppu/cell_context.h
src/gallium/drivers/cell/ppu/cell_draw_arrays.c
src/gallium/drivers/cell/ppu/cell_fence.c
src/gallium/drivers/cell/ppu/cell_pipe_state.c
src/gallium/drivers/cell/ppu/cell_screen.c
src/gallium/drivers/cell/ppu/cell_state_shader.c
src/gallium/drivers/cell/ppu/cell_texture.c
src/gallium/drivers/cell/ppu/cell_texture.h
src/gallium/include/state_tracker/sw_winsys.h
src/gallium/winsys/xlib/xlib_cell.c

index 770f7328a71bcf4173a1bd50bc7b2c49e9558296..f56a28d62e2cad5697e3bec059928bceead4b396 100644 (file)
@@ -30,8 +30,8 @@
 #include "util/u_memory.h"
 #include "util/u_math.h"
 
-#include "sp_screen.h"
-#include "sp_buffer.h"
+#include "cell_screen.h"
+#include "cell_buffer.h"
 
 
 static void *
index a77cc5b9067804c0df716dccfe82099bab5c1e53..233b91dec6b301021a500c23b8511e6b359ad9e8 100644 (file)
@@ -34,7 +34,7 @@
 #include "pipe/p_defines.h"
 #include "draw/draw_vertex.h"
 #include "draw/draw_vbuf.h"
-#include "cell_winsys.h"
+/*#include "cell_winsys.h"*/
 #include "cell/common.h"
 #include "rtasm/rtasm_ppc_spe.h"
 #include "tgsi/tgsi_scan.h"
index bd15034a5d176246df38fc9673d2f013db385954..15d4e8338f43eb532c7cd86676b305a45506213b 100644 (file)
@@ -63,21 +63,21 @@ cell_draw_range_elements(struct pipe_context *pipe,
                          unsigned max_index,
                          unsigned mode, unsigned start, unsigned count)
 {
-   struct cell_context *sp = cell_context(pipe);
-   struct draw_context *draw = sp->draw;
+   struct cell_context *cell = cell_context(pipe);
+   struct draw_context *draw = cell->draw;
    unsigned i;
 
-   if (sp->dirty)
-      cell_update_derived( sp );
+   if (cell->dirty)
+      cell_update_derived( cell );
 
 #if 0
-   cell_map_surfaces(sp);
+   cell_map_surfaces(cell);
 #endif
 
    /*
     * Map vertex buffers
     */
-   for (i = 0; i < sp->num_vertex_buffers; i++) {
+   for (i = 0; i < cell->num_vertex_buffers; i++) {
       void *buf = cell_buffer(cell->vertex_buffer[i].buffer)->data;
       draw_set_mapped_vertex_buffer(draw, i, buf);
    }
@@ -98,7 +98,7 @@ cell_draw_range_elements(struct pipe_context *pipe,
    /*
     * unmap vertex/index buffers - will cause draw module to flush
     */
-   for (i = 0; i < sp->num_vertex_buffers; i++) {
+   for (i = 0; i < cell->num_vertex_buffers; i++) {
       draw_set_mapped_vertex_buffer(draw, i, NULL);
    }
    if (indexBuffer) {
index e10071529a8fa226d1d9179ee55c2553f45d0b77..035ef41b898aabea3b152b53eb64a451bdea052b 100644 (file)
@@ -92,7 +92,6 @@ cell_add_buffer_to_list(struct cell_context *cell,
                         struct cell_buffer_list *list,
                         struct pipe_buffer *buffer)
 {
-   struct pipe_screen *ps = cell->pipe.screen;
    struct cell_buffer_node *node = CALLOC_STRUCT(cell_buffer_node);
    /* create new list node which references the buffer, insert at head */
    if (node) {
@@ -157,8 +156,13 @@ cell_add_fenced_textures(struct cell_context *cell)
          printf("Adding texture %p buffer %p to list\n",
                 ct, ct->tiled_buffer[level]);
 #endif
-         if (ct->buffer)
+#if 00
+         /* XXX this needs to be fixed/restored!
+          * Maybe keep pointers to textures, not buffers.
+          */
+         if (ct->base.buffer)
             cell_add_buffer_to_list(cell, list, ct->buffer);
+#endif
       }
    }
 }
index 3d8b4409c75cb8cd13f793c9a4a6aa12ede81f8d..dce10ae7f863c0a4e2c83e1c66afe0a51d43b1af 100644 (file)
@@ -292,17 +292,23 @@ cell_set_sampler_textures(struct pipe_context *pipe,
 static void
 cell_map_surfaces(struct cell_context *cell)
 {
+#if 0
    struct pipe_screen *screen = cell->pipe.screen;
+#endif
    uint i;
 
    for (i = 0; i < 1; i++) {
       struct pipe_surface *ps = cell->framebuffer.cbufs[i];
       if (ps) {
          struct cell_texture *ct = cell_texture(ps->texture);
+#if 0
          cell->cbuf_map[i] = screen->buffer_map(screen,
                                                 ct->buffer,
                                                 (PIPE_BUFFER_USAGE_GPU_READ |
                                                  PIPE_BUFFER_USAGE_GPU_WRITE));
+#else
+         cell->cbuf_map[i] = ct->data;
+#endif
       }
    }
 
@@ -310,10 +316,14 @@ cell_map_surfaces(struct cell_context *cell)
       struct pipe_surface *ps = cell->framebuffer.zsbuf;
       if (ps) {
          struct cell_texture *ct = cell_texture(ps->texture);
+#if 0
          cell->zsbuf_map = screen->buffer_map(screen,
                                               ct->buffer,
                                               (PIPE_BUFFER_USAGE_GPU_READ |
                                                PIPE_BUFFER_USAGE_GPU_WRITE));
+#else
+         cell->zsbuf_map = ct->data;
+#endif
       }
    }
 }
@@ -325,17 +335,17 @@ cell_map_surfaces(struct cell_context *cell)
 static void
 cell_unmap_surfaces(struct cell_context *cell)
 {
-   struct pipe_screen *screen = cell->pipe.screen;
+   /*struct pipe_screen *screen = cell->pipe.screen;*/
    uint i;
 
    for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
       struct pipe_surface *ps = cell->framebuffer.cbufs[i];
       if (ps && cell->cbuf_map[i]) {
-         struct cell_texture *ct = cell_texture(ps->texture);
+         /*struct cell_texture *ct = cell_texture(ps->texture);*/
          assert(ps->texture);
-         assert(ct->buffer);
+         /*assert(ct->buffer);*/
 
-         screen->buffer_unmap(screen, ct->buffer);
+         /*screen->buffer_unmap(screen, ct->buffer);*/
          cell->cbuf_map[i] = NULL;
       }
    }
@@ -343,8 +353,8 @@ cell_unmap_surfaces(struct cell_context *cell)
    {
       struct pipe_surface *ps = cell->framebuffer.zsbuf;
       if (ps && cell->zsbuf_map) {
-         struct cell_texture *ct = cell_texture(ps->texture);
-         screen->buffer_unmap(screen, ct->buffer);
+         /*struct cell_texture *ct = cell_texture(ps->texture);*/
+         /*screen->buffer_unmap(screen, ct->buffer);*/
          cell->zsbuf_map = NULL;
       }
    }
index 00035be53a1215954679e8a560ed3667e5cfcda7..fc04767a1ee8615879d0ef60c4d404e1873614bb 100644 (file)
@@ -174,7 +174,7 @@ cell_destroy_screen( struct pipe_screen *screen )
 struct pipe_screen *
 cell_create_screen(struct sw_winsys *winsys)
 {
-   struct cell_screen *screen = CALLOC_STRUCT(pipe_screen);
+   struct cell_screen *screen = CALLOC_STRUCT(cell_screen);
 
    if (!screen)
       return NULL;
@@ -194,5 +194,5 @@ cell_create_screen(struct sw_winsys *winsys)
    cell_init_screen_texture_funcs(&screen->base);
    cell_init_screen_buffer_funcs(&screen->base);
 
-   return screen;
+   return &screen->base;
 }
index 634240285476c9f458b0e9f47db5069334c448d0..9e29ddc2d4598e5be868499a83ed473b7221fe93 100644 (file)
@@ -183,7 +183,7 @@ cell_delete_vs_state(struct pipe_context *pipe, void *vs)
 static void
 cell_set_constant_buffer(struct pipe_context *pipe,
                          uint shader, uint index,
-                         struct pipe_buffer *buf)
+                         struct pipe_buffer *constants)
 {
    struct cell_context *cell = cell_context(pipe);
    unsigned size = constants ? constants->size : 0;
@@ -198,7 +198,7 @@ cell_set_constant_buffer(struct pipe_context *pipe,
    draw_flush(cell->draw);
 
    /* note: reference counting */
-   pipe_buffer_reference(&cell->constants[shader], buf);
+   pipe_buffer_reference(&cell->constants[shader], constants);
 
    if(shader == PIPE_SHADER_VERTEX) {
       draw_set_mapped_constant_buffer(cell->draw, PIPE_SHADER_VERTEX, 0,
index 002dd3a9b55f57d56cc84b254784cd51b5a33a66..c8a1acd86a913d2c0501c3b6cb66005f2c0e2ac6 100644 (file)
@@ -40,6 +40,7 @@
 #include "util/u_memory.h"
 
 #include "cell_context.h"
+#include "cell_screen.h"
 #include "cell_state.h"
 #include "cell_texture.h"
 
@@ -142,7 +143,7 @@ cell_texture_create(struct pipe_screen *screen,
 
 fail:
    if (ct->dt) {
-      struct sw_winsys winsys = cell_screen(screen)->winsys;
+      struct sw_winsys *winsys = cell_screen(screen)->winsys;
       winsys->displaytarget_destroy(winsys, ct->dt);
    }
 
@@ -531,7 +532,9 @@ cell_flush_frontbuffer(struct pipe_screen *_screen,
    /* Need to untwiddle from our internal representation here:
     */
    {
-      unsigned *map = winsys->displaytarget_map(winsys, ct->dt);
+      unsigned *map = winsys->displaytarget_map(winsys, ct->dt,
+                                                (PIPE_BUFFER_USAGE_CPU_READ |
+                                                 PIPE_BUFFER_USAGE_CPU_WRITE));
       unsigned *src = (unsigned *)(ct->data + ct->level_offset[surface->level]);
 
       untwiddle_image_uint(surface->width,
@@ -541,7 +544,7 @@ cell_flush_frontbuffer(struct pipe_screen *_screen,
                            ct->dt_stride,
                            src);
 
-      winsys->displaytarget_unmap(winsys, c->dt);
+      winsys->displaytarget_unmap(winsys, ct->dt);
    }
 
    winsys->displaytarget_display(winsys, ct->dt, context_private);
index b89db1a5a8c6c74e760581a1a81c074312b420cf..2be057931220b2fb763a73636ee1fae031106012 100644 (file)
@@ -28,6 +28,7 @@
 #ifndef CELL_TEXTURE_H
 #define CELL_TEXTURE_H
 
+#include "cell/common.h"
 
 struct cell_context;
 struct pipe_texture;
index 719c3f3eee130df98203ce70669cbb297c721194..0de98bbc1c9b8e34c6ee7ee5373654d8fc08fefd 100644 (file)
@@ -88,6 +88,9 @@ struct sw_winsys
                             unsigned alignment,
                             unsigned *stride );
 
+   /**
+    * \param flags  bitmask of PIPE_BUFFER_USAGE_x flags
+    */
    void *
    (*displaytarget_map)( struct sw_winsys *ws, 
                          struct sw_displaytarget *dt,
index 2ad1aab43977903ac70a80076141d192026b2fb7..d943953bd1a036dc9eb8c27ac9711d395627685c 100644 (file)
  */
 
 
-
-
 #include "xlib.h"
 
-
 #if defined(GALLIUM_CELL)
 
 #include "cell/ppu/cell_texture.h"
 #include "util/u_debug.h"
 
 
-
-
-
+/**
+ * Display/copy the image in the surface into the X window specified
+ * by the XMesaBuffer.
+ */
+static void
+xm_cell_displaytarget_display(struct sw_winsys *ws,
+                              struct sw_displaytarget *dt,
+                              void *context_private)
+{
+   struct xlib_drawable *xlib_drawable = (struct xlib_drawable *)context_private;
+   xlib_sw_display(xlib_drawable, dt);
+}
 
 
 static struct pipe_screen *
@@ -64,7 +70,7 @@ xlib_create_cell_screen( Display *dpy )
    /* Plug in a little cell-specific code:
     */
 
-   ws->base.displaytarget_display = xm_cell_displaytarget_display;
+   winsys->displaytarget_display = xm_cell_displaytarget_display;
 
    screen = cell_create_screen(winsys);
    if (screen == NULL)
@@ -80,13 +86,10 @@ fail:
 }
 
 
-
-
 struct xm_driver xlib_cell_driver = 
 {
    .create_pipe_screen = xlib_create_cell_screen,
 };
 
 
-
 #endif /* GALLIUM_CELL */