Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [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 | */ |
Marek Olšák | 7209703 | 2014-01-22 18:50:36 +0100 | [diff] [blame] | 23 | |
Andreas Hartmetz | 786af2f | 2014-01-04 18:44:33 +0100 | [diff] [blame] | 24 | #include "si_pipe.h" |
Marek Olšák | 7209703 | 2014-01-22 18:50:36 +0100 | [diff] [blame] | 25 | #include "si_public.h" |
| 26 | |
Christian König | 5b2855b | 2013-04-03 10:18:35 +0200 | [diff] [blame] | 27 | #include "radeon/radeon_uvd.h" |
Marek Olšák | 7209703 | 2014-01-22 18:50:36 +0100 | [diff] [blame] | 28 | #include "util/u_blitter.h" |
| 29 | #include "util/u_memory.h" |
| 30 | #include "util/u_simple_shaders.h" |
| 31 | #include "vl/vl_decoder.h" |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 32 | |
| 33 | /* |
| 34 | * pipe_context |
| 35 | */ |
Andreas Hartmetz | 45578de | 2014-01-07 02:40:22 +0100 | [diff] [blame] | 36 | void si_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence, |
| 37 | unsigned flags) |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 38 | { |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 39 | struct si_context *sctx = (struct si_context *)ctx; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 40 | struct pipe_query *render_cond = NULL; |
Roland Scheidegger | 793e8e3 | 2013-06-14 19:48:57 +0200 | [diff] [blame] | 41 | boolean render_cond_cond = FALSE; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 42 | unsigned render_cond_mode = 0; |
| 43 | |
Marek Olšák | 9807556 | 2013-10-08 21:50:43 +0200 | [diff] [blame] | 44 | if (fence) { |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 45 | *fence = sctx->b.ws->cs_create_fence(sctx->b.rings.gfx.cs); |
Marek Olšák | 9807556 | 2013-10-08 21:50:43 +0200 | [diff] [blame] | 46 | } |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 47 | |
| 48 | /* Disable render condition. */ |
Marek Olšák | 62d55c0 | 2014-01-22 00:06:32 +0100 | [diff] [blame] | 49 | if (sctx->b.current_render_cond) { |
| 50 | render_cond = sctx->b.current_render_cond; |
| 51 | render_cond_cond = sctx->b.current_render_cond_cond; |
| 52 | render_cond_mode = sctx->b.current_render_cond_mode; |
Roland Scheidegger | 793e8e3 | 2013-06-14 19:48:57 +0200 | [diff] [blame] | 53 | ctx->render_condition(ctx, NULL, FALSE, 0); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 54 | } |
| 55 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 56 | si_context_flush(sctx, flags); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 57 | |
| 58 | /* Re-enable render condition. */ |
| 59 | if (render_cond) { |
Roland Scheidegger | 793e8e3 | 2013-06-14 19:48:57 +0200 | [diff] [blame] | 60 | ctx->render_condition(ctx, render_cond, render_cond_cond, render_cond_mode); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 61 | } |
| 62 | } |
| 63 | |
Andreas Hartmetz | eb0ddb6 | 2014-01-07 03:07:55 +0100 | [diff] [blame] | 64 | static void si_flush_from_st(struct pipe_context *ctx, |
| 65 | struct pipe_fence_handle **fence, |
| 66 | unsigned flags) |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 67 | { |
Andreas Hartmetz | 45578de | 2014-01-07 02:40:22 +0100 | [diff] [blame] | 68 | si_flush(ctx, fence, |
| 69 | flags & PIPE_FLUSH_END_OF_FRAME ? RADEON_FLUSH_END_OF_FRAME : 0); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 70 | } |
| 71 | |
Andreas Hartmetz | eb0ddb6 | 2014-01-07 03:07:55 +0100 | [diff] [blame] | 72 | static void si_flush_from_winsys(void *ctx, unsigned flags) |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 73 | { |
Andreas Hartmetz | 45578de | 2014-01-07 02:40:22 +0100 | [diff] [blame] | 74 | si_flush((struct pipe_context*)ctx, NULL, flags); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 75 | } |
| 76 | |
Andreas Hartmetz | eb0ddb6 | 2014-01-07 03:07:55 +0100 | [diff] [blame] | 77 | static void si_destroy_context(struct pipe_context *context) |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 78 | { |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 79 | struct si_context *sctx = (struct si_context *)context; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 80 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 81 | si_release_all_descriptors(sctx); |
Marek Olšák | c8e70e6 | 2013-08-06 06:42:22 +0200 | [diff] [blame] | 82 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 83 | pipe_resource_reference(&sctx->null_const_buf.buffer, NULL); |
| 84 | r600_resource_reference(&sctx->border_color_table, NULL); |
Michel Dänzer | 9ccaa24 | 2012-09-07 16:09:08 +0200 | [diff] [blame] | 85 | |
Christian König | 1fa2acb | 2014-03-08 14:18:30 +0100 | [diff] [blame] | 86 | si_pm4_delete_state(sctx, gs_rings, sctx->gs_rings); |
| 87 | si_pm4_delete_state(sctx, gs_onoff, sctx->gs_on); |
| 88 | si_pm4_delete_state(sctx, gs_onoff, sctx->gs_off); |
Michel Dänzer | 404b29d | 2013-11-21 16:45:28 +0900 | [diff] [blame] | 89 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 90 | if (sctx->dummy_pixel_shader) { |
| 91 | sctx->b.b.delete_fs_state(&sctx->b.b, sctx->dummy_pixel_shader); |
Michel Dänzer | 82cd9c0 | 2012-08-08 15:35:42 +0200 | [diff] [blame] | 92 | } |
Marek Olšák | 356c041 | 2013-08-06 21:30:59 +0200 | [diff] [blame] | 93 | for (int i = 0; i < 8; i++) { |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 94 | sctx->b.b.delete_depth_stencil_alpha_state(&sctx->b.b, sctx->custom_dsa_flush_depth_stencil[i]); |
| 95 | sctx->b.b.delete_depth_stencil_alpha_state(&sctx->b.b, sctx->custom_dsa_flush_depth[i]); |
| 96 | sctx->b.b.delete_depth_stencil_alpha_state(&sctx->b.b, sctx->custom_dsa_flush_stencil[i]); |
Marek Olšák | 356c041 | 2013-08-06 21:30:59 +0200 | [diff] [blame] | 97 | } |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 98 | sctx->b.b.delete_depth_stencil_alpha_state(&sctx->b.b, sctx->custom_dsa_flush_inplace); |
| 99 | sctx->b.b.delete_blend_state(&sctx->b.b, sctx->custom_blend_resolve); |
| 100 | sctx->b.b.delete_blend_state(&sctx->b.b, sctx->custom_blend_decompress); |
Marek Olšák | a38e1fd | 2014-03-06 02:44:07 +0100 | [diff] [blame] | 101 | sctx->b.b.delete_blend_state(&sctx->b.b, sctx->custom_blend_fastclear); |
Marek Olšák | 6a5499b | 2014-03-04 17:49:39 +0100 | [diff] [blame] | 102 | util_unreference_framebuffer_state(&sctx->framebuffer.state); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 103 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 104 | util_blitter_destroy(sctx->blitter); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 105 | |
Christian König | 58d2afa | 2014-03-07 21:52:51 +0100 | [diff] [blame] | 106 | si_pm4_cleanup(sctx); |
| 107 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 108 | r600_common_context_cleanup(&sctx->b); |
| 109 | FREE(sctx); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 110 | } |
| 111 | |
Andreas Hartmetz | eb0ddb6 | 2014-01-07 03:07:55 +0100 | [diff] [blame] | 112 | static struct pipe_context *si_create_context(struct pipe_screen *screen, void *priv) |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 113 | { |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 114 | struct si_context *sctx = CALLOC_STRUCT(si_context); |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 115 | struct si_screen* sscreen = (struct si_screen *)screen; |
Marek Olšák | 4569bf9 | 2013-10-30 20:44:23 +0100 | [diff] [blame] | 116 | int shader, i; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 117 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 118 | if (sctx == NULL) |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 119 | return NULL; |
| 120 | |
Marek Olšák | 4e5c70e | 2014-01-21 18:01:01 +0100 | [diff] [blame] | 121 | sctx->b.b.screen = screen; /* this must be set first */ |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 122 | sctx->b.b.priv = priv; |
| 123 | sctx->b.b.destroy = si_destroy_context; |
| 124 | sctx->b.b.flush = si_flush_from_st; |
Marek Olšák | 4e5c70e | 2014-01-21 18:01:01 +0100 | [diff] [blame] | 125 | sctx->screen = sscreen; /* Easy accessing of screen/winsys. */ |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 126 | |
Marek Olšák | 4e5c70e | 2014-01-21 18:01:01 +0100 | [diff] [blame] | 127 | if (!r600_common_context_init(&sctx->b, &sscreen->b)) |
| 128 | goto fail; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 129 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 130 | si_init_blit_functions(sctx); |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 131 | si_init_compute_functions(sctx); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 132 | |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 133 | if (sscreen->b.info.has_uvd) { |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 134 | sctx->b.b.create_video_codec = si_uvd_create_decoder; |
| 135 | sctx->b.b.create_video_buffer = si_video_buffer_create; |
Christian König | 5b2855b | 2013-04-03 10:18:35 +0200 | [diff] [blame] | 136 | } else { |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 137 | sctx->b.b.create_video_codec = vl_create_decoder; |
| 138 | sctx->b.b.create_video_buffer = vl_video_buffer_create; |
Christian König | 5b2855b | 2013-04-03 10:18:35 +0200 | [diff] [blame] | 139 | } |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 140 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 141 | sctx->b.rings.gfx.cs = sctx->b.ws->cs_create(sctx->b.ws, RING_GFX, NULL); |
| 142 | sctx->b.rings.gfx.flush = si_flush_from_winsys; |
Marek Olšák | c8e70e6 | 2013-08-06 06:42:22 +0200 | [diff] [blame] | 143 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 144 | si_init_all_descriptors(sctx); |
Marek Olšák | c8e70e6 | 2013-08-06 06:42:22 +0200 | [diff] [blame] | 145 | |
Marek Olšák | a77ee8b | 2013-08-26 17:19:39 +0200 | [diff] [blame] | 146 | /* Initialize cache_flush. */ |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 147 | sctx->cache_flush = si_atom_cache_flush; |
| 148 | sctx->atoms.cache_flush = &sctx->cache_flush; |
Marek Olšák | a77ee8b | 2013-08-26 17:19:39 +0200 | [diff] [blame] | 149 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 150 | sctx->atoms.streamout_begin = &sctx->b.streamout.begin_atom; |
Marek Olšák | f549129 | 2014-03-09 22:12:26 +0100 | [diff] [blame] | 151 | sctx->atoms.streamout_enable = &sctx->b.streamout.enable_atom; |
Marek Olšák | 2b0a54d | 2013-08-14 01:52:38 +0200 | [diff] [blame] | 152 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 153 | switch (sctx->b.chip_class) { |
Alex Deucher | 5b3f1ea | 2013-06-07 13:58:34 -0400 | [diff] [blame] | 154 | case SI: |
Alex Deucher | f29f206 | 2013-06-07 14:00:11 -0400 | [diff] [blame] | 155 | case CIK: |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 156 | si_init_state_functions(sctx); |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 157 | si_init_config(sctx); |
Alex Deucher | f29f206 | 2013-06-07 14:00:11 -0400 | [diff] [blame] | 158 | break; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 159 | default: |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 160 | R600_ERR("Unsupported chip class %d.\n", sctx->b.chip_class); |
Marek Olšák | a81c3e0 | 2013-08-14 01:04:39 +0200 | [diff] [blame] | 161 | goto fail; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 162 | } |
| 163 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 164 | sctx->b.ws->cs_set_flush_callback(sctx->b.rings.gfx.cs, si_flush_from_winsys, sctx); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 165 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 166 | sctx->blitter = util_blitter_create(&sctx->b.b); |
| 167 | if (sctx->blitter == NULL) |
Marek Olšák | a81c3e0 | 2013-08-14 01:04:39 +0200 | [diff] [blame] | 168 | goto fail; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 169 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 170 | sctx->dummy_pixel_shader = |
| 171 | util_make_fragment_cloneinput_shader(&sctx->b.b, 0, |
Michel Dänzer | 82cd9c0 | 2012-08-08 15:35:42 +0200 | [diff] [blame] | 172 | TGSI_SEMANTIC_GENERIC, |
| 173 | TGSI_INTERPOLATE_CONSTANT); |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 174 | sctx->b.b.bind_fs_state(&sctx->b.b, sctx->dummy_pixel_shader); |
Michel Dänzer | 82cd9c0 | 2012-08-08 15:35:42 +0200 | [diff] [blame] | 175 | |
Marek Olšák | 9eb3b9d | 2013-08-31 00:13:43 +0200 | [diff] [blame] | 176 | /* these must be last */ |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 177 | si_begin_new_cs(sctx); |
Marek Olšák | 62d55c0 | 2014-01-22 00:06:32 +0100 | [diff] [blame] | 178 | r600_query_init_backend_mask(&sctx->b); /* this emits commands and must be last */ |
Marek Olšák | 4569bf9 | 2013-10-30 20:44:23 +0100 | [diff] [blame] | 179 | |
| 180 | /* CIK cannot unbind a constant buffer (S_BUFFER_LOAD is buggy |
| 181 | * with a NULL buffer). We need to use a dummy buffer instead. */ |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 182 | if (sctx->b.chip_class == CIK) { |
| 183 | sctx->null_const_buf.buffer = pipe_buffer_create(screen, PIPE_BIND_CONSTANT_BUFFER, |
Marek Olšák | c321144 | 2014-02-03 03:42:17 +0100 | [diff] [blame] | 184 | PIPE_USAGE_DEFAULT, 16); |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 185 | sctx->null_const_buf.buffer_size = sctx->null_const_buf.buffer->width0; |
Marek Olšák | 4569bf9 | 2013-10-30 20:44:23 +0100 | [diff] [blame] | 186 | |
| 187 | for (shader = 0; shader < SI_NUM_SHADERS; shader++) { |
| 188 | for (i = 0; i < NUM_CONST_BUFFERS; i++) { |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 189 | sctx->b.b.set_constant_buffer(&sctx->b.b, shader, i, |
| 190 | &sctx->null_const_buf); |
Marek Olšák | 4569bf9 | 2013-10-30 20:44:23 +0100 | [diff] [blame] | 191 | } |
| 192 | } |
| 193 | |
| 194 | /* Clear the NULL constant buffer, because loads should return zeros. */ |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 195 | sctx->b.clear_buffer(&sctx->b.b, sctx->null_const_buf.buffer, 0, |
| 196 | sctx->null_const_buf.buffer->width0, 0); |
Marek Olšák | 4569bf9 | 2013-10-30 20:44:23 +0100 | [diff] [blame] | 197 | } |
| 198 | |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 199 | return &sctx->b.b; |
Marek Olšák | a81c3e0 | 2013-08-14 01:04:39 +0200 | [diff] [blame] | 200 | fail: |
Andreas Hartmetz | 8662e66 | 2014-01-11 16:00:50 +0100 | [diff] [blame] | 201 | si_destroy_context(&sctx->b.b); |
Marek Olšák | a81c3e0 | 2013-08-14 01:04:39 +0200 | [diff] [blame] | 202 | return NULL; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | /* |
| 206 | * pipe_screen |
| 207 | */ |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 208 | |
Andreas Hartmetz | eb0ddb6 | 2014-01-07 03:07:55 +0100 | [diff] [blame] | 209 | static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param) |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 210 | { |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 211 | struct si_screen *sscreen = (struct si_screen *)pscreen; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 212 | |
| 213 | switch (param) { |
| 214 | /* Supported features (boolean caps). */ |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 215 | case PIPE_CAP_TWO_SIDED_STENCIL: |
Tom Stellard | 69a9218 | 2012-04-14 17:37:37 -0400 | [diff] [blame] | 216 | case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 217 | case PIPE_CAP_ANISOTROPIC_FILTER: |
| 218 | case PIPE_CAP_POINT_SPRITE: |
| 219 | case PIPE_CAP_OCCLUSION_QUERY: |
| 220 | case PIPE_CAP_TEXTURE_SHADOW_MAP: |
| 221 | case PIPE_CAP_TEXTURE_MIRROR_CLAMP: |
| 222 | case PIPE_CAP_BLEND_EQUATION_SEPARATE: |
| 223 | case PIPE_CAP_TEXTURE_SWIZZLE: |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 224 | case PIPE_CAP_DEPTH_CLIP_DISABLE: |
| 225 | case PIPE_CAP_SHADER_STENCIL_EXPORT: |
| 226 | case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: |
| 227 | case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: |
| 228 | case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT: |
| 229 | case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: |
| 230 | case PIPE_CAP_SM3: |
| 231 | case PIPE_CAP_SEAMLESS_CUBE_MAP: |
| 232 | case PIPE_CAP_PRIMITIVE_RESTART: |
| 233 | case PIPE_CAP_CONDITIONAL_RENDER: |
| 234 | case PIPE_CAP_TEXTURE_BARRIER: |
| 235 | case PIPE_CAP_INDEP_BLEND_ENABLE: |
| 236 | case PIPE_CAP_INDEP_BLEND_FUNC: |
| 237 | case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE: |
| 238 | case PIPE_CAP_VERTEX_COLOR_UNCLAMPED: |
Marek Olšák | 2a311b1 | 2012-04-24 01:23:33 +0200 | [diff] [blame] | 239 | case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: |
| 240 | case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: |
| 241 | case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: |
Marek Olšák | 437ab1d | 2012-04-24 15:19:31 +0200 | [diff] [blame] | 242 | case PIPE_CAP_USER_INDEX_BUFFERS: |
| 243 | case PIPE_CAP_USER_CONSTANT_BUFFERS: |
Fredrik Höglund | af37212 | 2012-06-18 22:50:02 +0200 | [diff] [blame] | 244 | case PIPE_CAP_START_INSTANCE: |
Michel Dänzer | d0f51fe | 2012-09-05 18:27:02 +0200 | [diff] [blame] | 245 | case PIPE_CAP_NPOT_TEXTURES: |
Ilia Mirkin | 12d39b4 | 2013-10-04 04:32:15 -0400 | [diff] [blame] | 246 | case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES: |
Marek Olšák | 3e10ab6 | 2013-03-14 17:18:43 +0100 | [diff] [blame] | 247 | case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER: |
Christian König | e4ed587 | 2013-03-21 18:02:52 +0100 | [diff] [blame] | 248 | case PIPE_CAP_TGSI_INSTANCEID: |
Tom Stellard | 302f53d | 2012-10-25 13:50:10 -0400 | [diff] [blame] | 249 | case PIPE_CAP_COMPUTE: |
Marek Olšák | dbeedbb | 2013-10-31 15:08:49 +0100 | [diff] [blame] | 250 | case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: |
Marek Olšák | 1a02bb7 | 2013-11-21 15:25:55 +0100 | [diff] [blame] | 251 | case PIPE_CAP_TGSI_VS_LAYER: |
Marek Olšák | 8739c60 | 2014-01-22 00:08:11 +0100 | [diff] [blame] | 252 | case PIPE_CAP_QUERY_PIPELINE_STATISTICS: |
Marek Olšák | 6381dd7 | 2014-01-27 21:46:21 +0100 | [diff] [blame] | 253 | case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: |
Marek Olšák | aafb0f9 | 2013-08-17 02:47:21 +0200 | [diff] [blame] | 254 | return 1; |
Marek Olšák | 21d9a1b | 2013-08-16 15:21:45 +0200 | [diff] [blame] | 255 | |
Marek Olšák | 2f1c449 | 2013-07-30 22:29:30 +0200 | [diff] [blame] | 256 | case PIPE_CAP_TEXTURE_MULTISAMPLE: |
Marek Olšák | 751e869 | 2013-11-20 13:48:19 +0100 | [diff] [blame] | 257 | /* 2D tiling on CIK is supported since DRM 2.35.0 */ |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 258 | return HAVE_LLVM >= 0x0304 && (sscreen->b.chip_class < CIK || |
| 259 | sscreen->b.info.drm_minor >= 35); |
Marek Olšák | 2f1c449 | 2013-07-30 22:29:30 +0200 | [diff] [blame] | 260 | |
Marek Olšák | c9f2af3 | 2012-10-28 17:52:48 +0100 | [diff] [blame] | 261 | case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: |
Marek Olšák | de5094d | 2014-03-09 22:29:20 +0100 | [diff] [blame^] | 262 | return R600_MAP_BUFFER_ALIGNMENT; |
Marek Olšák | c9f2af3 | 2012-10-28 17:52:48 +0100 | [diff] [blame] | 263 | |
Marek Olšák | 1b749dc | 2012-04-24 17:31:17 +0200 | [diff] [blame] | 264 | case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: |
Marek Olšák | e219842 | 2014-03-09 20:05:54 +0100 | [diff] [blame] | 265 | case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: |
| 266 | return 4; |
Marek Olšák | 1b749dc | 2012-04-24 17:31:17 +0200 | [diff] [blame] | 267 | |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 268 | case PIPE_CAP_GLSL_FEATURE_LEVEL: |
Michel Dänzer | d7c68e2 | 2014-01-24 17:51:34 +0900 | [diff] [blame] | 269 | return HAVE_LLVM >= 0x0305 ? 330 : 140; |
Marek Olšák | dbeedbb | 2013-10-31 15:08:49 +0100 | [diff] [blame] | 270 | |
Marek Olšák | dbeedbb | 2013-10-31 15:08:49 +0100 | [diff] [blame] | 271 | case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE: |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 272 | return MIN2(sscreen->b.info.vram_size, 0xFFFFFFFF); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 273 | |
| 274 | /* Unsupported features. */ |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 275 | case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: |
| 276 | case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 277 | case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS: |
| 278 | case PIPE_CAP_FRAGMENT_COLOR_CLAMPED: |
| 279 | case PIPE_CAP_VERTEX_COLOR_CLAMPED: |
| 280 | case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: |
Marek Olšák | 2a311b1 | 2012-04-24 01:23:33 +0200 | [diff] [blame] | 281 | case PIPE_CAP_USER_VERTEX_BUFFERS: |
Maxence Le Dore | 6d7d821 | 2012-12-13 05:17:35 +0100 | [diff] [blame] | 282 | case PIPE_CAP_CUBE_MAP_ARRAY: |
Dave Airlie | 2fcbec4 | 2013-09-21 18:45:43 +1000 | [diff] [blame] | 283 | case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS: |
| 284 | case PIPE_CAP_TEXTURE_GATHER_SM5: |
Marek Olšák | de5094d | 2014-03-09 22:29:20 +0100 | [diff] [blame^] | 285 | case PIPE_CAP_TGSI_TEXCOORD: |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 286 | return 0; |
| 287 | |
Marek Olšák | 164de0d | 2013-10-30 21:44:07 +0100 | [diff] [blame] | 288 | case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: |
| 289 | return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_R600; |
| 290 | |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 291 | /* Stream output. */ |
| 292 | case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS: |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 293 | return sscreen->b.has_streamout ? 4 : 0; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 294 | case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 295 | return sscreen->b.has_streamout ? 1 : 0; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 296 | case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS: |
| 297 | case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS: |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 298 | return sscreen->b.has_streamout ? 32*4 : 0; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 299 | |
Grigori Goronzy | d34d5fd | 2014-02-09 22:56:20 +0100 | [diff] [blame] | 300 | /* Geometry shader output. */ |
| 301 | case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES: |
| 302 | return 1024; |
| 303 | case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS: |
| 304 | return 4095; |
| 305 | |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 306 | /* Texturing. */ |
| 307 | case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 308 | case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: |
Marek Olšák | 4f1f323 | 2014-03-09 20:03:57 +0100 | [diff] [blame] | 309 | return 15; /* 16384 */ |
| 310 | case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: |
| 311 | /* textures support 8192, but layered rendering supports 2048 */ |
| 312 | return 12; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 313 | case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: |
Marek Olšák | 4f1f323 | 2014-03-09 20:03:57 +0100 | [diff] [blame] | 314 | /* textures support 8192, but layered rendering supports 2048 */ |
| 315 | return 2048; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 316 | |
| 317 | /* Render targets. */ |
| 318 | case PIPE_CAP_MAX_RENDER_TARGETS: |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 319 | return 8; |
| 320 | |
Marek Olšák | a62cd69 | 2013-09-21 19:45:08 +0200 | [diff] [blame] | 321 | case PIPE_CAP_MAX_VIEWPORTS: |
| 322 | return 1; |
| 323 | |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 324 | /* Timer queries, present when the clock frequency is non zero. */ |
Niels Ole Salscheider | db6f416 | 2013-08-09 11:59:28 +0200 | [diff] [blame] | 325 | case PIPE_CAP_QUERY_TIMESTAMP: |
José Fonseca | 9976216 | 2012-12-09 09:50:34 +0000 | [diff] [blame] | 326 | case PIPE_CAP_QUERY_TIME_ELAPSED: |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 327 | return sscreen->b.info.r600_clock_crystal_freq != 0; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 328 | |
| 329 | case PIPE_CAP_MIN_TEXEL_OFFSET: |
| 330 | return -8; |
| 331 | |
| 332 | case PIPE_CAP_MAX_TEXEL_OFFSET: |
| 333 | return 7; |
Tom Stellard | 4e90bc9 | 2013-07-09 21:21:39 -0700 | [diff] [blame] | 334 | case PIPE_CAP_ENDIANNESS: |
| 335 | return PIPE_ENDIAN_LITTLE; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 336 | } |
| 337 | return 0; |
| 338 | } |
| 339 | |
Andreas Hartmetz | eb0ddb6 | 2014-01-07 03:07:55 +0100 | [diff] [blame] | 340 | static int si_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param) |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 341 | { |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 342 | switch(shader) |
| 343 | { |
| 344 | case PIPE_SHADER_FRAGMENT: |
| 345 | case PIPE_SHADER_VERTEX: |
| 346 | break; |
| 347 | case PIPE_SHADER_GEOMETRY: |
Michel Dänzer | d7c68e2 | 2014-01-24 17:51:34 +0900 | [diff] [blame] | 348 | #if HAVE_LLVM < 0x0305 |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 349 | return 0; |
Michel Dänzer | d7c68e2 | 2014-01-24 17:51:34 +0900 | [diff] [blame] | 350 | #endif |
| 351 | break; |
Tom Stellard | 302f53d | 2012-10-25 13:50:10 -0400 | [diff] [blame] | 352 | case PIPE_SHADER_COMPUTE: |
| 353 | switch (param) { |
| 354 | case PIPE_SHADER_CAP_PREFERRED_IR: |
| 355 | return PIPE_SHADER_IR_LLVM; |
| 356 | default: |
| 357 | return 0; |
| 358 | } |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 359 | default: |
| 360 | /* TODO: support tessellation */ |
| 361 | return 0; |
| 362 | } |
| 363 | |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 364 | switch (param) { |
| 365 | case PIPE_SHADER_CAP_MAX_INSTRUCTIONS: |
| 366 | case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS: |
| 367 | case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS: |
| 368 | case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS: |
| 369 | return 16384; |
| 370 | case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: |
Marek Olšák | 225228a | 2013-01-31 19:40:24 +0100 | [diff] [blame] | 371 | return 32; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 372 | case PIPE_SHADER_CAP_MAX_INPUTS: |
Marek Olšák | 225228a | 2013-01-31 19:40:24 +0100 | [diff] [blame] | 373 | return 32; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 374 | case PIPE_SHADER_CAP_MAX_TEMPS: |
| 375 | return 256; /* Max native temporaries. */ |
| 376 | case PIPE_SHADER_CAP_MAX_ADDRS: |
| 377 | /* FIXME Isn't this equal to TEMPS? */ |
| 378 | return 1; /* Max native address registers */ |
| 379 | case PIPE_SHADER_CAP_MAX_CONSTS: |
Christian König | 8c80894 | 2013-02-04 17:55:32 +0100 | [diff] [blame] | 380 | return 4096; /* actually only memory limits this */ |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 381 | case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: |
Marek Olšák | 2fd4200 | 2013-10-25 11:45:47 +0200 | [diff] [blame] | 382 | return NUM_PIPE_CONST_BUFFERS; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 383 | case PIPE_SHADER_CAP_MAX_PREDS: |
| 384 | return 0; /* FIXME */ |
| 385 | case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED: |
| 386 | return 1; |
Brian Paul | 13f3ae5 | 2013-02-01 11:16:54 -0700 | [diff] [blame] | 387 | case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED: |
| 388 | return 0; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 389 | case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR: |
Michel Dänzer | 3b3687a | 2014-01-22 18:47:21 +0900 | [diff] [blame] | 390 | /* Indirection of geometry shader input dimension is not |
| 391 | * handled yet |
| 392 | */ |
| 393 | return shader < PIPE_SHADER_GEOMETRY; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 394 | case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR: |
| 395 | case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR: |
| 396 | case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR: |
Christian König | 90862c85 | 2013-03-07 12:00:18 +0100 | [diff] [blame] | 397 | return 1; |
Tom Stellard | ae9be35 | 2012-07-25 08:22:30 -0400 | [diff] [blame] | 398 | case PIPE_SHADER_CAP_INTEGERS: |
| 399 | return 1; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 400 | case PIPE_SHADER_CAP_SUBROUTINES: |
| 401 | return 0; |
| 402 | case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: |
Roland Scheidegger | 2983c03 | 2013-11-26 02:30:41 +0100 | [diff] [blame] | 403 | case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 404 | return 16; |
Marek Olšák | 7b01bc1 | 2012-10-11 21:35:45 +0200 | [diff] [blame] | 405 | case PIPE_SHADER_CAP_PREFERRED_IR: |
| 406 | return PIPE_SHADER_IR_TGSI; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 407 | } |
| 408 | return 0; |
| 409 | } |
| 410 | |
Andreas Hartmetz | eb0ddb6 | 2014-01-07 03:07:55 +0100 | [diff] [blame] | 411 | static void si_destroy_screen(struct pipe_screen* pscreen) |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 412 | { |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 413 | struct si_screen *sscreen = (struct si_screen *)pscreen; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 414 | |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 415 | if (sscreen == NULL) |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 416 | return; |
| 417 | |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 418 | if (!radeon_winsys_unref(sscreen->b.ws)) |
Christian König | 4871128 | 2013-09-25 13:59:56 +0200 | [diff] [blame] | 419 | return; |
| 420 | |
Marek Olšák | ed42e95 | 2014-01-22 02:49:53 +0100 | [diff] [blame] | 421 | r600_destroy_common_screen(&sscreen->b); |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 422 | } |
| 423 | |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 424 | struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws) |
| 425 | { |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 426 | struct si_screen *sscreen = CALLOC_STRUCT(si_screen); |
| 427 | if (sscreen == NULL) { |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 428 | return NULL; |
| 429 | } |
| 430 | |
Marek Olšák | 09fc5d6 | 2013-09-22 21:47:35 +0200 | [diff] [blame] | 431 | /* Set functions first. */ |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 432 | sscreen->b.b.context_create = si_create_context; |
| 433 | sscreen->b.b.destroy = si_destroy_screen; |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 434 | sscreen->b.b.get_param = si_get_param; |
| 435 | sscreen->b.b.get_shader_param = si_get_shader_param; |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 436 | sscreen->b.b.is_format_supported = si_is_format_supported; |
Tom Stellard | 7b4592a | 2014-01-28 06:51:50 -0800 | [diff] [blame] | 437 | sscreen->b.b.resource_create = r600_resource_create_common; |
Marek Olšák | 09fc5d6 | 2013-09-22 21:47:35 +0200 | [diff] [blame] | 438 | |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 439 | if (!r600_common_screen_init(&sscreen->b, ws)) { |
| 440 | FREE(sscreen); |
Marek Olšák | 1bb77f8 | 2013-09-22 22:12:18 +0200 | [diff] [blame] | 441 | return NULL; |
| 442 | } |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 443 | |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 444 | sscreen->b.has_cp_dma = true; |
| 445 | sscreen->b.has_streamout = HAVE_LLVM >= 0x0304; |
Marek Olšák | bba39d8 | 2013-11-28 15:09:35 +0100 | [diff] [blame] | 446 | |
Marek Olšák | 0cb9de1 | 2013-09-22 15:34:12 +0200 | [diff] [blame] | 447 | if (debug_get_bool_option("RADEON_DUMP_SHADERS", FALSE)) |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 448 | sscreen->b.debug_flags |= DBG_FS | DBG_VS | DBG_GS | DBG_PS | DBG_CS; |
Marek Olšák | 0cb9de1 | 2013-09-22 15:34:12 +0200 | [diff] [blame] | 449 | |
Marek Olšák | b893bbf | 2013-10-03 16:39:50 +0200 | [diff] [blame] | 450 | /* Create the auxiliary context. This must be done last. */ |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 451 | sscreen->b.aux_context = sscreen->b.b.context_create(&sscreen->b.b, NULL); |
Marek Olšák | b893bbf | 2013-10-03 16:39:50 +0200 | [diff] [blame] | 452 | |
Andreas Hartmetz | aa7ae4f | 2014-01-11 16:01:11 +0100 | [diff] [blame] | 453 | return &sscreen->b.b; |
Tom Stellard | a75c616 | 2012-01-06 17:38:37 -0500 | [diff] [blame] | 454 | } |