Lines Matching refs:rctx

470 	struct r600_context *rctx = (struct r600_context *)ctx;  in evergreen_create_rs_state()  local
543 if (rctx->b.chip_class == CAYMAN) { in evergreen_create_rs_state()
620 static void evergreen_fill_buffer_resource_words(struct r600_context *rctx, in evergreen_fill_buffer_resource_words() argument
667 texture_buffer_sampler_view(struct r600_context *rctx, in texture_buffer_sampler_view() argument
684 evergreen_fill_buffer_resource_words(rctx, view->base.texture, in texture_buffer_sampler_view()
690 LIST_ADDTAIL(&view->list, &rctx->texture_buffers); in texture_buffer_sampler_view()
707 static int evergreen_fill_tex_resource_words(struct r600_context *rctx, in evergreen_fill_tex_resource_words() argument
713 struct r600_screen *rscreen = (struct r600_screen*)rctx->b.b.screen; in evergreen_fill_tex_resource_words()
756 format = r600_translate_texformat(rctx->b.b.screen, params->pipe_format, in evergreen_fill_tex_resource_words()
901 struct r600_context *rctx = (struct r600_context*)ctx; in evergreen_create_sampler_view_custom() local
919 return texture_buffer_sampler_view(rctx, view, width0, height0); in evergreen_create_sampler_view_custom()
936 ret = evergreen_fill_tex_resource_words(rctx, texture, &params, in evergreen_create_sampler_view_custom()
964 static void evergreen_emit_config_state(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_config_state() argument
966 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_config_state()
971 radeon_emit(cs, S_008C04_NUM_CLAUSE_TEMP_GPRS(rctx->r6xx_num_clause_temp_gprs)); in evergreen_emit_config_state()
991 static void evergreen_emit_clip_state(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_clip_state() argument
993 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_clip_state()
994 struct pipe_clip_state *state = &rctx->clip_state.state; in evergreen_emit_clip_state()
1005 static void evergreen_get_scissor_rect(struct r600_context *rctx, in evergreen_get_scissor_rect() argument
1011 evergreen_apply_scissor_bug_workaround(&rctx->b, &scissor); in evergreen_get_scissor_rect()
1031 static void evergreen_set_color_surface_buffer(struct r600_context *rctx, in evergreen_set_color_surface_buffer() argument
1042 MAX2(64, rctx->screen->b.info.pipe_interleave_bytes / block_size); in evergreen_set_color_surface_buffer()
1049 format = r600_translate_colorformat(rctx->b.chip_class, pformat, FALSE); in evergreen_set_color_surface_buffer()
1099 static void evergreen_set_color_surface_common(struct r600_context *rctx, in evergreen_set_color_surface_common() argument
1107 struct r600_screen *rscreen = rctx->screen; in evergreen_set_color_surface_common()
1178 if (rctx->b.chip_class == CAYMAN) { in evergreen_set_color_surface_common()
1209 format = r600_translate_colorformat(rctx->b.chip_class, pformat, do_endian_swap); in evergreen_set_color_surface_common()
1277 void evergreen_init_color_surface_rat(struct r600_context *rctx, in evergreen_init_color_surface_rat() argument
1283 evergreen_set_color_surface_buffer(rctx, (struct r600_resource *)surf->base.texture, in evergreen_init_color_surface_rat()
1305 void evergreen_init_color_surface(struct r600_context *rctx, in evergreen_init_color_surface() argument
1312 evergreen_set_color_surface_common(rctx, rtex, level, in evergreen_init_color_surface()
1336 static void evergreen_init_depth_surface(struct r600_context *rctx, in evergreen_init_depth_surface() argument
1339 struct r600_screen *rscreen = rctx->screen; in evergreen_init_depth_surface()
1412 surf->db_stencil_info = rctx->screen->b.info.drm_minor >= 18 ? in evergreen_init_depth_surface()
1433 struct r600_context *rctx = (struct r600_context *)ctx; in evergreen_set_framebuffer_state() local
1442 rctx->b.flags |= R600_CONTEXT_WAIT_3D_IDLE | in evergreen_set_framebuffer_state()
1450 util_copy_framebuffer_state(&rctx->framebuffer.state, state); in evergreen_set_framebuffer_state()
1453 rctx->framebuffer.export_16bpc = state->nr_cbufs != 0; in evergreen_set_framebuffer_state()
1454 rctx->framebuffer.cb0_is_integer = state->nr_cbufs && state->cbufs[0] && in evergreen_set_framebuffer_state()
1456 rctx->framebuffer.compressed_cb_mask = 0; in evergreen_set_framebuffer_state()
1457 rctx->framebuffer.nr_samples = util_framebuffer_get_num_samples(state); in evergreen_set_framebuffer_state()
1469 evergreen_init_color_surface(rctx, surf); in evergreen_set_framebuffer_state()
1473 rctx->framebuffer.export_16bpc = false; in evergreen_set_framebuffer_state()
1477 rctx->framebuffer.compressed_cb_mask |= 1 << i; in evergreen_set_framebuffer_state()
1493 if (rctx->alphatest_state.bypass != alphatest_bypass) { in evergreen_set_framebuffer_state()
1494 rctx->alphatest_state.bypass = alphatest_bypass; in evergreen_set_framebuffer_state()
1495 r600_mark_atom_dirty(rctx, &rctx->alphatest_state.atom); in evergreen_set_framebuffer_state()
1497 if (rctx->alphatest_state.cb0_export_16bpc != export_16bpc) { in evergreen_set_framebuffer_state()
1498 rctx->alphatest_state.cb0_export_16bpc = export_16bpc; in evergreen_set_framebuffer_state()
1499 r600_mark_atom_dirty(rctx, &rctx->alphatest_state.atom); in evergreen_set_framebuffer_state()
1510 evergreen_init_depth_surface(rctx, surf); in evergreen_set_framebuffer_state()
1513 if (state->zsbuf->format != rctx->poly_offset_state.zs_format) { in evergreen_set_framebuffer_state()
1514 rctx->poly_offset_state.zs_format = state->zsbuf->format; in evergreen_set_framebuffer_state()
1515 r600_mark_atom_dirty(rctx, &rctx->poly_offset_state.atom); in evergreen_set_framebuffer_state()
1518 if (rctx->db_state.rsurf != surf) { in evergreen_set_framebuffer_state()
1519 rctx->db_state.rsurf = surf; in evergreen_set_framebuffer_state()
1520 r600_mark_atom_dirty(rctx, &rctx->db_state.atom); in evergreen_set_framebuffer_state()
1521 r600_mark_atom_dirty(rctx, &rctx->db_misc_state.atom); in evergreen_set_framebuffer_state()
1523 } else if (rctx->db_state.rsurf) { in evergreen_set_framebuffer_state()
1524 rctx->db_state.rsurf = NULL; in evergreen_set_framebuffer_state()
1525 r600_mark_atom_dirty(rctx, &rctx->db_state.atom); in evergreen_set_framebuffer_state()
1526 r600_mark_atom_dirty(rctx, &rctx->db_misc_state.atom); in evergreen_set_framebuffer_state()
1529 if (rctx->cb_misc_state.nr_cbufs != state->nr_cbufs) { in evergreen_set_framebuffer_state()
1530 rctx->cb_misc_state.nr_cbufs = state->nr_cbufs; in evergreen_set_framebuffer_state()
1531 r600_mark_atom_dirty(rctx, &rctx->cb_misc_state.atom); in evergreen_set_framebuffer_state()
1534 if (state->nr_cbufs == 0 && rctx->alphatest_state.bypass) { in evergreen_set_framebuffer_state()
1535 rctx->alphatest_state.bypass = false; in evergreen_set_framebuffer_state()
1536 r600_mark_atom_dirty(rctx, &rctx->alphatest_state.atom); in evergreen_set_framebuffer_state()
1539 log_samples = util_logbase2(rctx->framebuffer.nr_samples); in evergreen_set_framebuffer_state()
1541 if ((rctx->b.chip_class == CAYMAN || in evergreen_set_framebuffer_state()
1542 rctx->b.family == CHIP_RV770) && in evergreen_set_framebuffer_state()
1543 rctx->db_misc_state.log_samples != log_samples) { in evergreen_set_framebuffer_state()
1544 rctx->db_misc_state.log_samples = log_samples; in evergreen_set_framebuffer_state()
1545 r600_mark_atom_dirty(rctx, &rctx->db_misc_state.atom); in evergreen_set_framebuffer_state()
1550 rctx->framebuffer.atom.num_dw = 4; /* SCISSOR */ in evergreen_set_framebuffer_state()
1553 if (rctx->b.chip_class == EVERGREEN) in evergreen_set_framebuffer_state()
1554 rctx->framebuffer.atom.num_dw += 17; /* Evergreen */ in evergreen_set_framebuffer_state()
1556 rctx->framebuffer.atom.num_dw += 28; /* Cayman */ in evergreen_set_framebuffer_state()
1559 rctx->framebuffer.atom.num_dw += state->nr_cbufs * 23; in evergreen_set_framebuffer_state()
1560 rctx->framebuffer.atom.num_dw += state->nr_cbufs * 2; in evergreen_set_framebuffer_state()
1561 rctx->framebuffer.atom.num_dw += (12 - state->nr_cbufs) * 3; in evergreen_set_framebuffer_state()
1565 rctx->framebuffer.atom.num_dw += 24; in evergreen_set_framebuffer_state()
1566 rctx->framebuffer.atom.num_dw += 2; in evergreen_set_framebuffer_state()
1567 } else if (rctx->screen->b.info.drm_minor >= 18) { in evergreen_set_framebuffer_state()
1568 rctx->framebuffer.atom.num_dw += 4; in evergreen_set_framebuffer_state()
1571 r600_mark_atom_dirty(rctx, &rctx->framebuffer.atom); in evergreen_set_framebuffer_state()
1573 r600_set_sample_locations_constant_buffer(rctx); in evergreen_set_framebuffer_state()
1574 rctx->framebuffer.do_update_surf_dirtiness = true; in evergreen_set_framebuffer_state()
1579 struct r600_context *rctx = (struct r600_context *)ctx; in evergreen_set_min_samples() local
1581 if (rctx->ps_iter_samples == min_samples) in evergreen_set_min_samples()
1584 rctx->ps_iter_samples = min_samples; in evergreen_set_min_samples()
1585 if (rctx->framebuffer.nr_samples > 1) { in evergreen_set_min_samples()
1586 r600_mark_atom_dirty(rctx, &rctx->framebuffer.atom); in evergreen_set_min_samples()
1642 static void evergreen_emit_msaa_state(struct r600_context *rctx, int nr_samples, int ps_iter_sample… in evergreen_emit_msaa_state() argument
1645 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_msaa_state()
1689 static void evergreen_emit_image_state(struct r600_context *rctx, struct r600_atom *atom, in evergreen_emit_image_state() argument
1693 struct pipe_framebuffer_state *fb_state = &rctx->framebuffer.state; in evergreen_emit_image_state()
1694 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_image_state()
1705 idx += fb_state->nr_cbufs + (rctx->dual_src_blend ? 1 : 0); in evergreen_emit_image_state()
1715 reloc = radeon_add_to_buffer_list(&rctx->b, in evergreen_emit_image_state()
1716 &rctx->b.gfx, in evergreen_emit_image_state()
1721 immed_reloc = radeon_add_to_buffer_list(&rctx->b, in evergreen_emit_image_state()
1722 &rctx->b.gfx, in evergreen_emit_image_state()
1787 static void evergreen_emit_fragment_image_state(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_fragment_image_state() argument
1789 evergreen_emit_image_state(rctx, atom, in evergreen_emit_fragment_image_state()
1794 static void evergreen_emit_compute_image_state(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_compute_image_state() argument
1796 evergreen_emit_image_state(rctx, atom, in evergreen_emit_compute_image_state()
1802 static void evergreen_emit_fragment_buffer_state(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_fragment_buffer_state() argument
1804 int offset = util_bitcount(rctx->fragment_images.enabled_mask); in evergreen_emit_fragment_buffer_state()
1805 evergreen_emit_image_state(rctx, atom, in evergreen_emit_fragment_buffer_state()
1810 static void evergreen_emit_compute_buffer_state(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_compute_buffer_state() argument
1812 int offset = util_bitcount(rctx->compute_images.enabled_mask); in evergreen_emit_compute_buffer_state()
1813 evergreen_emit_image_state(rctx, atom, in evergreen_emit_compute_buffer_state()
1819 static void evergreen_emit_framebuffer_state(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_framebuffer_state() argument
1821 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_framebuffer_state()
1822 struct pipe_framebuffer_state *state = &rctx->framebuffer.state; in evergreen_emit_framebuffer_state()
1845 reloc = radeon_add_to_buffer_list(&rctx->b, in evergreen_emit_framebuffer_state()
1846 &rctx->b.gfx, in evergreen_emit_framebuffer_state()
1854 cmask_reloc = radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, in evergreen_emit_framebuffer_state()
1889 if (rctx->framebuffer.dual_src_blend && i == 1 && state->cbufs[0]) { in evergreen_emit_framebuffer_state()
1894 i += util_bitcount(rctx->fragment_images.enabled_mask); in evergreen_emit_framebuffer_state()
1895 i += util_bitcount(rctx->fragment_buffers.enabled_mask); in evergreen_emit_framebuffer_state()
1904 unsigned reloc = radeon_add_to_buffer_list(&rctx->b, in evergreen_emit_framebuffer_state()
1905 &rctx->b.gfx, in evergreen_emit_framebuffer_state()
1935 } else if (rctx->screen->b.info.drm_minor >= 18) { in evergreen_emit_framebuffer_state()
1944 evergreen_get_scissor_rect(rctx, 0, 0, state->width, state->height, &tl, &br); in evergreen_emit_framebuffer_state()
1950 if (rctx->b.chip_class == EVERGREEN) { in evergreen_emit_framebuffer_state()
1951 evergreen_emit_msaa_state(rctx, rctx->framebuffer.nr_samples, rctx->ps_iter_samples); in evergreen_emit_framebuffer_state()
1957 if (rctx->framebuffer.nr_samples > 1) in evergreen_emit_framebuffer_state()
1958 cayman_emit_msaa_sample_locs(cs, rctx->framebuffer.nr_samples); in evergreen_emit_framebuffer_state()
1959 cayman_emit_msaa_config(cs, rctx->framebuffer.nr_samples, in evergreen_emit_framebuffer_state()
1960 rctx->ps_iter_samples, 0, sc_mode_cntl_1); in evergreen_emit_framebuffer_state()
1964 static void evergreen_emit_polygon_offset(struct r600_context *rctx, struct r600_atom *a) in evergreen_emit_polygon_offset() argument
1966 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_polygon_offset()
2004 uint32_t evergreen_construct_rat_mask(struct r600_context *rctx, struct r600_cb_misc_state *a, in evergreen_construct_rat_mask() argument
2022 static void evergreen_emit_cb_misc_state(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_cb_misc_state() argument
2024 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_cb_misc_state()
2028 unsigned rat_colormask = evergreen_construct_rat_mask(rctx, a, a->nr_cbufs); in evergreen_emit_cb_misc_state()
2037 static void evergreen_emit_db_state(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_db_state() argument
2039 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_db_state()
2050 reloc_idx = radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, &rtex->resource, in evergreen_emit_db_state()
2060 static void evergreen_emit_db_misc_state(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_db_misc_state() argument
2062 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_db_misc_state()
2070 if (rctx->b.num_occlusion_queries > 0 && in evergreen_emit_db_misc_state()
2073 if (rctx->b.chip_class == CAYMAN) { in evergreen_emit_db_misc_state()
2085 if (rctx->alphatest_state.sx_alpha_test_control) in evergreen_emit_db_misc_state()
2112 static void evergreen_emit_vertex_buffers(struct r600_context *rctx, in evergreen_emit_vertex_buffers() argument
2117 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_vertex_buffers()
2152 radeon_emit(cs, radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, rbuffer, in evergreen_emit_vertex_buffers()
2158 static void evergreen_fs_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom * atom) in evergreen_fs_emit_vertex_buffers() argument
2160 evergreen_emit_vertex_buffers(rctx, &rctx->vertex_buffer_state, EG_FETCH_CONSTANTS_OFFSET_FS, 0); in evergreen_fs_emit_vertex_buffers()
2163 static void evergreen_cs_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom * atom) in evergreen_cs_emit_vertex_buffers() argument
2165 evergreen_emit_vertex_buffers(rctx, &rctx->cs_vertex_buffer_state, EG_FETCH_CONSTANTS_OFFSET_CS, in evergreen_cs_emit_vertex_buffers()
2169 static void evergreen_emit_constant_buffers(struct r600_context *rctx, in evergreen_emit_constant_buffers() argument
2176 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_constant_buffers()
2198 radeon_emit(cs, radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, rbuffer, in evergreen_emit_constant_buffers()
2224 radeon_emit(cs, radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, rbuffer, in evergreen_emit_constant_buffers()
2233 static void evergreen_emit_vs_constant_buffers(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_vs_constant_buffers() argument
2235 if (rctx->vs_shader->current->shader.vs_as_ls) { in evergreen_emit_vs_constant_buffers()
2236 evergreen_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_VERTEX], in evergreen_emit_vs_constant_buffers()
2242 evergreen_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_VERTEX], in evergreen_emit_vs_constant_buffers()
2250 static void evergreen_emit_gs_constant_buffers(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_gs_constant_buffers() argument
2252 evergreen_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_GEOMETRY], in evergreen_emit_gs_constant_buffers()
2259 static void evergreen_emit_ps_constant_buffers(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_ps_constant_buffers() argument
2261 evergreen_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_FRAGMENT], in evergreen_emit_ps_constant_buffers()
2268 static void evergreen_emit_cs_constant_buffers(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_cs_constant_buffers() argument
2270 evergreen_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_COMPUTE], in evergreen_emit_cs_constant_buffers()
2278 static void evergreen_emit_tes_constant_buffers(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_tes_constant_buffers() argument
2280 if (!rctx->tes_shader) in evergreen_emit_tes_constant_buffers()
2282 evergreen_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_TESS_EVAL], in evergreen_emit_tes_constant_buffers()
2289 static void evergreen_emit_tcs_constant_buffers(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_tcs_constant_buffers() argument
2291 if (!rctx->tes_shader) in evergreen_emit_tcs_constant_buffers()
2293 evergreen_emit_constant_buffers(rctx, &rctx->constbuf_state[PIPE_SHADER_TESS_CTRL], in evergreen_emit_tcs_constant_buffers()
2300 static void evergreen_emit_sampler_views(struct r600_context *rctx, in evergreen_emit_sampler_views() argument
2304 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_sampler_views()
2319 reloc = radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, rview->tex_resource, in evergreen_emit_sampler_views()
2333 static void evergreen_emit_vs_sampler_views(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_vs_sampler_views() argument
2335 if (rctx->vs_shader->current->shader.vs_as_ls) { in evergreen_emit_vs_sampler_views()
2336 evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].views, in evergreen_emit_vs_sampler_views()
2339 evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].views, in evergreen_emit_vs_sampler_views()
2344 static void evergreen_emit_gs_sampler_views(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_gs_sampler_views() argument
2346 evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_GEOMETRY].views, in evergreen_emit_gs_sampler_views()
2350 static void evergreen_emit_tcs_sampler_views(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_tcs_sampler_views() argument
2352 evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_TESS_CTRL].views, in evergreen_emit_tcs_sampler_views()
2356 static void evergreen_emit_tes_sampler_views(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_tes_sampler_views() argument
2358 if (!rctx->tes_shader) in evergreen_emit_tes_sampler_views()
2360 evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_TESS_EVAL].views, in evergreen_emit_tes_sampler_views()
2364 static void evergreen_emit_ps_sampler_views(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_ps_sampler_views() argument
2366 evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].views, in evergreen_emit_ps_sampler_views()
2370 static void evergreen_emit_cs_sampler_views(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_cs_sampler_views() argument
2372 evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_COMPUTE].views, in evergreen_emit_cs_sampler_views()
2376 static void evergreen_emit_sampler_states(struct r600_context *rctx, in evergreen_emit_sampler_states() argument
2382 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_sampler_states()
2405 static void evergreen_emit_vs_sampler_states(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_vs_sampler_states() argument
2407 if (rctx->vs_shader->current->shader.vs_as_ls) { in evergreen_emit_vs_sampler_states()
2408 evergreen_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_VERTEX], 72, in evergreen_emit_vs_sampler_states()
2411 evergreen_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_VERTEX], 18, in evergreen_emit_vs_sampler_states()
2416 static void evergreen_emit_gs_sampler_states(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_gs_sampler_states() argument
2418 evergreen_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_GEOMETRY], 36, in evergreen_emit_gs_sampler_states()
2422 static void evergreen_emit_tcs_sampler_states(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_tcs_sampler_states() argument
2424 evergreen_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_TESS_CTRL], 54, in evergreen_emit_tcs_sampler_states()
2428 static void evergreen_emit_tes_sampler_states(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_tes_sampler_states() argument
2430 if (!rctx->tes_shader) in evergreen_emit_tes_sampler_states()
2432 evergreen_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_TESS_EVAL], 18, in evergreen_emit_tes_sampler_states()
2436 static void evergreen_emit_ps_sampler_states(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_ps_sampler_states() argument
2438 evergreen_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT], 0, in evergreen_emit_ps_sampler_states()
2442 static void evergreen_emit_cs_sampler_states(struct r600_context *rctx, struct r600_atom *atom) in evergreen_emit_cs_sampler_states() argument
2444 evergreen_emit_sampler_states(rctx, &rctx->samplers[PIPE_SHADER_COMPUTE], 90, in evergreen_emit_cs_sampler_states()
2449 static void evergreen_emit_sample_mask(struct r600_context *rctx, struct r600_atom *a) in evergreen_emit_sample_mask() argument
2454 radeon_set_context_reg(rctx->b.gfx.cs, R_028C3C_PA_SC_AA_MASK, in evergreen_emit_sample_mask()
2458 static void cayman_emit_sample_mask(struct r600_context *rctx, struct r600_atom *a) in cayman_emit_sample_mask() argument
2461 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in cayman_emit_sample_mask()
2469 static void evergreen_emit_vertex_fetch_shader(struct r600_context *rctx, struct r600_atom *a) in evergreen_emit_vertex_fetch_shader() argument
2471 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_vertex_fetch_shader()
2481 radeon_emit(cs, radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, shader->buffer, in evergreen_emit_vertex_fetch_shader()
2486 static void evergreen_emit_shader_stages(struct r600_context *rctx, struct r600_atom *a) in evergreen_emit_shader_stages() argument
2488 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_shader_stages()
2493 if (rctx->vs_shader->current->shader.vs_as_gs_a) { in evergreen_emit_shader_stages()
2501 if (rctx->gs_shader->gs_max_out_vertices <= 128) in evergreen_emit_shader_stages()
2503 else if (rctx->gs_shader->gs_max_out_vertices <= 256) in evergreen_emit_shader_stages()
2505 else if (rctx->gs_shader->gs_max_out_vertices <= 512) in evergreen_emit_shader_stages()
2512 if (!rctx->tes_shader) in evergreen_emit_shader_stages()
2518 if (rctx->gs_shader->current->shader.gs_prim_id_input) in evergreen_emit_shader_stages()
2522 if (rctx->tes_shader) { in evergreen_emit_shader_stages()
2524 struct tgsi_shader_info *info = &rctx->tes_shader->current->selector->info; in evergreen_emit_shader_stages()
2574 if (rctx->tes_shader) { in evergreen_emit_shader_stages()
2590 static void evergreen_emit_gs_rings(struct r600_context *rctx, struct r600_atom *a) in evergreen_emit_gs_rings() argument
2592 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_gs_rings()
2605 radeon_emit(cs, radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, rbuffer, in evergreen_emit_gs_rings()
2615 radeon_emit(cs, radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, rbuffer, in evergreen_emit_gs_rings()
2653 static void cayman_init_atom_start_cs(struct r600_context *rctx) in cayman_init_atom_start_cs() argument
2655 struct r600_command_buffer *cb = &rctx->start_cs_cmd; in cayman_init_atom_start_cs()
2675 cayman_init_common_regs(cb, rctx->b.chip_class, in cayman_init_atom_start_cs()
2676 rctx->b.family, rctx->screen->b.info.drm_minor); in cayman_init_atom_start_cs()
2790 if (rctx->screen->b.has_streamout) { in cayman_init_atom_start_cs()
2812 void evergreen_init_common_regs(struct r600_context *rctx, struct r600_command_buffer *cb, in evergreen_init_common_regs() argument
2836 rctx->default_gprs[R600_HW_STAGE_PS] = 93; in evergreen_init_common_regs()
2837 rctx->default_gprs[R600_HW_STAGE_VS] = 46; in evergreen_init_common_regs()
2838 rctx->r6xx_num_clause_temp_gprs = 4; in evergreen_init_common_regs()
2839 rctx->default_gprs[R600_HW_STAGE_GS] = 31; in evergreen_init_common_regs()
2840 rctx->default_gprs[R600_HW_STAGE_ES] = 31; in evergreen_init_common_regs()
2841 rctx->default_gprs[EG_HW_STAGE_HS] = 23; in evergreen_init_common_regs()
2842 rctx->default_gprs[EG_HW_STAGE_LS] = 23; in evergreen_init_common_regs()
2882 void evergreen_init_atom_start_cs(struct r600_context *rctx) in evergreen_init_atom_start_cs() argument
2884 struct r600_command_buffer *cb = &rctx->start_cs_cmd; in evergreen_init_atom_start_cs()
2901 if (rctx->b.chip_class == CAYMAN) { in evergreen_init_atom_start_cs()
2902 cayman_init_atom_start_cs(rctx); in evergreen_init_atom_start_cs()
2923 evergreen_init_common_regs(rctx, cb, rctx->b.chip_class, in evergreen_init_atom_start_cs()
2924 rctx->b.family, rctx->screen->b.info.drm_minor); in evergreen_init_atom_start_cs()
2926 family = rctx->b.family; in evergreen_init_atom_start_cs()
3200 if (rctx->screen->b.has_streamout) { in evergreen_init_atom_start_cs()
3215 if (rctx->b.family == CHIP_CAICOS) { in evergreen_init_atom_start_cs()
3240 struct r600_context *rctx = (struct r600_context *)ctx; in evergreen_update_ps_state() local
3257 unsigned sprite_coord_enable = rctx->rasterizer ? rctx->rasterizer->sprite_coord_enable : 0; in evergreen_update_ps_state()
3306 rctx->rasterizer && rctx->rasterizer->flatshade)) { in evergreen_update_ps_state()
3328 rctx->framebuffer.nr_samples > 1 && rctx->ps_iter_samples > 0) in evergreen_update_ps_state()
3426 if (rctx->rasterizer) in evergreen_update_ps_state()
3427 shader->flatshade = rctx->rasterizer->flatshade; in evergreen_update_ps_state()
3448 struct r600_context *rctx = (struct r600_context *)ctx; in evergreen_update_gs_state() local
3469 if (rctx->screen->b.info.drm_minor >= 35) { in evergreen_update_gs_state()
3597 void *evergreen_create_resolve_blend(struct r600_context *rctx) in evergreen_create_resolve_blend() argument
3604 return evergreen_create_blend_state_mode(&rctx->b.b, &blend, V_028808_CB_RESOLVE); in evergreen_create_resolve_blend()
3607 void *evergreen_create_decompress_blend(struct r600_context *rctx) in evergreen_create_decompress_blend() argument
3610 unsigned mode = rctx->screen->has_compressed_msaa_texturing ? in evergreen_create_decompress_blend()
3616 return evergreen_create_blend_state_mode(&rctx->b.b, &blend, mode); in evergreen_create_decompress_blend()
3619 void *evergreen_create_fastclear_blend(struct r600_context *rctx) in evergreen_create_fastclear_blend() argument
3627 return evergreen_create_blend_state_mode(&rctx->b.b, &blend, mode); in evergreen_create_fastclear_blend()
3630 void *evergreen_create_db_flush_dsa(struct r600_context *rctx) in evergreen_create_db_flush_dsa() argument
3634 return rctx->b.b.create_depth_stencil_alpha_state(&rctx->b.b, &dsa); in evergreen_create_db_flush_dsa()
3637 void evergreen_update_db_shader_control(struct r600_context * rctx) in evergreen_update_db_shader_control() argument
3642 if (!rctx->ps_shader) { in evergreen_update_db_shader_control()
3646 dual_export = rctx->framebuffer.export_16bpc && in evergreen_update_db_shader_control()
3647 !rctx->ps_shader->current->ps_depth_export; in evergreen_update_db_shader_control()
3649 db_shader_control = rctx->ps_shader->current->db_shader_control | in evergreen_update_db_shader_control()
3653 S_02880C_ALPHA_TO_MASK_DISABLE(rctx->framebuffer.cb0_is_integer); in evergreen_update_db_shader_control()
3667 if (rctx->alphatest_state.sx_alpha_test_control || rctx->ps_shader->info.writes_memory) { in evergreen_update_db_shader_control()
3673 if (db_shader_control != rctx->db_misc_state.db_shader_control) { in evergreen_update_db_shader_control()
3674 rctx->db_misc_state.db_shader_control = db_shader_control; in evergreen_update_db_shader_control()
3675 r600_mark_atom_dirty(rctx, &rctx->db_misc_state.atom); in evergreen_update_db_shader_control()
3679 static void evergreen_dma_copy_tile(struct r600_context *rctx, in evergreen_dma_copy_tile() argument
3694 struct radeon_winsys_cs *cs = rctx->b.dma.cs; in evergreen_dma_copy_tile()
3714 nbanks = eg_num_banks(rctx->screen->b.info.r600_num_banks); in evergreen_dma_copy_tile()
3770 r600_need_dma_space(&rctx->b, ncopy * 9, &rdst->resource, &rsrc->resource); in evergreen_dma_copy_tile()
3779 radeon_add_to_buffer_list(&rctx->b, &rctx->b.dma, &rsrc->resource, in evergreen_dma_copy_tile()
3781 radeon_add_to_buffer_list(&rctx->b, &rctx->b.dma, &rdst->resource, in evergreen_dma_copy_tile()
3808 struct r600_context *rctx = (struct r600_context *)ctx; in evergreen_dma_copy() local
3816 if (rctx->b.dma.cs == NULL) { in evergreen_dma_copy()
3820 if (rctx->cmd_buf_is_compute) { in evergreen_dma_copy()
3821 rctx->b.gfx.flush(rctx, PIPE_FLUSH_ASYNC, NULL); in evergreen_dma_copy()
3822 rctx->cmd_buf_is_compute = false; in evergreen_dma_copy()
3826 evergreen_dma_copy_buffer(rctx, dst, src, dst_x, src_box->x, src_box->width); in evergreen_dma_copy()
3831 !r600_prepare_for_dma_blit(&rctx->b, rdst, dst_level, dstx, dsty, in evergreen_dma_copy()
3866 if ((rctx->b.chip_class == CAYMAN) && in evergreen_dma_copy()
3885 evergreen_dma_copy_buffer(rctx, dst, src, dst_offset, src_offset, in evergreen_dma_copy()
3888 evergreen_dma_copy_tile(rctx, dst, dst_level, dst_x, dst_y, dst_z, in evergreen_dma_copy()
3903 struct r600_context *rctx = (struct r600_context *)ctx; in evergreen_set_tess_state() local
3905 memcpy(rctx->tess_state, default_outer_level, sizeof(float) * 4); in evergreen_set_tess_state()
3906 memcpy(rctx->tess_state+4, default_inner_level, sizeof(float) * 2); in evergreen_set_tess_state()
3907 rctx->driver_consts[PIPE_SHADER_TESS_CTRL].tcs_default_levels_dirty = true; in evergreen_set_tess_state()
3910 static void evergreen_setup_immed_buffer(struct r600_context *rctx, in evergreen_setup_immed_buffer() argument
3914 struct r600_screen *rscreen = (struct r600_screen *)rctx->b.b.screen; in evergreen_setup_immed_buffer()
3931 evergreen_fill_buffer_resource_words(rctx, &resource->immed_buffer->b.b, in evergreen_setup_immed_buffer()
3941 struct r600_context *rctx = (struct r600_context *)ctx; in evergreen_set_hw_atomic_buffers() local
3945 astate = &rctx->atomic_buffer_state; in evergreen_set_hw_atomic_buffers()
3973 struct r600_context *rctx = (struct r600_context *)ctx; in evergreen_set_shader_buffers() local
3987 istate = &rctx->fragment_buffers; in evergreen_set_shader_buffers()
3989 istate = &rctx->compute_buffers; in evergreen_set_shader_buffers()
4009 evergreen_setup_immed_buffer(rctx, rview, PIPE_FORMAT_R32_UINT); in evergreen_set_shader_buffers()
4013 evergreen_set_color_surface_buffer(rctx, resource, in evergreen_set_shader_buffers()
4043 evergreen_fill_buffer_resource_words(rctx, &resource->b.b, in evergreen_set_shader_buffers()
4054 r600_mark_atom_dirty(rctx, &rctx->framebuffer.atom); in evergreen_set_shader_buffers()
4057 if (rctx->cb_misc_state.buffer_rat_enabled_mask != istate->enabled_mask) { in evergreen_set_shader_buffers()
4058 rctx->cb_misc_state.buffer_rat_enabled_mask = istate->enabled_mask; in evergreen_set_shader_buffers()
4059 r600_mark_atom_dirty(rctx, &rctx->cb_misc_state.atom); in evergreen_set_shader_buffers()
4063 r600_mark_atom_dirty(rctx, &istate->atom); in evergreen_set_shader_buffers()
4071 struct r600_context *rctx = (struct r600_context *)ctx; in evergreen_set_shader_images() local
4086 istate = &rctx->fragment_images; in evergreen_set_shader_images()
4088 istate = &rctx->compute_images; in evergreen_set_shader_images()
4116 evergreen_setup_immed_buffer(rctx, rview, iview->format); in evergreen_set_shader_images()
4131 evergreen_set_color_surface_common(rctx, rtex, in evergreen_set_shader_images()
4142 evergreen_set_color_surface_buffer(rctx, resource, in evergreen_set_shader_images()
4204 evergreen_fill_tex_resource_words(rctx, &resource->b.b, &tex_params, in evergreen_set_shader_images()
4217 evergreen_fill_buffer_resource_words(rctx, &resource->b.b, in evergreen_set_shader_images()
4227 rctx->b.flags |= R600_CONTEXT_WAIT_3D_IDLE | R600_CONTEXT_FLUSH_AND_INV; in evergreen_set_shader_images()
4228 rctx->b.flags |= R600_CONTEXT_FLUSH_AND_INV_CB | in evergreen_set_shader_images()
4232 r600_mark_atom_dirty(rctx, &rctx->framebuffer.atom); in evergreen_set_shader_images()
4234 if (rctx->cb_misc_state.image_rat_enabled_mask != istate->enabled_mask) { in evergreen_set_shader_images()
4235 rctx->cb_misc_state.image_rat_enabled_mask = istate->enabled_mask; in evergreen_set_shader_images()
4236 r600_mark_atom_dirty(rctx, &rctx->cb_misc_state.atom); in evergreen_set_shader_images()
4240 r600_mark_atom_dirty(rctx, &istate->atom); in evergreen_set_shader_images()
4243 void evergreen_init_state_functions(struct r600_context *rctx) in evergreen_init_state_functions() argument
4256 if (rctx->b.chip_class == EVERGREEN) { in evergreen_init_state_functions()
4257 r600_init_atom(rctx, &rctx->config_state.atom, id++, evergreen_emit_config_state, 11); in evergreen_init_state_functions()
4258 rctx->config_state.dyn_gpr_enabled = true; in evergreen_init_state_functions()
4260 r600_init_atom(rctx, &rctx->framebuffer.atom, id++, evergreen_emit_framebuffer_state, 0); in evergreen_init_state_functions()
4261 r600_init_atom(rctx, &rctx->fragment_images.atom, id++, evergreen_emit_fragment_image_state, 0); in evergreen_init_state_functions()
4262 r600_init_atom(rctx, &rctx->compute_images.atom, id++, evergreen_emit_compute_image_state, 0); in evergreen_init_state_functions()
4263 r600_init_atom(rctx, &rctx->fragment_buffers.atom, id++, evergreen_emit_fragment_buffer_state, 0); in evergreen_init_state_functions()
4264 r600_init_atom(rctx, &rctx->compute_buffers.atom, id++, evergreen_emit_compute_buffer_state, 0); in evergreen_init_state_functions()
4266 …r600_init_atom(rctx, &rctx->constbuf_state[PIPE_SHADER_VERTEX].atom, id++, evergreen_emit_vs_const… in evergreen_init_state_functions()
4267 …r600_init_atom(rctx, &rctx->constbuf_state[PIPE_SHADER_GEOMETRY].atom, id++, evergreen_emit_gs_con… in evergreen_init_state_functions()
4268 …r600_init_atom(rctx, &rctx->constbuf_state[PIPE_SHADER_FRAGMENT].atom, id++, evergreen_emit_ps_con… in evergreen_init_state_functions()
4269 …r600_init_atom(rctx, &rctx->constbuf_state[PIPE_SHADER_TESS_CTRL].atom, id++, evergreen_emit_tcs_c… in evergreen_init_state_functions()
4270 …r600_init_atom(rctx, &rctx->constbuf_state[PIPE_SHADER_TESS_EVAL].atom, id++, evergreen_emit_tes_c… in evergreen_init_state_functions()
4271 …r600_init_atom(rctx, &rctx->constbuf_state[PIPE_SHADER_COMPUTE].atom, id++, evergreen_emit_cs_cons… in evergreen_init_state_functions()
4273 r600_init_atom(rctx, &rctx->cs_shader_state.atom, id++, evergreen_emit_cs_shader, 0); in evergreen_init_state_functions()
4275 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].states.atom, id++, evergreen_emit_vs_samp… in evergreen_init_state_functions()
4276 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_GEOMETRY].states.atom, id++, evergreen_emit_gs_sa… in evergreen_init_state_functions()
4277 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_TESS_CTRL].states.atom, id++, evergreen_emit_tcs_… in evergreen_init_state_functions()
4278 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_TESS_EVAL].states.atom, id++, evergreen_emit_tes_… in evergreen_init_state_functions()
4279 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].states.atom, id++, evergreen_emit_ps_sa… in evergreen_init_state_functions()
4280 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_COMPUTE].states.atom, id++, evergreen_emit_cs_sam… in evergreen_init_state_functions()
4282 r600_init_atom(rctx, &rctx->vertex_buffer_state.atom, id++, evergreen_fs_emit_vertex_buffers, 0); in evergreen_init_state_functions()
4283 …r600_init_atom(rctx, &rctx->cs_vertex_buffer_state.atom, id++, evergreen_cs_emit_vertex_buffers, 0… in evergreen_init_state_functions()
4284 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].views.atom, id++, evergreen_emit_vs_sampl… in evergreen_init_state_functions()
4285 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_GEOMETRY].views.atom, id++, evergreen_emit_gs_sam… in evergreen_init_state_functions()
4286 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_TESS_CTRL].views.atom, id++, evergreen_emit_tcs_s… in evergreen_init_state_functions()
4287 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_TESS_EVAL].views.atom, id++, evergreen_emit_tes_s… in evergreen_init_state_functions()
4288 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].views.atom, id++, evergreen_emit_ps_sam… in evergreen_init_state_functions()
4289 …r600_init_atom(rctx, &rctx->samplers[PIPE_SHADER_COMPUTE].views.atom, id++, evergreen_emit_cs_samp… in evergreen_init_state_functions()
4291 r600_init_atom(rctx, &rctx->vgt_state.atom, id++, r600_emit_vgt_state, 10); in evergreen_init_state_functions()
4293 if (rctx->b.chip_class == EVERGREEN) { in evergreen_init_state_functions()
4294 r600_init_atom(rctx, &rctx->sample_mask.atom, id++, evergreen_emit_sample_mask, 3); in evergreen_init_state_functions()
4296 r600_init_atom(rctx, &rctx->sample_mask.atom, id++, cayman_emit_sample_mask, 4); in evergreen_init_state_functions()
4298 rctx->sample_mask.sample_mask = ~0; in evergreen_init_state_functions()
4300 r600_init_atom(rctx, &rctx->alphatest_state.atom, id++, r600_emit_alphatest_state, 6); in evergreen_init_state_functions()
4301 r600_init_atom(rctx, &rctx->blend_color.atom, id++, r600_emit_blend_color, 6); in evergreen_init_state_functions()
4302 r600_init_atom(rctx, &rctx->blend_state.atom, id++, r600_emit_cso_state, 0); in evergreen_init_state_functions()
4303 r600_init_atom(rctx, &rctx->cb_misc_state.atom, id++, evergreen_emit_cb_misc_state, 4); in evergreen_init_state_functions()
4304 r600_init_atom(rctx, &rctx->clip_misc_state.atom, id++, r600_emit_clip_misc_state, 9); in evergreen_init_state_functions()
4305 r600_init_atom(rctx, &rctx->clip_state.atom, id++, evergreen_emit_clip_state, 26); in evergreen_init_state_functions()
4306 r600_init_atom(rctx, &rctx->db_misc_state.atom, id++, evergreen_emit_db_misc_state, 10); in evergreen_init_state_functions()
4307 r600_init_atom(rctx, &rctx->db_state.atom, id++, evergreen_emit_db_state, 14); in evergreen_init_state_functions()
4308 r600_init_atom(rctx, &rctx->dsa_state.atom, id++, r600_emit_cso_state, 0); in evergreen_init_state_functions()
4309 r600_init_atom(rctx, &rctx->poly_offset_state.atom, id++, evergreen_emit_polygon_offset, 9); in evergreen_init_state_functions()
4310 r600_init_atom(rctx, &rctx->rasterizer_state.atom, id++, r600_emit_cso_state, 0); in evergreen_init_state_functions()
4311 r600_add_atom(rctx, &rctx->b.scissors.atom, id++); in evergreen_init_state_functions()
4312 r600_add_atom(rctx, &rctx->b.viewports.atom, id++); in evergreen_init_state_functions()
4313 r600_init_atom(rctx, &rctx->stencil_ref.atom, id++, r600_emit_stencil_ref, 4); in evergreen_init_state_functions()
4314 r600_init_atom(rctx, &rctx->vertex_fetch_shader.atom, id++, evergreen_emit_vertex_fetch_shader, 5); in evergreen_init_state_functions()
4315 r600_add_atom(rctx, &rctx->b.render_cond_atom, id++); in evergreen_init_state_functions()
4316 r600_add_atom(rctx, &rctx->b.streamout.begin_atom, id++); in evergreen_init_state_functions()
4317 r600_add_atom(rctx, &rctx->b.streamout.enable_atom, id++); in evergreen_init_state_functions()
4319 r600_init_atom(rctx, &rctx->hw_shader_stages[i].atom, id++, r600_emit_shader, 0); in evergreen_init_state_functions()
4320 r600_init_atom(rctx, &rctx->shader_stages.atom, id++, evergreen_emit_shader_stages, 15); in evergreen_init_state_functions()
4321 r600_init_atom(rctx, &rctx->gs_rings.atom, id++, evergreen_emit_gs_rings, 26); in evergreen_init_state_functions()
4323 rctx->b.b.create_blend_state = evergreen_create_blend_state; in evergreen_init_state_functions()
4324 rctx->b.b.create_depth_stencil_alpha_state = evergreen_create_dsa_state; in evergreen_init_state_functions()
4325 rctx->b.b.create_rasterizer_state = evergreen_create_rs_state; in evergreen_init_state_functions()
4326 rctx->b.b.create_sampler_state = evergreen_create_sampler_state; in evergreen_init_state_functions()
4327 rctx->b.b.create_sampler_view = evergreen_create_sampler_view; in evergreen_init_state_functions()
4328 rctx->b.b.set_framebuffer_state = evergreen_set_framebuffer_state; in evergreen_init_state_functions()
4329 rctx->b.b.set_polygon_stipple = evergreen_set_polygon_stipple; in evergreen_init_state_functions()
4330 rctx->b.b.set_min_samples = evergreen_set_min_samples; in evergreen_init_state_functions()
4331 rctx->b.b.set_tess_state = evergreen_set_tess_state; in evergreen_init_state_functions()
4332 rctx->b.b.set_hw_atomic_buffers = evergreen_set_hw_atomic_buffers; in evergreen_init_state_functions()
4333 rctx->b.b.set_shader_images = evergreen_set_shader_images; in evergreen_init_state_functions()
4334 rctx->b.b.set_shader_buffers = evergreen_set_shader_buffers; in evergreen_init_state_functions()
4335 if (rctx->b.chip_class == EVERGREEN) in evergreen_init_state_functions()
4336 rctx->b.b.get_sample_position = evergreen_get_sample_position; in evergreen_init_state_functions()
4338 rctx->b.b.get_sample_position = cayman_get_sample_position; in evergreen_init_state_functions()
4339 rctx->b.dma_copy = evergreen_dma_copy; in evergreen_init_state_functions()
4341 evergreen_init_compute_state_functions(rctx); in evergreen_init_state_functions()
4361 void evergreen_setup_tess_constants(struct r600_context *rctx, const struct pipe_draw_info *info, u… in evergreen_setup_tess_constants() argument
4364 struct r600_pipe_shader_selector *tcs = rctx->tcs_shader ? rctx->tcs_shader : rctx->tes_shader; in evergreen_setup_tess_constants()
4365 struct r600_pipe_shader_selector *ls = rctx->vs_shader; in evergreen_setup_tess_constants()
4376 unsigned num_pipes = rctx->screen->b.info.r600_max_quad_pipes; in evergreen_setup_tess_constants()
4381 if (!rctx->tes_shader) { in evergreen_setup_tess_constants()
4382 rctx->lds_alloc = 0; in evergreen_setup_tess_constants()
4383 rctx->b.b.set_constant_buffer(&rctx->b.b, PIPE_SHADER_VERTEX, in evergreen_setup_tess_constants()
4385 rctx->b.b.set_constant_buffer(&rctx->b.b, PIPE_SHADER_TESS_CTRL, in evergreen_setup_tess_constants()
4387 rctx->b.b.set_constant_buffer(&rctx->b.b, PIPE_SHADER_TESS_EVAL, in evergreen_setup_tess_constants()
4392 if (rctx->lds_alloc != 0 && in evergreen_setup_tess_constants()
4393 rctx->last_ls == ls && in evergreen_setup_tess_constants()
4394 rctx->last_num_tcs_input_cp == num_tcs_input_cp && in evergreen_setup_tess_constants()
4395 rctx->last_tcs == tcs) in evergreen_setup_tess_constants()
4400 if (rctx->tcs_shader) { in evergreen_setup_tess_constants()
4419 output_patch0_offset = rctx->tcs_shader ? input_patch_size * *num_patches : 0; in evergreen_setup_tess_constants()
4438 rctx->lds_alloc = (lds_size | (num_waves << 14)); in evergreen_setup_tess_constants()
4440 rctx->last_ls = ls; in evergreen_setup_tess_constants()
4441 rctx->last_tcs = tcs; in evergreen_setup_tess_constants()
4442 rctx->last_num_tcs_input_cp = num_tcs_input_cp; in evergreen_setup_tess_constants()
4447 rctx->b.b.set_constant_buffer(&rctx->b.b, PIPE_SHADER_VERTEX, in evergreen_setup_tess_constants()
4449 rctx->b.b.set_constant_buffer(&rctx->b.b, PIPE_SHADER_TESS_CTRL, in evergreen_setup_tess_constants()
4451 rctx->b.b.set_constant_buffer(&rctx->b.b, PIPE_SHADER_TESS_EVAL, in evergreen_setup_tess_constants()
4456 uint32_t evergreen_get_ls_hs_config(struct r600_context *rctx, in evergreen_get_ls_hs_config() argument
4462 if (!rctx->tes_shader) in evergreen_get_ls_hs_config()
4465 num_output_cp = rctx->tcs_shader ? in evergreen_get_ls_hs_config()
4466 rctx->tcs_shader->info.properties[TGSI_PROPERTY_TCS_VERTICES_OUT] : in evergreen_get_ls_hs_config()
4474 void evergreen_set_ls_hs_config(struct r600_context *rctx, in evergreen_set_ls_hs_config() argument
4481 void evergreen_set_lds_alloc(struct r600_context *rctx, in evergreen_set_lds_alloc() argument
4490 bool evergreen_adjust_gprs(struct r600_context *rctx) in evergreen_adjust_gprs() argument
4496 unsigned def_num_clause_temp_gprs = rctx->r6xx_num_clause_temp_gprs; in evergreen_adjust_gprs()
4504 def_gprs[i] = rctx->default_gprs[i]; in evergreen_adjust_gprs()
4510 if (!rctx->hw_shader_stages[EG_HW_STAGE_HS].shader) { in evergreen_adjust_gprs()
4511 if (rctx->config_state.dyn_gpr_enabled) in evergreen_adjust_gprs()
4515 rctx->config_state.dyn_gpr_enabled = true; in evergreen_adjust_gprs()
4516 r600_mark_atom_dirty(rctx, &rctx->config_state.atom); in evergreen_adjust_gprs()
4517 rctx->b.flags |= R600_CONTEXT_WAIT_3D_IDLE; in evergreen_adjust_gprs()
4524 if (rctx->hw_shader_stages[i].shader) in evergreen_adjust_gprs()
4525 num_gprs[i] = rctx->hw_shader_stages[i].shader->shader.bc.ngpr; in evergreen_adjust_gprs()
4530 cur_gprs[R600_HW_STAGE_PS] = G_008C04_NUM_PS_GPRS(rctx->config_state.sq_gpr_resource_mgmt_1); in evergreen_adjust_gprs()
4531 cur_gprs[R600_HW_STAGE_VS] = G_008C04_NUM_VS_GPRS(rctx->config_state.sq_gpr_resource_mgmt_1); in evergreen_adjust_gprs()
4532 cur_gprs[R600_HW_STAGE_GS] = G_008C08_NUM_GS_GPRS(rctx->config_state.sq_gpr_resource_mgmt_2); in evergreen_adjust_gprs()
4533 cur_gprs[R600_HW_STAGE_ES] = G_008C08_NUM_ES_GPRS(rctx->config_state.sq_gpr_resource_mgmt_2); in evergreen_adjust_gprs()
4534 cur_gprs[EG_HW_STAGE_LS] = G_008C0C_NUM_LS_GPRS(rctx->config_state.sq_gpr_resource_mgmt_3); in evergreen_adjust_gprs()
4535 cur_gprs[EG_HW_STAGE_HS] = G_008C0C_NUM_HS_GPRS(rctx->config_state.sq_gpr_resource_mgmt_3); in evergreen_adjust_gprs()
4553 if (rctx->config_state.dyn_gpr_enabled) { in evergreen_adjust_gprs()
4555 rctx->config_state.dyn_gpr_enabled = false; in evergreen_adjust_gprs()
4589 if (rctx->config_state.sq_gpr_resource_mgmt_1 != tmp[0] || in evergreen_adjust_gprs()
4590 rctx->config_state.sq_gpr_resource_mgmt_2 != tmp[1] || in evergreen_adjust_gprs()
4591 rctx->config_state.sq_gpr_resource_mgmt_3 != tmp[2]) { in evergreen_adjust_gprs()
4592 rctx->config_state.sq_gpr_resource_mgmt_1 = tmp[0]; in evergreen_adjust_gprs()
4593 rctx->config_state.sq_gpr_resource_mgmt_2 = tmp[1]; in evergreen_adjust_gprs()
4594 rctx->config_state.sq_gpr_resource_mgmt_3 = tmp[2]; in evergreen_adjust_gprs()
4601 r600_mark_atom_dirty(rctx, &rctx->config_state.atom); in evergreen_adjust_gprs()
4602 rctx->b.flags |= R600_CONTEXT_WAIT_3D_IDLE; in evergreen_adjust_gprs()
4609 void eg_trace_emit(struct r600_context *rctx) in eg_trace_emit() argument
4611 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in eg_trace_emit()
4614 if (rctx->b.chip_class < EVERGREEN) in eg_trace_emit()
4618 reloc = radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, in eg_trace_emit()
4619 (struct r600_resource*)rctx->trace_buf, RADEON_USAGE_WRITE, in eg_trace_emit()
4622 rctx->trace_id++; in eg_trace_emit()
4623 radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, rctx->trace_buf, in eg_trace_emit()
4626 radeon_emit(cs, rctx->trace_buf->gpu_address); in eg_trace_emit()
4627 radeon_emit(cs, rctx->trace_buf->gpu_address >> 32 | MEM_WRITE_32_BITS | MEM_WRITE_CONFIRM); in eg_trace_emit()
4628 radeon_emit(cs, rctx->trace_id); in eg_trace_emit()
4633 radeon_emit(cs, AC_ENCODE_TRACE_POINT(rctx->trace_id)); in eg_trace_emit()
4636 static void evergreen_emit_set_append_cnt(struct r600_context *rctx, in evergreen_emit_set_append_cnt() argument
4641 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_set_append_cnt()
4642 unsigned reloc = radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, in evergreen_emit_set_append_cnt()
4659 static void evergreen_emit_event_write_eos(struct r600_context *rctx, in evergreen_emit_event_write_eos() argument
4664 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_event_write_eos()
4667 uint32_t reloc = radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, in evergreen_emit_event_write_eos()
4686 static void cayman_emit_event_write_eos(struct r600_context *rctx, in cayman_emit_event_write_eos() argument
4691 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in cayman_emit_event_write_eos()
4693 uint32_t reloc = radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, in cayman_emit_event_write_eos()
4712 static void cayman_write_count_to_gds(struct r600_context *rctx, in cayman_write_count_to_gds() argument
4717 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in cayman_write_count_to_gds()
4718 unsigned reloc = radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, in cayman_write_count_to_gds()
4734 bool evergreen_emit_atomic_buffer_setup(struct r600_context *rctx, in evergreen_emit_atomic_buffer_setup() argument
4739 struct r600_atomic_buffer_state *astate = &rctx->atomic_buffer_state; in evergreen_emit_atomic_buffer_setup()
4755 pshader = rctx->hw_shader_stages[i].shader; in evergreen_emit_atomic_buffer_setup()
4788 if (rctx->b.chip_class == CAYMAN) in evergreen_emit_atomic_buffer_setup()
4789 cayman_write_count_to_gds(rctx, atomic, resource, pkt_flags); in evergreen_emit_atomic_buffer_setup()
4791 evergreen_emit_set_append_cnt(rctx, atomic, resource, pkt_flags); in evergreen_emit_atomic_buffer_setup()
4797 void evergreen_emit_atomic_buffer_save(struct r600_context *rctx, in evergreen_emit_atomic_buffer_save() argument
4802 struct radeon_winsys_cs *cs = rctx->b.gfx.cs; in evergreen_emit_atomic_buffer_save()
4803 struct r600_atomic_buffer_state *astate = &rctx->atomic_buffer_state; in evergreen_emit_atomic_buffer_save()
4823 if (rctx->b.chip_class == CAYMAN) in evergreen_emit_atomic_buffer_save()
4824 cayman_emit_event_write_eos(rctx, atomic, resource, pkt_flags); in evergreen_emit_atomic_buffer_save()
4826 evergreen_emit_event_write_eos(rctx, atomic, resource, pkt_flags); in evergreen_emit_atomic_buffer_save()
4832 ++rctx->append_fence_id; in evergreen_emit_atomic_buffer_save()
4833 reloc = radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, in evergreen_emit_atomic_buffer_save()
4834 r600_resource(rctx->append_fence), in evergreen_emit_atomic_buffer_save()
4837 dst_offset = r600_resource(rctx->append_fence)->gpu_address; in evergreen_emit_atomic_buffer_save()
4842 radeon_emit(cs, rctx->append_fence_id); in evergreen_emit_atomic_buffer_save()
4850 radeon_emit(cs, rctx->append_fence_id); in evergreen_emit_atomic_buffer_save()