1 /*
2 * Copyright © 2021 Raspberry Pi Ltd
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 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * 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 NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #include "v3dv_private.h"
25 #include "broadcom/common/v3d_macros.h"
26 #include "broadcom/cle/v3dx_pack.h"
27 #include "broadcom/compiler/v3d_compiler.h"
28
29 void
v3dX(job_emit_noop)30 v3dX(job_emit_noop)(struct v3dv_job *job)
31 {
32 v3dv_job_start_frame(job, 1, 1, 1, true, true, 1,
33 V3D_INTERNAL_BPP_32, 4, false);
34 v3dX(job_emit_binning_flush)(job);
35
36 struct v3dv_cl *rcl = &job->rcl;
37 v3dv_cl_ensure_space_with_branch(rcl, 200 + 1 * 256 *
38 cl_packet_length(SUPERTILE_COORDINATES));
39
40 cl_emit(rcl, TILE_RENDERING_MODE_CFG_COMMON, config) {
41 config.early_z_disable = true;
42 config.image_width_pixels = 1;
43 config.image_height_pixels = 1;
44 config.number_of_render_targets = 1;
45 config.multisample_mode_4x = false;
46 #if V3D_VERSION == 42
47 config.maximum_bpp_of_all_render_targets = V3D_INTERNAL_BPP_32;
48 #endif
49 #if V3D_VERSION >= 71
50 config.log2_tile_width = 3; /* Tile size 64 */
51 config.log2_tile_height = 3; /* Tile size 64 */
52 #endif
53 }
54
55 #if V3D_VERSION == 42
56 cl_emit(rcl, TILE_RENDERING_MODE_CFG_COLOR, rt) {
57 rt.render_target_0_internal_bpp = V3D_INTERNAL_BPP_32;
58 rt.render_target_0_internal_type = V3D_INTERNAL_TYPE_8;
59 rt.render_target_0_clamp = V3D_RENDER_TARGET_CLAMP_NONE;
60 }
61 #endif
62 #if V3D_VERSION >= 71
63 cl_emit(rcl, TILE_RENDERING_MODE_CFG_RENDER_TARGET_PART1, rt) {
64 rt.internal_bpp = V3D_INTERNAL_BPP_32;
65 rt.internal_type_and_clamping = V3D_RENDER_TARGET_TYPE_CLAMP_8;
66 rt.stride = 1; /* Unused RT */
67 }
68 #endif
69
70 cl_emit(rcl, TILE_RENDERING_MODE_CFG_ZS_CLEAR_VALUES, clear) {
71 clear.z_clear_value = 1.0f;
72 clear.stencil_clear_value = 0;
73 };
74
75 cl_emit(rcl, TILE_LIST_INITIAL_BLOCK_SIZE, init) {
76 init.use_auto_chained_tile_lists = true;
77 init.size_of_first_block_in_chained_tile_lists =
78 TILE_ALLOCATION_BLOCK_SIZE_64B;
79 }
80
81 cl_emit(rcl, MULTICORE_RENDERING_TILE_LIST_SET_BASE, list) {
82 list.address = v3dv_cl_address(job->tile_alloc, 0);
83 }
84
85 cl_emit(rcl, MULTICORE_RENDERING_SUPERTILE_CFG, config) {
86 config.number_of_bin_tile_lists = 1;
87 config.total_frame_width_in_tiles = 1;
88 config.total_frame_height_in_tiles = 1;
89 config.supertile_width_in_tiles = 1;
90 config.supertile_height_in_tiles = 1;
91 config.total_frame_width_in_supertiles = 1;
92 config.total_frame_height_in_supertiles = 1;
93 }
94
95 struct v3dv_cl *icl = &job->indirect;
96 v3dv_cl_ensure_space(icl, 200, 1);
97 struct v3dv_cl_reloc tile_list_start = v3dv_cl_get_address(icl);
98
99 cl_emit(icl, TILE_COORDINATES_IMPLICIT, coords);
100
101 cl_emit(icl, END_OF_LOADS, end);
102
103 cl_emit(icl, BRANCH_TO_IMPLICIT_TILE_LIST, branch);
104
105 cl_emit(icl, STORE_TILE_BUFFER_GENERAL, store) {
106 store.buffer_to_store = NONE;
107 }
108
109 cl_emit(icl, END_OF_TILE_MARKER, end);
110
111 cl_emit(icl, RETURN_FROM_SUB_LIST, ret);
112
113 cl_emit(rcl, START_ADDRESS_OF_GENERIC_TILE_LIST, branch) {
114 branch.start = tile_list_start;
115 branch.end = v3dv_cl_get_address(icl);
116 }
117
118 cl_emit(rcl, SUPERTILE_COORDINATES, coords) {
119 coords.column_number_in_supertiles = 0;
120 coords.row_number_in_supertiles = 0;
121 }
122
123 cl_emit(rcl, END_OF_RENDERING, end);
124 }
125