X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Filo%2Filo_draw.c;h=6831d2c4eff381b5050b86daad171f59a0ba0e89;hb=779653489e53dc837fec5b20319f4b221e8a6432;hp=dfba90d8e3a7e66bc4d56420b83c8fd47d3359b9;hpb=18cbd3cc3414bca77edc26d0e009b8acbf551cba;p=mesa.git diff --git a/src/gallium/drivers/ilo/ilo_draw.c b/src/gallium/drivers/ilo/ilo_draw.c index dfba90d8e3a..6831d2c4eff 100644 --- a/src/gallium/drivers/ilo/ilo_draw.c +++ b/src/gallium/drivers/ilo/ilo_draw.c @@ -26,7 +26,7 @@ */ #include "util/u_prim.h" -#include "intel_winsys.h" +#include "core/intel_winsys.h" #include "ilo_render.h" #include "ilo_blit.h" @@ -71,6 +71,7 @@ query_process_bo(const struct ilo_context *ilo, struct ilo_query *q) switch (q->type) { case PIPE_QUERY_OCCLUSION_COUNTER: + case PIPE_QUERY_OCCLUSION_PREDICATE: case PIPE_QUERY_TIME_ELAPSED: case PIPE_QUERY_PRIMITIVES_GENERATED: case PIPE_QUERY_PRIMITIVES_EMITTED: @@ -157,6 +158,7 @@ ilo_init_draw_query(struct ilo_context *ilo, struct ilo_query *q) switch (q->type) { case PIPE_QUERY_OCCLUSION_COUNTER: + case PIPE_QUERY_OCCLUSION_PREDICATE: case PIPE_QUERY_TIME_ELAPSED: case PIPE_QUERY_PRIMITIVES_GENERATED: case PIPE_QUERY_PRIMITIVES_EMITTED: @@ -176,15 +178,14 @@ ilo_init_draw_query(struct ilo_context *ilo, struct ilo_query *q) break; } - q->cmd_len = ilo_render_estimate_size(ilo->render, - ILO_RENDER_QUERY, q); + q->cmd_len = ilo_render_get_query_len(ilo->render, q->type); /* double cmd_len and stride if in pairs */ q->cmd_len <<= q->in_pairs; q->stride <<= q->in_pairs; bo_size = (q->stride > 4096) ? q->stride : 4096; - q->bo = intel_winsys_alloc_buffer(ilo->winsys, "query", bo_size, false); + q->bo = intel_winsys_alloc_bo(ilo->winsys, "query", bo_size, false); if (!q->bo) return false; @@ -297,8 +298,9 @@ draw_vbo(struct ilo_context *ilo, const struct ilo_state_vector *vec) bool success = true; int max_len, before_space; - /* on GEN7+, we need SOL_RESET to reset the SO write offsets */ + /* on Gen7 and Gen7.5, we need SOL_RESET to reset the SO write offsets */ if (ilo_dev_gen(ilo->dev) >= ILO_GEN(7) && + ilo_dev_gen(ilo->dev) <= ILO_GEN(7.5) && (vec->dirty & ILO_DIRTY_SO) && vec->so.enabled && !vec->so.append_bitmask) { ilo_cp_submit(ilo->cp, "SOL_RESET"); @@ -321,8 +323,7 @@ draw_vbo(struct ilo_context *ilo, const struct ilo_state_vector *vec) ilo_draw_set_owner(ilo); /* make sure there is enough room first */ - max_len = ilo_render_estimate_size(ilo->render, - ILO_RENDER_DRAW, vec); + max_len = ilo_render_get_draw_len(ilo->render, vec); if (need_flush) max_len += ilo_render_get_flush_len(ilo->render); @@ -376,8 +377,7 @@ ilo_draw_rectlist(struct ilo_context *ilo) ilo_draw_set_owner(ilo); - max_len = ilo_render_estimate_size(ilo->render, - ILO_RENDER_RECTLIST, ilo->blitter); + max_len = ilo_render_get_rectlist_len(ilo->render, ilo->blitter); max_len += ilo_render_get_flush_len(ilo->render) * 2; if (max_len > ilo_cp_space(ilo->cp)) { @@ -446,6 +446,7 @@ draw_vbo_with_sw_restart(struct ilo_context *ilo, const struct pipe_draw_info *info) { const struct ilo_ib_state *ib = &ilo->state_vector.ib; + const struct ilo_vma *vma; union { const void *ptr; const uint8_t *u8; @@ -454,12 +455,14 @@ draw_vbo_with_sw_restart(struct ilo_context *ilo, } u; /* we will draw with IB mapped */ - if (ib->buffer) { - u.ptr = intel_bo_map(ilo_buffer(ib->buffer)->bo, false); + if (ib->state.buffer) { + vma = ilo_resource_get_vma(ib->state.buffer); + u.ptr = intel_bo_map(vma->bo, false); if (u.ptr) - u.u8 += ib->offset; + u.u8 += vma->bo_offset + ib->state.offset; } else { - u.ptr = ib->user_buffer; + vma = NULL; + u.ptr = ib->state.user_buffer; } if (!u.ptr) @@ -485,7 +488,7 @@ draw_vbo_with_sw_restart(struct ilo_context *ilo, (pipe)->draw_vbo(pipe, &subinfo); \ } while (0) - switch (ib->index_size) { + switch (ib->state.index_size) { case 1: DRAW_VBO_WITH_SW_RESTART(&ilo->base, info, u.u8); break; @@ -502,8 +505,8 @@ draw_vbo_with_sw_restart(struct ilo_context *ilo, #undef DRAW_VBO_WITH_SW_RESTART - if (ib->buffer) - intel_bo_unmap(ilo_buffer(ib->buffer)->bo); + if (vma) + intel_bo_unmap(vma->bo); } static bool @@ -513,9 +516,9 @@ draw_vbo_need_sw_restart(const struct ilo_context *ilo, /* the restart index is fixed prior to GEN7.5 */ if (ilo_dev_gen(ilo->dev) < ILO_GEN(7.5)) { const unsigned cut_index = - (ilo->state_vector.ib.index_size == 1) ? 0xff : - (ilo->state_vector.ib.index_size == 2) ? 0xffff : - (ilo->state_vector.ib.index_size == 4) ? 0xffffffff : 0; + (ilo->state_vector.ib.state.index_size == 1) ? 0xff : + (ilo->state_vector.ib.state.index_size == 2) ? 0xffff : + (ilo->state_vector.ib.state.index_size == 4) ? 0xffffffff : 0; if (info->restart_index < cut_index) return true; @@ -546,6 +549,7 @@ static void ilo_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) { struct ilo_context *ilo = ilo_context(pipe); + int vs_scratch_size, gs_scratch_size, fs_scratch_size; if (ilo_debug & ILO_DEBUG_DRAW) { if (info->indexed) { @@ -573,8 +577,15 @@ ilo_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) ilo_finalize_3d_states(ilo, info); + /* upload kernels */ ilo_shader_cache_upload(ilo->shader_cache, &ilo->cp->builder); + /* prepare scratch spaces */ + ilo_shader_cache_get_max_scratch_sizes(ilo->shader_cache, + &vs_scratch_size, &gs_scratch_size, &fs_scratch_size); + ilo_render_prepare_scratch_spaces(ilo->render, + vs_scratch_size, gs_scratch_size, fs_scratch_size); + ilo_blit_resolve_framebuffer(ilo); /* If draw_vbo ever fails, return immediately. */