pvr: Add support for generating per-job EOT program

Signed-off-by: Simon Perretta <simon.perretta@imgtec.com>
Acked-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21474>
This commit is contained in:
Simon Perretta 2023-02-14 00:45:01 +00:00 committed by Marge Bot
parent 88e42e18d9
commit 4ddcda8369
3 changed files with 101 additions and 0 deletions

View file

@ -64,6 +64,8 @@ pvr_files = files(
'pvr_spm.c',
'pvr_tex_state.c',
'pvr_wsi.c',
'usc/pvr_uscgen.c',
)
pvr_includes = [

View file

@ -0,0 +1,63 @@
/*
* Copyright © 2023 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "pvr_job_transfer.h"
#include "pvr_uscgen.h"
#include "rogue/rogue.h"
#include "rogue/rogue_builder.h"
#include "util/u_dynarray.h"
#include <stdbool.h>
void pvr_uscgen_per_job_eot(uint32_t state0,
uint32_t state1,
unsigned *temps_used,
struct util_dynarray *binary)
{
rogue_builder b;
rogue_shader *shader = rogue_shader_create(NULL, MESA_SHADER_NONE);
rogue_set_shader_name(shader, "per-job EOT");
rogue_builder_init(&b, shader);
rogue_push_block(&b);
rogue_reg *state_word_0 = rogue_ssa_reg(shader, 0);
rogue_reg *state_word_1 = rogue_ssa_reg(shader, 1);
rogue_MOV(&b, rogue_ref_reg(state_word_0), rogue_ref_imm(state0));
rogue_MOV(&b, rogue_ref_reg(state_word_1), rogue_ref_imm(state1));
rogue_backend_instr *emitpix = rogue_EMITPIX(&b,
rogue_ref_reg(state_word_0),
rogue_ref_reg(state_word_1));
rogue_set_backend_op_mod(emitpix, ROGUE_BACKEND_OP_MOD_FREEP);
rogue_END(&b);
rogue_shader_passes(shader);
rogue_encode_shader(NULL, shader, binary);
*temps_used = rogue_count_used_regs(shader, ROGUE_REG_CLASS_TEMP);
ralloc_free(shader);
}

View file

@ -0,0 +1,36 @@
/*
* Copyright © 2023 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef PVR_USCGEN_H
#define PVR_USCGEN_H
#include "util/u_dynarray.h"
#include <stdint.h>
void pvr_uscgen_per_job_eot(uint32_t state0,
uint32_t state1,
unsigned *temps_used,
struct util_dynarray *binary);
#endif /* PVR_USCGEN_H */