1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright (C) 2012-2013 Rob Clark <robclark@freedesktop.org> 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 FROM, 20bf215546Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21bf215546Sopenharmony_ci * SOFTWARE. 22bf215546Sopenharmony_ci * 23bf215546Sopenharmony_ci * Authors: 24bf215546Sopenharmony_ci * Rob Clark <robclark@freedesktop.org> 25bf215546Sopenharmony_ci */ 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci#include "pipe/p_state.h" 28bf215546Sopenharmony_ci#include "util/u_helpers.h" 29bf215546Sopenharmony_ci#include "util/u_memory.h" 30bf215546Sopenharmony_ci#include "util/u_string.h" 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci#include "freedreno_resource.h" 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci#include "fd2_blend.h" 35bf215546Sopenharmony_ci#include "fd2_context.h" 36bf215546Sopenharmony_ci#include "fd2_emit.h" 37bf215546Sopenharmony_ci#include "fd2_program.h" 38bf215546Sopenharmony_ci#include "fd2_rasterizer.h" 39bf215546Sopenharmony_ci#include "fd2_texture.h" 40bf215546Sopenharmony_ci#include "fd2_util.h" 41bf215546Sopenharmony_ci#include "fd2_zsa.h" 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_ci/* NOTE: just define the position for const regs statically.. the blob 44bf215546Sopenharmony_ci * driver doesn't seem to change these dynamically, and I can't really 45bf215546Sopenharmony_ci * think of a good reason to so.. 46bf215546Sopenharmony_ci */ 47bf215546Sopenharmony_ci#define VS_CONST_BASE 0x20 48bf215546Sopenharmony_ci#define PS_CONST_BASE 0x120 49bf215546Sopenharmony_ci 50bf215546Sopenharmony_cistatic void 51bf215546Sopenharmony_ciemit_constants(struct fd_ringbuffer *ring, uint32_t base, 52bf215546Sopenharmony_ci struct fd_constbuf_stateobj *constbuf, 53bf215546Sopenharmony_ci struct fd2_shader_stateobj *shader) 54bf215546Sopenharmony_ci{ 55bf215546Sopenharmony_ci uint32_t enabled_mask = constbuf->enabled_mask; 56bf215546Sopenharmony_ci uint32_t start_base = base; 57bf215546Sopenharmony_ci unsigned i; 58bf215546Sopenharmony_ci 59bf215546Sopenharmony_ci /* emit user constants: */ 60bf215546Sopenharmony_ci while (enabled_mask) { 61bf215546Sopenharmony_ci unsigned index = ffs(enabled_mask) - 1; 62bf215546Sopenharmony_ci struct pipe_constant_buffer *cb = &constbuf->cb[index]; 63bf215546Sopenharmony_ci unsigned size = align(cb->buffer_size, 4) / 4; /* size in dwords */ 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ci // I expect that size should be a multiple of vec4's: 66bf215546Sopenharmony_ci assert(size == align(size, 4)); 67bf215546Sopenharmony_ci 68bf215546Sopenharmony_ci /* hmm, sometimes we still seem to end up with consts bound, 69bf215546Sopenharmony_ci * even if shader isn't using them, which ends up overwriting 70bf215546Sopenharmony_ci * const reg's used for immediates.. this is a hack to work 71bf215546Sopenharmony_ci * around that: 72bf215546Sopenharmony_ci */ 73bf215546Sopenharmony_ci if (shader && ((base - start_base) >= (shader->first_immediate * 4))) 74bf215546Sopenharmony_ci break; 75bf215546Sopenharmony_ci 76bf215546Sopenharmony_ci const uint32_t *dwords; 77bf215546Sopenharmony_ci 78bf215546Sopenharmony_ci if (cb->user_buffer) { 79bf215546Sopenharmony_ci dwords = cb->user_buffer; 80bf215546Sopenharmony_ci } else { 81bf215546Sopenharmony_ci struct fd_resource *rsc = fd_resource(cb->buffer); 82bf215546Sopenharmony_ci dwords = fd_bo_map(rsc->bo); 83bf215546Sopenharmony_ci } 84bf215546Sopenharmony_ci 85bf215546Sopenharmony_ci dwords = (uint32_t *)(((uint8_t *)dwords) + cb->buffer_offset); 86bf215546Sopenharmony_ci 87bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, size + 1); 88bf215546Sopenharmony_ci OUT_RING(ring, base); 89bf215546Sopenharmony_ci for (i = 0; i < size; i++) 90bf215546Sopenharmony_ci OUT_RING(ring, *(dwords++)); 91bf215546Sopenharmony_ci 92bf215546Sopenharmony_ci base += size; 93bf215546Sopenharmony_ci enabled_mask &= ~(1 << index); 94bf215546Sopenharmony_ci } 95bf215546Sopenharmony_ci 96bf215546Sopenharmony_ci /* emit shader immediates: */ 97bf215546Sopenharmony_ci if (shader) { 98bf215546Sopenharmony_ci for (i = 0; i < shader->num_immediates; i++) { 99bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 5); 100bf215546Sopenharmony_ci OUT_RING(ring, start_base + (4 * (shader->first_immediate + i))); 101bf215546Sopenharmony_ci OUT_RING(ring, shader->immediates[i].val[0]); 102bf215546Sopenharmony_ci OUT_RING(ring, shader->immediates[i].val[1]); 103bf215546Sopenharmony_ci OUT_RING(ring, shader->immediates[i].val[2]); 104bf215546Sopenharmony_ci OUT_RING(ring, shader->immediates[i].val[3]); 105bf215546Sopenharmony_ci base += 4; 106bf215546Sopenharmony_ci } 107bf215546Sopenharmony_ci } 108bf215546Sopenharmony_ci} 109bf215546Sopenharmony_ci 110bf215546Sopenharmony_citypedef uint32_t texmask; 111bf215546Sopenharmony_ci 112bf215546Sopenharmony_cistatic texmask 113bf215546Sopenharmony_ciemit_texture(struct fd_ringbuffer *ring, struct fd_context *ctx, 114bf215546Sopenharmony_ci struct fd_texture_stateobj *tex, unsigned samp_id, texmask emitted) 115bf215546Sopenharmony_ci{ 116bf215546Sopenharmony_ci unsigned const_idx = fd2_get_const_idx(ctx, tex, samp_id); 117bf215546Sopenharmony_ci static const struct fd2_sampler_stateobj dummy_sampler = {}; 118bf215546Sopenharmony_ci static const struct fd2_pipe_sampler_view dummy_view = {}; 119bf215546Sopenharmony_ci const struct fd2_sampler_stateobj *sampler; 120bf215546Sopenharmony_ci const struct fd2_pipe_sampler_view *view; 121bf215546Sopenharmony_ci struct fd_resource *rsc; 122bf215546Sopenharmony_ci 123bf215546Sopenharmony_ci if (emitted & (1 << const_idx)) 124bf215546Sopenharmony_ci return 0; 125bf215546Sopenharmony_ci 126bf215546Sopenharmony_ci sampler = tex->samplers[samp_id] 127bf215546Sopenharmony_ci ? fd2_sampler_stateobj(tex->samplers[samp_id]) 128bf215546Sopenharmony_ci : &dummy_sampler; 129bf215546Sopenharmony_ci view = tex->textures[samp_id] ? fd2_pipe_sampler_view(tex->textures[samp_id]) 130bf215546Sopenharmony_ci : &dummy_view; 131bf215546Sopenharmony_ci 132bf215546Sopenharmony_ci rsc = view->base.texture ? fd_resource(view->base.texture) : NULL; 133bf215546Sopenharmony_ci 134bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 7); 135bf215546Sopenharmony_ci OUT_RING(ring, 0x00010000 + (0x6 * const_idx)); 136bf215546Sopenharmony_ci 137bf215546Sopenharmony_ci OUT_RING(ring, sampler->tex0 | view->tex0); 138bf215546Sopenharmony_ci if (rsc) 139bf215546Sopenharmony_ci OUT_RELOC(ring, rsc->bo, fd_resource_offset(rsc, 0, 0), view->tex1, 0); 140bf215546Sopenharmony_ci else 141bf215546Sopenharmony_ci OUT_RING(ring, 0); 142bf215546Sopenharmony_ci 143bf215546Sopenharmony_ci OUT_RING(ring, view->tex2); 144bf215546Sopenharmony_ci OUT_RING(ring, sampler->tex3 | view->tex3); 145bf215546Sopenharmony_ci OUT_RING(ring, sampler->tex4 | view->tex4); 146bf215546Sopenharmony_ci 147bf215546Sopenharmony_ci if (rsc && rsc->b.b.last_level) 148bf215546Sopenharmony_ci OUT_RELOC(ring, rsc->bo, fd_resource_offset(rsc, 1, 0), view->tex5, 0); 149bf215546Sopenharmony_ci else 150bf215546Sopenharmony_ci OUT_RING(ring, view->tex5); 151bf215546Sopenharmony_ci 152bf215546Sopenharmony_ci return (1 << const_idx); 153bf215546Sopenharmony_ci} 154bf215546Sopenharmony_ci 155bf215546Sopenharmony_cistatic void 156bf215546Sopenharmony_ciemit_textures(struct fd_ringbuffer *ring, struct fd_context *ctx) 157bf215546Sopenharmony_ci{ 158bf215546Sopenharmony_ci struct fd_texture_stateobj *fragtex = &ctx->tex[PIPE_SHADER_FRAGMENT]; 159bf215546Sopenharmony_ci struct fd_texture_stateobj *verttex = &ctx->tex[PIPE_SHADER_VERTEX]; 160bf215546Sopenharmony_ci texmask emitted = 0; 161bf215546Sopenharmony_ci unsigned i; 162bf215546Sopenharmony_ci 163bf215546Sopenharmony_ci for (i = 0; i < verttex->num_samplers; i++) 164bf215546Sopenharmony_ci if (verttex->samplers[i]) 165bf215546Sopenharmony_ci emitted |= emit_texture(ring, ctx, verttex, i, emitted); 166bf215546Sopenharmony_ci 167bf215546Sopenharmony_ci for (i = 0; i < fragtex->num_samplers; i++) 168bf215546Sopenharmony_ci if (fragtex->samplers[i]) 169bf215546Sopenharmony_ci emitted |= emit_texture(ring, ctx, fragtex, i, emitted); 170bf215546Sopenharmony_ci} 171bf215546Sopenharmony_ci 172bf215546Sopenharmony_civoid 173bf215546Sopenharmony_cifd2_emit_vertex_bufs(struct fd_ringbuffer *ring, uint32_t val, 174bf215546Sopenharmony_ci struct fd2_vertex_buf *vbufs, uint32_t n) 175bf215546Sopenharmony_ci{ 176bf215546Sopenharmony_ci unsigned i; 177bf215546Sopenharmony_ci 178bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 1 + (2 * n)); 179bf215546Sopenharmony_ci OUT_RING(ring, (0x1 << 16) | (val & 0xffff)); 180bf215546Sopenharmony_ci for (i = 0; i < n; i++) { 181bf215546Sopenharmony_ci struct fd_resource *rsc = fd_resource(vbufs[i].prsc); 182bf215546Sopenharmony_ci OUT_RELOC(ring, rsc->bo, vbufs[i].offset, 3, 0); 183bf215546Sopenharmony_ci OUT_RING(ring, vbufs[i].size); 184bf215546Sopenharmony_ci } 185bf215546Sopenharmony_ci} 186bf215546Sopenharmony_ci 187bf215546Sopenharmony_civoid 188bf215546Sopenharmony_cifd2_emit_state_binning(struct fd_context *ctx, 189bf215546Sopenharmony_ci const enum fd_dirty_3d_state dirty) 190bf215546Sopenharmony_ci{ 191bf215546Sopenharmony_ci struct fd2_blend_stateobj *blend = fd2_blend_stateobj(ctx->blend); 192bf215546Sopenharmony_ci struct fd_ringbuffer *ring = ctx->batch->binning; 193bf215546Sopenharmony_ci 194bf215546Sopenharmony_ci /* subset of fd2_emit_state needed for hw binning on a20x */ 195bf215546Sopenharmony_ci 196bf215546Sopenharmony_ci if (dirty & (FD_DIRTY_PROG | FD_DIRTY_VTXSTATE)) 197bf215546Sopenharmony_ci fd2_program_emit(ctx, ring, &ctx->prog); 198bf215546Sopenharmony_ci 199bf215546Sopenharmony_ci if (dirty & (FD_DIRTY_PROG | FD_DIRTY_CONST)) { 200bf215546Sopenharmony_ci emit_constants(ring, VS_CONST_BASE * 4, 201bf215546Sopenharmony_ci &ctx->constbuf[PIPE_SHADER_VERTEX], 202bf215546Sopenharmony_ci (dirty & FD_DIRTY_PROG) ? ctx->prog.vs : NULL); 203bf215546Sopenharmony_ci } 204bf215546Sopenharmony_ci 205bf215546Sopenharmony_ci if (dirty & FD_DIRTY_VIEWPORT) { 206bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 9); 207bf215546Sopenharmony_ci OUT_RING(ring, 0x00000184); 208bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.translate[0])); 209bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.translate[1])); 210bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.translate[2])); 211bf215546Sopenharmony_ci OUT_RING(ring, fui(0.0f)); 212bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.scale[0])); 213bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.scale[1])); 214bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.scale[2])); 215bf215546Sopenharmony_ci OUT_RING(ring, fui(0.0f)); 216bf215546Sopenharmony_ci } 217bf215546Sopenharmony_ci 218bf215546Sopenharmony_ci /* not sure why this is needed */ 219bf215546Sopenharmony_ci if (dirty & (FD_DIRTY_BLEND | FD_DIRTY_FRAMEBUFFER)) { 220bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 221bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_BLEND_CONTROL)); 222bf215546Sopenharmony_ci OUT_RING(ring, blend->rb_blendcontrol); 223bf215546Sopenharmony_ci 224bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 225bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_MASK)); 226bf215546Sopenharmony_ci OUT_RING(ring, blend->rb_colormask); 227bf215546Sopenharmony_ci } 228bf215546Sopenharmony_ci 229bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 230bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_SU_SC_MODE_CNTL)); 231bf215546Sopenharmony_ci OUT_RING(ring, A2XX_PA_SU_SC_MODE_CNTL_FACE_KILL_ENABLE); 232bf215546Sopenharmony_ci} 233bf215546Sopenharmony_ci 234bf215546Sopenharmony_civoid 235bf215546Sopenharmony_cifd2_emit_state(struct fd_context *ctx, const enum fd_dirty_3d_state dirty) 236bf215546Sopenharmony_ci{ 237bf215546Sopenharmony_ci struct fd2_blend_stateobj *blend = fd2_blend_stateobj(ctx->blend); 238bf215546Sopenharmony_ci struct fd2_zsa_stateobj *zsa = fd2_zsa_stateobj(ctx->zsa); 239bf215546Sopenharmony_ci struct fd2_shader_stateobj *fs = ctx->prog.fs; 240bf215546Sopenharmony_ci struct fd_ringbuffer *ring = ctx->batch->draw; 241bf215546Sopenharmony_ci 242bf215546Sopenharmony_ci /* NOTE: we probably want to eventually refactor this so each state 243bf215546Sopenharmony_ci * object handles emitting it's own state.. although the mapping of 244bf215546Sopenharmony_ci * state to registers is not always orthogonal, sometimes a single 245bf215546Sopenharmony_ci * register contains bitfields coming from multiple state objects, 246bf215546Sopenharmony_ci * so not sure the best way to deal with that yet. 247bf215546Sopenharmony_ci */ 248bf215546Sopenharmony_ci 249bf215546Sopenharmony_ci if (dirty & FD_DIRTY_SAMPLE_MASK) { 250bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 251bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_AA_MASK)); 252bf215546Sopenharmony_ci OUT_RING(ring, ctx->sample_mask); 253bf215546Sopenharmony_ci } 254bf215546Sopenharmony_ci 255bf215546Sopenharmony_ci if (dirty & (FD_DIRTY_ZSA | FD_DIRTY_STENCIL_REF | FD_DIRTY_PROG)) { 256bf215546Sopenharmony_ci struct pipe_stencil_ref *sr = &ctx->stencil_ref; 257bf215546Sopenharmony_ci uint32_t val = zsa->rb_depthcontrol; 258bf215546Sopenharmony_ci 259bf215546Sopenharmony_ci if (fs->has_kill) 260bf215546Sopenharmony_ci val &= ~A2XX_RB_DEPTHCONTROL_EARLY_Z_ENABLE; 261bf215546Sopenharmony_ci 262bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 263bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_DEPTHCONTROL)); 264bf215546Sopenharmony_ci OUT_RING(ring, val); 265bf215546Sopenharmony_ci 266bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 4); 267bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_STENCILREFMASK_BF)); 268bf215546Sopenharmony_ci OUT_RING(ring, zsa->rb_stencilrefmask_bf | 269bf215546Sopenharmony_ci A2XX_RB_STENCILREFMASK_STENCILREF(sr->ref_value[1])); 270bf215546Sopenharmony_ci OUT_RING(ring, zsa->rb_stencilrefmask | 271bf215546Sopenharmony_ci A2XX_RB_STENCILREFMASK_STENCILREF(sr->ref_value[0])); 272bf215546Sopenharmony_ci OUT_RING(ring, zsa->rb_alpha_ref); 273bf215546Sopenharmony_ci } 274bf215546Sopenharmony_ci 275bf215546Sopenharmony_ci if (ctx->rasterizer && dirty & FD_DIRTY_RASTERIZER) { 276bf215546Sopenharmony_ci struct fd2_rasterizer_stateobj *rasterizer = 277bf215546Sopenharmony_ci fd2_rasterizer_stateobj(ctx->rasterizer); 278bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 3); 279bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_CL_CLIP_CNTL)); 280bf215546Sopenharmony_ci OUT_RING(ring, rasterizer->pa_cl_clip_cntl); 281bf215546Sopenharmony_ci OUT_RING(ring, rasterizer->pa_su_sc_mode_cntl | 282bf215546Sopenharmony_ci A2XX_PA_SU_SC_MODE_CNTL_VTX_WINDOW_OFFSET_ENABLE); 283bf215546Sopenharmony_ci 284bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 5); 285bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_SU_POINT_SIZE)); 286bf215546Sopenharmony_ci OUT_RING(ring, rasterizer->pa_su_point_size); 287bf215546Sopenharmony_ci OUT_RING(ring, rasterizer->pa_su_point_minmax); 288bf215546Sopenharmony_ci OUT_RING(ring, rasterizer->pa_su_line_cntl); 289bf215546Sopenharmony_ci OUT_RING(ring, rasterizer->pa_sc_line_stipple); 290bf215546Sopenharmony_ci 291bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 6); 292bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_SU_VTX_CNTL)); 293bf215546Sopenharmony_ci OUT_RING(ring, rasterizer->pa_su_vtx_cntl); 294bf215546Sopenharmony_ci OUT_RING(ring, fui(1.0f)); /* PA_CL_GB_VERT_CLIP_ADJ */ 295bf215546Sopenharmony_ci OUT_RING(ring, fui(1.0f)); /* PA_CL_GB_VERT_DISC_ADJ */ 296bf215546Sopenharmony_ci OUT_RING(ring, fui(1.0f)); /* PA_CL_GB_HORZ_CLIP_ADJ */ 297bf215546Sopenharmony_ci OUT_RING(ring, fui(1.0f)); /* PA_CL_GB_HORZ_DISC_ADJ */ 298bf215546Sopenharmony_ci 299bf215546Sopenharmony_ci if (rasterizer->base.offset_tri) { 300bf215546Sopenharmony_ci /* TODO: why multiply scale by 2 ? without it deqp test fails 301bf215546Sopenharmony_ci * deqp/piglit tests aren't very precise 302bf215546Sopenharmony_ci */ 303bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 5); 304bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_SU_POLY_OFFSET_FRONT_SCALE)); 305bf215546Sopenharmony_ci OUT_RING(ring, 306bf215546Sopenharmony_ci fui(rasterizer->base.offset_scale * 2.0f)); /* FRONT_SCALE */ 307bf215546Sopenharmony_ci OUT_RING(ring, fui(rasterizer->base.offset_units)); /* FRONT_OFFSET */ 308bf215546Sopenharmony_ci OUT_RING(ring, 309bf215546Sopenharmony_ci fui(rasterizer->base.offset_scale * 2.0f)); /* BACK_SCALE */ 310bf215546Sopenharmony_ci OUT_RING(ring, fui(rasterizer->base.offset_units)); /* BACK_OFFSET */ 311bf215546Sopenharmony_ci } 312bf215546Sopenharmony_ci } 313bf215546Sopenharmony_ci 314bf215546Sopenharmony_ci /* NOTE: scissor enabled bit is part of rasterizer state: */ 315bf215546Sopenharmony_ci if (dirty & (FD_DIRTY_SCISSOR | FD_DIRTY_RASTERIZER)) { 316bf215546Sopenharmony_ci struct pipe_scissor_state *scissor = fd_context_get_scissor(ctx); 317bf215546Sopenharmony_ci 318bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 3); 319bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_WINDOW_SCISSOR_TL)); 320bf215546Sopenharmony_ci OUT_RING(ring, xy2d(scissor->minx, /* PA_SC_WINDOW_SCISSOR_TL */ 321bf215546Sopenharmony_ci scissor->miny)); 322bf215546Sopenharmony_ci OUT_RING(ring, xy2d(scissor->maxx, /* PA_SC_WINDOW_SCISSOR_BR */ 323bf215546Sopenharmony_ci scissor->maxy)); 324bf215546Sopenharmony_ci 325bf215546Sopenharmony_ci ctx->batch->max_scissor.minx = 326bf215546Sopenharmony_ci MIN2(ctx->batch->max_scissor.minx, scissor->minx); 327bf215546Sopenharmony_ci ctx->batch->max_scissor.miny = 328bf215546Sopenharmony_ci MIN2(ctx->batch->max_scissor.miny, scissor->miny); 329bf215546Sopenharmony_ci ctx->batch->max_scissor.maxx = 330bf215546Sopenharmony_ci MAX2(ctx->batch->max_scissor.maxx, scissor->maxx); 331bf215546Sopenharmony_ci ctx->batch->max_scissor.maxy = 332bf215546Sopenharmony_ci MAX2(ctx->batch->max_scissor.maxy, scissor->maxy); 333bf215546Sopenharmony_ci } 334bf215546Sopenharmony_ci 335bf215546Sopenharmony_ci if (dirty & FD_DIRTY_VIEWPORT) { 336bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 7); 337bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_CL_VPORT_XSCALE)); 338bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.scale[0])); /* PA_CL_VPORT_XSCALE */ 339bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.translate[0])); /* PA_CL_VPORT_XOFFSET */ 340bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.scale[1])); /* PA_CL_VPORT_YSCALE */ 341bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.translate[1])); /* PA_CL_VPORT_YOFFSET */ 342bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.scale[2])); /* PA_CL_VPORT_ZSCALE */ 343bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.translate[2])); /* PA_CL_VPORT_ZOFFSET */ 344bf215546Sopenharmony_ci 345bf215546Sopenharmony_ci /* set viewport in C65/C66, for a20x hw binning and fragcoord.z */ 346bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 9); 347bf215546Sopenharmony_ci OUT_RING(ring, 0x00000184); 348bf215546Sopenharmony_ci 349bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.translate[0])); 350bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.translate[1])); 351bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.translate[2])); 352bf215546Sopenharmony_ci OUT_RING(ring, fui(0.0f)); 353bf215546Sopenharmony_ci 354bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.scale[0])); 355bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.scale[1])); 356bf215546Sopenharmony_ci OUT_RING(ring, fui(ctx->viewport.scale[2])); 357bf215546Sopenharmony_ci OUT_RING(ring, fui(0.0f)); 358bf215546Sopenharmony_ci } 359bf215546Sopenharmony_ci 360bf215546Sopenharmony_ci if (dirty & (FD_DIRTY_PROG | FD_DIRTY_VTXSTATE | FD_DIRTY_TEXSTATE)) 361bf215546Sopenharmony_ci fd2_program_emit(ctx, ring, &ctx->prog); 362bf215546Sopenharmony_ci 363bf215546Sopenharmony_ci if (dirty & (FD_DIRTY_PROG | FD_DIRTY_CONST)) { 364bf215546Sopenharmony_ci emit_constants(ring, VS_CONST_BASE * 4, 365bf215546Sopenharmony_ci &ctx->constbuf[PIPE_SHADER_VERTEX], 366bf215546Sopenharmony_ci (dirty & FD_DIRTY_PROG) ? ctx->prog.vs : NULL); 367bf215546Sopenharmony_ci emit_constants(ring, PS_CONST_BASE * 4, 368bf215546Sopenharmony_ci &ctx->constbuf[PIPE_SHADER_FRAGMENT], 369bf215546Sopenharmony_ci (dirty & FD_DIRTY_PROG) ? ctx->prog.fs : NULL); 370bf215546Sopenharmony_ci } 371bf215546Sopenharmony_ci 372bf215546Sopenharmony_ci if (dirty & (FD_DIRTY_BLEND | FD_DIRTY_ZSA)) { 373bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 374bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_COLORCONTROL)); 375bf215546Sopenharmony_ci OUT_RING(ring, zsa->rb_colorcontrol | blend->rb_colorcontrol); 376bf215546Sopenharmony_ci } 377bf215546Sopenharmony_ci 378bf215546Sopenharmony_ci if (dirty & (FD_DIRTY_BLEND | FD_DIRTY_FRAMEBUFFER)) { 379bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 380bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_BLEND_CONTROL)); 381bf215546Sopenharmony_ci OUT_RING(ring, blend->rb_blendcontrol); 382bf215546Sopenharmony_ci 383bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 384bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_MASK)); 385bf215546Sopenharmony_ci OUT_RING(ring, blend->rb_colormask); 386bf215546Sopenharmony_ci } 387bf215546Sopenharmony_ci 388bf215546Sopenharmony_ci if (dirty & FD_DIRTY_BLEND_COLOR) { 389bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 5); 390bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_BLEND_RED)); 391bf215546Sopenharmony_ci OUT_RING(ring, float_to_ubyte(ctx->blend_color.color[0])); 392bf215546Sopenharmony_ci OUT_RING(ring, float_to_ubyte(ctx->blend_color.color[1])); 393bf215546Sopenharmony_ci OUT_RING(ring, float_to_ubyte(ctx->blend_color.color[2])); 394bf215546Sopenharmony_ci OUT_RING(ring, float_to_ubyte(ctx->blend_color.color[3])); 395bf215546Sopenharmony_ci } 396bf215546Sopenharmony_ci 397bf215546Sopenharmony_ci if (dirty & (FD_DIRTY_TEX | FD_DIRTY_PROG)) 398bf215546Sopenharmony_ci emit_textures(ring, ctx); 399bf215546Sopenharmony_ci} 400bf215546Sopenharmony_ci 401bf215546Sopenharmony_ci/* emit per-context initialization: 402bf215546Sopenharmony_ci */ 403bf215546Sopenharmony_civoid 404bf215546Sopenharmony_cifd2_emit_restore(struct fd_context *ctx, struct fd_ringbuffer *ring) 405bf215546Sopenharmony_ci{ 406bf215546Sopenharmony_ci if (is_a20x(ctx->screen)) { 407bf215546Sopenharmony_ci OUT_PKT0(ring, REG_A2XX_RB_BC_CONTROL, 1); 408bf215546Sopenharmony_ci OUT_RING(ring, A2XX_RB_BC_CONTROL_ACCUM_TIMEOUT_SELECT(3) | 409bf215546Sopenharmony_ci A2XX_RB_BC_CONTROL_DISABLE_LZ_NULL_ZCMD_DROP | 410bf215546Sopenharmony_ci A2XX_RB_BC_CONTROL_ENABLE_CRC_UPDATE | 411bf215546Sopenharmony_ci A2XX_RB_BC_CONTROL_ACCUM_DATA_FIFO_LIMIT(8) | 412bf215546Sopenharmony_ci A2XX_RB_BC_CONTROL_MEM_EXPORT_TIMEOUT_SELECT(3)); 413bf215546Sopenharmony_ci 414bf215546Sopenharmony_ci /* not sure why this is required */ 415bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 416bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_VIZ_QUERY)); 417bf215546Sopenharmony_ci OUT_RING(ring, A2XX_PA_SC_VIZ_QUERY_VIZ_QUERY_ID(16)); 418bf215546Sopenharmony_ci 419bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 420bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL)); 421bf215546Sopenharmony_ci OUT_RING(ring, 0x00000002); 422bf215546Sopenharmony_ci 423bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 424bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_VGT_OUT_DEALLOC_CNTL)); 425bf215546Sopenharmony_ci OUT_RING(ring, 0x00000002); 426bf215546Sopenharmony_ci } else { 427bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 428bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL)); 429bf215546Sopenharmony_ci OUT_RING(ring, 0x0000003b); 430bf215546Sopenharmony_ci } 431bf215546Sopenharmony_ci 432bf215546Sopenharmony_ci /* enable perfcntrs */ 433bf215546Sopenharmony_ci OUT_PKT0(ring, REG_A2XX_CP_PERFMON_CNTL, 1); 434bf215546Sopenharmony_ci OUT_RING(ring, COND(FD_DBG(PERFC), 1)); 435bf215546Sopenharmony_ci 436bf215546Sopenharmony_ci /* note: perfcntrs don't work without the PM_OVERRIDE bit */ 437bf215546Sopenharmony_ci OUT_PKT0(ring, REG_A2XX_RBBM_PM_OVERRIDE1, 2); 438bf215546Sopenharmony_ci OUT_RING(ring, 0xffffffff); 439bf215546Sopenharmony_ci OUT_RING(ring, 0x00000fff); 440bf215546Sopenharmony_ci 441bf215546Sopenharmony_ci OUT_PKT0(ring, REG_A2XX_TP0_CHICKEN, 1); 442bf215546Sopenharmony_ci OUT_RING(ring, 0x00000002); 443bf215546Sopenharmony_ci 444bf215546Sopenharmony_ci OUT_PKT3(ring, CP_INVALIDATE_STATE, 1); 445bf215546Sopenharmony_ci OUT_RING(ring, 0x00007fff); 446bf215546Sopenharmony_ci 447bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 448bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_SQ_VS_CONST)); 449bf215546Sopenharmony_ci OUT_RING(ring, A2XX_SQ_VS_CONST_BASE(VS_CONST_BASE) | 450bf215546Sopenharmony_ci A2XX_SQ_VS_CONST_SIZE(0x100)); 451bf215546Sopenharmony_ci 452bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 453bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_SQ_PS_CONST)); 454bf215546Sopenharmony_ci OUT_RING(ring, 455bf215546Sopenharmony_ci A2XX_SQ_PS_CONST_BASE(PS_CONST_BASE) | A2XX_SQ_PS_CONST_SIZE(0xe0)); 456bf215546Sopenharmony_ci 457bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 3); 458bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_VGT_MAX_VTX_INDX)); 459bf215546Sopenharmony_ci OUT_RING(ring, 0xffffffff); /* VGT_MAX_VTX_INDX */ 460bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); /* VGT_MIN_VTX_INDX */ 461bf215546Sopenharmony_ci 462bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 463bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_VGT_INDX_OFFSET)); 464bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 465bf215546Sopenharmony_ci 466bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 467bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_SQ_CONTEXT_MISC)); 468bf215546Sopenharmony_ci OUT_RING(ring, A2XX_SQ_CONTEXT_MISC_SC_SAMPLE_CNTL(CENTERS_ONLY)); 469bf215546Sopenharmony_ci 470bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 471bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_SQ_INTERPOLATOR_CNTL)); 472bf215546Sopenharmony_ci OUT_RING(ring, 0xffffffff); 473bf215546Sopenharmony_ci 474bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 475bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_AA_CONFIG)); 476bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 477bf215546Sopenharmony_ci 478bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 479bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_LINE_CNTL)); 480bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 481bf215546Sopenharmony_ci 482bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 483bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_WINDOW_OFFSET)); 484bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 485bf215546Sopenharmony_ci 486bf215546Sopenharmony_ci // XXX we change this dynamically for draw/clear.. vs gmem<->mem.. 487bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 488bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_MODECONTROL)); 489bf215546Sopenharmony_ci OUT_RING(ring, A2XX_RB_MODECONTROL_EDRAM_MODE(COLOR_DEPTH)); 490bf215546Sopenharmony_ci 491bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 492bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_SAMPLE_POS)); 493bf215546Sopenharmony_ci OUT_RING(ring, 0x88888888); 494bf215546Sopenharmony_ci 495bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 496bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_DEST_MASK)); 497bf215546Sopenharmony_ci OUT_RING(ring, 0xffffffff); 498bf215546Sopenharmony_ci 499bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 500bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_COPY_DEST_INFO)); 501bf215546Sopenharmony_ci OUT_RING(ring, A2XX_RB_COPY_DEST_INFO_FORMAT(COLORX_4_4_4_4) | 502bf215546Sopenharmony_ci A2XX_RB_COPY_DEST_INFO_WRITE_RED | 503bf215546Sopenharmony_ci A2XX_RB_COPY_DEST_INFO_WRITE_GREEN | 504bf215546Sopenharmony_ci A2XX_RB_COPY_DEST_INFO_WRITE_BLUE | 505bf215546Sopenharmony_ci A2XX_RB_COPY_DEST_INFO_WRITE_ALPHA); 506bf215546Sopenharmony_ci 507bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 3); 508bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_SQ_WRAPPING_0)); 509bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); /* SQ_WRAPPING_0 */ 510bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); /* SQ_WRAPPING_1 */ 511bf215546Sopenharmony_ci 512bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_DRAW_INIT_FLAGS, 1); 513bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 514bf215546Sopenharmony_ci 515bf215546Sopenharmony_ci OUT_PKT3(ring, CP_WAIT_REG_EQ, 4); 516bf215546Sopenharmony_ci OUT_RING(ring, 0x000005d0); 517bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 518bf215546Sopenharmony_ci OUT_RING(ring, 0x5f601000); 519bf215546Sopenharmony_ci OUT_RING(ring, 0x00000001); 520bf215546Sopenharmony_ci 521bf215546Sopenharmony_ci OUT_PKT0(ring, REG_A2XX_SQ_INST_STORE_MANAGMENT, 1); 522bf215546Sopenharmony_ci OUT_RING(ring, 0x00000180); 523bf215546Sopenharmony_ci 524bf215546Sopenharmony_ci OUT_PKT3(ring, CP_INVALIDATE_STATE, 1); 525bf215546Sopenharmony_ci OUT_RING(ring, 0x00000300); 526bf215546Sopenharmony_ci 527bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_SHADER_BASES, 1); 528bf215546Sopenharmony_ci OUT_RING(ring, 0x80000180); 529bf215546Sopenharmony_ci 530bf215546Sopenharmony_ci /* not sure what this form of CP_SET_CONSTANT is.. */ 531bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 13); 532bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 533bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 534bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 535bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 536bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 537bf215546Sopenharmony_ci OUT_RING(ring, 0x469c4000); 538bf215546Sopenharmony_ci OUT_RING(ring, 0x3f800000); 539bf215546Sopenharmony_ci OUT_RING(ring, 0x3f000000); 540bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); 541bf215546Sopenharmony_ci OUT_RING(ring, 0x40000000); 542bf215546Sopenharmony_ci OUT_RING(ring, 0x3f400000); 543bf215546Sopenharmony_ci OUT_RING(ring, 0x3ec00000); 544bf215546Sopenharmony_ci OUT_RING(ring, 0x3e800000); 545bf215546Sopenharmony_ci 546bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 547bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_MASK)); 548bf215546Sopenharmony_ci OUT_RING(ring, 549bf215546Sopenharmony_ci A2XX_RB_COLOR_MASK_WRITE_RED | A2XX_RB_COLOR_MASK_WRITE_GREEN | 550bf215546Sopenharmony_ci A2XX_RB_COLOR_MASK_WRITE_BLUE | A2XX_RB_COLOR_MASK_WRITE_ALPHA); 551bf215546Sopenharmony_ci 552bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 5); 553bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_RB_BLEND_RED)); 554bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); /* RB_BLEND_RED */ 555bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); /* RB_BLEND_GREEN */ 556bf215546Sopenharmony_ci OUT_RING(ring, 0x00000000); /* RB_BLEND_BLUE */ 557bf215546Sopenharmony_ci OUT_RING(ring, 0x000000ff); /* RB_BLEND_ALPHA */ 558bf215546Sopenharmony_ci 559bf215546Sopenharmony_ci OUT_PKT3(ring, CP_SET_CONSTANT, 2); 560bf215546Sopenharmony_ci OUT_RING(ring, CP_REG(REG_A2XX_PA_CL_VTE_CNTL)); 561bf215546Sopenharmony_ci OUT_RING(ring, A2XX_PA_CL_VTE_CNTL_VTX_W0_FMT | 562bf215546Sopenharmony_ci A2XX_PA_CL_VTE_CNTL_VPORT_X_SCALE_ENA | 563bf215546Sopenharmony_ci A2XX_PA_CL_VTE_CNTL_VPORT_X_OFFSET_ENA | 564bf215546Sopenharmony_ci A2XX_PA_CL_VTE_CNTL_VPORT_Y_SCALE_ENA | 565bf215546Sopenharmony_ci A2XX_PA_CL_VTE_CNTL_VPORT_Y_OFFSET_ENA | 566bf215546Sopenharmony_ci A2XX_PA_CL_VTE_CNTL_VPORT_Z_SCALE_ENA | 567bf215546Sopenharmony_ci A2XX_PA_CL_VTE_CNTL_VPORT_Z_OFFSET_ENA); 568bf215546Sopenharmony_ci} 569bf215546Sopenharmony_ci 570bf215546Sopenharmony_civoid 571bf215546Sopenharmony_cifd2_emit_init_screen(struct pipe_screen *pscreen) 572bf215546Sopenharmony_ci{ 573bf215546Sopenharmony_ci struct fd_screen *screen = fd_screen(pscreen); 574bf215546Sopenharmony_ci screen->emit_ib = fd2_emit_ib; 575bf215546Sopenharmony_ci} 576bf215546Sopenharmony_ci 577bf215546Sopenharmony_civoid 578bf215546Sopenharmony_cifd2_emit_init(struct pipe_context *pctx) 579bf215546Sopenharmony_ci{ 580bf215546Sopenharmony_ci} 581