diff options
author | Thomas Balling Sørensen <tball@tball-laptop.(none)> | 2010-10-05 12:04:08 +0200 |
---|---|---|
committer | Thomas Balling Sørensen <tball@tball-laptop.(none)> | 2010-10-05 12:04:08 +0200 |
commit | 1218430e1200a08cd64b6555d3fd1fd0274ad9e5 (patch) | |
tree | e060fb27b8388a4bd237ca39fc20f1675c5e367c /src/gallium/drivers/cell/ppu | |
parent | 63b1525cf0a50e3d31328c3b56355a86056e4c05 (diff) | |
parent | bf21b7006c63c3dc47045c22d4f372dfe6c7ce67 (diff) |
Merge branch 'master' into pipe-video
Conflicts:
configs/linux-dri
configure.ac
src/gallium/drivers/nvfx/Makefile
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_screen.h
src/gallium/include/state_tracker/dri1_api.h
src/gallium/include/state_tracker/drm_api.h
src/gallium/tests/python/samples/tri.py
src/gallium/tests/trivial/Makefile
src/gallium/tests/unit/Makefile
src/gallium/tests/unit/SConscript
src/gallium/tests/unit/u_format_test.c
src/gallium/winsys/nouveau/drm/nouveau_drm_api.c
Diffstat (limited to 'src/gallium/drivers/cell/ppu')
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_context.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_context.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_draw_arrays.c | 51 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_fence.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_pipe_state.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_render.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_screen.c | 31 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_state_vertex.c | 22 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_surface.c | 17 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_texture.c | 32 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_vbuf.c | 8 |
11 files changed, 111 insertions, 94 deletions
diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c index 49cece58b8f..143eca848f1 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.c +++ b/src/gallium/drivers/cell/ppu/cell_context.c @@ -73,7 +73,7 @@ cell_destroy_context( struct pipe_context *pipe ) static struct draw_context * cell_draw_create(struct cell_context *cell) { - struct draw_context *draw = draw_create(); + struct draw_context *draw = draw_create(&cell->pipe); #if 0 /* broken */ if (getenv("GALLIUM_CELL_VS")) { @@ -88,14 +88,14 @@ cell_draw_create(struct cell_context *cell) static const struct debug_named_value cell_debug_flags[] = { - {"checker", CELL_DEBUG_CHECKER},/**< modulate tile clear color by SPU ID */ - {"asm", CELL_DEBUG_ASM}, /**< dump SPU asm code */ - {"sync", CELL_DEBUG_SYNC}, /**< SPUs do synchronous DMA */ - {"fragops", CELL_DEBUG_FRAGMENT_OPS}, /**< SPUs emit fragment ops debug messages*/ - {"fragopfallback", CELL_DEBUG_FRAGMENT_OP_FALLBACK}, /**< SPUs use reference implementation for fragment ops*/ - {"cmd", CELL_DEBUG_CMD}, /**< SPUs dump command buffer info */ - {"cache", CELL_DEBUG_CACHE}, /**< report texture cache stats on exit */ - {NULL, 0} + {"checker", CELL_DEBUG_CHECKER, NULL},/**< modulate tile clear color by SPU ID */ + {"asm", CELL_DEBUG_ASM, NULL}, /**< dump SPU asm code */ + {"sync", CELL_DEBUG_SYNC, NULL}, /**< SPUs do synchronous DMA */ + {"fragops", CELL_DEBUG_FRAGMENT_OPS, NULL}, /**< SPUs emit fragment ops debug messages*/ + {"fragopfallback", CELL_DEBUG_FRAGMENT_OP_FALLBACK, NULL}, /**< SPUs use reference implementation for fragment ops*/ + {"cmd", CELL_DEBUG_CMD, NULL}, /**< SPUs dump command buffer info */ + {"cache", CELL_DEBUG_CACHE, NULL}, /**< report texture cache stats on exit */ + DEBUG_NAMED_VALUE_END }; static unsigned int diff --git a/src/gallium/drivers/cell/ppu/cell_context.h b/src/gallium/drivers/cell/ppu/cell_context.h index 07b6eebc69c..d1aee62ba1e 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.h +++ b/src/gallium/drivers/cell/ppu/cell_context.h @@ -132,6 +132,7 @@ struct cell_context struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; uint num_vertex_buffers; + struct pipe_index_buffer index_buffer; ubyte *cbuf_map[PIPE_MAX_COLOR_BUFS]; ubyte *zsbuf_map; @@ -154,7 +155,7 @@ struct cell_context struct vertex_info vertex_info; /** Mapped constant buffers */ - void *mapped_constants[PIPE_SHADER_TYPES]; + const void *mapped_constants[PIPE_SHADER_TYPES]; PIPE_ALIGN_VAR(16) struct cell_spu_function_info spu_functions; diff --git a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c index b50a30bee80..a367fa3fe15 100644 --- a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c +++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c @@ -56,16 +56,11 @@ * XXX should the element buffer be specified/bound with a separate function? */ static void -cell_draw_range_elements(struct pipe_context *pipe, - struct pipe_resource *indexBuffer, - unsigned indexSize, - int indexBias, - unsigned min_index, - unsigned max_index, - unsigned mode, unsigned start, unsigned count) +cell_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) { struct cell_context *cell = cell_context(pipe); struct draw_context *draw = cell->draw; + void *mapped_indices = NULL; unsigned i; if (cell->dirty) @@ -83,18 +78,13 @@ cell_draw_range_elements(struct pipe_context *pipe, draw_set_mapped_vertex_buffer(draw, i, buf); } /* Map index buffer, if present */ - if (indexBuffer) { - void *mapped_indexes = cell_resource(indexBuffer)->data; - draw_set_mapped_element_buffer(draw, indexSize, indexBias, mapped_indexes); - } - else { - /* no index/element buffer */ - draw_set_mapped_element_buffer(draw, 0, 0, NULL); - } + if (info->indexed && cell->index_buffer.buffer) + mapped_indices = cell_resource(cell->index_buffer.buffer)->data; + draw_set_mapped_index_buffer(draw, mapped_indices); /* draw! */ - draw_arrays(draw, mode, start, count); + draw_vbo(draw, info); /* * unmap vertex/index buffers - will cause draw module to flush @@ -102,8 +92,8 @@ cell_draw_range_elements(struct pipe_context *pipe, for (i = 0; i < cell->num_vertex_buffers; i++) { draw_set_mapped_vertex_buffer(draw, i, NULL); } - if (indexBuffer) { - draw_set_mapped_element_buffer(draw, 0, NULL); + if (mapped_indices) { + draw_set_mapped_index_buffer(draw, NULL); } /* @@ -115,32 +105,9 @@ cell_draw_range_elements(struct pipe_context *pipe, } -static void -cell_draw_elements(struct pipe_context *pipe, - struct pipe_resource *indexBuffer, - unsigned indexSize, int indexBias, - unsigned mode, unsigned start, unsigned count) -{ - cell_draw_range_elements( pipe, indexBuffer, - indexSize, indeBias, - 0, 0xffffffff, - mode, start, count ); -} - - -static void -cell_draw_arrays(struct pipe_context *pipe, unsigned mode, - unsigned start, unsigned count) -{ - cell_draw_elements(pipe, NULL, 0, 0, mode, start, count); -} - - void cell_init_draw_functions(struct cell_context *cell) { - cell->pipe.draw_arrays = cell_draw_arrays; - cell->pipe.draw_elements = cell_draw_elements; - cell->pipe.draw_range_elements = cell_draw_range_elements; + cell->pipe.draw_vbo = cell_draw_vbo; } diff --git a/src/gallium/drivers/cell/ppu/cell_fence.c b/src/gallium/drivers/cell/ppu/cell_fence.c index eac798e8cf6..e7c9fc46d9f 100644 --- a/src/gallium/drivers/cell/ppu/cell_fence.c +++ b/src/gallium/drivers/cell/ppu/cell_fence.c @@ -87,6 +87,7 @@ struct cell_buffer_node }; +#if 0 static void cell_add_buffer_to_list(struct cell_context *cell, struct cell_buffer_list *list, @@ -100,6 +101,7 @@ cell_add_buffer_to_list(struct cell_context *cell, list->head = node; } } +#endif /** @@ -113,7 +115,7 @@ cell_free_fenced_buffers(struct cell_context *cell, struct cell_buffer_list *list) { if (list->head) { - struct pipe_screen *ps = cell->pipe.screen; + /*struct pipe_screen *ps = cell->pipe.screen;*/ struct cell_buffer_node *node; cell_fence_finish(cell, &list->fence); @@ -123,7 +125,7 @@ cell_free_fenced_buffers(struct cell_context *cell, while (node) { struct cell_buffer_node *next = node->next; assert(node->buffer); - pipe_buffer_unmap(ps, node->buffer); + /* XXX need this? pipe_buffer_unmap(ps, node->buffer);*/ #if 0 printf("Unref buffer %p\n", node->buffer); if (node->buffer->reference.count == 1) @@ -146,7 +148,7 @@ cell_free_fenced_buffers(struct cell_context *cell, void cell_add_fenced_textures(struct cell_context *cell) { - struct cell_buffer_list *list = &cell->fenced_buffers[cell->cur_batch]; + /*struct cell_buffer_list *list = &cell->fenced_buffers[cell->cur_batch];*/ uint i; for (i = 0; i < cell->num_textures; i++) { diff --git a/src/gallium/drivers/cell/ppu/cell_pipe_state.c b/src/gallium/drivers/cell/ppu/cell_pipe_state.c index 8c975c6ae2a..223adda48f0 100644 --- a/src/gallium/drivers/cell/ppu/cell_pipe_state.c +++ b/src/gallium/drivers/cell/ppu/cell_pipe_state.c @@ -125,6 +125,7 @@ cell_set_stencil_ref(struct pipe_context *pipe, cell->dirty |= CELL_NEW_DEPTH_STENCIL; } + static void cell_set_clip_state(struct pipe_context *pipe, const struct pipe_clip_state *clip) @@ -136,6 +137,12 @@ cell_set_clip_state(struct pipe_context *pipe, } +static void +cell_set_sample_mask(struct pipe_context *pipe, + unsigned sample_mask) +{ +} + /* Called when driver state tracker notices changes to the viewport * matrix: @@ -197,7 +204,7 @@ cell_bind_rasterizer_state(struct pipe_context *pipe, void *rast) struct cell_context *cell = cell_context(pipe); /* pass-through to draw module */ - draw_set_rasterizer_state(cell->draw, rasterizer); + draw_set_rasterizer_state(cell->draw, rasterizer, rast); cell->rasterizer = rasterizer; @@ -274,7 +281,7 @@ cell_set_fragment_sampler_views(struct pipe_context *pipe, struct pipe_resource *new_tex = new_view ? new_view->texture : NULL; pipe_sampler_view_reference(&cell->fragment_sampler_views[i], - views[i]); + new_view); pipe_resource_reference((struct pipe_resource **) &cell->texture[i], (struct pipe_resource *) new_tex); @@ -430,7 +437,6 @@ cell_set_framebuffer_state(struct pipe_context *pipe, } - void cell_init_state_functions(struct cell_context *cell) { @@ -457,6 +463,7 @@ cell_init_state_functions(struct cell_context *cell) cell->pipe.set_blend_color = cell_set_blend_color; cell->pipe.set_stencil_ref = cell_set_stencil_ref; cell->pipe.set_clip_state = cell_set_clip_state; + cell->pipe.set_sample_mask = cell_set_sample_mask; cell->pipe.set_framebuffer_state = cell_set_framebuffer_state; diff --git a/src/gallium/drivers/cell/ppu/cell_render.c b/src/gallium/drivers/cell/ppu/cell_render.c index 79cb8df82fa..f648482c551 100644 --- a/src/gallium/drivers/cell/ppu/cell_render.c +++ b/src/gallium/drivers/cell/ppu/cell_render.c @@ -152,7 +152,7 @@ cell_flush_prim_buffer(struct cell_context *cell) struct cell_command_render *render = &cell_global.command[i].render; render->prim_type = PIPE_PRIM_TRIANGLES; render->num_verts = cell->prim_buffer.num_verts; - render->front_winding = cell->rasterizer->front_winding; + render->front_ccw = cell->rasterizer->front_ccw; render->vertex_size = cell->vertex_info->size * 4; render->xmin = cell->prim_buffer.xmin; render->ymin = cell->prim_buffer.ymin; diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c index b4fd8d7235c..8d2b4b96438 100644 --- a/src/gallium/drivers/cell/ppu/cell_screen.c +++ b/src/gallium/drivers/cell/ppu/cell_screen.c @@ -55,7 +55,7 @@ cell_get_name(struct pipe_screen *screen) static int -cell_get_param(struct pipe_screen *screen, int param) +cell_get_param(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: @@ -76,6 +76,8 @@ cell_get_param(struct pipe_screen *screen, int param) return 1; case PIPE_CAP_OCCLUSION_QUERY: return 1; + case PIPE_CAP_TIMER_QUERY: + return 0; case PIPE_CAP_TEXTURE_SHADOW_MAP: return 10; case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: @@ -88,8 +90,6 @@ cell_get_param(struct pipe_screen *screen, int param) return 1; /* XXX not really true */ case PIPE_CAP_TEXTURE_MIRROR_CLAMP: return 0; /* XXX to do */ - case PIPE_CAP_TGSI_CONT_SUPPORTED: - return 1; case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT: case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: return 1; @@ -103,9 +103,23 @@ cell_get_param(struct pipe_screen *screen, int param) } } +static int +cell_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param) +{ + switch(shader) + { + case PIPE_SHADER_FRAGMENT: + return tgsi_exec_get_shader_param(param); + case PIPE_SHADER_VERTEX: + case PIPE_SHADER_GEOMETRY: + return draw_get_shader_param(shader, param); + default: + return 0; + } +} static float -cell_get_paramf(struct pipe_screen *screen, int param) +cell_get_paramf(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_LINE_WIDTH: @@ -132,13 +146,17 @@ cell_get_paramf(struct pipe_screen *screen, int param) static boolean cell_is_format_supported( struct pipe_screen *screen, - enum pipe_format format, + enum pipe_format format, enum pipe_texture_target target, - unsigned tex_usage, + unsigned sample_count, + unsigned tex_usage, unsigned geom_flags ) { struct sw_winsys *winsys = cell_screen(screen)->winsys; + if (sample_count > 1) + return FALSE; + if (tex_usage & (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | PIPE_BIND_SHARED)) { @@ -194,6 +212,7 @@ cell_create_screen(struct sw_winsys *winsys) screen->base.get_name = cell_get_name; screen->base.get_vendor = cell_get_vendor; screen->base.get_param = cell_get_param; + screen->base.get_shader_param = cell_get_shader_param; screen->base.get_paramf = cell_get_paramf; screen->base.is_format_supported = cell_is_format_supported; screen->base.context_create = cell_create_context; diff --git a/src/gallium/drivers/cell/ppu/cell_state_vertex.c b/src/gallium/drivers/cell/ppu/cell_state_vertex.c index 9510ea9ac2b..a065d68b5a6 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_vertex.c +++ b/src/gallium/drivers/cell/ppu/cell_state_vertex.c @@ -36,7 +36,7 @@ #include "draw/draw_context.h" -void * +static void * cell_create_vertex_elements_state(struct pipe_context *pipe, unsigned count, const struct pipe_vertex_element *attribs) @@ -51,7 +51,7 @@ cell_create_vertex_elements_state(struct pipe_context *pipe, return velems; } -void +static void cell_bind_vertex_elements_state(struct pipe_context *pipe, void *velems) { @@ -66,7 +66,7 @@ cell_bind_vertex_elements_state(struct pipe_context *pipe, draw_set_vertex_elements(cell->draw, cell_velems->count, cell_velems->velem); } -void +static void cell_delete_vertex_elements_state(struct pipe_context *pipe, void *velems) { FREE( velems ); @@ -91,10 +91,26 @@ cell_set_vertex_buffers(struct pipe_context *pipe, } +static void +cell_set_index_buffer(struct pipe_context *pipe, + const struct pipe_index_buffer *ib) +{ + struct cell_context *cell = cell_context(pipe); + + if (ib) + memcpy(&cell->index_buffer, ib, sizeof(cell->index_buffer)); + else + memset(&cell->index_buffer, 0, sizeof(cell->index_buffer)); + + draw_set_index_buffer(cell->draw, ib); +} + + void cell_init_vertex_functions(struct cell_context *cell) { cell->pipe.set_vertex_buffers = cell_set_vertex_buffers; + cell->pipe.set_index_buffer = cell_set_index_buffer; cell->pipe.create_vertex_elements_state = cell_create_vertex_elements_state; cell->pipe.bind_vertex_elements_state = cell_bind_vertex_elements_state; cell->pipe.delete_vertex_elements_state = cell_delete_vertex_elements_state; diff --git a/src/gallium/drivers/cell/ppu/cell_surface.c b/src/gallium/drivers/cell/ppu/cell_surface.c index ffb8595d828..777454479b1 100644 --- a/src/gallium/drivers/cell/ppu/cell_surface.c +++ b/src/gallium/drivers/cell/ppu/cell_surface.c @@ -25,26 +25,13 @@ * **************************************************************************/ -#include "util/u_rect.h" +#include "util/u_surface.h" #include "cell_context.h" #include "cell_surface.h" -static void -cell_surface_copy(struct pipe_context *pipe, - struct pipe_surface *dest, unsigned destx, unsigned desty, - struct pipe_surface *src, unsigned srcx, unsigned srcy, - unsigned width, unsigned height) -{ - util_surface_copy(pipe, FALSE, - dest, destx, desty, - src, srcx, srcy, - width, height); -} - void cell_init_surface_functions(struct cell_context *cell) { - cell->pipe.surface_copy = cell_surface_copy; - cell->pipe.surface_fill = util_surface_fill; + cell->pipe.resource_copy_region = util_resource_copy_region; } diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c index d08334d892b..b3042df7792 100644 --- a/src/gallium/drivers/cell/ppu/cell_texture.c +++ b/src/gallium/drivers/cell/ppu/cell_texture.c @@ -34,7 +34,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "util/u_inlines.h" - +#include "util/u_transfer.h" #include "util/u_format.h" #include "util/u_math.h" #include "util/u_memory.h" @@ -42,7 +42,7 @@ #include "cell_context.h" #include "cell_screen.h" #include "cell_state.h" -#include "cell_resource.h" +#include "cell_texture.h" #include "state_tracker/sw_winsys.h" @@ -155,9 +155,9 @@ fail: static void -cell_resource_destroy(struct pipe_resource *pt) +cell_resource_destroy(struct pipe_screen *scrn, struct pipe_resource *pt) { - struct cell_screen *screen = cell_screen(pt->screen); + struct cell_screen *screen = cell_screen(scrn); struct sw_winsys *winsys = screen->winsys; struct cell_resource *ct = cell_resource(pt); @@ -365,10 +365,10 @@ cell_get_transfer(struct pipe_context *ctx, { struct cell_resource *ct = cell_resource(resource); struct cell_transfer *ctrans; - enum pipe_format *format = resource->format; + enum pipe_format format = resource->format; assert(resource); - assert(level <= resource->last_level); + assert(sr.level <= resource->last_level); /* make sure the requested region is in the image bounds */ assert(box->x + box->width <= u_minify(resource->width0, sr.level)); @@ -612,6 +612,24 @@ cell_user_buffer_create(struct pipe_screen *screen, } +static struct pipe_resource * +cell_resource_from_handle(struct pipe_screen *screen, + const struct pipe_resource *templat, + struct winsys_handle *handle) +{ + /* XXX todo */ + return NULL; +} + + +static boolean +cell_resource_get_handle(struct pipe_screen *scree, + struct pipe_resource *tex, + struct winsys_handle *handle) +{ + /* XXX todo */ + return FALSE; +} void @@ -630,7 +648,7 @@ cell_init_screen_texture_funcs(struct pipe_screen *screen) } void -cell_init_transfer_funcs(struct cell_context *cell) +cell_init_texture_transfer_funcs(struct cell_context *cell) { cell->pipe.get_transfer = cell_get_transfer; cell->pipe.transfer_destroy = cell_transfer_destroy; diff --git a/src/gallium/drivers/cell/ppu/cell_vbuf.c b/src/gallium/drivers/cell/ppu/cell_vbuf.c index cfaffb52a85..37b71956482 100644 --- a/src/gallium/drivers/cell/ppu/cell_vbuf.c +++ b/src/gallium/drivers/cell/ppu/cell_vbuf.c @@ -165,9 +165,9 @@ cell_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim) static void -cell_vbuf_draw(struct vbuf_render *vbr, - const ushort *indices, - uint nr_indices) +cell_vbuf_draw_elements(struct vbuf_render *vbr, + const ushort *indices, + uint nr_indices) { struct cell_vbuf_render *cvbr = cell_vbuf_render(vbr); struct cell_context *cell = cvbr->cell; @@ -319,7 +319,7 @@ cell_init_vbuf(struct cell_context *cell) cell->vbuf_render->base.map_vertices = cell_vbuf_map_vertices; cell->vbuf_render->base.unmap_vertices = cell_vbuf_unmap_vertices; cell->vbuf_render->base.set_primitive = cell_vbuf_set_primitive; - cell->vbuf_render->base.draw = cell_vbuf_draw; + cell->vbuf_render->base.draw_elements = cell_vbuf_draw_elements; cell->vbuf_render->base.release_vertices = cell_vbuf_release_vertices; cell->vbuf_render->base.destroy = cell_vbuf_destroy; |