1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright © 2021 Raspberry Pi Ltd
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21bf215546Sopenharmony_ci * IN THE SOFTWARE.
22bf215546Sopenharmony_ci */
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ci#include "v3dv_private.h"
25bf215546Sopenharmony_ci#include "broadcom/common/v3d_macros.h"
26bf215546Sopenharmony_ci#include "broadcom/cle/v3dx_pack.h"
27bf215546Sopenharmony_ci#include "broadcom/compiler/v3d_compiler.h"
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_civoid
30bf215546Sopenharmony_civ3dX(job_emit_noop)(struct v3dv_job *job)
31bf215546Sopenharmony_ci{
32bf215546Sopenharmony_ci   v3dv_job_start_frame(job, 1, 1, 1, true, 1, V3D_INTERNAL_BPP_32, false);
33bf215546Sopenharmony_ci   v3dX(job_emit_binning_flush)(job);
34bf215546Sopenharmony_ci
35bf215546Sopenharmony_ci   struct v3dv_cl *rcl = &job->rcl;
36bf215546Sopenharmony_ci   v3dv_cl_ensure_space_with_branch(rcl, 200 + 1 * 256 *
37bf215546Sopenharmony_ci                                    cl_packet_length(SUPERTILE_COORDINATES));
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ci   cl_emit(rcl, TILE_RENDERING_MODE_CFG_COMMON, config) {
40bf215546Sopenharmony_ci      config.early_z_disable = true;
41bf215546Sopenharmony_ci      config.image_width_pixels = 1;
42bf215546Sopenharmony_ci      config.image_height_pixels = 1;
43bf215546Sopenharmony_ci      config.number_of_render_targets = 1;
44bf215546Sopenharmony_ci      config.multisample_mode_4x = false;
45bf215546Sopenharmony_ci      config.maximum_bpp_of_all_render_targets = V3D_INTERNAL_BPP_32;
46bf215546Sopenharmony_ci   }
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_ci   cl_emit(rcl, TILE_RENDERING_MODE_CFG_COLOR, rt) {
49bf215546Sopenharmony_ci      rt.render_target_0_internal_bpp = V3D_INTERNAL_BPP_32;
50bf215546Sopenharmony_ci      rt.render_target_0_internal_type = V3D_INTERNAL_TYPE_8;
51bf215546Sopenharmony_ci      rt.render_target_0_clamp = V3D_RENDER_TARGET_CLAMP_NONE;
52bf215546Sopenharmony_ci   }
53bf215546Sopenharmony_ci
54bf215546Sopenharmony_ci   cl_emit(rcl, TILE_RENDERING_MODE_CFG_ZS_CLEAR_VALUES, clear) {
55bf215546Sopenharmony_ci      clear.z_clear_value = 1.0f;
56bf215546Sopenharmony_ci      clear.stencil_clear_value = 0;
57bf215546Sopenharmony_ci   };
58bf215546Sopenharmony_ci
59bf215546Sopenharmony_ci   cl_emit(rcl, TILE_LIST_INITIAL_BLOCK_SIZE, init) {
60bf215546Sopenharmony_ci      init.use_auto_chained_tile_lists = true;
61bf215546Sopenharmony_ci      init.size_of_first_block_in_chained_tile_lists =
62bf215546Sopenharmony_ci         TILE_ALLOCATION_BLOCK_SIZE_64B;
63bf215546Sopenharmony_ci   }
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ci   cl_emit(rcl, MULTICORE_RENDERING_TILE_LIST_SET_BASE, list) {
66bf215546Sopenharmony_ci      list.address = v3dv_cl_address(job->tile_alloc, 0);
67bf215546Sopenharmony_ci   }
68bf215546Sopenharmony_ci
69bf215546Sopenharmony_ci   cl_emit(rcl, MULTICORE_RENDERING_SUPERTILE_CFG, config) {
70bf215546Sopenharmony_ci      config.number_of_bin_tile_lists = 1;
71bf215546Sopenharmony_ci      config.total_frame_width_in_tiles = 1;
72bf215546Sopenharmony_ci      config.total_frame_height_in_tiles = 1;
73bf215546Sopenharmony_ci      config.supertile_width_in_tiles = 1;
74bf215546Sopenharmony_ci      config.supertile_height_in_tiles = 1;
75bf215546Sopenharmony_ci      config.total_frame_width_in_supertiles = 1;
76bf215546Sopenharmony_ci      config.total_frame_height_in_supertiles = 1;
77bf215546Sopenharmony_ci   }
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_ci   struct v3dv_cl *icl = &job->indirect;
80bf215546Sopenharmony_ci   v3dv_cl_ensure_space(icl, 200, 1);
81bf215546Sopenharmony_ci   struct v3dv_cl_reloc tile_list_start = v3dv_cl_get_address(icl);
82bf215546Sopenharmony_ci
83bf215546Sopenharmony_ci   cl_emit(icl, TILE_COORDINATES_IMPLICIT, coords);
84bf215546Sopenharmony_ci
85bf215546Sopenharmony_ci   cl_emit(icl, END_OF_LOADS, end);
86bf215546Sopenharmony_ci
87bf215546Sopenharmony_ci   cl_emit(icl, BRANCH_TO_IMPLICIT_TILE_LIST, branch);
88bf215546Sopenharmony_ci
89bf215546Sopenharmony_ci   cl_emit(icl, STORE_TILE_BUFFER_GENERAL, store) {
90bf215546Sopenharmony_ci      store.buffer_to_store = NONE;
91bf215546Sopenharmony_ci   }
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_ci   cl_emit(icl, END_OF_TILE_MARKER, end);
94bf215546Sopenharmony_ci
95bf215546Sopenharmony_ci   cl_emit(icl, RETURN_FROM_SUB_LIST, ret);
96bf215546Sopenharmony_ci
97bf215546Sopenharmony_ci   cl_emit(rcl, START_ADDRESS_OF_GENERIC_TILE_LIST, branch) {
98bf215546Sopenharmony_ci      branch.start = tile_list_start;
99bf215546Sopenharmony_ci      branch.end = v3dv_cl_get_address(icl);
100bf215546Sopenharmony_ci   }
101bf215546Sopenharmony_ci
102bf215546Sopenharmony_ci   cl_emit(rcl, SUPERTILE_COORDINATES, coords) {
103bf215546Sopenharmony_ci      coords.column_number_in_supertiles = 0;
104bf215546Sopenharmony_ci      coords.row_number_in_supertiles = 0;
105bf215546Sopenharmony_ci   }
106bf215546Sopenharmony_ci
107bf215546Sopenharmony_ci   cl_emit(rcl, END_OF_RENDERING, end);
108bf215546Sopenharmony_ci}
109