Path: blob/21.2-virgl/src/gallium/drivers/freedreno/a2xx/fd2_emit.c
4574 views
/*1* Copyright (C) 2012-2013 Rob Clark <[email protected]>2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20* SOFTWARE.21*22* Authors:23* Rob Clark <[email protected]>24*/2526#include "pipe/p_state.h"27#include "util/u_helpers.h"28#include "util/u_memory.h"29#include "util/u_string.h"3031#include "freedreno_resource.h"3233#include "fd2_blend.h"34#include "fd2_context.h"35#include "fd2_emit.h"36#include "fd2_program.h"37#include "fd2_rasterizer.h"38#include "fd2_texture.h"39#include "fd2_util.h"40#include "fd2_zsa.h"4142/* NOTE: just define the position for const regs statically.. the blob43* driver doesn't seem to change these dynamically, and I can't really44* think of a good reason to so..45*/46#define VS_CONST_BASE 0x2047#define PS_CONST_BASE 0x1204849static void50emit_constants(struct fd_ringbuffer *ring, uint32_t base,51struct fd_constbuf_stateobj *constbuf,52struct fd2_shader_stateobj *shader)53{54uint32_t enabled_mask = constbuf->enabled_mask;55uint32_t start_base = base;56unsigned i;5758/* emit user constants: */59while (enabled_mask) {60unsigned index = ffs(enabled_mask) - 1;61struct pipe_constant_buffer *cb = &constbuf->cb[index];62unsigned size = align(cb->buffer_size, 4) / 4; /* size in dwords */6364// I expect that size should be a multiple of vec4's:65assert(size == align(size, 4));6667/* hmm, sometimes we still seem to end up with consts bound,68* even if shader isn't using them, which ends up overwriting69* const reg's used for immediates.. this is a hack to work70* around that:71*/72if (shader && ((base - start_base) >= (shader->first_immediate * 4)))73break;7475const uint32_t *dwords;7677if (cb->user_buffer) {78dwords = cb->user_buffer;79} else {80struct fd_resource *rsc = fd_resource(cb->buffer);81dwords = fd_bo_map(rsc->bo);82}8384dwords = (uint32_t *)(((uint8_t *)dwords) + cb->buffer_offset);8586OUT_PKT3(ring, CP_SET_CONSTANT, size + 1);87OUT_RING(ring, base);88for (i = 0; i < size; i++)89OUT_RING(ring, *(dwords++));9091base += size;92enabled_mask &= ~(1 << index);93}9495/* emit shader immediates: */96if (shader) {97for (i = 0; i < shader->num_immediates; i++) {98OUT_PKT3(ring, CP_SET_CONSTANT, 5);99OUT_RING(ring, start_base + (4 * (shader->first_immediate + i)));100OUT_RING(ring, shader->immediates[i].val[0]);101OUT_RING(ring, shader->immediates[i].val[1]);102OUT_RING(ring, shader->immediates[i].val[2]);103OUT_RING(ring, shader->immediates[i].val[3]);104base += 4;105}106}107}108109typedef uint32_t texmask;110111static texmask112emit_texture(struct fd_ringbuffer *ring, struct fd_context *ctx,113struct fd_texture_stateobj *tex, unsigned samp_id, texmask emitted)114{115unsigned const_idx = fd2_get_const_idx(ctx, tex, samp_id);116static const struct fd2_sampler_stateobj dummy_sampler = {};117static const struct fd2_pipe_sampler_view dummy_view = {};118const struct fd2_sampler_stateobj *sampler;119const struct fd2_pipe_sampler_view *view;120struct fd_resource *rsc;121122if (emitted & (1 << const_idx))123return 0;124125sampler = tex->samplers[samp_id]126? fd2_sampler_stateobj(tex->samplers[samp_id])127: &dummy_sampler;128view = tex->textures[samp_id] ? fd2_pipe_sampler_view(tex->textures[samp_id])129: &dummy_view;130131rsc = view->base.texture ? fd_resource(view->base.texture) : NULL;132133OUT_PKT3(ring, CP_SET_CONSTANT, 7);134OUT_RING(ring, 0x00010000 + (0x6 * const_idx));135136OUT_RING(ring, sampler->tex0 | view->tex0);137if (rsc)138OUT_RELOC(ring, rsc->bo, fd_resource_offset(rsc, 0, 0), view->tex1, 0);139else140OUT_RING(ring, 0);141142OUT_RING(ring, view->tex2);143OUT_RING(ring, sampler->tex3 | view->tex3);144OUT_RING(ring, sampler->tex4 | view->tex4);145146if (rsc && rsc->b.b.last_level)147OUT_RELOC(ring, rsc->bo, fd_resource_offset(rsc, 1, 0), view->tex5, 0);148else149OUT_RING(ring, view->tex5);150151return (1 << const_idx);152}153154static void155emit_textures(struct fd_ringbuffer *ring, struct fd_context *ctx)156{157struct fd_texture_stateobj *fragtex = &ctx->tex[PIPE_SHADER_FRAGMENT];158struct fd_texture_stateobj *verttex = &ctx->tex[PIPE_SHADER_VERTEX];159texmask emitted = 0;160unsigned i;161162for (i = 0; i < verttex->num_samplers; i++)163if (verttex->samplers[i])164emitted |= emit_texture(ring, ctx, verttex, i, emitted);165166for (i = 0; i < fragtex->num_samplers; i++)167if (fragtex->samplers[i])168emitted |= emit_texture(ring, ctx, fragtex, i, emitted);169}170171void172fd2_emit_vertex_bufs(struct fd_ringbuffer *ring, uint32_t val,173struct fd2_vertex_buf *vbufs, uint32_t n)174{175unsigned i;176177OUT_PKT3(ring, CP_SET_CONSTANT, 1 + (2 * n));178OUT_RING(ring, (0x1 << 16) | (val & 0xffff));179for (i = 0; i < n; i++) {180struct fd_resource *rsc = fd_resource(vbufs[i].prsc);181OUT_RELOC(ring, rsc->bo, vbufs[i].offset, 3, 0);182OUT_RING(ring, vbufs[i].size);183}184}185186void187fd2_emit_state_binning(struct fd_context *ctx,188const enum fd_dirty_3d_state dirty)189{190struct fd2_blend_stateobj *blend = fd2_blend_stateobj(ctx->blend);191struct fd_ringbuffer *ring = ctx->batch->binning;192193/* subset of fd2_emit_state needed for hw binning on a20x */194195if (dirty & (FD_DIRTY_PROG | FD_DIRTY_VTXSTATE))196fd2_program_emit(ctx, ring, &ctx->prog);197198if (dirty & (FD_DIRTY_PROG | FD_DIRTY_CONST)) {199emit_constants(ring, VS_CONST_BASE * 4,200&ctx->constbuf[PIPE_SHADER_VERTEX],201(dirty & FD_DIRTY_PROG) ? ctx->prog.vs : NULL);202}203204if (dirty & FD_DIRTY_VIEWPORT) {205OUT_PKT3(ring, CP_SET_CONSTANT, 9);206OUT_RING(ring, 0x00000184);207OUT_RING(ring, fui(ctx->viewport.translate[0]));208OUT_RING(ring, fui(ctx->viewport.translate[1]));209OUT_RING(ring, fui(ctx->viewport.translate[2]));210OUT_RING(ring, fui(0.0f));211OUT_RING(ring, fui(ctx->viewport.scale[0]));212OUT_RING(ring, fui(ctx->viewport.scale[1]));213OUT_RING(ring, fui(ctx->viewport.scale[2]));214OUT_RING(ring, fui(0.0f));215}216217/* not sure why this is needed */218if (dirty & (FD_DIRTY_BLEND | FD_DIRTY_FRAMEBUFFER)) {219OUT_PKT3(ring, CP_SET_CONSTANT, 2);220OUT_RING(ring, CP_REG(REG_A2XX_RB_BLEND_CONTROL));221OUT_RING(ring, blend->rb_blendcontrol);222223OUT_PKT3(ring, CP_SET_CONSTANT, 2);224OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_MASK));225OUT_RING(ring, blend->rb_colormask);226}227228OUT_PKT3(ring, CP_SET_CONSTANT, 2);229OUT_RING(ring, CP_REG(REG_A2XX_PA_SU_SC_MODE_CNTL));230OUT_RING(ring, A2XX_PA_SU_SC_MODE_CNTL_FACE_KILL_ENABLE);231}232233void234fd2_emit_state(struct fd_context *ctx, const enum fd_dirty_3d_state dirty)235{236struct fd2_blend_stateobj *blend = fd2_blend_stateobj(ctx->blend);237struct fd2_zsa_stateobj *zsa = fd2_zsa_stateobj(ctx->zsa);238struct fd2_shader_stateobj *fs = ctx->prog.fs;239struct fd_ringbuffer *ring = ctx->batch->draw;240241/* NOTE: we probably want to eventually refactor this so each state242* object handles emitting it's own state.. although the mapping of243* state to registers is not always orthogonal, sometimes a single244* register contains bitfields coming from multiple state objects,245* so not sure the best way to deal with that yet.246*/247248if (dirty & FD_DIRTY_SAMPLE_MASK) {249OUT_PKT3(ring, CP_SET_CONSTANT, 2);250OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_AA_MASK));251OUT_RING(ring, ctx->sample_mask);252}253254if (dirty & (FD_DIRTY_ZSA | FD_DIRTY_STENCIL_REF | FD_DIRTY_PROG)) {255struct pipe_stencil_ref *sr = &ctx->stencil_ref;256uint32_t val = zsa->rb_depthcontrol;257258if (fs->has_kill)259val &= ~A2XX_RB_DEPTHCONTROL_EARLY_Z_ENABLE;260261OUT_PKT3(ring, CP_SET_CONSTANT, 2);262OUT_RING(ring, CP_REG(REG_A2XX_RB_DEPTHCONTROL));263OUT_RING(ring, val);264265OUT_PKT3(ring, CP_SET_CONSTANT, 4);266OUT_RING(ring, CP_REG(REG_A2XX_RB_STENCILREFMASK_BF));267OUT_RING(ring, zsa->rb_stencilrefmask_bf |268A2XX_RB_STENCILREFMASK_STENCILREF(sr->ref_value[1]));269OUT_RING(ring, zsa->rb_stencilrefmask |270A2XX_RB_STENCILREFMASK_STENCILREF(sr->ref_value[0]));271OUT_RING(ring, zsa->rb_alpha_ref);272}273274if (ctx->rasterizer && dirty & FD_DIRTY_RASTERIZER) {275struct fd2_rasterizer_stateobj *rasterizer =276fd2_rasterizer_stateobj(ctx->rasterizer);277OUT_PKT3(ring, CP_SET_CONSTANT, 3);278OUT_RING(ring, CP_REG(REG_A2XX_PA_CL_CLIP_CNTL));279OUT_RING(ring, rasterizer->pa_cl_clip_cntl);280OUT_RING(ring, rasterizer->pa_su_sc_mode_cntl |281A2XX_PA_SU_SC_MODE_CNTL_VTX_WINDOW_OFFSET_ENABLE);282283OUT_PKT3(ring, CP_SET_CONSTANT, 5);284OUT_RING(ring, CP_REG(REG_A2XX_PA_SU_POINT_SIZE));285OUT_RING(ring, rasterizer->pa_su_point_size);286OUT_RING(ring, rasterizer->pa_su_point_minmax);287OUT_RING(ring, rasterizer->pa_su_line_cntl);288OUT_RING(ring, rasterizer->pa_sc_line_stipple);289290OUT_PKT3(ring, CP_SET_CONSTANT, 6);291OUT_RING(ring, CP_REG(REG_A2XX_PA_SU_VTX_CNTL));292OUT_RING(ring, rasterizer->pa_su_vtx_cntl);293OUT_RING(ring, fui(1.0)); /* PA_CL_GB_VERT_CLIP_ADJ */294OUT_RING(ring, fui(1.0)); /* PA_CL_GB_VERT_DISC_ADJ */295OUT_RING(ring, fui(1.0)); /* PA_CL_GB_HORZ_CLIP_ADJ */296OUT_RING(ring, fui(1.0)); /* PA_CL_GB_HORZ_DISC_ADJ */297298if (rasterizer->base.offset_tri) {299/* TODO: why multiply scale by 2 ? without it deqp test fails300* deqp/piglit tests aren't very precise301*/302OUT_PKT3(ring, CP_SET_CONSTANT, 5);303OUT_RING(ring, CP_REG(REG_A2XX_PA_SU_POLY_OFFSET_FRONT_SCALE));304OUT_RING(ring,305fui(rasterizer->base.offset_scale * 2.0f)); /* FRONT_SCALE */306OUT_RING(ring, fui(rasterizer->base.offset_units)); /* FRONT_OFFSET */307OUT_RING(ring,308fui(rasterizer->base.offset_scale * 2.0f)); /* BACK_SCALE */309OUT_RING(ring, fui(rasterizer->base.offset_units)); /* BACK_OFFSET */310}311}312313/* NOTE: scissor enabled bit is part of rasterizer state: */314if (dirty & (FD_DIRTY_SCISSOR | FD_DIRTY_RASTERIZER)) {315struct pipe_scissor_state *scissor = fd_context_get_scissor(ctx);316317OUT_PKT3(ring, CP_SET_CONSTANT, 3);318OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_WINDOW_SCISSOR_TL));319OUT_RING(ring, xy2d(scissor->minx, /* PA_SC_WINDOW_SCISSOR_TL */320scissor->miny));321OUT_RING(ring, xy2d(scissor->maxx, /* PA_SC_WINDOW_SCISSOR_BR */322scissor->maxy));323324ctx->batch->max_scissor.minx =325MIN2(ctx->batch->max_scissor.minx, scissor->minx);326ctx->batch->max_scissor.miny =327MIN2(ctx->batch->max_scissor.miny, scissor->miny);328ctx->batch->max_scissor.maxx =329MAX2(ctx->batch->max_scissor.maxx, scissor->maxx);330ctx->batch->max_scissor.maxy =331MAX2(ctx->batch->max_scissor.maxy, scissor->maxy);332}333334if (dirty & FD_DIRTY_VIEWPORT) {335OUT_PKT3(ring, CP_SET_CONSTANT, 7);336OUT_RING(ring, CP_REG(REG_A2XX_PA_CL_VPORT_XSCALE));337OUT_RING(ring, fui(ctx->viewport.scale[0])); /* PA_CL_VPORT_XSCALE */338OUT_RING(ring, fui(ctx->viewport.translate[0])); /* PA_CL_VPORT_XOFFSET */339OUT_RING(ring, fui(ctx->viewport.scale[1])); /* PA_CL_VPORT_YSCALE */340OUT_RING(ring, fui(ctx->viewport.translate[1])); /* PA_CL_VPORT_YOFFSET */341OUT_RING(ring, fui(ctx->viewport.scale[2])); /* PA_CL_VPORT_ZSCALE */342OUT_RING(ring, fui(ctx->viewport.translate[2])); /* PA_CL_VPORT_ZOFFSET */343344/* set viewport in C65/C66, for a20x hw binning and fragcoord.z */345OUT_PKT3(ring, CP_SET_CONSTANT, 9);346OUT_RING(ring, 0x00000184);347348OUT_RING(ring, fui(ctx->viewport.translate[0]));349OUT_RING(ring, fui(ctx->viewport.translate[1]));350OUT_RING(ring, fui(ctx->viewport.translate[2]));351OUT_RING(ring, fui(0.0f));352353OUT_RING(ring, fui(ctx->viewport.scale[0]));354OUT_RING(ring, fui(ctx->viewport.scale[1]));355OUT_RING(ring, fui(ctx->viewport.scale[2]));356OUT_RING(ring, fui(0.0f));357}358359if (dirty & (FD_DIRTY_PROG | FD_DIRTY_VTXSTATE | FD_DIRTY_TEXSTATE))360fd2_program_emit(ctx, ring, &ctx->prog);361362if (dirty & (FD_DIRTY_PROG | FD_DIRTY_CONST)) {363emit_constants(ring, VS_CONST_BASE * 4,364&ctx->constbuf[PIPE_SHADER_VERTEX],365(dirty & FD_DIRTY_PROG) ? ctx->prog.vs : NULL);366emit_constants(ring, PS_CONST_BASE * 4,367&ctx->constbuf[PIPE_SHADER_FRAGMENT],368(dirty & FD_DIRTY_PROG) ? ctx->prog.fs : NULL);369}370371if (dirty & (FD_DIRTY_BLEND | FD_DIRTY_ZSA)) {372OUT_PKT3(ring, CP_SET_CONSTANT, 2);373OUT_RING(ring, CP_REG(REG_A2XX_RB_COLORCONTROL));374OUT_RING(ring, zsa->rb_colorcontrol | blend->rb_colorcontrol);375}376377if (dirty & (FD_DIRTY_BLEND | FD_DIRTY_FRAMEBUFFER)) {378OUT_PKT3(ring, CP_SET_CONSTANT, 2);379OUT_RING(ring, CP_REG(REG_A2XX_RB_BLEND_CONTROL));380OUT_RING(ring, blend->rb_blendcontrol);381382OUT_PKT3(ring, CP_SET_CONSTANT, 2);383OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_MASK));384OUT_RING(ring, blend->rb_colormask);385}386387if (dirty & FD_DIRTY_BLEND_COLOR) {388OUT_PKT3(ring, CP_SET_CONSTANT, 5);389OUT_RING(ring, CP_REG(REG_A2XX_RB_BLEND_RED));390OUT_RING(ring, float_to_ubyte(ctx->blend_color.color[0]));391OUT_RING(ring, float_to_ubyte(ctx->blend_color.color[1]));392OUT_RING(ring, float_to_ubyte(ctx->blend_color.color[2]));393OUT_RING(ring, float_to_ubyte(ctx->blend_color.color[3]));394}395396if (dirty & (FD_DIRTY_TEX | FD_DIRTY_PROG))397emit_textures(ring, ctx);398}399400/* emit per-context initialization:401*/402void403fd2_emit_restore(struct fd_context *ctx, struct fd_ringbuffer *ring)404{405if (is_a20x(ctx->screen)) {406OUT_PKT0(ring, REG_A2XX_RB_BC_CONTROL, 1);407OUT_RING(ring, A2XX_RB_BC_CONTROL_ACCUM_TIMEOUT_SELECT(3) |408A2XX_RB_BC_CONTROL_DISABLE_LZ_NULL_ZCMD_DROP |409A2XX_RB_BC_CONTROL_ENABLE_CRC_UPDATE |410A2XX_RB_BC_CONTROL_ACCUM_DATA_FIFO_LIMIT(8) |411A2XX_RB_BC_CONTROL_MEM_EXPORT_TIMEOUT_SELECT(3));412413/* not sure why this is required */414OUT_PKT3(ring, CP_SET_CONSTANT, 2);415OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_VIZ_QUERY));416OUT_RING(ring, A2XX_PA_SC_VIZ_QUERY_VIZ_QUERY_ID(16));417418OUT_PKT3(ring, CP_SET_CONSTANT, 2);419OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));420OUT_RING(ring, 0x00000002);421422OUT_PKT3(ring, CP_SET_CONSTANT, 2);423OUT_RING(ring, CP_REG(REG_A2XX_VGT_OUT_DEALLOC_CNTL));424OUT_RING(ring, 0x00000002);425} else {426OUT_PKT3(ring, CP_SET_CONSTANT, 2);427OUT_RING(ring, CP_REG(REG_A2XX_VGT_VERTEX_REUSE_BLOCK_CNTL));428OUT_RING(ring, 0x0000003b);429}430431/* enable perfcntrs */432OUT_PKT0(ring, REG_A2XX_CP_PERFMON_CNTL, 1);433OUT_RING(ring, COND(FD_DBG(PERFC), 1));434435/* note: perfcntrs don't work without the PM_OVERRIDE bit */436OUT_PKT0(ring, REG_A2XX_RBBM_PM_OVERRIDE1, 2);437OUT_RING(ring, 0xffffffff);438OUT_RING(ring, 0x00000fff);439440OUT_PKT0(ring, REG_A2XX_TP0_CHICKEN, 1);441OUT_RING(ring, 0x00000002);442443OUT_PKT3(ring, CP_INVALIDATE_STATE, 1);444OUT_RING(ring, 0x00007fff);445446OUT_PKT3(ring, CP_SET_CONSTANT, 2);447OUT_RING(ring, CP_REG(REG_A2XX_SQ_VS_CONST));448OUT_RING(ring, A2XX_SQ_VS_CONST_BASE(VS_CONST_BASE) |449A2XX_SQ_VS_CONST_SIZE(0x100));450451OUT_PKT3(ring, CP_SET_CONSTANT, 2);452OUT_RING(ring, CP_REG(REG_A2XX_SQ_PS_CONST));453OUT_RING(ring,454A2XX_SQ_PS_CONST_BASE(PS_CONST_BASE) | A2XX_SQ_PS_CONST_SIZE(0xe0));455456OUT_PKT3(ring, CP_SET_CONSTANT, 3);457OUT_RING(ring, CP_REG(REG_A2XX_VGT_MAX_VTX_INDX));458OUT_RING(ring, 0xffffffff); /* VGT_MAX_VTX_INDX */459OUT_RING(ring, 0x00000000); /* VGT_MIN_VTX_INDX */460461OUT_PKT3(ring, CP_SET_CONSTANT, 2);462OUT_RING(ring, CP_REG(REG_A2XX_VGT_INDX_OFFSET));463OUT_RING(ring, 0x00000000);464465OUT_PKT3(ring, CP_SET_CONSTANT, 2);466OUT_RING(ring, CP_REG(REG_A2XX_SQ_CONTEXT_MISC));467OUT_RING(ring, A2XX_SQ_CONTEXT_MISC_SC_SAMPLE_CNTL(CENTERS_ONLY));468469OUT_PKT3(ring, CP_SET_CONSTANT, 2);470OUT_RING(ring, CP_REG(REG_A2XX_SQ_INTERPOLATOR_CNTL));471OUT_RING(ring, 0xffffffff);472473OUT_PKT3(ring, CP_SET_CONSTANT, 2);474OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_AA_CONFIG));475OUT_RING(ring, 0x00000000);476477OUT_PKT3(ring, CP_SET_CONSTANT, 2);478OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_LINE_CNTL));479OUT_RING(ring, 0x00000000);480481OUT_PKT3(ring, CP_SET_CONSTANT, 2);482OUT_RING(ring, CP_REG(REG_A2XX_PA_SC_WINDOW_OFFSET));483OUT_RING(ring, 0x00000000);484485// XXX we change this dynamically for draw/clear.. vs gmem<->mem..486OUT_PKT3(ring, CP_SET_CONSTANT, 2);487OUT_RING(ring, CP_REG(REG_A2XX_RB_MODECONTROL));488OUT_RING(ring, A2XX_RB_MODECONTROL_EDRAM_MODE(COLOR_DEPTH));489490OUT_PKT3(ring, CP_SET_CONSTANT, 2);491OUT_RING(ring, CP_REG(REG_A2XX_RB_SAMPLE_POS));492OUT_RING(ring, 0x88888888);493494OUT_PKT3(ring, CP_SET_CONSTANT, 2);495OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_DEST_MASK));496OUT_RING(ring, 0xffffffff);497498OUT_PKT3(ring, CP_SET_CONSTANT, 2);499OUT_RING(ring, CP_REG(REG_A2XX_RB_COPY_DEST_INFO));500OUT_RING(ring, A2XX_RB_COPY_DEST_INFO_FORMAT(COLORX_4_4_4_4) |501A2XX_RB_COPY_DEST_INFO_WRITE_RED |502A2XX_RB_COPY_DEST_INFO_WRITE_GREEN |503A2XX_RB_COPY_DEST_INFO_WRITE_BLUE |504A2XX_RB_COPY_DEST_INFO_WRITE_ALPHA);505506OUT_PKT3(ring, CP_SET_CONSTANT, 3);507OUT_RING(ring, CP_REG(REG_A2XX_SQ_WRAPPING_0));508OUT_RING(ring, 0x00000000); /* SQ_WRAPPING_0 */509OUT_RING(ring, 0x00000000); /* SQ_WRAPPING_1 */510511OUT_PKT3(ring, CP_SET_DRAW_INIT_FLAGS, 1);512OUT_RING(ring, 0x00000000);513514OUT_PKT3(ring, CP_WAIT_REG_EQ, 4);515OUT_RING(ring, 0x000005d0);516OUT_RING(ring, 0x00000000);517OUT_RING(ring, 0x5f601000);518OUT_RING(ring, 0x00000001);519520OUT_PKT0(ring, REG_A2XX_SQ_INST_STORE_MANAGMENT, 1);521OUT_RING(ring, 0x00000180);522523OUT_PKT3(ring, CP_INVALIDATE_STATE, 1);524OUT_RING(ring, 0x00000300);525526OUT_PKT3(ring, CP_SET_SHADER_BASES, 1);527OUT_RING(ring, 0x80000180);528529/* not sure what this form of CP_SET_CONSTANT is.. */530OUT_PKT3(ring, CP_SET_CONSTANT, 13);531OUT_RING(ring, 0x00000000);532OUT_RING(ring, 0x00000000);533OUT_RING(ring, 0x00000000);534OUT_RING(ring, 0x00000000);535OUT_RING(ring, 0x00000000);536OUT_RING(ring, 0x469c4000);537OUT_RING(ring, 0x3f800000);538OUT_RING(ring, 0x3f000000);539OUT_RING(ring, 0x00000000);540OUT_RING(ring, 0x40000000);541OUT_RING(ring, 0x3f400000);542OUT_RING(ring, 0x3ec00000);543OUT_RING(ring, 0x3e800000);544545OUT_PKT3(ring, CP_SET_CONSTANT, 2);546OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_MASK));547OUT_RING(ring,548A2XX_RB_COLOR_MASK_WRITE_RED | A2XX_RB_COLOR_MASK_WRITE_GREEN |549A2XX_RB_COLOR_MASK_WRITE_BLUE | A2XX_RB_COLOR_MASK_WRITE_ALPHA);550551OUT_PKT3(ring, CP_SET_CONSTANT, 5);552OUT_RING(ring, CP_REG(REG_A2XX_RB_BLEND_RED));553OUT_RING(ring, 0x00000000); /* RB_BLEND_RED */554OUT_RING(ring, 0x00000000); /* RB_BLEND_GREEN */555OUT_RING(ring, 0x00000000); /* RB_BLEND_BLUE */556OUT_RING(ring, 0x000000ff); /* RB_BLEND_ALPHA */557558OUT_PKT3(ring, CP_SET_CONSTANT, 2);559OUT_RING(ring, CP_REG(REG_A2XX_PA_CL_VTE_CNTL));560OUT_RING(ring, A2XX_PA_CL_VTE_CNTL_VTX_W0_FMT |561A2XX_PA_CL_VTE_CNTL_VPORT_X_SCALE_ENA |562A2XX_PA_CL_VTE_CNTL_VPORT_X_OFFSET_ENA |563A2XX_PA_CL_VTE_CNTL_VPORT_Y_SCALE_ENA |564A2XX_PA_CL_VTE_CNTL_VPORT_Y_OFFSET_ENA |565A2XX_PA_CL_VTE_CNTL_VPORT_Z_SCALE_ENA |566A2XX_PA_CL_VTE_CNTL_VPORT_Z_OFFSET_ENA);567}568569void570fd2_emit_init_screen(struct pipe_screen *pscreen)571{572struct fd_screen *screen = fd_screen(pscreen);573screen->emit_ib = fd2_emit_ib;574}575576void577fd2_emit_init(struct pipe_context *pctx)578{579}580581582