1b8e80941Smrg/* 2b8e80941Smrg * Copyright © 2017 Broadcom 3b8e80941Smrg * 4b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5b8e80941Smrg * copy of this software and associated documentation files (the "Software"), 6b8e80941Smrg * to deal in the Software without restriction, including without limitation 7b8e80941Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8b8e80941Smrg * and/or sell copies of the Software, and to permit persons to whom the 9b8e80941Smrg * Software is furnished to do so, subject to the following conditions: 10b8e80941Smrg * 11b8e80941Smrg * The above copyright notice and this permission notice (including the next 12b8e80941Smrg * paragraph) shall be included in all copies or substantial portions of the 13b8e80941Smrg * Software. 14b8e80941Smrg * 15b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18b8e80941Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19b8e80941Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20b8e80941Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21b8e80941Smrg * IN THE SOFTWARE. 22b8e80941Smrg */ 23b8e80941Smrg 24b8e80941Smrg#include "util/u_format.h" 25b8e80941Smrg#include "v3d_context.h" 26b8e80941Smrg#include "v3d_tiling.h" 27b8e80941Smrg#include "broadcom/common/v3d_macros.h" 28b8e80941Smrg#include "broadcom/cle/v3dx_pack.h" 29b8e80941Smrg 30b8e80941Smrg#define PIPE_CLEAR_COLOR_BUFFERS (PIPE_CLEAR_COLOR0 | \ 31b8e80941Smrg PIPE_CLEAR_COLOR1 | \ 32b8e80941Smrg PIPE_CLEAR_COLOR2 | \ 33b8e80941Smrg PIPE_CLEAR_COLOR3) \ 34b8e80941Smrg 35b8e80941Smrg#define PIPE_FIRST_COLOR_BUFFER_BIT (ffs(PIPE_CLEAR_COLOR0) - 1) 36b8e80941Smrg 37b8e80941Smrg/* The HW queues up the load until the tile coordinates show up, but can only 38b8e80941Smrg * track one at a time. If we need to do more than one load, then we need to 39b8e80941Smrg * flush out the previous load by emitting the tile coordinates and doing a 40b8e80941Smrg * dummy store. 41b8e80941Smrg */ 42b8e80941Smrgstatic void 43b8e80941Smrgflush_last_load(struct v3d_cl *cl) 44b8e80941Smrg{ 45b8e80941Smrg if (V3D_VERSION >= 40) 46b8e80941Smrg return; 47b8e80941Smrg 48b8e80941Smrg cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords); 49b8e80941Smrg cl_emit(cl, STORE_TILE_BUFFER_GENERAL, store) { 50b8e80941Smrg store.buffer_to_store = NONE; 51b8e80941Smrg } 52b8e80941Smrg} 53b8e80941Smrg 54b8e80941Smrgstatic void 55b8e80941Smrgload_general(struct v3d_cl *cl, struct pipe_surface *psurf, int buffer, 56b8e80941Smrg uint32_t pipe_bit, uint32_t *loads_pending) 57b8e80941Smrg{ 58b8e80941Smrg struct v3d_surface *surf = v3d_surface(psurf); 59b8e80941Smrg bool separate_stencil = surf->separate_stencil && buffer == STENCIL; 60b8e80941Smrg if (separate_stencil) { 61b8e80941Smrg psurf = surf->separate_stencil; 62b8e80941Smrg surf = v3d_surface(psurf); 63b8e80941Smrg } 64b8e80941Smrg 65b8e80941Smrg struct v3d_resource *rsc = v3d_resource(psurf->texture); 66b8e80941Smrg 67b8e80941Smrg cl_emit(cl, LOAD_TILE_BUFFER_GENERAL, load) { 68b8e80941Smrg load.buffer_to_load = buffer; 69b8e80941Smrg load.address = cl_address(rsc->bo, surf->offset); 70b8e80941Smrg 71b8e80941Smrg#if V3D_VERSION >= 40 72b8e80941Smrg load.memory_format = surf->tiling; 73b8e80941Smrg if (separate_stencil) 74b8e80941Smrg load.input_image_format = V3D_OUTPUT_IMAGE_FORMAT_S8; 75b8e80941Smrg else 76b8e80941Smrg load.input_image_format = surf->format; 77b8e80941Smrg load.r_b_swap = surf->swap_rb; 78b8e80941Smrg 79b8e80941Smrg if (surf->tiling == VC5_TILING_UIF_NO_XOR || 80b8e80941Smrg surf->tiling == VC5_TILING_UIF_XOR) { 81b8e80941Smrg load.height_in_ub_or_stride = 82b8e80941Smrg surf->padded_height_of_output_image_in_uif_blocks; 83b8e80941Smrg } else if (surf->tiling == VC5_TILING_RASTER) { 84b8e80941Smrg struct v3d_resource_slice *slice = 85b8e80941Smrg &rsc->slices[psurf->u.tex.level]; 86b8e80941Smrg load.height_in_ub_or_stride = slice->stride; 87b8e80941Smrg } 88b8e80941Smrg 89b8e80941Smrg if (psurf->texture->nr_samples > 1) 90b8e80941Smrg load.decimate_mode = V3D_DECIMATE_MODE_ALL_SAMPLES; 91b8e80941Smrg else 92b8e80941Smrg load.decimate_mode = V3D_DECIMATE_MODE_SAMPLE_0; 93b8e80941Smrg 94b8e80941Smrg#else /* V3D_VERSION < 40 */ 95b8e80941Smrg /* Can't do raw ZSTENCIL loads -- need to load/store them to 96b8e80941Smrg * separate buffers for Z and stencil. 97b8e80941Smrg */ 98b8e80941Smrg assert(buffer != ZSTENCIL); 99b8e80941Smrg load.raw_mode = true; 100b8e80941Smrg load.padded_height_of_output_image_in_uif_blocks = 101b8e80941Smrg surf->padded_height_of_output_image_in_uif_blocks; 102b8e80941Smrg#endif /* V3D_VERSION < 40 */ 103b8e80941Smrg } 104b8e80941Smrg 105b8e80941Smrg *loads_pending &= ~pipe_bit; 106b8e80941Smrg if (*loads_pending) 107b8e80941Smrg flush_last_load(cl); 108b8e80941Smrg} 109b8e80941Smrg 110b8e80941Smrgstatic void 111b8e80941Smrgstore_general(struct v3d_job *job, 112b8e80941Smrg struct v3d_cl *cl, struct pipe_surface *psurf, int buffer, 113b8e80941Smrg int pipe_bit, uint32_t *stores_pending, bool general_color_clear) 114b8e80941Smrg{ 115b8e80941Smrg struct v3d_surface *surf = v3d_surface(psurf); 116b8e80941Smrg bool separate_stencil = surf->separate_stencil && buffer == STENCIL; 117b8e80941Smrg if (separate_stencil) { 118b8e80941Smrg psurf = surf->separate_stencil; 119b8e80941Smrg surf = v3d_surface(psurf); 120b8e80941Smrg } 121b8e80941Smrg 122b8e80941Smrg *stores_pending &= ~pipe_bit; 123b8e80941Smrg bool last_store = !(*stores_pending); 124b8e80941Smrg 125b8e80941Smrg struct v3d_resource *rsc = v3d_resource(psurf->texture); 126b8e80941Smrg 127b8e80941Smrg rsc->writes++; 128b8e80941Smrg 129b8e80941Smrg cl_emit(cl, STORE_TILE_BUFFER_GENERAL, store) { 130b8e80941Smrg store.buffer_to_store = buffer; 131b8e80941Smrg store.address = cl_address(rsc->bo, surf->offset); 132b8e80941Smrg 133b8e80941Smrg#if V3D_VERSION >= 40 134b8e80941Smrg store.clear_buffer_being_stored = false; 135b8e80941Smrg 136b8e80941Smrg if (separate_stencil) 137b8e80941Smrg store.output_image_format = V3D_OUTPUT_IMAGE_FORMAT_S8; 138b8e80941Smrg else 139b8e80941Smrg store.output_image_format = surf->format; 140b8e80941Smrg 141b8e80941Smrg store.r_b_swap = surf->swap_rb; 142b8e80941Smrg store.memory_format = surf->tiling; 143b8e80941Smrg 144b8e80941Smrg if (surf->tiling == VC5_TILING_UIF_NO_XOR || 145b8e80941Smrg surf->tiling == VC5_TILING_UIF_XOR) { 146b8e80941Smrg store.height_in_ub_or_stride = 147b8e80941Smrg surf->padded_height_of_output_image_in_uif_blocks; 148b8e80941Smrg } else if (surf->tiling == VC5_TILING_RASTER) { 149b8e80941Smrg struct v3d_resource_slice *slice = 150b8e80941Smrg &rsc->slices[psurf->u.tex.level]; 151b8e80941Smrg store.height_in_ub_or_stride = slice->stride; 152b8e80941Smrg } 153b8e80941Smrg 154b8e80941Smrg if (psurf->texture->nr_samples > 1) 155b8e80941Smrg store.decimate_mode = V3D_DECIMATE_MODE_ALL_SAMPLES; 156b8e80941Smrg else 157b8e80941Smrg store.decimate_mode = V3D_DECIMATE_MODE_SAMPLE_0; 158b8e80941Smrg 159b8e80941Smrg#else /* V3D_VERSION < 40 */ 160b8e80941Smrg /* Can't do raw ZSTENCIL stores -- need to load/store them to 161b8e80941Smrg * separate buffers for Z and stencil. 162b8e80941Smrg */ 163b8e80941Smrg assert(buffer != ZSTENCIL); 164b8e80941Smrg store.raw_mode = true; 165b8e80941Smrg if (!last_store) { 166b8e80941Smrg store.disable_color_buffers_clear_on_write = true; 167b8e80941Smrg store.disable_z_buffer_clear_on_write = true; 168b8e80941Smrg store.disable_stencil_buffer_clear_on_write = true; 169b8e80941Smrg } else { 170b8e80941Smrg store.disable_color_buffers_clear_on_write = 171b8e80941Smrg !(((pipe_bit & PIPE_CLEAR_COLOR_BUFFERS) && 172b8e80941Smrg general_color_clear && 173b8e80941Smrg (job->clear & pipe_bit))); 174b8e80941Smrg store.disable_z_buffer_clear_on_write = 175b8e80941Smrg !(job->clear & PIPE_CLEAR_DEPTH); 176b8e80941Smrg store.disable_stencil_buffer_clear_on_write = 177b8e80941Smrg !(job->clear & PIPE_CLEAR_STENCIL); 178b8e80941Smrg } 179b8e80941Smrg store.padded_height_of_output_image_in_uif_blocks = 180b8e80941Smrg surf->padded_height_of_output_image_in_uif_blocks; 181b8e80941Smrg#endif /* V3D_VERSION < 40 */ 182b8e80941Smrg } 183b8e80941Smrg 184b8e80941Smrg /* There must be a TILE_COORDINATES_IMPLICIT between each store. */ 185b8e80941Smrg if (V3D_VERSION < 40 && !last_store) { 186b8e80941Smrg cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords); 187b8e80941Smrg } 188b8e80941Smrg} 189b8e80941Smrg 190b8e80941Smrgstatic int 191b8e80941Smrgzs_buffer_from_pipe_bits(int pipe_clear_bits) 192b8e80941Smrg{ 193b8e80941Smrg switch (pipe_clear_bits & PIPE_CLEAR_DEPTHSTENCIL) { 194b8e80941Smrg case PIPE_CLEAR_DEPTHSTENCIL: 195b8e80941Smrg return ZSTENCIL; 196b8e80941Smrg case PIPE_CLEAR_DEPTH: 197b8e80941Smrg return Z; 198b8e80941Smrg case PIPE_CLEAR_STENCIL: 199b8e80941Smrg return STENCIL; 200b8e80941Smrg default: 201b8e80941Smrg return NONE; 202b8e80941Smrg } 203b8e80941Smrg} 204b8e80941Smrg 205b8e80941Smrgstatic void 206b8e80941Smrgv3d_rcl_emit_loads(struct v3d_job *job, struct v3d_cl *cl) 207b8e80941Smrg{ 208b8e80941Smrg uint32_t loads_pending = job->load; 209b8e80941Smrg 210b8e80941Smrg for (int i = 0; i < V3D_MAX_DRAW_BUFFERS; i++) { 211b8e80941Smrg uint32_t bit = PIPE_CLEAR_COLOR0 << i; 212b8e80941Smrg if (!(loads_pending & bit)) 213b8e80941Smrg continue; 214b8e80941Smrg 215b8e80941Smrg struct pipe_surface *psurf = job->cbufs[i]; 216b8e80941Smrg if (!psurf || (V3D_VERSION < 40 && 217b8e80941Smrg psurf->texture->nr_samples <= 1)) { 218b8e80941Smrg continue; 219b8e80941Smrg } 220b8e80941Smrg 221b8e80941Smrg load_general(cl, psurf, RENDER_TARGET_0 + i, 222b8e80941Smrg bit, &loads_pending); 223b8e80941Smrg } 224b8e80941Smrg 225b8e80941Smrg if ((loads_pending & PIPE_CLEAR_DEPTHSTENCIL) && 226b8e80941Smrg (V3D_VERSION >= 40 || 227b8e80941Smrg (job->zsbuf && job->zsbuf->texture->nr_samples > 1))) { 228b8e80941Smrg struct v3d_resource *rsc = v3d_resource(job->zsbuf->texture); 229b8e80941Smrg 230b8e80941Smrg if (rsc->separate_stencil && 231b8e80941Smrg (loads_pending & PIPE_CLEAR_STENCIL)) { 232b8e80941Smrg load_general(cl, job->zsbuf, 233b8e80941Smrg STENCIL, 234b8e80941Smrg PIPE_CLEAR_STENCIL, 235b8e80941Smrg &loads_pending); 236b8e80941Smrg } 237b8e80941Smrg 238b8e80941Smrg if (loads_pending & PIPE_CLEAR_DEPTHSTENCIL) { 239b8e80941Smrg load_general(cl, job->zsbuf, 240b8e80941Smrg zs_buffer_from_pipe_bits(loads_pending), 241b8e80941Smrg loads_pending & PIPE_CLEAR_DEPTHSTENCIL, 242b8e80941Smrg &loads_pending); 243b8e80941Smrg } 244b8e80941Smrg } 245b8e80941Smrg 246b8e80941Smrg#if V3D_VERSION < 40 247b8e80941Smrg /* The initial reload will be queued until we get the 248b8e80941Smrg * tile coordinates. 249b8e80941Smrg */ 250b8e80941Smrg if (loads_pending) { 251b8e80941Smrg cl_emit(cl, RELOAD_TILE_COLOR_BUFFER, load) { 252b8e80941Smrg load.disable_color_buffer_load = 253b8e80941Smrg (~loads_pending & 254b8e80941Smrg PIPE_CLEAR_COLOR_BUFFERS) >> 255b8e80941Smrg PIPE_FIRST_COLOR_BUFFER_BIT; 256b8e80941Smrg load.enable_z_load = 257b8e80941Smrg loads_pending & PIPE_CLEAR_DEPTH; 258b8e80941Smrg load.enable_stencil_load = 259b8e80941Smrg loads_pending & PIPE_CLEAR_STENCIL; 260b8e80941Smrg } 261b8e80941Smrg } 262b8e80941Smrg#else /* V3D_VERSION >= 40 */ 263b8e80941Smrg assert(!loads_pending); 264b8e80941Smrg cl_emit(cl, END_OF_LOADS, end); 265b8e80941Smrg#endif 266b8e80941Smrg} 267b8e80941Smrg 268b8e80941Smrgstatic void 269b8e80941Smrgv3d_rcl_emit_stores(struct v3d_job *job, struct v3d_cl *cl) 270b8e80941Smrg{ 271b8e80941Smrg#if V3D_VERSION < 40 272b8e80941Smrg MAYBE_UNUSED bool needs_color_clear = job->clear & PIPE_CLEAR_COLOR_BUFFERS; 273b8e80941Smrg MAYBE_UNUSED bool needs_z_clear = job->clear & PIPE_CLEAR_DEPTH; 274b8e80941Smrg MAYBE_UNUSED bool needs_s_clear = job->clear & PIPE_CLEAR_STENCIL; 275b8e80941Smrg 276b8e80941Smrg /* For clearing color in a TLB general on V3D 3.3: 277b8e80941Smrg * 278b8e80941Smrg * - NONE buffer store clears all TLB color buffers. 279b8e80941Smrg * - color buffer store clears just the TLB color buffer being stored. 280b8e80941Smrg * - Z/S buffers store may not clear the TLB color buffer. 281b8e80941Smrg * 282b8e80941Smrg * And on V3D 4.1, we only have one flag for "clear the buffer being 283b8e80941Smrg * stored" in the general packet, and a separate packet to clear all 284b8e80941Smrg * color TLB buffers. 285b8e80941Smrg * 286b8e80941Smrg * As a result, we only bother flagging TLB color clears in a general 287b8e80941Smrg * packet when we don't have to emit a separate packet to clear all 288b8e80941Smrg * TLB color buffers. 289b8e80941Smrg */ 290b8e80941Smrg bool general_color_clear = (needs_color_clear && 291b8e80941Smrg (job->clear & PIPE_CLEAR_COLOR_BUFFERS) == 292b8e80941Smrg (job->store & PIPE_CLEAR_COLOR_BUFFERS)); 293b8e80941Smrg#else 294b8e80941Smrg bool general_color_clear = false; 295b8e80941Smrg#endif 296b8e80941Smrg 297b8e80941Smrg uint32_t stores_pending = job->store; 298b8e80941Smrg 299b8e80941Smrg /* For V3D 4.1, use general stores for all TLB stores. 300b8e80941Smrg * 301b8e80941Smrg * For V3D 3.3, we only use general stores to do raw stores for any 302b8e80941Smrg * MSAA surfaces. These output UIF tiled images where each 4x MSAA 303b8e80941Smrg * pixel is a 2x2 quad, and the format will be that of the 304b8e80941Smrg * internal_type/internal_bpp, rather than the format from GL's 305b8e80941Smrg * perspective. Non-MSAA surfaces will use 306b8e80941Smrg * STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED. 307b8e80941Smrg */ 308b8e80941Smrg for (int i = 0; i < V3D_MAX_DRAW_BUFFERS; i++) { 309b8e80941Smrg uint32_t bit = PIPE_CLEAR_COLOR0 << i; 310b8e80941Smrg if (!(job->store & bit)) 311b8e80941Smrg continue; 312b8e80941Smrg 313b8e80941Smrg struct pipe_surface *psurf = job->cbufs[i]; 314b8e80941Smrg if (!psurf || 315b8e80941Smrg (V3D_VERSION < 40 && psurf->texture->nr_samples <= 1)) { 316b8e80941Smrg continue; 317b8e80941Smrg } 318b8e80941Smrg 319b8e80941Smrg store_general(job, cl, psurf, RENDER_TARGET_0 + i, bit, 320b8e80941Smrg &stores_pending, general_color_clear); 321b8e80941Smrg } 322b8e80941Smrg 323b8e80941Smrg if (job->store & PIPE_CLEAR_DEPTHSTENCIL && job->zsbuf && 324b8e80941Smrg !(V3D_VERSION < 40 && job->zsbuf->texture->nr_samples <= 1)) { 325b8e80941Smrg struct v3d_resource *rsc = v3d_resource(job->zsbuf->texture); 326b8e80941Smrg if (rsc->separate_stencil) { 327b8e80941Smrg if (job->store & PIPE_CLEAR_DEPTH) { 328b8e80941Smrg store_general(job, cl, job->zsbuf, Z, 329b8e80941Smrg PIPE_CLEAR_DEPTH, 330b8e80941Smrg &stores_pending, 331b8e80941Smrg general_color_clear); 332b8e80941Smrg } 333b8e80941Smrg 334b8e80941Smrg if (job->store & PIPE_CLEAR_STENCIL) { 335b8e80941Smrg store_general(job, cl, job->zsbuf, STENCIL, 336b8e80941Smrg PIPE_CLEAR_STENCIL, 337b8e80941Smrg &stores_pending, 338b8e80941Smrg general_color_clear); 339b8e80941Smrg } 340b8e80941Smrg } else { 341b8e80941Smrg store_general(job, cl, job->zsbuf, 342b8e80941Smrg zs_buffer_from_pipe_bits(job->store), 343b8e80941Smrg job->store & PIPE_CLEAR_DEPTHSTENCIL, 344b8e80941Smrg &stores_pending, general_color_clear); 345b8e80941Smrg } 346b8e80941Smrg } 347b8e80941Smrg 348b8e80941Smrg#if V3D_VERSION < 40 349b8e80941Smrg if (stores_pending) { 350b8e80941Smrg cl_emit(cl, STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_EXTENDED, store) { 351b8e80941Smrg 352b8e80941Smrg store.disable_color_buffer_write = 353b8e80941Smrg (~stores_pending >> 354b8e80941Smrg PIPE_FIRST_COLOR_BUFFER_BIT) & 0xf; 355b8e80941Smrg store.enable_z_write = stores_pending & PIPE_CLEAR_DEPTH; 356b8e80941Smrg store.enable_stencil_write = stores_pending & PIPE_CLEAR_STENCIL; 357b8e80941Smrg 358b8e80941Smrg /* Note that when set this will clear all of the color 359b8e80941Smrg * buffers. 360b8e80941Smrg */ 361b8e80941Smrg store.disable_color_buffers_clear_on_write = 362b8e80941Smrg !needs_color_clear; 363b8e80941Smrg store.disable_z_buffer_clear_on_write = 364b8e80941Smrg !needs_z_clear; 365b8e80941Smrg store.disable_stencil_buffer_clear_on_write = 366b8e80941Smrg !needs_s_clear; 367b8e80941Smrg }; 368b8e80941Smrg } else if (needs_color_clear && !general_color_clear) { 369b8e80941Smrg /* If we didn't do our color clears in the general packet, 370b8e80941Smrg * then emit a packet to clear all the TLB color buffers now. 371b8e80941Smrg */ 372b8e80941Smrg cl_emit(cl, STORE_TILE_BUFFER_GENERAL, store) { 373b8e80941Smrg store.buffer_to_store = NONE; 374b8e80941Smrg } 375b8e80941Smrg } 376b8e80941Smrg#else /* V3D_VERSION >= 40 */ 377b8e80941Smrg /* If we're emitting an RCL with GL_ARB_framebuffer_no_attachments, 378b8e80941Smrg * we still need to emit some sort of store. 379b8e80941Smrg */ 380b8e80941Smrg if (!job->store) { 381b8e80941Smrg cl_emit(cl, STORE_TILE_BUFFER_GENERAL, store) { 382b8e80941Smrg store.buffer_to_store = NONE; 383b8e80941Smrg } 384b8e80941Smrg } 385b8e80941Smrg 386b8e80941Smrg assert(!stores_pending); 387b8e80941Smrg 388b8e80941Smrg /* GFXH-1461/GFXH-1689: The per-buffer store command's clear 389b8e80941Smrg * buffer bit is broken for depth/stencil. In addition, the 390b8e80941Smrg * clear packet's Z/S bit is broken, but the RTs bit ends up 391b8e80941Smrg * clearing Z/S. 392b8e80941Smrg */ 393b8e80941Smrg if (job->clear) { 394b8e80941Smrg cl_emit(cl, CLEAR_TILE_BUFFERS, clear) { 395b8e80941Smrg clear.clear_z_stencil_buffer = true; 396b8e80941Smrg clear.clear_all_render_targets = true; 397b8e80941Smrg } 398b8e80941Smrg } 399b8e80941Smrg#endif /* V3D_VERSION >= 40 */ 400b8e80941Smrg} 401b8e80941Smrg 402b8e80941Smrgstatic void 403b8e80941Smrgv3d_rcl_emit_generic_per_tile_list(struct v3d_job *job, int last_cbuf) 404b8e80941Smrg{ 405b8e80941Smrg /* Emit the generic list in our indirect state -- the rcl will just 406b8e80941Smrg * have pointers into it. 407b8e80941Smrg */ 408b8e80941Smrg struct v3d_cl *cl = &job->indirect; 409b8e80941Smrg v3d_cl_ensure_space(cl, 200, 1); 410b8e80941Smrg struct v3d_cl_reloc tile_list_start = cl_get_address(cl); 411b8e80941Smrg 412b8e80941Smrg if (V3D_VERSION >= 40) { 413b8e80941Smrg /* V3D 4.x only requires a single tile coordinates, and 414b8e80941Smrg * END_OF_LOADS switches us between loading and rendering. 415b8e80941Smrg */ 416b8e80941Smrg cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords); 417b8e80941Smrg } 418b8e80941Smrg 419b8e80941Smrg v3d_rcl_emit_loads(job, cl); 420b8e80941Smrg 421b8e80941Smrg if (V3D_VERSION < 40) { 422b8e80941Smrg /* Tile Coordinates triggers the last reload and sets where 423b8e80941Smrg * the stores go. There must be one per store packet. 424b8e80941Smrg */ 425b8e80941Smrg cl_emit(cl, TILE_COORDINATES_IMPLICIT, coords); 426b8e80941Smrg } 427b8e80941Smrg 428b8e80941Smrg /* The binner starts out writing tiles assuming that the initial mode 429b8e80941Smrg * is triangles, so make sure that's the case. 430b8e80941Smrg */ 431b8e80941Smrg cl_emit(cl, PRIM_LIST_FORMAT, fmt) { 432b8e80941Smrg fmt.primitive_type = LIST_TRIANGLES; 433b8e80941Smrg } 434b8e80941Smrg 435b8e80941Smrg cl_emit(cl, BRANCH_TO_IMPLICIT_TILE_LIST, branch); 436b8e80941Smrg 437b8e80941Smrg v3d_rcl_emit_stores(job, cl); 438b8e80941Smrg 439b8e80941Smrg#if V3D_VERSION >= 40 440b8e80941Smrg cl_emit(cl, END_OF_TILE_MARKER, end); 441b8e80941Smrg#endif 442b8e80941Smrg 443b8e80941Smrg cl_emit(cl, RETURN_FROM_SUB_LIST, ret); 444b8e80941Smrg 445b8e80941Smrg cl_emit(&job->rcl, START_ADDRESS_OF_GENERIC_TILE_LIST, branch) { 446b8e80941Smrg branch.start = tile_list_start; 447b8e80941Smrg branch.end = cl_get_address(cl); 448b8e80941Smrg } 449b8e80941Smrg} 450b8e80941Smrg 451b8e80941Smrg#if V3D_VERSION >= 40 452b8e80941Smrgstatic void 453b8e80941Smrgv3d_setup_render_target(struct v3d_job *job, int cbuf, 454b8e80941Smrg uint32_t *rt_bpp, uint32_t *rt_type, uint32_t *rt_clamp) 455b8e80941Smrg{ 456b8e80941Smrg if (!job->cbufs[cbuf]) 457b8e80941Smrg return; 458b8e80941Smrg 459b8e80941Smrg struct v3d_surface *surf = v3d_surface(job->cbufs[cbuf]); 460b8e80941Smrg *rt_bpp = surf->internal_bpp; 461b8e80941Smrg *rt_type = surf->internal_type; 462b8e80941Smrg *rt_clamp = V3D_RENDER_TARGET_CLAMP_NONE; 463b8e80941Smrg} 464b8e80941Smrg 465b8e80941Smrg#else /* V3D_VERSION < 40 */ 466b8e80941Smrg 467b8e80941Smrgstatic void 468b8e80941Smrgv3d_emit_z_stencil_config(struct v3d_job *job, struct v3d_surface *surf, 469b8e80941Smrg struct v3d_resource *rsc, bool is_separate_stencil) 470b8e80941Smrg{ 471b8e80941Smrg cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_Z_STENCIL, zs) { 472b8e80941Smrg zs.address = cl_address(rsc->bo, surf->offset); 473b8e80941Smrg 474b8e80941Smrg if (!is_separate_stencil) { 475b8e80941Smrg zs.internal_type = surf->internal_type; 476b8e80941Smrg zs.output_image_format = surf->format; 477b8e80941Smrg } else { 478b8e80941Smrg zs.z_stencil_id = 1; /* Separate stencil */ 479b8e80941Smrg } 480b8e80941Smrg 481b8e80941Smrg zs.padded_height_of_output_image_in_uif_blocks = 482b8e80941Smrg surf->padded_height_of_output_image_in_uif_blocks; 483b8e80941Smrg 484b8e80941Smrg assert(surf->tiling != VC5_TILING_RASTER); 485b8e80941Smrg zs.memory_format = surf->tiling; 486b8e80941Smrg } 487b8e80941Smrg 488b8e80941Smrg if (job->store & (is_separate_stencil ? 489b8e80941Smrg PIPE_CLEAR_STENCIL : 490b8e80941Smrg PIPE_CLEAR_DEPTHSTENCIL)) { 491b8e80941Smrg rsc->writes++; 492b8e80941Smrg } 493b8e80941Smrg} 494b8e80941Smrg#endif /* V3D_VERSION < 40 */ 495b8e80941Smrg 496b8e80941Smrg#define div_round_up(a, b) (((a) + (b) - 1) / b) 497b8e80941Smrg 498b8e80941Smrgvoid 499b8e80941Smrgv3dX(emit_rcl)(struct v3d_job *job) 500b8e80941Smrg{ 501b8e80941Smrg /* The RCL list should be empty. */ 502b8e80941Smrg assert(!job->rcl.bo); 503b8e80941Smrg 504b8e80941Smrg v3d_cl_ensure_space_with_branch(&job->rcl, 200 + 256 * 505b8e80941Smrg cl_packet_length(SUPERTILE_COORDINATES)); 506b8e80941Smrg job->submit.rcl_start = job->rcl.bo->offset; 507b8e80941Smrg v3d_job_add_bo(job, job->rcl.bo); 508b8e80941Smrg 509b8e80941Smrg int nr_cbufs = 0; 510b8e80941Smrg for (int i = 0; i < V3D_MAX_DRAW_BUFFERS; i++) { 511b8e80941Smrg if (job->cbufs[i]) 512b8e80941Smrg nr_cbufs = i + 1; 513b8e80941Smrg } 514b8e80941Smrg 515b8e80941Smrg /* Comon config must be the first TILE_RENDERING_MODE_CFG 516b8e80941Smrg * and Z_STENCIL_CLEAR_VALUES must be last. The ones in between are 517b8e80941Smrg * optional updates to the previous HW state. 518b8e80941Smrg */ 519b8e80941Smrg cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_COMMON, config) { 520b8e80941Smrg#if V3D_VERSION < 40 521b8e80941Smrg config.enable_z_store = job->store & PIPE_CLEAR_DEPTH; 522b8e80941Smrg config.enable_stencil_store = job->store & PIPE_CLEAR_STENCIL; 523b8e80941Smrg#else /* V3D_VERSION >= 40 */ 524b8e80941Smrg if (job->zsbuf) { 525b8e80941Smrg struct v3d_surface *surf = v3d_surface(job->zsbuf); 526b8e80941Smrg config.internal_depth_type = surf->internal_type; 527b8e80941Smrg } 528b8e80941Smrg#endif /* V3D_VERSION >= 40 */ 529b8e80941Smrg 530b8e80941Smrg /* XXX: Early D/S clear */ 531b8e80941Smrg 532b8e80941Smrg switch (job->first_ez_state) { 533b8e80941Smrg case VC5_EZ_UNDECIDED: 534b8e80941Smrg case VC5_EZ_LT_LE: 535b8e80941Smrg config.early_z_disable = false; 536b8e80941Smrg config.early_z_test_and_update_direction = 537b8e80941Smrg EARLY_Z_DIRECTION_LT_LE; 538b8e80941Smrg break; 539b8e80941Smrg case VC5_EZ_GT_GE: 540b8e80941Smrg config.early_z_disable = false; 541b8e80941Smrg config.early_z_test_and_update_direction = 542b8e80941Smrg EARLY_Z_DIRECTION_GT_GE; 543b8e80941Smrg break; 544b8e80941Smrg case VC5_EZ_DISABLED: 545b8e80941Smrg config.early_z_disable = true; 546b8e80941Smrg } 547b8e80941Smrg 548b8e80941Smrg config.image_width_pixels = job->draw_width; 549b8e80941Smrg config.image_height_pixels = job->draw_height; 550b8e80941Smrg 551b8e80941Smrg config.number_of_render_targets = MAX2(nr_cbufs, 1); 552b8e80941Smrg 553b8e80941Smrg config.multisample_mode_4x = job->msaa; 554b8e80941Smrg 555b8e80941Smrg config.maximum_bpp_of_all_render_targets = job->internal_bpp; 556b8e80941Smrg } 557b8e80941Smrg 558b8e80941Smrg for (int i = 0; i < nr_cbufs; i++) { 559b8e80941Smrg struct pipe_surface *psurf = job->cbufs[i]; 560b8e80941Smrg if (!psurf) 561b8e80941Smrg continue; 562b8e80941Smrg struct v3d_surface *surf = v3d_surface(psurf); 563b8e80941Smrg struct v3d_resource *rsc = v3d_resource(psurf->texture); 564b8e80941Smrg 565b8e80941Smrg MAYBE_UNUSED uint32_t config_pad = 0; 566b8e80941Smrg uint32_t clear_pad = 0; 567b8e80941Smrg 568b8e80941Smrg /* XXX: Set the pad for raster. */ 569b8e80941Smrg if (surf->tiling == VC5_TILING_UIF_NO_XOR || 570b8e80941Smrg surf->tiling == VC5_TILING_UIF_XOR) { 571b8e80941Smrg int uif_block_height = v3d_utile_height(rsc->cpp) * 2; 572b8e80941Smrg uint32_t implicit_padded_height = (align(job->draw_height, uif_block_height) / 573b8e80941Smrg uif_block_height); 574b8e80941Smrg if (surf->padded_height_of_output_image_in_uif_blocks - 575b8e80941Smrg implicit_padded_height < 15) { 576b8e80941Smrg config_pad = (surf->padded_height_of_output_image_in_uif_blocks - 577b8e80941Smrg implicit_padded_height); 578b8e80941Smrg } else { 579b8e80941Smrg config_pad = 15; 580b8e80941Smrg clear_pad = surf->padded_height_of_output_image_in_uif_blocks; 581b8e80941Smrg } 582b8e80941Smrg } 583b8e80941Smrg 584b8e80941Smrg#if V3D_VERSION < 40 585b8e80941Smrg cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_COLOR, rt) { 586b8e80941Smrg rt.address = cl_address(rsc->bo, surf->offset); 587b8e80941Smrg rt.internal_type = surf->internal_type; 588b8e80941Smrg rt.output_image_format = surf->format; 589b8e80941Smrg rt.memory_format = surf->tiling; 590b8e80941Smrg rt.internal_bpp = surf->internal_bpp; 591b8e80941Smrg rt.render_target_number = i; 592b8e80941Smrg rt.pad = config_pad; 593b8e80941Smrg 594b8e80941Smrg if (job->store & PIPE_CLEAR_COLOR0 << i) 595b8e80941Smrg rsc->writes++; 596b8e80941Smrg } 597b8e80941Smrg#endif /* V3D_VERSION < 40 */ 598b8e80941Smrg 599b8e80941Smrg cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_CLEAR_COLORS_PART1, 600b8e80941Smrg clear) { 601b8e80941Smrg clear.clear_color_low_32_bits = job->clear_color[i][0]; 602b8e80941Smrg clear.clear_color_next_24_bits = job->clear_color[i][1] & 0xffffff; 603b8e80941Smrg clear.render_target_number = i; 604b8e80941Smrg }; 605b8e80941Smrg 606b8e80941Smrg if (surf->internal_bpp >= V3D_INTERNAL_BPP_64) { 607b8e80941Smrg cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_CLEAR_COLORS_PART2, 608b8e80941Smrg clear) { 609b8e80941Smrg clear.clear_color_mid_low_32_bits = 610b8e80941Smrg ((job->clear_color[i][1] >> 24) | 611b8e80941Smrg (job->clear_color[i][2] << 8)); 612b8e80941Smrg clear.clear_color_mid_high_24_bits = 613b8e80941Smrg ((job->clear_color[i][2] >> 24) | 614b8e80941Smrg ((job->clear_color[i][3] & 0xffff) << 8)); 615b8e80941Smrg clear.render_target_number = i; 616b8e80941Smrg }; 617b8e80941Smrg } 618b8e80941Smrg 619b8e80941Smrg if (surf->internal_bpp >= V3D_INTERNAL_BPP_128 || clear_pad) { 620b8e80941Smrg cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_CLEAR_COLORS_PART3, 621b8e80941Smrg clear) { 622b8e80941Smrg clear.uif_padded_height_in_uif_blocks = clear_pad; 623b8e80941Smrg clear.clear_color_high_16_bits = job->clear_color[i][3] >> 16; 624b8e80941Smrg clear.render_target_number = i; 625b8e80941Smrg }; 626b8e80941Smrg } 627b8e80941Smrg } 628b8e80941Smrg 629b8e80941Smrg#if V3D_VERSION >= 40 630b8e80941Smrg cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_COLOR, rt) { 631b8e80941Smrg v3d_setup_render_target(job, 0, 632b8e80941Smrg &rt.render_target_0_internal_bpp, 633b8e80941Smrg &rt.render_target_0_internal_type, 634b8e80941Smrg &rt.render_target_0_clamp); 635b8e80941Smrg v3d_setup_render_target(job, 1, 636b8e80941Smrg &rt.render_target_1_internal_bpp, 637b8e80941Smrg &rt.render_target_1_internal_type, 638b8e80941Smrg &rt.render_target_1_clamp); 639b8e80941Smrg v3d_setup_render_target(job, 2, 640b8e80941Smrg &rt.render_target_2_internal_bpp, 641b8e80941Smrg &rt.render_target_2_internal_type, 642b8e80941Smrg &rt.render_target_2_clamp); 643b8e80941Smrg v3d_setup_render_target(job, 3, 644b8e80941Smrg &rt.render_target_3_internal_bpp, 645b8e80941Smrg &rt.render_target_3_internal_type, 646b8e80941Smrg &rt.render_target_3_clamp); 647b8e80941Smrg } 648b8e80941Smrg#endif 649b8e80941Smrg 650b8e80941Smrg#if V3D_VERSION < 40 651b8e80941Smrg /* TODO: Don't bother emitting if we don't load/clear Z/S. */ 652b8e80941Smrg if (job->zsbuf) { 653b8e80941Smrg struct pipe_surface *psurf = job->zsbuf; 654b8e80941Smrg struct v3d_surface *surf = v3d_surface(psurf); 655b8e80941Smrg struct v3d_resource *rsc = v3d_resource(psurf->texture); 656b8e80941Smrg 657b8e80941Smrg v3d_emit_z_stencil_config(job, surf, rsc, false); 658b8e80941Smrg 659b8e80941Smrg /* Emit the separate stencil packet if we have a resource for 660b8e80941Smrg * it. The HW will only load/store this buffer if the 661b8e80941Smrg * Z/Stencil config doesn't have stencil in its format. 662b8e80941Smrg */ 663b8e80941Smrg if (surf->separate_stencil) { 664b8e80941Smrg v3d_emit_z_stencil_config(job, 665b8e80941Smrg v3d_surface(surf->separate_stencil), 666b8e80941Smrg rsc->separate_stencil, true); 667b8e80941Smrg } 668b8e80941Smrg } 669b8e80941Smrg#endif /* V3D_VERSION < 40 */ 670b8e80941Smrg 671b8e80941Smrg /* Ends rendering mode config. */ 672b8e80941Smrg cl_emit(&job->rcl, TILE_RENDERING_MODE_CFG_ZS_CLEAR_VALUES, 673b8e80941Smrg clear) { 674b8e80941Smrg clear.z_clear_value = job->clear_z; 675b8e80941Smrg clear.stencil_clear_value = job->clear_s; 676b8e80941Smrg }; 677b8e80941Smrg 678b8e80941Smrg /* Always set initial block size before the first branch, which needs 679b8e80941Smrg * to match the value from binning mode config. 680b8e80941Smrg */ 681b8e80941Smrg cl_emit(&job->rcl, TILE_LIST_INITIAL_BLOCK_SIZE, init) { 682b8e80941Smrg init.use_auto_chained_tile_lists = true; 683b8e80941Smrg init.size_of_first_block_in_chained_tile_lists = 684b8e80941Smrg TILE_ALLOCATION_BLOCK_SIZE_64B; 685b8e80941Smrg } 686b8e80941Smrg 687b8e80941Smrg uint32_t supertile_w = 1, supertile_h = 1; 688b8e80941Smrg 689b8e80941Smrg /* If doing multicore binning, we would need to initialize each core's 690b8e80941Smrg * tile list here. 691b8e80941Smrg */ 692b8e80941Smrg cl_emit(&job->rcl, MULTICORE_RENDERING_TILE_LIST_SET_BASE, list) { 693b8e80941Smrg list.address = cl_address(job->tile_alloc, 0); 694b8e80941Smrg } 695b8e80941Smrg 696b8e80941Smrg cl_emit(&job->rcl, MULTICORE_RENDERING_SUPERTILE_CFG, config) { 697b8e80941Smrg uint32_t frame_w_in_supertiles, frame_h_in_supertiles; 698b8e80941Smrg const uint32_t max_supertiles = 256; 699b8e80941Smrg 700b8e80941Smrg /* Size up our supertiles until we get under the limit. */ 701b8e80941Smrg for (;;) { 702b8e80941Smrg frame_w_in_supertiles = div_round_up(job->draw_tiles_x, 703b8e80941Smrg supertile_w); 704b8e80941Smrg frame_h_in_supertiles = div_round_up(job->draw_tiles_y, 705b8e80941Smrg supertile_h); 706b8e80941Smrg if (frame_w_in_supertiles * frame_h_in_supertiles < 707b8e80941Smrg max_supertiles) { 708b8e80941Smrg break; 709b8e80941Smrg } 710b8e80941Smrg 711b8e80941Smrg if (supertile_w < supertile_h) 712b8e80941Smrg supertile_w++; 713b8e80941Smrg else 714b8e80941Smrg supertile_h++; 715b8e80941Smrg } 716b8e80941Smrg 717b8e80941Smrg config.number_of_bin_tile_lists = 1; 718b8e80941Smrg config.total_frame_width_in_tiles = job->draw_tiles_x; 719b8e80941Smrg config.total_frame_height_in_tiles = job->draw_tiles_y; 720b8e80941Smrg 721b8e80941Smrg config.supertile_width_in_tiles = supertile_w; 722b8e80941Smrg config.supertile_height_in_tiles = supertile_h; 723b8e80941Smrg 724b8e80941Smrg config.total_frame_width_in_supertiles = frame_w_in_supertiles; 725b8e80941Smrg config.total_frame_height_in_supertiles = frame_h_in_supertiles; 726b8e80941Smrg } 727b8e80941Smrg 728b8e80941Smrg /* Start by clearing the tile buffer. */ 729b8e80941Smrg cl_emit(&job->rcl, TILE_COORDINATES, coords) { 730b8e80941Smrg coords.tile_column_number = 0; 731b8e80941Smrg coords.tile_row_number = 0; 732b8e80941Smrg } 733b8e80941Smrg 734b8e80941Smrg /* Emit an initial clear of the tile buffers. This is necessary for 735b8e80941Smrg * any buffers that should be cleared (since clearing normally happens 736b8e80941Smrg * at the *end* of the generic tile list), but it's also nice to clear 737b8e80941Smrg * everything so the first tile doesn't inherit any contents from some 738b8e80941Smrg * previous frame. 739b8e80941Smrg * 740b8e80941Smrg * Also, implement the GFXH-1742 workaround. There's a race in the HW 741b8e80941Smrg * between the RCL updating the TLB's internal type/size and the 742b8e80941Smrg * spawning of the QPU instances using the TLB's current internal 743b8e80941Smrg * type/size. To make sure the QPUs get the right state,, we need 1 744b8e80941Smrg * dummy store in between internal type/size changes on V3D 3.x, and 2 745b8e80941Smrg * dummy stores on 4.x. 746b8e80941Smrg */ 747b8e80941Smrg#if V3D_VERSION < 40 748b8e80941Smrg cl_emit(&job->rcl, STORE_TILE_BUFFER_GENERAL, store) { 749b8e80941Smrg store.buffer_to_store = NONE; 750b8e80941Smrg } 751b8e80941Smrg#else 752b8e80941Smrg for (int i = 0; i < 2; i++) { 753b8e80941Smrg if (i > 0) 754b8e80941Smrg cl_emit(&job->rcl, TILE_COORDINATES, coords); 755b8e80941Smrg cl_emit(&job->rcl, END_OF_LOADS, end); 756b8e80941Smrg cl_emit(&job->rcl, STORE_TILE_BUFFER_GENERAL, store) { 757b8e80941Smrg store.buffer_to_store = NONE; 758b8e80941Smrg } 759b8e80941Smrg if (i == 0) { 760b8e80941Smrg cl_emit(&job->rcl, CLEAR_TILE_BUFFERS, clear) { 761b8e80941Smrg clear.clear_z_stencil_buffer = true; 762b8e80941Smrg clear.clear_all_render_targets = true; 763b8e80941Smrg } 764b8e80941Smrg } 765b8e80941Smrg cl_emit(&job->rcl, END_OF_TILE_MARKER, end); 766b8e80941Smrg } 767b8e80941Smrg#endif 768b8e80941Smrg 769b8e80941Smrg cl_emit(&job->rcl, FLUSH_VCD_CACHE, flush); 770b8e80941Smrg 771b8e80941Smrg v3d_rcl_emit_generic_per_tile_list(job, nr_cbufs - 1); 772b8e80941Smrg 773b8e80941Smrg /* XXX perf: We should expose GL_MESA_tile_raster_order to improve X11 774b8e80941Smrg * performance, but we should use Morton order otherwise to improve 775b8e80941Smrg * cache locality. 776b8e80941Smrg */ 777b8e80941Smrg uint32_t supertile_w_in_pixels = job->tile_width * supertile_w; 778b8e80941Smrg uint32_t supertile_h_in_pixels = job->tile_height * supertile_h; 779b8e80941Smrg uint32_t min_x_supertile = job->draw_min_x / supertile_w_in_pixels; 780b8e80941Smrg uint32_t min_y_supertile = job->draw_min_y / supertile_h_in_pixels; 781b8e80941Smrg 782b8e80941Smrg uint32_t max_x_supertile = 0; 783b8e80941Smrg uint32_t max_y_supertile = 0; 784b8e80941Smrg if (job->draw_max_x != 0 && job->draw_max_y != 0) { 785b8e80941Smrg max_x_supertile = (job->draw_max_x - 1) / supertile_w_in_pixels; 786b8e80941Smrg max_y_supertile = (job->draw_max_y - 1) / supertile_h_in_pixels; 787b8e80941Smrg } 788b8e80941Smrg 789b8e80941Smrg for (int y = min_y_supertile; y <= max_y_supertile; y++) { 790b8e80941Smrg for (int x = min_x_supertile; x <= max_x_supertile; x++) { 791b8e80941Smrg cl_emit(&job->rcl, SUPERTILE_COORDINATES, coords) { 792b8e80941Smrg coords.column_number_in_supertiles = x; 793b8e80941Smrg coords.row_number_in_supertiles = y; 794b8e80941Smrg } 795b8e80941Smrg } 796b8e80941Smrg } 797b8e80941Smrg 798b8e80941Smrg if (job->tmu_dirty_rcl) { 799b8e80941Smrg cl_emit(&job->rcl, L1_CACHE_FLUSH_CONTROL, flush) { 800b8e80941Smrg flush.tmu_config_cache_clear = 0xf; 801b8e80941Smrg flush.tmu_data_cache_clear = 0xf; 802b8e80941Smrg flush.uniforms_cache_clear = 0xf; 803b8e80941Smrg flush.instruction_cache_clear = 0xf; 804b8e80941Smrg } 805b8e80941Smrg 806b8e80941Smrg cl_emit(&job->rcl, L2T_CACHE_FLUSH_CONTROL, flush) { 807b8e80941Smrg flush.l2t_flush_mode = L2T_FLUSH_MODE_CLEAN; 808b8e80941Smrg flush.l2t_flush_start = cl_address(NULL, 0); 809b8e80941Smrg flush.l2t_flush_end = cl_address(NULL, ~0); 810b8e80941Smrg } 811b8e80941Smrg } 812b8e80941Smrg 813b8e80941Smrg cl_emit(&job->rcl, END_OF_RENDERING, end); 814b8e80941Smrg} 815