00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00034 #include <stdio.h>
00035
00036 #include "pipe/p_defines.h"
00037 #include "pipe/p_format.h"
00038 #include "util/u_memory.h"
00039 #include "pipe/p_winsys.h"
00040 #include "pipe/p_screen.h"
00041
00042 #include "draw/draw_context.h"
00043 #include "draw/draw_private.h"
00044
00045 #include "cell/common.h"
00046 #include "cell_batch.h"
00047 #include "cell_clear.h"
00048 #include "cell_context.h"
00049 #include "cell_draw_arrays.h"
00050 #include "cell_flush.h"
00051 #include "cell_state.h"
00052 #include "cell_surface.h"
00053 #include "cell_spu.h"
00054 #include "cell_pipe_state.h"
00055 #include "cell_texture.h"
00056 #include "cell_vbuf.h"
00057
00058
00059
00060 static void
00061 cell_destroy_context( struct pipe_context *pipe )
00062 {
00063 struct cell_context *cell = cell_context(pipe);
00064
00065 cell_spu_exit(cell);
00066
00067 align_free(cell);
00068 }
00069
00070
00071 static struct draw_context *
00072 cell_draw_create(struct cell_context *cell)
00073 {
00074 struct draw_context *draw = draw_create();
00075
00076 #if 0
00077 if (getenv("GALLIUM_CELL_VS")) {
00078
00079 draw->shader_queue_flush = cell_vertex_shader_queue_flush;
00080 draw->driver_private = cell;
00081 }
00082 #endif
00083
00084 return draw;
00085 }
00086
00087
00088 #ifdef DEBUG
00089 static const struct debug_named_value cell_debug_flags[] = {
00090 {"checker", CELL_DEBUG_CHECKER},
00091 {"sync", CELL_DEBUG_SYNC},
00092 {NULL, 0}
00093 };
00094 #endif
00095
00096
00097 struct pipe_context *
00098 cell_create_context(struct pipe_screen *screen,
00099 struct cell_winsys *cws)
00100 {
00101 struct cell_context *cell;
00102
00103
00104 cell = (struct cell_context*) align_malloc(sizeof(struct cell_context), 16);
00105 if (!cell)
00106 return NULL;
00107
00108 memset(cell, 0, sizeof(*cell));
00109
00110 cell->winsys = cws;
00111 cell->pipe.winsys = screen->winsys;
00112 cell->pipe.screen = screen;
00113 cell->pipe.destroy = cell_destroy_context;
00114
00115 cell->pipe.clear = cell_clear_surface;
00116 cell->pipe.flush = cell_flush;
00117
00118 #if 0
00119 cell->pipe.begin_query = cell_begin_query;
00120 cell->pipe.end_query = cell_end_query;
00121 cell->pipe.wait_query = cell_wait_query;
00122 #endif
00123
00124 cell_init_draw_functions(cell);
00125 cell_init_state_functions(cell);
00126 cell_init_shader_functions(cell);
00127 cell_init_surface_functions(cell);
00128 cell_init_texture_functions(cell);
00129 cell_init_vertex_functions(cell);
00130
00131 cell->draw = cell_draw_create(cell);
00132
00133 cell_init_vbuf(cell);
00134
00135 draw_set_rasterize_stage(cell->draw, cell->vbuf);
00136
00137
00138 draw_wide_point_threshold(cell->draw, 0.0);
00139 draw_wide_line_threshold(cell->draw, 0.0);
00140
00141
00142 cell->debug_flags = debug_get_flags_option("CELL_DEBUG",
00143 cell_debug_flags,
00144 0 );
00145
00146
00147
00148
00149 cell->num_spus = 6;
00150
00151
00152
00153
00154 cell_start_spus(cell);
00155
00156 cell_init_batch_buffers(cell);
00157
00158 return &cell->pipe;
00159 }