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
29void
30v3dX(job_emit_noop)(struct v3dv_job *job)
31{
32   v3dv_job_start_frame(job, 1, 1, 1, true, 1, V3D_INTERNAL_BPP_32, false);
33   v3dX(job_emit_binning_flush)(job);
34
35   struct v3dv_cl *rcl = &job->rcl;
36   v3dv_cl_ensure_space_with_branch(rcl, 200 + 1 * 256 *
37                                    cl_packet_length(SUPERTILE_COORDINATES));
38
39   cl_emit(rcl, TILE_RENDERING_MODE_CFG_COMMON, config) {
40      config.early_z_disable = true;
41      config.image_width_pixels = 1;
42      config.image_height_pixels = 1;
43      config.number_of_render_targets = 1;
44      config.multisample_mode_4x = false;
45      config.maximum_bpp_of_all_render_targets = V3D_INTERNAL_BPP_32;
46   }
47
48   cl_emit(rcl, TILE_RENDERING_MODE_CFG_COLOR, rt) {
49      rt.render_target_0_internal_bpp = V3D_INTERNAL_BPP_32;
50      rt.render_target_0_internal_type = V3D_INTERNAL_TYPE_8;
51      rt.render_target_0_clamp = V3D_RENDER_TARGET_CLAMP_NONE;
52   }
53
54   cl_emit(rcl, TILE_RENDERING_MODE_CFG_ZS_CLEAR_VALUES, clear) {
55      clear.z_clear_value = 1.0f;
56      clear.stencil_clear_value = 0;
57   };
58
59   cl_emit(rcl, TILE_LIST_INITIAL_BLOCK_SIZE, init) {
60      init.use_auto_chained_tile_lists = true;
61      init.size_of_first_block_in_chained_tile_lists =
62         TILE_ALLOCATION_BLOCK_SIZE_64B;
63   }
64
65   cl_emit(rcl, MULTICORE_RENDERING_TILE_LIST_SET_BASE, list) {
66      list.address = v3dv_cl_address(job->tile_alloc, 0);
67   }
68
69   cl_emit(rcl, MULTICORE_RENDERING_SUPERTILE_CFG, config) {
70      config.number_of_bin_tile_lists = 1;
71      config.total_frame_width_in_tiles = 1;
72      config.total_frame_height_in_tiles = 1;
73      config.supertile_width_in_tiles = 1;
74      config.supertile_height_in_tiles = 1;
75      config.total_frame_width_in_supertiles = 1;
76      config.total_frame_height_in_supertiles = 1;
77   }
78
79   struct v3dv_cl *icl = &job->indirect;
80   v3dv_cl_ensure_space(icl, 200, 1);
81   struct v3dv_cl_reloc tile_list_start = v3dv_cl_get_address(icl);
82
83   cl_emit(icl, TILE_COORDINATES_IMPLICIT, coords);
84
85   cl_emit(icl, END_OF_LOADS, end);
86
87   cl_emit(icl, BRANCH_TO_IMPLICIT_TILE_LIST, branch);
88
89   cl_emit(icl, STORE_TILE_BUFFER_GENERAL, store) {
90      store.buffer_to_store = NONE;
91   }
92
93   cl_emit(icl, END_OF_TILE_MARKER, end);
94
95   cl_emit(icl, RETURN_FROM_SUB_LIST, ret);
96
97   cl_emit(rcl, START_ADDRESS_OF_GENERIC_TILE_LIST, branch) {
98      branch.start = tile_list_start;
99      branch.end = v3dv_cl_get_address(icl);
100   }
101
102   cl_emit(rcl, SUPERTILE_COORDINATES, coords) {
103      coords.column_number_in_supertiles = 0;
104      coords.row_number_in_supertiles = 0;
105   }
106
107   cl_emit(rcl, END_OF_RENDERING, end);
108}
109