Path: blob/21.2-virgl/src/gallium/drivers/v3d/v3dx_job.c
4570 views
/*1* Copyright © 2014-2017 Broadcom2*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, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223/** @file v3dx_job.c24*25* V3D version-specific functions for submitting V3D render jobs to the26* kernel.27*/2829#include "v3d_context.h"30#include "broadcom/cle/v3dx_pack.h"3132void v3dX(bcl_epilogue)(struct v3d_context *v3d, struct v3d_job *job)33{34v3d_cl_ensure_space_with_branch(&job->bcl,35cl_packet_length(PRIMITIVE_COUNTS_FEEDBACK) +36#if V3D_VERSION >= 4137cl_packet_length(TRANSFORM_FEEDBACK_SPECS) +38#endif39cl_packet_length(FLUSH));4041if (job->tf_enabled) {42/* Write primitive counts to memory. */43assert(v3d->prim_counts);44struct v3d_resource *rsc =45v3d_resource(v3d->prim_counts);46cl_emit(&job->bcl, PRIMITIVE_COUNTS_FEEDBACK, counter) {47counter.address =48cl_address(rsc->bo,49v3d->prim_counts_offset);50counter.read_write_64byte = false;51counter.op = 0;52}53}5455/* Disable TF at the end of the CL, so that the TF block56* cleans up and finishes before it gets reset by the next57* frame's tile binning mode cfg packet. (SWVC5-718).58*/59#if V3D_VERSION >= 4160if (job->tf_enabled) {61cl_emit(&job->bcl, TRANSFORM_FEEDBACK_SPECS, tfe) {62tfe.enable = false;63};64}65#endif /* V3D_VERSION >= 41 */6667/* We just FLUSH here to tell the HW to cap the bin CLs with a68* return. Any remaining state changes won't be flushed to69* the bins first -- you would need FLUSH_ALL for that, but70* the HW for hasn't been validated71*/72cl_emit(&job->bcl, FLUSH, flush);73}747576