Lines Matching refs:hwtnl
51 struct svga_hwtnl *hwtnl = CALLOC_STRUCT(svga_hwtnl); in svga_hwtnl_create() local
52 if (!hwtnl) in svga_hwtnl_create()
55 hwtnl->svga = svga; in svga_hwtnl_create()
57 hwtnl->cmd.swc = svga->swc; in svga_hwtnl_create()
59 return hwtnl; in svga_hwtnl_create()
67 svga_hwtnl_destroy(struct svga_hwtnl *hwtnl) in svga_hwtnl_destroy() argument
73 pipe_resource_reference(&hwtnl->index_cache[i][j].buffer, NULL); in svga_hwtnl_destroy()
77 for (i = 0; i < hwtnl->cmd.vbuf_count; i++) in svga_hwtnl_destroy()
78 pipe_vertex_buffer_unreference(&hwtnl->cmd.vbufs[i]); in svga_hwtnl_destroy()
80 for (i = 0; i < hwtnl->cmd.prim_count; i++) in svga_hwtnl_destroy()
81 pipe_resource_reference(&hwtnl->cmd.prim_ib[i], NULL); in svga_hwtnl_destroy()
83 FREE(hwtnl); in svga_hwtnl_destroy()
88 svga_hwtnl_set_flatshade(struct svga_hwtnl *hwtnl, in svga_hwtnl_set_flatshade() argument
91 struct svga_screen *svgascreen = svga_screen(hwtnl->svga->pipe.screen); in svga_hwtnl_set_flatshade()
94 hwtnl->api_pv = (flatshade && !flatshade_first) ? PV_LAST : PV_FIRST; in svga_hwtnl_set_flatshade()
99 hwtnl->hw_pv = hwtnl->api_pv; in svga_hwtnl_set_flatshade()
103 hwtnl->hw_pv = PV_FIRST; in svga_hwtnl_set_flatshade()
109 svga_hwtnl_set_fillmode(struct svga_hwtnl *hwtnl, unsigned mode) in svga_hwtnl_set_fillmode() argument
111 hwtnl->api_fillmode = mode; in svga_hwtnl_set_fillmode()
116 svga_hwtnl_vertex_decls(struct svga_hwtnl *hwtnl, in svga_hwtnl_vertex_decls() argument
122 assert(hwtnl->cmd.prim_count == 0); in svga_hwtnl_vertex_decls()
123 hwtnl->cmd.vdecl_count = count; in svga_hwtnl_vertex_decls()
124 hwtnl->cmd.vdecl_layout_id = layout_id; in svga_hwtnl_vertex_decls()
125 memcpy(hwtnl->cmd.vdecl, decls, count * sizeof(*decls)); in svga_hwtnl_vertex_decls()
126 memcpy(hwtnl->cmd.vdecl_buffer_index, buffer_indexes, in svga_hwtnl_vertex_decls()
135 svga_hwtnl_vertex_buffers(struct svga_hwtnl *hwtnl, in svga_hwtnl_vertex_buffers() argument
138 struct pipe_vertex_buffer *dst = hwtnl->cmd.vbufs; in svga_hwtnl_vertex_buffers()
147 for ( ; i < hwtnl->cmd.vbuf_count; i++) { in svga_hwtnl_vertex_buffers()
152 hwtnl->cmd.vbuf_count = count; in svga_hwtnl_vertex_buffers()
161 svga_hwtnl_is_buffer_referred(struct svga_hwtnl *hwtnl, in svga_hwtnl_is_buffer_referred() argument
170 if (!hwtnl->cmd.prim_count) { in svga_hwtnl_is_buffer_referred()
174 for (i = 0; i < hwtnl->cmd.vbuf_count; ++i) { in svga_hwtnl_is_buffer_referred()
175 if (hwtnl->cmd.vbufs[i].buffer.resource == buffer) { in svga_hwtnl_is_buffer_referred()
180 for (i = 0; i < hwtnl->cmd.prim_count; ++i) { in svga_hwtnl_is_buffer_referred()
181 if (hwtnl->cmd.prim_ib[i] == buffer) { in svga_hwtnl_is_buffer_referred()
191 draw_vgpu9(struct svga_hwtnl *hwtnl) in draw_vgpu9() argument
193 struct svga_winsys_context *swc = hwtnl->cmd.swc; in draw_vgpu9()
194 struct svga_context *svga = hwtnl->svga; in draw_vgpu9()
221 for (i = 0; i < hwtnl->cmd.vdecl_count; i++) { in draw_vgpu9()
222 unsigned j = hwtnl->cmd.vdecl_buffer_index[i]; in draw_vgpu9()
223 handle = svga_buffer_handle(svga, hwtnl->cmd.vbufs[j].buffer.resource, in draw_vgpu9()
231 for (i = 0; i < hwtnl->cmd.prim_count; i++) { in draw_vgpu9()
232 if (hwtnl->cmd.prim_ib[i]) { in draw_vgpu9()
233 handle = svga_buffer_handle(svga, hwtnl->cmd.prim_ib[i], in draw_vgpu9()
275 hwtnl->cmd.prim_count); in draw_vgpu9()
279 hwtnl->cmd.vdecl_count, in draw_vgpu9()
280 &prim, hwtnl->cmd.prim_count); in draw_vgpu9()
285 hwtnl->cmd.vdecl, in draw_vgpu9()
286 hwtnl->cmd.vdecl_count * sizeof hwtnl->cmd.vdecl[0]); in draw_vgpu9()
288 for (i = 0; i < hwtnl->cmd.vdecl_count; i++) { in draw_vgpu9()
297 if (hwtnl->cmd.prim_count == 1) { in draw_vgpu9()
298 vdecl[i].rangeHint.first = hwtnl->cmd.min_index[0]; in draw_vgpu9()
299 vdecl[i].rangeHint.last = hwtnl->cmd.max_index[0] + 1; in draw_vgpu9()
312 hwtnl->cmd.prim, hwtnl->cmd.prim_count * sizeof hwtnl->cmd.prim[0]); in draw_vgpu9()
314 for (i = 0; i < hwtnl->cmd.prim_count; i++) { in draw_vgpu9()
318 pipe_resource_reference(&hwtnl->cmd.prim_ib[i], NULL); in draw_vgpu9()
323 hwtnl->cmd.prim_count = 0; in draw_vgpu9()
523 validate_vertex_buffers(struct svga_hwtnl *hwtnl, in validate_vertex_buffers() argument
526 struct svga_context *svga = hwtnl->svga; in validate_vertex_buffers()
530 const unsigned vbuf_count = so_vertex_count ? 1 : hwtnl->cmd.vbuf_count; in validate_vertex_buffers()
545 svga_buffer(hwtnl->cmd.vbufs[i].buffer.resource); in validate_vertex_buffers()
571 svga_buffer(hwtnl->cmd.vbufs[i].buffer.resource); in validate_vertex_buffers()
594 if (svga->state.hw_draw.layout_id != hwtnl->cmd.vdecl_layout_id) { in validate_vertex_buffers()
597 hwtnl->cmd.vdecl_layout_id); in validate_vertex_buffers()
601 svga->state.hw_draw.layout_id = hwtnl->cmd.vdecl_layout_id; in validate_vertex_buffers()
624 vbuffer_attrs[0].stride = hwtnl->cmd.vbufs[0].stride; in validate_vertex_buffers()
625 vbuffer_attrs[0].offset = hwtnl->cmd.vbufs[0].buffer_offset; in validate_vertex_buffers()
632 vbuffer_attrs[i].stride = hwtnl->cmd.vbufs[i].stride; in validate_vertex_buffers()
633 vbuffer_attrs[i].offset = hwtnl->cmd.vbufs[i].buffer_offset; in validate_vertex_buffers()
751 validate_index_buffer(struct svga_hwtnl *hwtnl, in validate_index_buffer() argument
755 struct svga_context *svga = hwtnl->svga; in validate_index_buffer()
803 draw_vgpu10(struct svga_hwtnl *hwtnl, in draw_vgpu10() argument
812 struct svga_context *svga = hwtnl->svga; in draw_vgpu10()
817 assert(hwtnl->cmd.prim_count == 0); in draw_vgpu10()
853 ret = validate_vertex_buffers(hwtnl, so_vertex_count); in draw_vgpu10()
858 ret = validate_index_buffer(hwtnl, range, ib); in draw_vgpu10()
950 hwtnl->cmd.prim_count = 0; in draw_vgpu10()
965 svga_hwtnl_flush(struct svga_hwtnl *hwtnl) in svga_hwtnl_flush() argument
969 SVGA_STATS_TIME_PUSH(svga_sws(hwtnl->svga), SVGA_STATS_TIME_HWTNLFLUSH); in svga_hwtnl_flush()
971 if (!svga_have_vgpu10(hwtnl->svga) && hwtnl->cmd.prim_count) { in svga_hwtnl_flush()
973 ret = draw_vgpu9(hwtnl); in svga_hwtnl_flush()
976 SVGA_STATS_TIME_POP(svga_screen(hwtnl->svga->pipe.screen)->sws); in svga_hwtnl_flush()
982 svga_hwtnl_set_index_bias(struct svga_hwtnl *hwtnl, int index_bias) in svga_hwtnl_set_index_bias() argument
984 hwtnl->index_bias = index_bias; in svga_hwtnl_set_index_bias()
997 check_draw_params(struct svga_hwtnl *hwtnl, in check_draw_params() argument
1004 assert(!svga_have_vgpu10(hwtnl->svga)); in check_draw_params()
1006 for (i = 0; i < hwtnl->cmd.vdecl_count; i++) { in check_draw_params()
1007 unsigned j = hwtnl->cmd.vdecl_buffer_index[i]; in check_draw_params()
1008 const struct pipe_vertex_buffer *vb = &hwtnl->cmd.vbufs[j]; in check_draw_params()
1010 unsigned offset = hwtnl->cmd.vdecl[i].array.offset; in check_draw_params()
1011 unsigned stride = hwtnl->cmd.vdecl[i].array.stride; in check_draw_params()
1012 int index_bias = (int) range->indexBias + hwtnl->index_bias; in check_draw_params()
1027 switch (hwtnl->cmd.vdecl[i].identity.type) { in check_draw_params()
1146 svga_hwtnl_prim(struct svga_hwtnl *hwtnl, in svga_hwtnl_prim() argument
1157 SVGA_STATS_TIME_PUSH(svga_sws(hwtnl->svga), SVGA_STATS_TIME_HWTNLPRIM); in svga_hwtnl_prim()
1159 if (svga_have_vgpu10(hwtnl->svga)) { in svga_hwtnl_prim()
1161 SVGA_RETRY(hwtnl->svga, draw_vgpu10(hwtnl, range, vcount, min_index, in svga_hwtnl_prim()
1170 check_draw_params(hwtnl, range, min_index, max_index, ib); in svga_hwtnl_prim()
1177 if (hwtnl->cmd.prim_count + 1 >= QSZ) { in svga_hwtnl_prim()
1178 ret = svga_hwtnl_flush(hwtnl); in svga_hwtnl_prim()
1184 hwtnl->cmd.min_index[hwtnl->cmd.prim_count] = min_index; in svga_hwtnl_prim()
1185 hwtnl->cmd.max_index[hwtnl->cmd.prim_count] = max_index; in svga_hwtnl_prim()
1187 hwtnl->cmd.prim[hwtnl->cmd.prim_count] = *range; in svga_hwtnl_prim()
1188 hwtnl->cmd.prim[hwtnl->cmd.prim_count].indexBias += hwtnl->index_bias; in svga_hwtnl_prim()
1190 pipe_resource_reference(&hwtnl->cmd.prim_ib[hwtnl->cmd.prim_count], ib); in svga_hwtnl_prim()
1191 hwtnl->cmd.prim_count++; in svga_hwtnl_prim()
1195 SVGA_STATS_TIME_POP(svga_screen(hwtnl->svga->pipe.screen)->sws); in svga_hwtnl_prim()
1204 svga_hwtnl_has_pending_prim(struct svga_hwtnl *hwtnl) in svga_hwtnl_has_pending_prim() argument
1206 return hwtnl->cmd.prim_count > 0; in svga_hwtnl_has_pending_prim()