Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2010 Jerome Glisse <glisse@freedesktop.org> |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * on the rights to use, copy, modify, merge, publish, distribute, sub |
| 8 | * license, and/or sell copies of the Software, and to permit persons to whom |
| 9 | * the Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, |
| 19 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 20 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
| 21 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | #include <stdio.h> |
| 24 | #include <errno.h> |
| 25 | #include <pipe/p_defines.h> |
| 26 | #include <pipe/p_state.h> |
| 27 | #include <pipe/p_context.h> |
| 28 | #include <tgsi/tgsi_scan.h> |
| 29 | #include <tgsi/tgsi_parse.h> |
| 30 | #include <tgsi/tgsi_util.h> |
| 31 | #include <util/u_blitter.h> |
| 32 | #include <util/u_double_list.h> |
Marcin Slusarz | b5dfc38 | 2011-04-16 22:15:52 +0200 | [diff] [blame] | 33 | #include "util/u_format.h" |
Dave Airlie | 8e04379 | 2011-02-11 13:42:52 +1000 | [diff] [blame] | 34 | #include <util/u_format_s3tc.h> |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 35 | #include <util/u_transfer.h> |
| 36 | #include <util/u_surface.h> |
| 37 | #include <util/u_pack_color.h> |
| 38 | #include <util/u_memory.h> |
| 39 | #include <util/u_inlines.h> |
Marek Olšák | 02f8f13 | 2011-01-28 03:03:38 +0100 | [diff] [blame] | 40 | #include "util/u_upload_mgr.h" |
Fredrik Höglund | 948e1eb | 2011-03-29 19:43:59 +0200 | [diff] [blame] | 41 | #include "os/os_time.h" |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 42 | #include <pipebuffer/pb_buffer.h> |
| 43 | #include "r600.h" |
| 44 | #include "r600d.h" |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 45 | #include "r600_resource.h" |
| 46 | #include "r600_shader.h" |
| 47 | #include "r600_pipe.h" |
| 48 | #include "r600_state_inlines.h" |
| 49 | |
| 50 | /* |
| 51 | * pipe_context |
| 52 | */ |
Fredrik Höglund | 948e1eb | 2011-03-29 19:43:59 +0200 | [diff] [blame] | 53 | static struct r600_fence *r600_create_fence(struct r600_pipe_context *ctx) |
| 54 | { |
| 55 | struct r600_fence *fence = NULL; |
| 56 | |
| 57 | if (!ctx->fences.bo) { |
| 58 | /* Create the shared buffer object */ |
| 59 | ctx->fences.bo = r600_bo(ctx->radeon, 4096, 0, 0, 0); |
| 60 | if (!ctx->fences.bo) { |
| 61 | R600_ERR("r600: failed to create bo for fence objects\n"); |
| 62 | return NULL; |
| 63 | } |
| 64 | ctx->fences.data = r600_bo_map(ctx->radeon, ctx->fences.bo, PB_USAGE_UNSYNCHRONIZED, NULL); |
| 65 | } |
| 66 | |
| 67 | if (!LIST_IS_EMPTY(&ctx->fences.pool)) { |
| 68 | struct r600_fence *entry; |
| 69 | |
| 70 | /* Try to find a freed fence that has been signalled */ |
| 71 | LIST_FOR_EACH_ENTRY(entry, &ctx->fences.pool, head) { |
| 72 | if (ctx->fences.data[entry->index] != 0) { |
| 73 | LIST_DELINIT(&entry->head); |
| 74 | fence = entry; |
| 75 | break; |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | if (!fence) { |
| 81 | /* Allocate a new fence */ |
| 82 | struct r600_fence_block *block; |
| 83 | unsigned index; |
| 84 | |
| 85 | if ((ctx->fences.next_index + 1) >= 1024) { |
| 86 | R600_ERR("r600: too many concurrent fences\n"); |
| 87 | return NULL; |
| 88 | } |
| 89 | |
| 90 | index = ctx->fences.next_index++; |
| 91 | |
| 92 | if (!(index % FENCE_BLOCK_SIZE)) { |
| 93 | /* Allocate a new block */ |
| 94 | block = CALLOC_STRUCT(r600_fence_block); |
| 95 | if (block == NULL) |
| 96 | return NULL; |
| 97 | |
| 98 | LIST_ADD(&block->head, &ctx->fences.blocks); |
| 99 | } else { |
| 100 | block = LIST_ENTRY(struct r600_fence_block, ctx->fences.blocks.next, head); |
| 101 | } |
| 102 | |
| 103 | fence = &block->fences[index % FENCE_BLOCK_SIZE]; |
| 104 | fence->ctx = ctx; |
| 105 | fence->index = index; |
| 106 | } |
| 107 | |
| 108 | pipe_reference_init(&fence->reference, 1); |
| 109 | |
| 110 | ctx->fences.data[fence->index] = 0; |
| 111 | r600_context_emit_fence(&ctx->ctx, ctx->fences.bo, fence->index, 1); |
| 112 | return fence; |
| 113 | } |
| 114 | |
Marek Olšák | 7e02303 | 2011-03-08 00:57:48 +0100 | [diff] [blame] | 115 | static void r600_flush(struct pipe_context *ctx, |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 116 | struct pipe_fence_handle **fence) |
| 117 | { |
| 118 | struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; |
Fredrik Höglund | 948e1eb | 2011-03-29 19:43:59 +0200 | [diff] [blame] | 119 | struct r600_fence **rfence = (struct r600_fence**)fence; |
| 120 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 121 | #if 0 |
| 122 | static int dc = 0; |
| 123 | char dname[256]; |
| 124 | #endif |
| 125 | |
Fredrik Höglund | 948e1eb | 2011-03-29 19:43:59 +0200 | [diff] [blame] | 126 | if (rfence) |
| 127 | *rfence = r600_create_fence(rctx); |
| 128 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 129 | if (!rctx->ctx.pm4_cdwords) |
| 130 | return; |
| 131 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 132 | #if 0 |
| 133 | sprintf(dname, "gallium-%08d.bof", dc); |
| 134 | if (dc < 20) { |
| 135 | r600_context_dump_bof(&rctx->ctx, dname); |
| 136 | R600_ERR("dumped %s\n", dname); |
| 137 | } |
| 138 | dc++; |
| 139 | #endif |
| 140 | r600_context_flush(&rctx->ctx); |
| 141 | } |
| 142 | |
Jerome Glisse | c33e091 | 2011-02-28 13:33:13 -0500 | [diff] [blame] | 143 | static void r600_update_num_contexts(struct r600_screen *rscreen, int diff) |
Marek Olšák | f0b202e | 2011-02-08 17:30:39 +0100 | [diff] [blame] | 144 | { |
| 145 | pipe_mutex_lock(rscreen->mutex_num_contexts); |
| 146 | if (diff > 0) { |
| 147 | rscreen->num_contexts++; |
| 148 | |
| 149 | if (rscreen->num_contexts > 1) |
| 150 | util_slab_set_thread_safety(&rscreen->pool_buffers, |
| 151 | UTIL_SLAB_MULTITHREADED); |
| 152 | } else { |
| 153 | rscreen->num_contexts--; |
| 154 | |
| 155 | if (rscreen->num_contexts <= 1) |
| 156 | util_slab_set_thread_safety(&rscreen->pool_buffers, |
| 157 | UTIL_SLAB_SINGLETHREADED); |
| 158 | } |
| 159 | pipe_mutex_unlock(rscreen->mutex_num_contexts); |
| 160 | } |
| 161 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 162 | static void r600_destroy_context(struct pipe_context *context) |
| 163 | { |
| 164 | struct r600_pipe_context *rctx = (struct r600_pipe_context *)context; |
| 165 | |
Tilman Sauerbeck | ecb1b8b | 2010-10-31 12:16:03 +0100 | [diff] [blame] | 166 | rctx->context.delete_depth_stencil_alpha_state(&rctx->context, rctx->custom_dsa_flush); |
Henri Verbeet | 09eff39 | 2011-04-07 22:21:20 +0200 | [diff] [blame] | 167 | util_unreference_framebuffer_state(&rctx->framebuffer); |
Tilman Sauerbeck | ecb1b8b | 2010-10-31 12:16:03 +0100 | [diff] [blame] | 168 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 169 | r600_context_fini(&rctx->ctx); |
José Fonseca | 01b39b0 | 2010-11-03 20:22:28 +0000 | [diff] [blame] | 170 | |
| 171 | util_blitter_destroy(rctx->blitter); |
| 172 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 173 | for (int i = 0; i < R600_PIPE_NSTATES; i++) { |
| 174 | free(rctx->states[i]); |
| 175 | } |
| 176 | |
Marek Olšák | aa8a222 | 2011-02-07 02:00:56 +0100 | [diff] [blame] | 177 | u_vbuf_mgr_destroy(rctx->vbuf_mgr); |
Marek Olšák | f0b202e | 2011-02-08 17:30:39 +0100 | [diff] [blame] | 178 | util_slab_destroy(&rctx->pool_transfers); |
| 179 | |
Fredrik Höglund | 948e1eb | 2011-03-29 19:43:59 +0200 | [diff] [blame] | 180 | if (rctx->fences.bo) { |
| 181 | struct r600_fence_block *entry, *tmp; |
| 182 | |
| 183 | LIST_FOR_EACH_ENTRY_SAFE(entry, tmp, &rctx->fences.blocks, head) { |
| 184 | LIST_DEL(&entry->head); |
| 185 | FREE(entry); |
| 186 | } |
| 187 | |
| 188 | r600_bo_unmap(rctx->radeon, rctx->fences.bo); |
| 189 | r600_bo_reference(rctx->radeon, &rctx->fences.bo, NULL); |
| 190 | } |
| 191 | |
Marek Olšák | f0b202e | 2011-02-08 17:30:39 +0100 | [diff] [blame] | 192 | r600_update_num_contexts(rctx->screen, -1); |
Dave Airlie | e68c83a | 2010-10-21 17:34:25 +1000 | [diff] [blame] | 193 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 194 | FREE(rctx); |
| 195 | } |
| 196 | |
Dave Airlie | dbcd652 | 2010-09-30 09:07:07 +1000 | [diff] [blame] | 197 | static struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv) |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 198 | { |
| 199 | struct r600_pipe_context *rctx = CALLOC_STRUCT(r600_pipe_context); |
| 200 | struct r600_screen* rscreen = (struct r600_screen *)screen; |
Dave Airlie | 084c29b | 2010-10-01 10:13:04 +1000 | [diff] [blame] | 201 | enum chip_class class; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 202 | |
| 203 | if (rctx == NULL) |
| 204 | return NULL; |
Marek Olšák | f0b202e | 2011-02-08 17:30:39 +0100 | [diff] [blame] | 205 | |
| 206 | r600_update_num_contexts(rscreen, 1); |
| 207 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 208 | rctx->context.winsys = rscreen->screen.winsys; |
| 209 | rctx->context.screen = screen; |
| 210 | rctx->context.priv = priv; |
| 211 | rctx->context.destroy = r600_destroy_context; |
Dave Airlie | dbcd652 | 2010-09-30 09:07:07 +1000 | [diff] [blame] | 212 | rctx->context.flush = r600_flush; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 213 | |
| 214 | /* Easy accessing of screen/winsys. */ |
| 215 | rctx->screen = rscreen; |
| 216 | rctx->radeon = rscreen->radeon; |
| 217 | rctx->family = r600_get_family(rctx->radeon); |
| 218 | |
Fredrik Höglund | 948e1eb | 2011-03-29 19:43:59 +0200 | [diff] [blame] | 219 | rctx->fences.bo = NULL; |
| 220 | rctx->fences.data = NULL; |
| 221 | rctx->fences.next_index = 0; |
| 222 | LIST_INITHEAD(&rctx->fences.pool); |
| 223 | LIST_INITHEAD(&rctx->fences.blocks); |
| 224 | |
Dave Airlie | dbcd652 | 2010-09-30 09:07:07 +1000 | [diff] [blame] | 225 | r600_init_blit_functions(rctx); |
Jerome Glisse | 6abd777 | 2010-09-29 15:39:40 -0400 | [diff] [blame] | 226 | r600_init_query_functions(rctx); |
Dave Airlie | dbcd652 | 2010-09-30 09:07:07 +1000 | [diff] [blame] | 227 | r600_init_context_resource_functions(rctx); |
Roland Scheidegger | 4c70014 | 2010-12-02 04:33:43 +0100 | [diff] [blame] | 228 | r600_init_surface_functions(rctx); |
Marek Olšák | 2d7738e | 2011-01-28 22:17:41 +0100 | [diff] [blame] | 229 | rctx->context.draw_vbo = r600_draw_vbo; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 230 | |
| 231 | switch (r600_get_family(rctx->radeon)) { |
| 232 | case CHIP_R600: |
| 233 | case CHIP_RV610: |
| 234 | case CHIP_RV630: |
| 235 | case CHIP_RV670: |
| 236 | case CHIP_RV620: |
| 237 | case CHIP_RV635: |
| 238 | case CHIP_RS780: |
| 239 | case CHIP_RS880: |
| 240 | case CHIP_RV770: |
| 241 | case CHIP_RV730: |
| 242 | case CHIP_RV710: |
| 243 | case CHIP_RV740: |
Dave Airlie | dbcd652 | 2010-09-30 09:07:07 +1000 | [diff] [blame] | 244 | r600_init_state_functions(rctx); |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 245 | if (r600_context_init(&rctx->ctx, rctx->radeon)) { |
| 246 | r600_destroy_context(&rctx->context); |
| 247 | return NULL; |
| 248 | } |
Dave Airlie | dbcd652 | 2010-09-30 09:07:07 +1000 | [diff] [blame] | 249 | r600_init_config(rctx); |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 250 | break; |
| 251 | case CHIP_CEDAR: |
| 252 | case CHIP_REDWOOD: |
| 253 | case CHIP_JUNIPER: |
| 254 | case CHIP_CYPRESS: |
| 255 | case CHIP_HEMLOCK: |
Alex Deucher | 0e4c5f6 | 2010-11-22 17:47:24 -0500 | [diff] [blame] | 256 | case CHIP_PALM: |
Alex Deucher | 414cd5d | 2011-04-04 12:06:11 -0400 | [diff] [blame] | 257 | case CHIP_SUMO: |
| 258 | case CHIP_SUMO2: |
Alex Deucher | f54366b | 2011-01-06 18:05:16 -0500 | [diff] [blame] | 259 | case CHIP_BARTS: |
| 260 | case CHIP_TURKS: |
| 261 | case CHIP_CAICOS: |
Dave Airlie | 7779f6d | 2011-03-10 12:54:13 +1000 | [diff] [blame] | 262 | case CHIP_CAYMAN: |
Dave Airlie | dbcd652 | 2010-09-30 09:07:07 +1000 | [diff] [blame] | 263 | evergreen_init_state_functions(rctx); |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 264 | if (evergreen_context_init(&rctx->ctx, rctx->radeon)) { |
| 265 | r600_destroy_context(&rctx->context); |
| 266 | return NULL; |
| 267 | } |
Dave Airlie | dbcd652 | 2010-09-30 09:07:07 +1000 | [diff] [blame] | 268 | evergreen_init_config(rctx); |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 269 | break; |
| 270 | default: |
| 271 | R600_ERR("unsupported family %d\n", r600_get_family(rctx->radeon)); |
| 272 | r600_destroy_context(&rctx->context); |
| 273 | return NULL; |
| 274 | } |
| 275 | |
Marek Olšák | f0b202e | 2011-02-08 17:30:39 +0100 | [diff] [blame] | 276 | util_slab_create(&rctx->pool_transfers, |
| 277 | sizeof(struct pipe_transfer), 64, |
| 278 | UTIL_SLAB_SINGLETHREADED); |
| 279 | |
Marek Olšák | 467023e | 2011-02-08 15:21:35 +0100 | [diff] [blame] | 280 | rctx->vbuf_mgr = u_vbuf_mgr_create(&rctx->context, 1024 * 1024, 256, |
| 281 | PIPE_BIND_VERTEX_BUFFER | |
| 282 | PIPE_BIND_INDEX_BUFFER | |
| 283 | PIPE_BIND_CONSTANT_BUFFER, |
Fabian Bieler | 0ed5bf6 | 2011-02-14 22:44:42 +0100 | [diff] [blame] | 284 | U_VERTEX_FETCH_DWORD_ALIGNED); |
Marek Olšák | aa8a222 | 2011-02-07 02:00:56 +0100 | [diff] [blame] | 285 | if (!rctx->vbuf_mgr) { |
| 286 | r600_destroy_context(&rctx->context); |
| 287 | return NULL; |
| 288 | } |
| 289 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 290 | rctx->blitter = util_blitter_create(&rctx->context); |
| 291 | if (rctx->blitter == NULL) { |
Marek Olšák | f0b202e | 2011-02-08 17:30:39 +0100 | [diff] [blame] | 292 | r600_destroy_context(&rctx->context); |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 293 | return NULL; |
| 294 | } |
| 295 | |
Dave Airlie | 084c29b | 2010-10-01 10:13:04 +1000 | [diff] [blame] | 296 | class = r600_get_family_class(rctx->radeon); |
| 297 | if (class == R600 || class == R700) |
| 298 | rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx); |
| 299 | else |
| 300 | rctx->custom_dsa_flush = evergreen_create_db_flush_dsa(rctx); |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 301 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 302 | return &rctx->context; |
| 303 | } |
| 304 | |
| 305 | /* |
| 306 | * pipe_screen |
| 307 | */ |
| 308 | static const char* r600_get_vendor(struct pipe_screen* pscreen) |
| 309 | { |
| 310 | return "X.Org"; |
| 311 | } |
| 312 | |
Dave Airlie | 4378c17 | 2010-09-30 09:17:20 +1000 | [diff] [blame] | 313 | static const char *r600_get_family_name(enum radeon_family family) |
| 314 | { |
| 315 | switch(family) { |
Henri Verbeet | 9f06411 | 2010-11-07 18:40:12 +0100 | [diff] [blame] | 316 | case CHIP_R600: return "AMD R600"; |
| 317 | case CHIP_RV610: return "AMD RV610"; |
| 318 | case CHIP_RV630: return "AMD RV630"; |
| 319 | case CHIP_RV670: return "AMD RV670"; |
| 320 | case CHIP_RV620: return "AMD RV620"; |
| 321 | case CHIP_RV635: return "AMD RV635"; |
| 322 | case CHIP_RS780: return "AMD RS780"; |
| 323 | case CHIP_RS880: return "AMD RS880"; |
| 324 | case CHIP_RV770: return "AMD RV770"; |
| 325 | case CHIP_RV730: return "AMD RV730"; |
| 326 | case CHIP_RV710: return "AMD RV710"; |
| 327 | case CHIP_RV740: return "AMD RV740"; |
| 328 | case CHIP_CEDAR: return "AMD CEDAR"; |
| 329 | case CHIP_REDWOOD: return "AMD REDWOOD"; |
| 330 | case CHIP_JUNIPER: return "AMD JUNIPER"; |
| 331 | case CHIP_CYPRESS: return "AMD CYPRESS"; |
| 332 | case CHIP_HEMLOCK: return "AMD HEMLOCK"; |
Alex Deucher | 0e4c5f6 | 2010-11-22 17:47:24 -0500 | [diff] [blame] | 333 | case CHIP_PALM: return "AMD PALM"; |
Alex Deucher | 414cd5d | 2011-04-04 12:06:11 -0400 | [diff] [blame] | 334 | case CHIP_SUMO: return "AMD SUMO"; |
| 335 | case CHIP_SUMO2: return "AMD SUMO2"; |
Alex Deucher | f54366b | 2011-01-06 18:05:16 -0500 | [diff] [blame] | 336 | case CHIP_BARTS: return "AMD BARTS"; |
| 337 | case CHIP_TURKS: return "AMD TURKS"; |
| 338 | case CHIP_CAICOS: return "AMD CAICOS"; |
Dave Airlie | 7779f6d | 2011-03-10 12:54:13 +1000 | [diff] [blame] | 339 | case CHIP_CAYMAN: return "AMD CAYMAN"; |
Henri Verbeet | 9f06411 | 2010-11-07 18:40:12 +0100 | [diff] [blame] | 340 | default: return "AMD unknown"; |
Dave Airlie | 4378c17 | 2010-09-30 09:17:20 +1000 | [diff] [blame] | 341 | } |
| 342 | } |
| 343 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 344 | static const char* r600_get_name(struct pipe_screen* pscreen) |
| 345 | { |
| 346 | struct r600_screen *rscreen = (struct r600_screen *)pscreen; |
| 347 | enum radeon_family family = r600_get_family(rscreen->radeon); |
| 348 | |
Dave Airlie | 4378c17 | 2010-09-30 09:17:20 +1000 | [diff] [blame] | 349 | return r600_get_family_name(family); |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 350 | } |
| 351 | |
| 352 | static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) |
| 353 | { |
Alex Deucher | fae7cb8 | 2010-12-02 16:09:22 -0500 | [diff] [blame] | 354 | struct r600_screen *rscreen = (struct r600_screen *)pscreen; |
| 355 | enum radeon_family family = r600_get_family(rscreen->radeon); |
| 356 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 357 | switch (param) { |
| 358 | /* Supported features (boolean caps). */ |
| 359 | case PIPE_CAP_NPOT_TEXTURES: |
| 360 | case PIPE_CAP_TWO_SIDED_STENCIL: |
| 361 | case PIPE_CAP_GLSL: |
| 362 | case PIPE_CAP_DUAL_SOURCE_BLEND: |
| 363 | case PIPE_CAP_ANISOTROPIC_FILTER: |
| 364 | case PIPE_CAP_POINT_SPRITE: |
| 365 | case PIPE_CAP_OCCLUSION_QUERY: |
| 366 | case PIPE_CAP_TEXTURE_SHADOW_MAP: |
| 367 | case PIPE_CAP_TEXTURE_MIRROR_CLAMP: |
| 368 | case PIPE_CAP_TEXTURE_MIRROR_REPEAT: |
| 369 | case PIPE_CAP_BLEND_EQUATION_SEPARATE: |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 370 | case PIPE_CAP_TEXTURE_SWIZZLE: |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 371 | case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: |
| 372 | case PIPE_CAP_DEPTH_CLAMP: |
Dave Airlie | 39d1feb | 2010-10-06 10:14:33 +1000 | [diff] [blame] | 373 | case PIPE_CAP_SHADER_STENCIL_EXPORT: |
Marek Olšák | 95c7881 | 2011-03-05 16:06:10 +0100 | [diff] [blame] | 374 | case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: |
Marek Olšák | 4a7f013 | 2011-03-29 18:18:05 +0200 | [diff] [blame] | 375 | case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: |
Marek Olšák | 93754d8 | 2011-05-03 11:54:40 +0200 | [diff] [blame] | 376 | case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT: |
| 377 | case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: |
Dave Airlie | 13c9a85 | 2011-06-15 15:15:41 +1000 | [diff] [blame] | 378 | case PIPE_CAP_SM3: |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 379 | return 1; |
Marek Olšák | 93754d8 | 2011-05-03 11:54:40 +0200 | [diff] [blame] | 380 | |
| 381 | /* Supported except the original R600. */ |
Alex Deucher | d6fea4a | 2011-03-14 17:47:21 -0400 | [diff] [blame] | 382 | case PIPE_CAP_INDEP_BLEND_ENABLE: |
Dave Airlie | de48199 | 2011-04-25 06:55:09 +1000 | [diff] [blame] | 383 | case PIPE_CAP_INDEP_BLEND_FUNC: |
Alex Deucher | d6fea4a | 2011-03-14 17:47:21 -0400 | [diff] [blame] | 384 | /* R600 doesn't support per-MRT blends */ |
Marek Olšák | 93754d8 | 2011-05-03 11:54:40 +0200 | [diff] [blame] | 385 | return family == CHIP_R600 ? 0 : 1; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 386 | |
Marek Olšák | d931b0d | 2011-05-02 02:38:20 +0200 | [diff] [blame] | 387 | /* Supported on Evergreen. */ |
| 388 | case PIPE_CAP_SEAMLESS_CUBE_MAP: |
| 389 | case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE: |
| 390 | return family >= CHIP_CEDAR ? 1 : 0; |
| 391 | |
Marek Olšák | 93754d8 | 2011-05-03 11:54:40 +0200 | [diff] [blame] | 392 | /* Unsupported features. */ |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 393 | case PIPE_CAP_STREAM_OUTPUT: |
Tilman Sauerbeck | c49dcae | 2010-10-30 17:32:24 +0200 | [diff] [blame] | 394 | case PIPE_CAP_PRIMITIVE_RESTART: |
Marek Olšák | 5c477ab | 2011-04-11 14:37:58 +0200 | [diff] [blame] | 395 | case PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL: |
Marek Olšák | 93754d8 | 2011-05-03 11:54:40 +0200 | [diff] [blame] | 396 | case PIPE_CAP_TGSI_INSTANCEID: |
| 397 | case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: |
| 398 | case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: |
| 399 | return 0; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 400 | |
Dave Airlie | 69d969e | 2011-02-17 15:07:57 +1000 | [diff] [blame] | 401 | case PIPE_CAP_ARRAY_TEXTURES: |
| 402 | /* fix once the CS checker upstream is fixed */ |
| 403 | return debug_get_bool_option("R600_ARRAY_TEXTURE", FALSE); |
| 404 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 405 | /* Texturing. */ |
| 406 | case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: |
| 407 | case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: |
| 408 | case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: |
Alex Deucher | fae7cb8 | 2010-12-02 16:09:22 -0500 | [diff] [blame] | 409 | if (family >= CHIP_CEDAR) |
| 410 | return 15; |
| 411 | else |
| 412 | return 14; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 413 | case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 414 | case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 415 | return 16; |
Marek Olšák | 320adb9 | 2011-05-03 11:54:07 +0200 | [diff] [blame] | 416 | case PIPE_CAP_MAX_COMBINED_SAMPLERS: |
| 417 | return 32; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 418 | |
| 419 | /* Render targets. */ |
| 420 | case PIPE_CAP_MAX_RENDER_TARGETS: |
| 421 | /* FIXME some r6xx are buggy and can only do 4 */ |
| 422 | return 8; |
| 423 | |
Mathias Fröhlich | 90c2fd8 | 2011-01-23 22:35:13 +0100 | [diff] [blame] | 424 | /* Timer queries, present when the clock frequency is non zero. */ |
| 425 | case PIPE_CAP_TIMER_QUERY: |
| 426 | return r600_get_clock_crystal_freq(rscreen->radeon) != 0; |
| 427 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 428 | default: |
| 429 | R600_ERR("r600: unknown param %d\n", param); |
| 430 | return 0; |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | static float r600_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param) |
| 435 | { |
Alex Deucher | fae7cb8 | 2010-12-02 16:09:22 -0500 | [diff] [blame] | 436 | struct r600_screen *rscreen = (struct r600_screen *)pscreen; |
| 437 | enum radeon_family family = r600_get_family(rscreen->radeon); |
| 438 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 439 | switch (param) { |
| 440 | case PIPE_CAP_MAX_LINE_WIDTH: |
| 441 | case PIPE_CAP_MAX_LINE_WIDTH_AA: |
| 442 | case PIPE_CAP_MAX_POINT_WIDTH: |
| 443 | case PIPE_CAP_MAX_POINT_WIDTH_AA: |
Alex Deucher | fae7cb8 | 2010-12-02 16:09:22 -0500 | [diff] [blame] | 444 | if (family >= CHIP_CEDAR) |
| 445 | return 16384.0f; |
| 446 | else |
| 447 | return 8192.0f; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 448 | case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: |
| 449 | return 16.0f; |
| 450 | case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: |
| 451 | return 16.0f; |
| 452 | default: |
| 453 | R600_ERR("r600: unsupported paramf %d\n", param); |
| 454 | return 0.0f; |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param) |
| 459 | { |
| 460 | switch(shader) |
| 461 | { |
| 462 | case PIPE_SHADER_FRAGMENT: |
| 463 | case PIPE_SHADER_VERTEX: |
| 464 | break; |
| 465 | case PIPE_SHADER_GEOMETRY: |
| 466 | /* TODO: support and enable geometry programs */ |
| 467 | return 0; |
| 468 | default: |
| 469 | /* TODO: support tessellation on Evergreen */ |
| 470 | return 0; |
| 471 | } |
| 472 | |
| 473 | /* TODO: all these should be fixed, since r600 surely supports much more! */ |
| 474 | switch (param) { |
| 475 | case PIPE_SHADER_CAP_MAX_INSTRUCTIONS: |
| 476 | case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS: |
| 477 | case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS: |
| 478 | case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS: |
| 479 | return 16384; |
| 480 | case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: |
| 481 | return 8; /* FIXME */ |
| 482 | case PIPE_SHADER_CAP_MAX_INPUTS: |
| 483 | if(shader == PIPE_SHADER_FRAGMENT) |
| 484 | return 10; |
| 485 | else |
| 486 | return 16; |
| 487 | case PIPE_SHADER_CAP_MAX_TEMPS: |
Henri Verbeet | b2a98c3 | 2011-04-25 13:28:55 +0200 | [diff] [blame] | 488 | return 256; /* Max native temporaries. */ |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 489 | case PIPE_SHADER_CAP_MAX_ADDRS: |
Henri Verbeet | b2a98c3 | 2011-04-25 13:28:55 +0200 | [diff] [blame] | 490 | /* FIXME Isn't this equal to TEMPS? */ |
| 491 | return 1; /* Max native address registers */ |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 492 | case PIPE_SHADER_CAP_MAX_CONSTS: |
Henri Verbeet | eac5029 | 2011-03-07 21:15:03 +0100 | [diff] [blame] | 493 | return R600_MAX_CONST_BUFFER_SIZE; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 494 | case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: |
Henri Verbeet | 077c448 | 2011-02-07 15:22:08 +0100 | [diff] [blame] | 495 | return R600_MAX_CONST_BUFFERS; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 496 | case PIPE_SHADER_CAP_MAX_PREDS: |
| 497 | return 0; /* FIXME */ |
| 498 | case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED: |
| 499 | return 1; |
Marek Olšák | 5c7127c | 2010-11-12 03:07:05 +0100 | [diff] [blame] | 500 | case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR: |
| 501 | case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR: |
| 502 | case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR: |
| 503 | case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR: |
| 504 | return 1; |
Marek Olšák | 9aa089e | 2010-11-14 15:34:59 +0100 | [diff] [blame] | 505 | case PIPE_SHADER_CAP_SUBROUTINES: |
| 506 | return 0; |
Bryan Cain | 17b695e | 2011-05-05 21:10:28 -0500 | [diff] [blame^] | 507 | case PIPE_SHADER_CAP_INTEGERS: |
| 508 | return 0; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 509 | default: |
| 510 | return 0; |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | static boolean r600_is_format_supported(struct pipe_screen* screen, |
| 515 | enum pipe_format format, |
| 516 | enum pipe_texture_target target, |
| 517 | unsigned sample_count, |
Marek Olšák | e968975 | 2011-03-08 00:01:58 +0100 | [diff] [blame] | 518 | unsigned usage) |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 519 | { |
| 520 | unsigned retval = 0; |
| 521 | if (target >= PIPE_MAX_TEXTURE_TYPES) { |
| 522 | R600_ERR("r600: unsupported texture type %d\n", target); |
| 523 | return FALSE; |
| 524 | } |
| 525 | |
Marek Olšák | 75fa5c9 | 2011-04-11 06:23:00 +0200 | [diff] [blame] | 526 | if (!util_format_is_supported(format, usage)) |
| 527 | return FALSE; |
| 528 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 529 | /* Multisample */ |
| 530 | if (sample_count > 1) |
| 531 | return FALSE; |
| 532 | |
| 533 | if ((usage & PIPE_BIND_SAMPLER_VIEW) && |
Dave Airlie | 929be6e | 2011-03-01 14:55:35 +1000 | [diff] [blame] | 534 | r600_is_sampler_format_supported(screen, format)) { |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 535 | retval |= PIPE_BIND_SAMPLER_VIEW; |
| 536 | } |
| 537 | |
| 538 | if ((usage & (PIPE_BIND_RENDER_TARGET | |
Jerome Glisse | 119f006 | 2010-12-03 12:56:51 -0500 | [diff] [blame] | 539 | PIPE_BIND_DISPLAY_TARGET | |
| 540 | PIPE_BIND_SCANOUT | |
| 541 | PIPE_BIND_SHARED)) && |
Jerome Glisse | 7ffd4e9 | 2010-11-17 17:20:59 -0500 | [diff] [blame] | 542 | r600_is_colorbuffer_format_supported(format)) { |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 543 | retval |= usage & |
| 544 | (PIPE_BIND_RENDER_TARGET | |
| 545 | PIPE_BIND_DISPLAY_TARGET | |
| 546 | PIPE_BIND_SCANOUT | |
| 547 | PIPE_BIND_SHARED); |
| 548 | } |
| 549 | |
| 550 | if ((usage & PIPE_BIND_DEPTH_STENCIL) && |
| 551 | r600_is_zs_format_supported(format)) { |
| 552 | retval |= PIPE_BIND_DEPTH_STENCIL; |
| 553 | } |
| 554 | |
Marek Olšák | a22bda9 | 2011-02-07 03:46:25 +0100 | [diff] [blame] | 555 | if (usage & PIPE_BIND_VERTEX_BUFFER) { |
| 556 | struct r600_screen *rscreen = (struct r600_screen *)screen; |
| 557 | enum radeon_family family = r600_get_family(rscreen->radeon); |
| 558 | |
| 559 | if (r600_is_vertex_format_supported(format, family)) { |
| 560 | retval |= PIPE_BIND_VERTEX_BUFFER; |
| 561 | } |
| 562 | } |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 563 | |
| 564 | if (usage & PIPE_BIND_TRANSFER_READ) |
| 565 | retval |= PIPE_BIND_TRANSFER_READ; |
| 566 | if (usage & PIPE_BIND_TRANSFER_WRITE) |
| 567 | retval |= PIPE_BIND_TRANSFER_WRITE; |
| 568 | |
| 569 | return retval == usage; |
| 570 | } |
| 571 | |
| 572 | static void r600_destroy_screen(struct pipe_screen* pscreen) |
| 573 | { |
| 574 | struct r600_screen *rscreen = (struct r600_screen *)pscreen; |
| 575 | |
| 576 | if (rscreen == NULL) |
| 577 | return; |
Tilman Sauerbeck | 52ba68d | 2010-10-31 15:51:55 +0100 | [diff] [blame] | 578 | |
| 579 | radeon_decref(rscreen->radeon); |
| 580 | |
Marek Olšák | f0b202e | 2011-02-08 17:30:39 +0100 | [diff] [blame] | 581 | util_slab_destroy(&rscreen->pool_buffers); |
| 582 | pipe_mutex_destroy(rscreen->mutex_num_contexts); |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 583 | FREE(rscreen); |
| 584 | } |
| 585 | |
Fredrik Höglund | 948e1eb | 2011-03-29 19:43:59 +0200 | [diff] [blame] | 586 | static void r600_fence_reference(struct pipe_screen *pscreen, |
| 587 | struct pipe_fence_handle **ptr, |
| 588 | struct pipe_fence_handle *fence) |
| 589 | { |
| 590 | struct r600_fence **oldf = (struct r600_fence**)ptr; |
| 591 | struct r600_fence *newf = (struct r600_fence*)fence; |
| 592 | |
| 593 | if (pipe_reference(&(*oldf)->reference, &newf->reference)) { |
| 594 | struct r600_pipe_context *ctx = (*oldf)->ctx; |
| 595 | LIST_ADDTAIL(&(*oldf)->head, &ctx->fences.pool); |
| 596 | } |
| 597 | |
| 598 | *ptr = fence; |
| 599 | } |
| 600 | |
| 601 | static boolean r600_fence_signalled(struct pipe_screen *pscreen, |
| 602 | struct pipe_fence_handle *fence) |
| 603 | { |
| 604 | struct r600_fence *rfence = (struct r600_fence*)fence; |
| 605 | struct r600_pipe_context *ctx = rfence->ctx; |
| 606 | |
| 607 | return ctx->fences.data[rfence->index]; |
| 608 | } |
| 609 | |
| 610 | static boolean r600_fence_finish(struct pipe_screen *pscreen, |
| 611 | struct pipe_fence_handle *fence, |
| 612 | uint64_t timeout) |
| 613 | { |
| 614 | struct r600_fence *rfence = (struct r600_fence*)fence; |
| 615 | struct r600_pipe_context *ctx = rfence->ctx; |
| 616 | int64_t start_time = 0; |
| 617 | unsigned spins = 0; |
| 618 | |
| 619 | if (timeout != PIPE_TIMEOUT_INFINITE) { |
| 620 | start_time = os_time_get(); |
| 621 | |
| 622 | /* Convert to microseconds. */ |
| 623 | timeout /= 1000; |
| 624 | } |
| 625 | |
| 626 | while (ctx->fences.data[rfence->index] == 0) { |
| 627 | if (++spins % 256) |
| 628 | continue; |
| 629 | #ifdef PIPE_OS_UNIX |
| 630 | sched_yield(); |
| 631 | #else |
| 632 | os_time_sleep(10); |
| 633 | #endif |
| 634 | if (timeout != PIPE_TIMEOUT_INFINITE && |
| 635 | os_time_get() - start_time >= timeout) { |
| 636 | return FALSE; |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | return TRUE; |
| 641 | } |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 642 | |
Jerome Glisse | 6abd777 | 2010-09-29 15:39:40 -0400 | [diff] [blame] | 643 | struct pipe_screen *r600_screen_create(struct radeon *radeon) |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 644 | { |
| 645 | struct r600_screen *rscreen; |
| 646 | |
| 647 | rscreen = CALLOC_STRUCT(r600_screen); |
| 648 | if (rscreen == NULL) { |
| 649 | return NULL; |
| 650 | } |
| 651 | |
| 652 | rscreen->radeon = radeon; |
| 653 | rscreen->screen.winsys = (struct pipe_winsys*)radeon; |
| 654 | rscreen->screen.destroy = r600_destroy_screen; |
| 655 | rscreen->screen.get_name = r600_get_name; |
| 656 | rscreen->screen.get_vendor = r600_get_vendor; |
| 657 | rscreen->screen.get_param = r600_get_param; |
| 658 | rscreen->screen.get_shader_param = r600_get_shader_param; |
| 659 | rscreen->screen.get_paramf = r600_get_paramf; |
| 660 | rscreen->screen.is_format_supported = r600_is_format_supported; |
Dave Airlie | dbcd652 | 2010-09-30 09:07:07 +1000 | [diff] [blame] | 661 | rscreen->screen.context_create = r600_create_context; |
Fredrik Höglund | 948e1eb | 2011-03-29 19:43:59 +0200 | [diff] [blame] | 662 | rscreen->screen.fence_reference = r600_fence_reference; |
| 663 | rscreen->screen.fence_signalled = r600_fence_signalled; |
| 664 | rscreen->screen.fence_finish = r600_fence_finish; |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 665 | r600_init_screen_resource_functions(&rscreen->screen); |
| 666 | |
Dave Airlie | 7b3fa03 | 2010-10-08 11:56:43 +1000 | [diff] [blame] | 667 | rscreen->tiling_info = r600_get_tiling_info(radeon); |
Dave Airlie | 8e04379 | 2011-02-11 13:42:52 +1000 | [diff] [blame] | 668 | util_format_s3tc_init(); |
Dave Airlie | 7b3fa03 | 2010-10-08 11:56:43 +1000 | [diff] [blame] | 669 | |
Marek Olšák | f0b202e | 2011-02-08 17:30:39 +0100 | [diff] [blame] | 670 | util_slab_create(&rscreen->pool_buffers, |
| 671 | sizeof(struct r600_resource_buffer), 64, |
| 672 | UTIL_SLAB_SINGLETHREADED); |
| 673 | |
| 674 | pipe_mutex_init(rscreen->mutex_num_contexts); |
| 675 | |
Jerome Glisse | 1235bec | 2010-09-29 15:05:19 -0400 | [diff] [blame] | 676 | return &rscreen->screen; |
| 677 | } |