diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-08-26 05:30:39 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-08-26 05:30:39 +0000 |
commit | 27c93456b58343162f7c4ad20ca6bea0c9a91646 (patch) | |
tree | 945c20b63e0b9975ee40f114c5312f8d8f1a2d0b /lib/mesa/src/gallium/drivers/nouveau | |
parent | 875b83a3ee95e248388fbf72271acc80f6f97987 (diff) |
Import Mesa 20.1.6
Diffstat (limited to 'lib/mesa/src/gallium/drivers/nouveau')
26 files changed, 158 insertions, 419 deletions
diff --git a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_bb.cpp b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_bb.cpp index 9f0e07333..76fee8c79 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_bb.cpp +++ b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_bb.cpp @@ -536,9 +536,6 @@ Function::printCFGraph(const char *filePath) case Graph::Edge::BACK: fprintf(out, "\t%i -> %i;\n", idA, idB); break; - case Graph::Edge::DUMMY: - fprintf(out, "\t%i -> %i [style=dotted];\n", idA, idB); - break; default: assert(0); break; diff --git a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp index 950923a0d..66c0de19d 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp @@ -30,6 +30,7 @@ #include "codegen/nv50_ir_from_common.h" #include "codegen/nv50_ir_lowering_helper.h" #include "codegen/nv50_ir_util.h" +#include "tgsi/tgsi_from_mesa.h" #if __cplusplus >= 201103L #include <unordered_map> @@ -81,8 +82,6 @@ private: LValues& convert(nir_register *); LValues& convert(nir_ssa_def *); - ImgFormat convertGLImgFormat(GLuint); - Value* getSrc(nir_alu_src *, uint8_t component = 0); Value* getSrc(nir_register *, uint8_t); Value* getSrc(nir_src *, uint8_t, bool indirect = false); @@ -451,9 +450,6 @@ Converter::getOperation(nir_op op) return OP_SIN; case nir_op_fsqrt: return OP_SQRT; - case nir_op_fsub: - case nir_op_isub: - return OP_SUB; case nir_op_ftrunc: return OP_TRUNC; case nir_op_ixor: @@ -515,12 +511,18 @@ Converter::getOperation(nir_intrinsic_op op) case nir_intrinsic_bindless_image_atomic_exchange: case nir_intrinsic_image_atomic_exchange: case nir_intrinsic_image_deref_atomic_exchange: - case nir_intrinsic_bindless_image_atomic_max: - case nir_intrinsic_image_atomic_max: - case nir_intrinsic_image_deref_atomic_max: - case nir_intrinsic_bindless_image_atomic_min: - case nir_intrinsic_image_atomic_min: - case nir_intrinsic_image_deref_atomic_min: + case nir_intrinsic_bindless_image_atomic_imax: + case nir_intrinsic_image_atomic_imax: + case nir_intrinsic_image_deref_atomic_imax: + case nir_intrinsic_bindless_image_atomic_umax: + case nir_intrinsic_image_atomic_umax: + case nir_intrinsic_image_deref_atomic_umax: + case nir_intrinsic_bindless_image_atomic_imin: + case nir_intrinsic_image_atomic_imin: + case nir_intrinsic_image_deref_atomic_imin: + case nir_intrinsic_bindless_image_atomic_umin: + case nir_intrinsic_image_atomic_umin: + case nir_intrinsic_image_deref_atomic_umin: case nir_intrinsic_bindless_image_atomic_or: case nir_intrinsic_image_atomic_or: case nir_intrinsic_image_deref_atomic_or: @@ -579,52 +581,68 @@ Converter::getSubOp(nir_intrinsic_op op) { switch (op) { case nir_intrinsic_bindless_image_atomic_add: + case nir_intrinsic_global_atomic_add: case nir_intrinsic_image_atomic_add: case nir_intrinsic_image_deref_atomic_add: case nir_intrinsic_shared_atomic_add: case nir_intrinsic_ssbo_atomic_add: return NV50_IR_SUBOP_ATOM_ADD; case nir_intrinsic_bindless_image_atomic_and: + case nir_intrinsic_global_atomic_and: case nir_intrinsic_image_atomic_and: case nir_intrinsic_image_deref_atomic_and: case nir_intrinsic_shared_atomic_and: case nir_intrinsic_ssbo_atomic_and: return NV50_IR_SUBOP_ATOM_AND; case nir_intrinsic_bindless_image_atomic_comp_swap: + case nir_intrinsic_global_atomic_comp_swap: case nir_intrinsic_image_atomic_comp_swap: case nir_intrinsic_image_deref_atomic_comp_swap: case nir_intrinsic_shared_atomic_comp_swap: case nir_intrinsic_ssbo_atomic_comp_swap: return NV50_IR_SUBOP_ATOM_CAS; case nir_intrinsic_bindless_image_atomic_exchange: + case nir_intrinsic_global_atomic_exchange: case nir_intrinsic_image_atomic_exchange: case nir_intrinsic_image_deref_atomic_exchange: case nir_intrinsic_shared_atomic_exchange: case nir_intrinsic_ssbo_atomic_exchange: return NV50_IR_SUBOP_ATOM_EXCH; case nir_intrinsic_bindless_image_atomic_or: + case nir_intrinsic_global_atomic_or: case nir_intrinsic_image_atomic_or: case nir_intrinsic_image_deref_atomic_or: case nir_intrinsic_shared_atomic_or: case nir_intrinsic_ssbo_atomic_or: return NV50_IR_SUBOP_ATOM_OR; - case nir_intrinsic_bindless_image_atomic_max: - case nir_intrinsic_image_atomic_max: - case nir_intrinsic_image_deref_atomic_max: + case nir_intrinsic_bindless_image_atomic_imax: + case nir_intrinsic_bindless_image_atomic_umax: + case nir_intrinsic_global_atomic_imax: + case nir_intrinsic_global_atomic_umax: + case nir_intrinsic_image_atomic_imax: + case nir_intrinsic_image_atomic_umax: + case nir_intrinsic_image_deref_atomic_imax: + case nir_intrinsic_image_deref_atomic_umax: case nir_intrinsic_shared_atomic_imax: case nir_intrinsic_shared_atomic_umax: case nir_intrinsic_ssbo_atomic_imax: case nir_intrinsic_ssbo_atomic_umax: return NV50_IR_SUBOP_ATOM_MAX; - case nir_intrinsic_bindless_image_atomic_min: - case nir_intrinsic_image_atomic_min: - case nir_intrinsic_image_deref_atomic_min: + case nir_intrinsic_bindless_image_atomic_imin: + case nir_intrinsic_bindless_image_atomic_umin: + case nir_intrinsic_global_atomic_imin: + case nir_intrinsic_global_atomic_umin: + case nir_intrinsic_image_atomic_imin: + case nir_intrinsic_image_atomic_umin: + case nir_intrinsic_image_deref_atomic_imin: + case nir_intrinsic_image_deref_atomic_umin: case nir_intrinsic_shared_atomic_imin: case nir_intrinsic_shared_atomic_umin: case nir_intrinsic_ssbo_atomic_imin: case nir_intrinsic_ssbo_atomic_umin: return NV50_IR_SUBOP_ATOM_MIN; case nir_intrinsic_bindless_image_atomic_xor: + case nir_intrinsic_global_atomic_xor: case nir_intrinsic_image_atomic_xor: case nir_intrinsic_image_deref_atomic_xor: case nir_intrinsic_shared_atomic_xor: @@ -633,7 +651,6 @@ Converter::getSubOp(nir_intrinsic_op op) case nir_intrinsic_group_memory_barrier: case nir_intrinsic_memory_barrier: - case nir_intrinsic_memory_barrier_atomic_counter: case nir_intrinsic_memory_barrier_buffer: case nir_intrinsic_memory_barrier_image: return NV50_IR_SUBOP_MEMBAR(M, GL); @@ -857,256 +874,6 @@ vert_attrib_to_tgsi_semantic(gl_vert_attrib slot, unsigned *name, unsigned *inde } } -static void -varying_slot_to_tgsi_semantic(gl_varying_slot slot, unsigned *name, unsigned *index) -{ - assert(name && index); - - if (slot >= VARYING_SLOT_TESS_MAX) { - ERROR("invalid varying slot %u\n", slot); - assert(false); - return; - } - - if (slot >= VARYING_SLOT_PATCH0) { - *name = TGSI_SEMANTIC_PATCH; - *index = slot - VARYING_SLOT_PATCH0; - return; - } - - if (slot >= VARYING_SLOT_VAR0) { - *name = TGSI_SEMANTIC_GENERIC; - *index = slot - VARYING_SLOT_VAR0; - return; - } - - if (slot >= VARYING_SLOT_TEX0 && slot <= VARYING_SLOT_TEX7) { - *name = TGSI_SEMANTIC_TEXCOORD; - *index = slot - VARYING_SLOT_TEX0; - return; - } - - switch (slot) { - case VARYING_SLOT_BFC0: - *name = TGSI_SEMANTIC_BCOLOR; - *index = 0; - break; - case VARYING_SLOT_BFC1: - *name = TGSI_SEMANTIC_BCOLOR; - *index = 1; - break; - case VARYING_SLOT_CLIP_DIST0: - *name = TGSI_SEMANTIC_CLIPDIST; - *index = 0; - break; - case VARYING_SLOT_CLIP_DIST1: - *name = TGSI_SEMANTIC_CLIPDIST; - *index = 1; - break; - case VARYING_SLOT_CLIP_VERTEX: - *name = TGSI_SEMANTIC_CLIPVERTEX; - *index = 0; - break; - case VARYING_SLOT_COL0: - *name = TGSI_SEMANTIC_COLOR; - *index = 0; - break; - case VARYING_SLOT_COL1: - *name = TGSI_SEMANTIC_COLOR; - *index = 1; - break; - case VARYING_SLOT_EDGE: - *name = TGSI_SEMANTIC_EDGEFLAG; - *index = 0; - break; - case VARYING_SLOT_FACE: - *name = TGSI_SEMANTIC_FACE; - *index = 0; - break; - case VARYING_SLOT_FOGC: - *name = TGSI_SEMANTIC_FOG; - *index = 0; - break; - case VARYING_SLOT_LAYER: - *name = TGSI_SEMANTIC_LAYER; - *index = 0; - break; - case VARYING_SLOT_PNTC: - *name = TGSI_SEMANTIC_PCOORD; - *index = 0; - break; - case VARYING_SLOT_POS: - *name = TGSI_SEMANTIC_POSITION; - *index = 0; - break; - case VARYING_SLOT_PRIMITIVE_ID: - *name = TGSI_SEMANTIC_PRIMID; - *index = 0; - break; - case VARYING_SLOT_PSIZ: - *name = TGSI_SEMANTIC_PSIZE; - *index = 0; - break; - case VARYING_SLOT_TESS_LEVEL_INNER: - *name = TGSI_SEMANTIC_TESSINNER; - *index = 0; - break; - case VARYING_SLOT_TESS_LEVEL_OUTER: - *name = TGSI_SEMANTIC_TESSOUTER; - *index = 0; - break; - case VARYING_SLOT_VIEWPORT: - *name = TGSI_SEMANTIC_VIEWPORT_INDEX; - *index = 0; - break; - default: - ERROR("unknown varying slot %u\n", slot); - assert(false); - break; - } -} - -static void -frag_result_to_tgsi_semantic(unsigned slot, unsigned *name, unsigned *index) -{ - if (slot >= FRAG_RESULT_DATA0) { - *name = TGSI_SEMANTIC_COLOR; - *index = slot - FRAG_RESULT_COLOR - 2; // intentional - return; - } - - switch (slot) { - case FRAG_RESULT_COLOR: - *name = TGSI_SEMANTIC_COLOR; - *index = 0; - break; - case FRAG_RESULT_DEPTH: - *name = TGSI_SEMANTIC_POSITION; - *index = 0; - break; - case FRAG_RESULT_SAMPLE_MASK: - *name = TGSI_SEMANTIC_SAMPLEMASK; - *index = 0; - break; - default: - ERROR("unknown frag result slot %u\n", slot); - assert(false); - break; - } -} - -// copy of _mesa_sysval_to_semantic -static void -system_val_to_tgsi_semantic(unsigned val, unsigned *name, unsigned *index) -{ - *index = 0; - switch (val) { - // Vertex shader - case SYSTEM_VALUE_VERTEX_ID: - *name = TGSI_SEMANTIC_VERTEXID; - break; - case SYSTEM_VALUE_INSTANCE_ID: - *name = TGSI_SEMANTIC_INSTANCEID; - break; - case SYSTEM_VALUE_VERTEX_ID_ZERO_BASE: - *name = TGSI_SEMANTIC_VERTEXID_NOBASE; - break; - case SYSTEM_VALUE_BASE_VERTEX: - *name = TGSI_SEMANTIC_BASEVERTEX; - break; - case SYSTEM_VALUE_BASE_INSTANCE: - *name = TGSI_SEMANTIC_BASEINSTANCE; - break; - case SYSTEM_VALUE_DRAW_ID: - *name = TGSI_SEMANTIC_DRAWID; - break; - - // Geometry shader - case SYSTEM_VALUE_INVOCATION_ID: - *name = TGSI_SEMANTIC_INVOCATIONID; - break; - - // Fragment shader - case SYSTEM_VALUE_FRAG_COORD: - *name = TGSI_SEMANTIC_POSITION; - break; - case SYSTEM_VALUE_FRONT_FACE: - *name = TGSI_SEMANTIC_FACE; - break; - case SYSTEM_VALUE_SAMPLE_ID: - *name = TGSI_SEMANTIC_SAMPLEID; - break; - case SYSTEM_VALUE_SAMPLE_POS: - *name = TGSI_SEMANTIC_SAMPLEPOS; - break; - case SYSTEM_VALUE_SAMPLE_MASK_IN: - *name = TGSI_SEMANTIC_SAMPLEMASK; - break; - case SYSTEM_VALUE_HELPER_INVOCATION: - *name = TGSI_SEMANTIC_HELPER_INVOCATION; - break; - - // Tessellation shader - case SYSTEM_VALUE_TESS_COORD: - *name = TGSI_SEMANTIC_TESSCOORD; - break; - case SYSTEM_VALUE_VERTICES_IN: - *name = TGSI_SEMANTIC_VERTICESIN; - break; - case SYSTEM_VALUE_PRIMITIVE_ID: - *name = TGSI_SEMANTIC_PRIMID; - break; - case SYSTEM_VALUE_TESS_LEVEL_OUTER: - *name = TGSI_SEMANTIC_TESSOUTER; - break; - case SYSTEM_VALUE_TESS_LEVEL_INNER: - *name = TGSI_SEMANTIC_TESSINNER; - break; - - // Compute shader - case SYSTEM_VALUE_LOCAL_INVOCATION_ID: - *name = TGSI_SEMANTIC_THREAD_ID; - break; - case SYSTEM_VALUE_WORK_GROUP_ID: - *name = TGSI_SEMANTIC_BLOCK_ID; - break; - case SYSTEM_VALUE_NUM_WORK_GROUPS: - *name = TGSI_SEMANTIC_GRID_SIZE; - break; - case SYSTEM_VALUE_LOCAL_GROUP_SIZE: - *name = TGSI_SEMANTIC_BLOCK_SIZE; - break; - - // ARB_shader_ballot - case SYSTEM_VALUE_SUBGROUP_SIZE: - *name = TGSI_SEMANTIC_SUBGROUP_SIZE; - break; - case SYSTEM_VALUE_SUBGROUP_INVOCATION: - *name = TGSI_SEMANTIC_SUBGROUP_INVOCATION; - break; - case SYSTEM_VALUE_SUBGROUP_EQ_MASK: - *name = TGSI_SEMANTIC_SUBGROUP_EQ_MASK; - break; - case SYSTEM_VALUE_SUBGROUP_GE_MASK: - *name = TGSI_SEMANTIC_SUBGROUP_GE_MASK; - break; - case SYSTEM_VALUE_SUBGROUP_GT_MASK: - *name = TGSI_SEMANTIC_SUBGROUP_GT_MASK; - break; - case SYSTEM_VALUE_SUBGROUP_LE_MASK: - *name = TGSI_SEMANTIC_SUBGROUP_LE_MASK; - break; - case SYSTEM_VALUE_SUBGROUP_LT_MASK: - *name = TGSI_SEMANTIC_SUBGROUP_LT_MASK; - break; - - default: - ERROR("unknown system value %u\n", val); - assert(false); - break; - } -} - void Converter::setInterpolate(nv50_ir_varying *var, uint8_t mode, @@ -1185,9 +952,8 @@ bool Converter::assignSlots() { if (!(nir->info.system_values_read & 1ull << i)) continue; - system_val_to_tgsi_semantic(i, &name, &index); - info->sv[info->numSysVals].sn = name; - info->sv[info->numSysVals].si = index; + info->sv[info->numSysVals].sn = tgsi_get_sysval_semantic(i); + info->sv[info->numSysVals].si = 0; info->sv[info->numSysVals].input = 0; // TODO inferSysValDirection(sn); switch (i) { @@ -1229,18 +995,21 @@ bool Converter::assignSlots() { switch(prog->getType()) { case Program::TYPE_FRAGMENT: - varying_slot_to_tgsi_semantic((gl_varying_slot)slot, &name, &index); + tgsi_get_gl_varying_semantic((gl_varying_slot)slot, true, + &name, &index); for (uint16_t i = 0; i < slots; ++i) { setInterpolate(&info->in[vary + i], var->data.interpolation, var->data.centroid | var->data.sample, name); } break; case Program::TYPE_GEOMETRY: - varying_slot_to_tgsi_semantic((gl_varying_slot)slot, &name, &index); + tgsi_get_gl_varying_semantic((gl_varying_slot)slot, true, + &name, &index); break; case Program::TYPE_TESSELLATION_CONTROL: case Program::TYPE_TESSELLATION_EVAL: - varying_slot_to_tgsi_semantic((gl_varying_slot)slot, &name, &index); + tgsi_get_gl_varying_semantic((gl_varying_slot)slot, true, + &name, &index); if (var->data.patch && name == TGSI_SEMANTIC_PATCH) info->numPatchConstants = MAX2(info->numPatchConstants, index + slots); break; @@ -1293,7 +1062,7 @@ bool Converter::assignSlots() { switch(prog->getType()) { case Program::TYPE_FRAGMENT: - frag_result_to_tgsi_semantic((gl_frag_result)slot, &name, &index); + tgsi_get_gl_frag_result_semantic((gl_frag_result)slot, &name, &index); switch (name) { case TGSI_SEMANTIC_COLOR: if (!var->data.fb_fetch_output) @@ -1318,7 +1087,8 @@ bool Converter::assignSlots() { case Program::TYPE_TESSELLATION_CONTROL: case Program::TYPE_TESSELLATION_EVAL: case Program::TYPE_VERTEX: - varying_slot_to_tgsi_semantic((gl_varying_slot)slot, &name, &index); + tgsi_get_gl_varying_semantic((gl_varying_slot)slot, true, + &name, &index); if (var->data.patch && name != TGSI_SEMANTIC_TESSINNER && name != TGSI_SEMANTIC_TESSOUTER) @@ -1842,68 +1612,6 @@ Converter::convert(nir_intrinsic_op intr) } } -ImgFormat -Converter::convertGLImgFormat(GLuint format) -{ -#define FMT_CASE(a, b) \ - case GL_ ## a: return nv50_ir::FMT_ ## b - - switch (format) { - FMT_CASE(NONE, NONE); - - FMT_CASE(RGBA32F, RGBA32F); - FMT_CASE(RGBA16F, RGBA16F); - FMT_CASE(RG32F, RG32F); - FMT_CASE(RG16F, RG16F); - FMT_CASE(R11F_G11F_B10F, R11G11B10F); - FMT_CASE(R32F, R32F); - FMT_CASE(R16F, R16F); - - FMT_CASE(RGBA32UI, RGBA32UI); - FMT_CASE(RGBA16UI, RGBA16UI); - FMT_CASE(RGB10_A2UI, RGB10A2UI); - FMT_CASE(RGBA8UI, RGBA8UI); - FMT_CASE(RG32UI, RG32UI); - FMT_CASE(RG16UI, RG16UI); - FMT_CASE(RG8UI, RG8UI); - FMT_CASE(R32UI, R32UI); - FMT_CASE(R16UI, R16UI); - FMT_CASE(R8UI, R8UI); - - FMT_CASE(RGBA32I, RGBA32I); - FMT_CASE(RGBA16I, RGBA16I); - FMT_CASE(RGBA8I, RGBA8I); - FMT_CASE(RG32I, RG32I); - FMT_CASE(RG16I, RG16I); - FMT_CASE(RG8I, RG8I); - FMT_CASE(R32I, R32I); - FMT_CASE(R16I, R16I); - FMT_CASE(R8I, R8I); - - FMT_CASE(RGBA16, RGBA16); - FMT_CASE(RGB10_A2, RGB10A2); - FMT_CASE(RGBA8, RGBA8); - FMT_CASE(RG16, RG16); - FMT_CASE(RG8, RG8); - FMT_CASE(R16, R16); - FMT_CASE(R8, R8); - - FMT_CASE(RGBA16_SNORM, RGBA16_SNORM); - FMT_CASE(RGBA8_SNORM, RGBA8_SNORM); - FMT_CASE(RG16_SNORM, RG16_SNORM); - FMT_CASE(RG8_SNORM, RG8_SNORM); - FMT_CASE(R16_SNORM, R16_SNORM); - FMT_CASE(R8_SNORM, R8_SNORM); - - FMT_CASE(BGRA_INTEGER, BGRA8); - default: - ERROR("unknown format %x\n", format); - assert(false); - return nv50_ir::FMT_NONE; - } -#undef FMT_CASE -} - bool Converter::visit(nir_intrinsic_instr *insn) { @@ -1945,7 +1653,7 @@ Converter::visit(nir_intrinsic_instr *insn) } case Program::TYPE_GEOMETRY: case Program::TYPE_VERTEX: { - if (info->io.genUserClip > 0 && idx == clipVertexOutput) { + if (info->io.genUserClip > 0 && idx == (uint32_t)clipVertexOutput) { mkMov(clipVtx[i], src); src = clipVtx[i]; } @@ -2370,12 +2078,40 @@ Converter::visit(nir_intrinsic_instr *insn) info->io.globalAccess |= 0x2; break; } + case nir_intrinsic_global_atomic_add: + case nir_intrinsic_global_atomic_and: + case nir_intrinsic_global_atomic_comp_swap: + case nir_intrinsic_global_atomic_exchange: + case nir_intrinsic_global_atomic_or: + case nir_intrinsic_global_atomic_imax: + case nir_intrinsic_global_atomic_imin: + case nir_intrinsic_global_atomic_umax: + case nir_intrinsic_global_atomic_umin: + case nir_intrinsic_global_atomic_xor: { + const DataType dType = getDType(insn); + LValues &newDefs = convert(&insn->dest); + Value *address; + uint32_t offset = getIndirect(&insn->src[0], 0, address); + + Symbol *sym = mkSymbol(FILE_MEMORY_GLOBAL, 0, dType, offset); + Instruction *atom = + mkOp2(OP_ATOM, dType, newDefs[0], sym, getSrc(&insn->src[1], 0)); + if (op == nir_intrinsic_global_atomic_comp_swap) + atom->setSrc(2, getSrc(&insn->src[2], 0)); + atom->setIndirect(0, 0, address); + atom->subOp = getSubOp(op); + + info->io.globalAccess |= 0x2; + break; + } case nir_intrinsic_bindless_image_atomic_add: case nir_intrinsic_bindless_image_atomic_and: case nir_intrinsic_bindless_image_atomic_comp_swap: case nir_intrinsic_bindless_image_atomic_exchange: - case nir_intrinsic_bindless_image_atomic_max: - case nir_intrinsic_bindless_image_atomic_min: + case nir_intrinsic_bindless_image_atomic_imax: + case nir_intrinsic_bindless_image_atomic_umax: + case nir_intrinsic_bindless_image_atomic_imin: + case nir_intrinsic_bindless_image_atomic_umin: case nir_intrinsic_bindless_image_atomic_or: case nir_intrinsic_bindless_image_atomic_xor: case nir_intrinsic_bindless_image_load: @@ -2405,8 +2141,10 @@ Converter::visit(nir_intrinsic_instr *insn) case nir_intrinsic_bindless_image_atomic_and: case nir_intrinsic_bindless_image_atomic_comp_swap: case nir_intrinsic_bindless_image_atomic_exchange: - case nir_intrinsic_bindless_image_atomic_max: - case nir_intrinsic_bindless_image_atomic_min: + case nir_intrinsic_bindless_image_atomic_imax: + case nir_intrinsic_bindless_image_atomic_umax: + case nir_intrinsic_bindless_image_atomic_imin: + case nir_intrinsic_bindless_image_atomic_umin: case nir_intrinsic_bindless_image_atomic_or: case nir_intrinsic_bindless_image_atomic_xor: ty = getDType(insn); @@ -2456,7 +2194,7 @@ Converter::visit(nir_intrinsic_instr *insn) TexInstruction *texi = mkTex(getOperation(op), target.getEnum(), location, 0, defs, srcs); texi->tex.bindless = false; - texi->tex.format = &nv50_ir::TexInstruction::formatTable[convertGLImgFormat(nir_intrinsic_format(insn))]; + texi->tex.format = nv50_ir::TexInstruction::translateImgFormat(nir_intrinsic_format(insn)); texi->tex.mask = mask; texi->tex.bindless = true; texi->cache = convert(nir_intrinsic_access(insn)); @@ -2472,8 +2210,10 @@ Converter::visit(nir_intrinsic_instr *insn) case nir_intrinsic_image_deref_atomic_and: case nir_intrinsic_image_deref_atomic_comp_swap: case nir_intrinsic_image_deref_atomic_exchange: - case nir_intrinsic_image_deref_atomic_max: - case nir_intrinsic_image_deref_atomic_min: + case nir_intrinsic_image_deref_atomic_imax: + case nir_intrinsic_image_deref_atomic_umax: + case nir_intrinsic_image_deref_atomic_imin: + case nir_intrinsic_image_deref_atomic_umin: case nir_intrinsic_image_deref_atomic_or: case nir_intrinsic_image_deref_atomic_xor: case nir_intrinsic_image_deref_load: @@ -2507,8 +2247,10 @@ Converter::visit(nir_intrinsic_instr *insn) case nir_intrinsic_image_deref_atomic_and: case nir_intrinsic_image_deref_atomic_comp_swap: case nir_intrinsic_image_deref_atomic_exchange: - case nir_intrinsic_image_deref_atomic_max: - case nir_intrinsic_image_deref_atomic_min: + case nir_intrinsic_image_deref_atomic_imax: + case nir_intrinsic_image_deref_atomic_umax: + case nir_intrinsic_image_deref_atomic_imin: + case nir_intrinsic_image_deref_atomic_umin: case nir_intrinsic_image_deref_atomic_or: case nir_intrinsic_image_deref_atomic_xor: ty = getDType(insn); @@ -2558,7 +2300,7 @@ Converter::visit(nir_intrinsic_instr *insn) TexInstruction *texi = mkTex(getOperation(op), target.getEnum(), location, 0, defs, srcs); texi->tex.bindless = false; - texi->tex.format = &nv50_ir::TexInstruction::formatTable[convertGLImgFormat(tex->data.image.format)]; + texi->tex.format = nv50_ir::TexInstruction::translateImgFormat(tex->data.image.format); texi->tex.mask = mask; texi->cache = getCacheModeFromVar(tex); texi->setType(ty); @@ -2593,7 +2335,7 @@ Converter::visit(nir_intrinsic_instr *insn) break; } - case nir_intrinsic_barrier: { + case nir_intrinsic_control_barrier: { // TODO: add flag to shader_info info->numBarriers = 1; Instruction *bar = mkOp2(OP_BAR, TYPE_U32, NULL, mkImm(0), mkImm(0)); @@ -2603,7 +2345,6 @@ Converter::visit(nir_intrinsic_instr *insn) } case nir_intrinsic_group_memory_barrier: case nir_intrinsic_memory_barrier: - case nir_intrinsic_memory_barrier_atomic_counter: case nir_intrinsic_memory_barrier_buffer: case nir_intrinsic_memory_barrier_image: case nir_intrinsic_memory_barrier_shared: { @@ -2612,6 +2353,8 @@ Converter::visit(nir_intrinsic_instr *insn) bar->subOp = getSubOp(op); break; } + case nir_intrinsic_memory_barrier_tcs_patch: + break; case nir_intrinsic_shader_clock: { const DataType dType = getDType(insn); LValues &newDefs = convert(&insn->dest); @@ -2797,8 +2540,6 @@ Converter::visit(nir_alu_instr *insn) case nir_op_ushr: case nir_op_fsin: case nir_op_fsqrt: - case nir_op_fsub: - case nir_op_isub: case nir_op_ftrunc: case nir_op_ishl: case nir_op_ixor: { @@ -2937,7 +2678,9 @@ Converter::visit(nir_alu_instr *insn) break; case nir_op_vec2: case nir_op_vec3: - case nir_op_vec4: { + case nir_op_vec4: + case nir_op_vec8: + case nir_op_vec16: { LValues &newDefs = convert(&insn->dest); for (LValues::size_type c = 0u; c < newDefs.size(); ++c) { mkMov(newDefs[c], getSrc(&insn->src[c]), dType); @@ -3262,7 +3005,7 @@ Converter::convert(enum gl_access_qualifier access) CacheMode Converter::getCacheModeFromVar(const nir_variable *var) { - return convert(var->data.image.access); + return convert(var->data.access); } bool @@ -3480,7 +3223,7 @@ Converter::run() NIR_PASS_V(nir, nir_lower_regs_to_ssa); NIR_PASS_V(nir, nir_lower_load_const_to_scalar); NIR_PASS_V(nir, nir_lower_vars_to_ssa); - NIR_PASS_V(nir, nir_lower_alu_to_scalar, NULL); + NIR_PASS_V(nir, nir_lower_alu_to_scalar, NULL, NULL); NIR_PASS_V(nir, nir_lower_phis_to_scalar); do { diff --git a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.cpp b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.cpp index b1076cf41..e9a998174 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.cpp +++ b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.cpp @@ -77,7 +77,6 @@ const char *Graph::Edge::typeStr() const case FORWARD: return "forward"; case BACK: return "back"; case CROSS: return "cross"; - case DUMMY: return "dummy"; case UNKNOWN: default: return "unk"; @@ -184,7 +183,7 @@ Graph::Node::reachableBy(const Node *node, const Node *term) const continue; for (EdgeIterator ei = pos->outgoing(); !ei.end(); ei.next()) { - if (ei.getType() == Edge::BACK || ei.getType() == Edge::DUMMY) + if (ei.getType() == Edge::BACK) continue; if (ei.getNode()->visit(seq)) stack.push(ei.getNode()); @@ -301,7 +300,6 @@ private: switch (ei.getType()) { case Graph::Edge::TREE: case Graph::Edge::FORWARD: - case Graph::Edge::DUMMY: if (++(ei.getNode()->tag) == ei.getNode()->incidentCountFwd()) bb.push(ei.getNode()); break; @@ -371,8 +369,6 @@ void Graph::classifyDFS(Node *curr, int& seq) for (edge = curr->out; edge; edge = edge->next[0]) { node = edge->target; - if (edge->type == Edge::DUMMY) - continue; if (node->getSequence() == 0) { edge->type = Edge::TREE; @@ -387,8 +383,6 @@ void Graph::classifyDFS(Node *curr, int& seq) for (edge = curr->in; edge; edge = edge->next[1]) { node = edge->origin; - if (edge->type == Edge::DUMMY) - continue; if (node->getSequence() == 0) { edge->type = Edge::TREE; diff --git a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.h b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.h index 115f20e5e..fc85e78a5 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.h +++ b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_graph.h @@ -47,7 +47,6 @@ public: FORWARD, BACK, CROSS, // e.g. loop break - DUMMY }; Edge(Node *dst, Node *src, Type kind); diff --git a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_util.h b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_util.h index 307c23d5e..b1766f482 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_util.h +++ b/lib/mesa/src/gallium/drivers/nouveau/codegen/nv50_ir_util.h @@ -145,7 +145,7 @@ public: #define DLLIST_EMPTY(__list) ((__list)->next == (__list)) #define DLLIST_FOR_EACH(list, it) \ - for (DLList::Iterator (it) = (list)->iterator(); !(it).end(); (it).next()) + for (DLList::Iterator it = (list)->iterator(); !(it).end(); (it).next()) class DLList { diff --git a/lib/mesa/src/gallium/drivers/nouveau/meson.build b/lib/mesa/src/gallium/drivers/nouveau/meson.build index 2e65a81f0..7a1d18a63 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/meson.build +++ b/lib/mesa/src/gallium/drivers/nouveau/meson.build @@ -212,7 +212,7 @@ libnouveau = static_library( 'nouveau', files_libnouveau, include_directories : [ - inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_common, + inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_mapi, inc_mesa, ], c_args : [c_vis_args], cpp_args : [cpp_vis_args], @@ -223,13 +223,14 @@ nouveau_compiler = executable( 'nouveau_compiler', 'nouveau_compiler.c', include_directories : [inc_src, inc_include, inc_gallium, inc_gallium_aux], - dependencies : [dep_libdrm, dep_libdrm_nouveau, idep_mesautil], - link_with : [libnouveau, libgallium, libnir], + dependencies : [dep_libdrm, dep_libdrm_nouveau, idep_mesautil, idep_nir], + link_with : [libnouveau, libgallium], build_by_default : with_tools.contains('nouveau'), install : with_tools.contains('nouveau'), ) driver_nouveau = declare_dependency( compile_args : '-DGALLIUM_NOUVEAU', - link_with : [libnouveauwinsys, libnouveau, libnir], + dependencies : idep_nir, + link_with : [libnouveauwinsys, libnouveau], ) diff --git a/lib/mesa/src/gallium/drivers/nouveau/nouveau_mm.c b/lib/mesa/src/gallium/drivers/nouveau/nouveau_mm.c index 43b3d99f4..3ba6ea95d 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nouveau_mm.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nouveau_mm.c @@ -142,13 +142,13 @@ mm_slab_new(struct nouveau_mman *cache, int chunk_order) return PIPE_ERROR_OUT_OF_MEMORY; } - LIST_INITHEAD(&slab->head); + list_inithead(&slab->head); slab->cache = cache; slab->order = chunk_order; slab->count = slab->free = size >> chunk_order; - LIST_ADD(&slab->head, &mm_bucket_by_order(cache, chunk_order)->free); + list_add(&slab->head, &mm_bucket_by_order(cache, chunk_order)->free); cache->allocated += size; @@ -181,16 +181,16 @@ nouveau_mm_allocate(struct nouveau_mman *cache, return NULL; } - if (!LIST_IS_EMPTY(&bucket->used)) { + if (!list_is_empty(&bucket->used)) { slab = LIST_ENTRY(struct mm_slab, bucket->used.next, head); } else { - if (LIST_IS_EMPTY(&bucket->free)) { + if (list_is_empty(&bucket->free)) { mm_slab_new(cache, MAX2(mm_get_order(size), MM_MIN_ORDER)); } slab = LIST_ENTRY(struct mm_slab, bucket->free.next, head); - LIST_DEL(&slab->head); - LIST_ADD(&slab->head, &bucket->used); + list_del(&slab->head); + list_add(&slab->head, &bucket->used); } *offset = mm_slab_alloc(slab) << slab->order; @@ -202,8 +202,8 @@ nouveau_mm_allocate(struct nouveau_mman *cache, nouveau_bo_ref(slab->bo, bo); if (slab->free == 0) { - LIST_DEL(&slab->head); - LIST_ADD(&slab->head, &bucket->full); + list_del(&slab->head); + list_add(&slab->head, &bucket->full); } alloc->next = NULL; @@ -222,12 +222,12 @@ nouveau_mm_free(struct nouveau_mm_allocation *alloc) mm_slab_free(slab, alloc->offset >> slab->order); if (slab->free == slab->count) { - LIST_DEL(&slab->head); - LIST_ADDTAIL(&slab->head, &bucket->free); + list_del(&slab->head); + list_addtail(&slab->head, &bucket->free); } else if (slab->free == 1) { - LIST_DEL(&slab->head); - LIST_ADDTAIL(&slab->head, &bucket->used); + list_del(&slab->head); + list_addtail(&slab->head, &bucket->used); } FREE(alloc); @@ -255,9 +255,9 @@ nouveau_mm_create(struct nouveau_device *dev, uint32_t domain, cache->allocated = 0; for (i = 0; i < MM_NUM_BUCKETS; ++i) { - LIST_INITHEAD(&cache->bucket[i].free); - LIST_INITHEAD(&cache->bucket[i].used); - LIST_INITHEAD(&cache->bucket[i].full); + list_inithead(&cache->bucket[i].free); + list_inithead(&cache->bucket[i].used); + list_inithead(&cache->bucket[i].full); } return cache; @@ -269,7 +269,7 @@ nouveau_mm_free_slabs(struct list_head *head) struct mm_slab *slab, *next; LIST_FOR_EACH_ENTRY_SAFE(slab, next, head, head) { - LIST_DEL(&slab->head); + list_del(&slab->head); nouveau_bo_ref(NULL, &slab->bo); FREE(slab); } @@ -284,8 +284,8 @@ nouveau_mm_destroy(struct nouveau_mman *cache) return; for (i = 0; i < MM_NUM_BUCKETS; ++i) { - if (!LIST_IS_EMPTY(&cache->bucket[i].used) || - !LIST_IS_EMPTY(&cache->bucket[i].full)) + if (!list_is_empty(&cache->bucket[i].used) || + !list_is_empty(&cache->bucket[i].full)) debug_printf("WARNING: destroying GPU memory cache " "with some buffers still in use\n"); diff --git a/lib/mesa/src/gallium/drivers/nouveau/nouveau_video.c b/lib/mesa/src/gallium/drivers/nouveau/nouveau_video.c index 95d8866ba..5c9468662 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nouveau_video.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nouveau_video.c @@ -29,7 +29,7 @@ #include "nouveau_buffer.h" #include "util/u_video.h" -#include "util/u_format.h" +#include "util/format/u_format.h" #include "util/u_sampler.h" static int @@ -782,7 +782,7 @@ nouveau_video_buffer_create(struct pipe_context *pipe, screen->device->chipset < 0x40) return vl_video_buffer_create(pipe, templat); - assert(templat->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420); + assert(pipe_format_to_chroma_format(templat->buffer_format) == PIPE_VIDEO_CHROMA_FORMAT_420); width = align(templat->width, 64); height = align(templat->height, 64); @@ -795,7 +795,6 @@ nouveau_video_buffer_create(struct pipe_context *pipe, buffer->base.get_sampler_view_planes = nouveau_video_buffer_sampler_view_planes; buffer->base.get_sampler_view_components = nouveau_video_buffer_sampler_view_components; buffer->base.get_surfaces = nouveau_video_buffer_surfaces; - buffer->base.chroma_format = templat->chroma_format; buffer->base.buffer_format = templat->buffer_format; buffer->base.width = width; buffer->base.height = height; diff --git a/lib/mesa/src/gallium/drivers/nouveau/nouveau_vp3_video.c b/lib/mesa/src/gallium/drivers/nouveau/nouveau_vp3_video.c index d2e694587..b28d31e00 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nouveau_vp3_video.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nouveau_vp3_video.c @@ -32,7 +32,7 @@ #include "nouveau_vp3_video.h" #include "util/u_video.h" -#include "util/u_format.h" +#include "util/format/u_format.h" #include "util/u_sampler.h" static struct pipe_sampler_view ** @@ -89,7 +89,7 @@ nouveau_vp3_video_buffer_create(struct pipe_context *pipe, return vl_video_buffer_create(pipe, templat); assert(templat->interlaced); - assert(templat->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420); + assert(pipe_format_to_chroma_format(templat->buffer_format) == PIPE_VIDEO_CHROMA_FORMAT_420); buffer = CALLOC_STRUCT(nouveau_vp3_video_buffer); if (!buffer) @@ -98,7 +98,6 @@ nouveau_vp3_video_buffer_create(struct pipe_context *pipe, buffer->base.buffer_format = templat->buffer_format; buffer->base.context = pipe; buffer->base.destroy = nouveau_vp3_video_buffer_destroy; - buffer->base.chroma_format = templat->chroma_format; buffer->base.width = templat->width; buffer->base.height = templat->height; buffer->base.get_sampler_view_planes = nouveau_vp3_video_buffer_sampler_view_planes; diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_clear.c b/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_clear.c index 4e6df1eff..b307b6795 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_clear.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_clear.c @@ -50,7 +50,7 @@ pack_zeta(enum pipe_format format, double depth, unsigned stencil) } static void -nv30_clear(struct pipe_context *pipe, unsigned buffers, +nv30_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scissor_state *scissor_state, const union pipe_color_union *color, double depth, unsigned stencil) { struct nv30_context *nv30 = nv30_context(pipe); diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c b/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c index 073b2a346..065a39921 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c @@ -41,7 +41,7 @@ nv30_fragprog_upload(struct nv30_context *nv30) if (unlikely(!fp->buffer)) fp->buffer = pipe_buffer_create(pipe->screen, 0, 0, fp->insn_len * 4); -#ifndef PIPE_ARCH_BIG_ENDIAN +#if !UTIL_ARCH_BIG_ENDIAN pipe_buffer_write(pipe, fp->buffer, 0, fp->insn_len * 4, fp->insn); #else { diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_miptree.c index cdaffd433..e4ed0dbd2 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_miptree.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_miptree.c @@ -23,7 +23,7 @@ * */ -#include "util/u_format.h" +#include "util/format/u_format.h" #include "util/u_inlines.h" #include "util/u_surface.h" diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_texture.c b/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_texture.c index 358b3bbc3..dfea6dea3 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_texture.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nv30/nv30_texture.c @@ -24,7 +24,7 @@ */ #include "util/u_inlines.h" -#include "util/u_format.h" +#include "util/format/u_format.h" #include "nv_object.xml.h" #include "nv30/nv30-40_3d.xml.h" diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_blit.h b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_blit.h index 01667bb5f..30c1f7613 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_blit.h +++ b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_blit.h @@ -3,7 +3,7 @@ #define __NV50_BLIT_H__ #include "util/u_inlines.h" -#include "util/u_format.h" +#include "util/format/u_format.h" void * nv50_blitter_make_fp(struct pipe_context *, diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_miptree.c b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_miptree.c index 786d18033..400ce6c93 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_miptree.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_miptree.c @@ -23,7 +23,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "util/u_inlines.h" -#include "util/u_format.h" +#include "util/format/u_format.h" #include "nv50/nv50_context.h" #include "nv50/nv50_resource.h" diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_resource.c b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_resource.c index aed8c6241..e26f10da2 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_resource.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_resource.c @@ -1,7 +1,7 @@ #include "pipe/p_context.h" #include "util/u_inlines.h" -#include "util/u_format.h" +#include "util/format/u_format.h" #include "nouveau_screen.h" diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_tex.c b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_tex.c index 741e350c2..3f51c53e9 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_tex.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_tex.c @@ -25,7 +25,7 @@ #include "nv50/g80_texture.xml.h" #include "nv50/g80_defs.xml.h" -#include "util/u_format.h" +#include "util/format/u_format.h" static inline uint32_t nv50_tic_swizzle(const struct nv50_format *fmt, unsigned swz, bool tex_int) @@ -315,7 +315,7 @@ nv50_validate_tic(struct nv50_context *nv50, int s) struct nv50_tic_entry *tic = nv50_tic_entry(nv50->textures[s][i]); struct nv50_miptree *res; - if (!tic) { + if (!tic || tic->pipe.target == PIPE_BUFFER) { PUSH_DATA (push, 0); PUSH_DATA (push, 0); continue; diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_transfer.c b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_transfer.c index 8209f1f1e..28dd02e7e 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_transfer.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv50_transfer.c @@ -1,5 +1,5 @@ -#include "util/u_format.h" +#include "util/format/u_format.h" #include "nv50/nv50_context.h" diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv84_video.c b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv84_video.c index dbec1f786..0b5ebd48c 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv84_video.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv84_video.c @@ -25,7 +25,7 @@ #include <sys/types.h> #include <fcntl.h> -#include "util/u_format.h" +#include "util/format/u_format.h" #include "util/u_sampler.h" #include "vl/vl_zscan.h" @@ -619,7 +619,7 @@ nv84_video_buffer_create(struct pipe_context *pipe, debug_printf("Require interlaced video buffers\n"); return NULL; } - if (template->chroma_format != PIPE_VIDEO_CHROMA_FORMAT_420) { + if (pipe_format_to_chroma_format(template->buffer_format) != PIPE_VIDEO_CHROMA_FORMAT_420) { debug_printf("Must use 4:2:0 format\n"); return NULL; } @@ -638,7 +638,6 @@ nv84_video_buffer_create(struct pipe_context *pipe, buffer->base.buffer_format = template->buffer_format; buffer->base.context = pipe; buffer->base.destroy = nv84_video_buffer_destroy; - buffer->base.chroma_format = template->chroma_format; buffer->base.width = template->width; buffer->base.height = template->height; buffer->base.get_sampler_view_planes = nv84_video_buffer_sampler_view_planes; diff --git a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv98_video.c b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv98_video.c index e4b573589..ab426d6f5 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nv50/nv98_video.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nv50/nv98_video.c @@ -23,7 +23,7 @@ #include "nv50/nv98_video.h" #include "util/u_sampler.h" -#include "util/u_format.h" +#include "util/format/u_format.h" #include <nvif/class.h> diff --git a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c index 3ab2f5e3d..af5c6f7e6 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c @@ -285,7 +285,7 @@ nvc0_compute_validate_buffers(struct nvc0_context *nvc0) PUSH_DATA (push, nvc0->buffers[s][i].buffer_size); PUSH_DATA (push, 0); BCTX_REFN(nvc0->bufctx_cp, CP_BUF, res, RDWR); - util_range_add(&res->valid_buffer_range, + util_range_add(&res->base, &res->valid_buffer_range, nvc0->buffers[s][i].buffer_offset, nvc0->buffers[s][i].buffer_offset + nvc0->buffers[s][i].buffer_size); diff --git a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c index e6847bac0..c897e4e8b 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c @@ -26,7 +26,7 @@ #include "pipe/p_defines.h" #include "state_tracker/drm_driver.h" #include "util/u_inlines.h" -#include "util/u_format.h" +#include "util/format/u_format.h" #include "nvc0/nvc0_context.h" #include "nvc0/nvc0_resource.h" diff --git a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h index b24fca004..78a1d7926 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h +++ b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h @@ -38,7 +38,7 @@ nvc0_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *tmp, const uint64_t *modifiers, unsigned int count); -const struct u_resource_vtbl nvc0_miptree_vtbl; +extern const struct u_resource_vtbl nvc0_miptree_vtbl; struct pipe_surface * nvc0_miptree_surface_new(struct pipe_context *, diff --git a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c index 8820b5aac..8cb9776d9 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c @@ -27,7 +27,7 @@ #include "nv50/g80_texture.xml.h" #include "nv50/g80_defs.xml.h" -#include "util/u_format.h" +#include "util/format/u_format.h" #define NVE4_TIC_ENTRY_INVALID 0x000fffff #define NVE4_TSC_ENTRY_INVALID 0xfff00000 @@ -948,7 +948,7 @@ nvc0_mark_image_range_valid(const struct pipe_image_view *view) assert(view->resource->target == PIPE_BUFFER); - util_range_add(&res->valid_buffer_range, + util_range_add(&res->base, &res->valid_buffer_range, view->u.buf.offset, view->u.buf.offset + view->u.buf.size); } @@ -1433,7 +1433,15 @@ gm107_create_image_handle(struct pipe_context *pipe, nvc0->screen->tic.lock[tic->id / 32] |= 1 << (tic->id % 32); - return 0x100000000ULL | tic->id; + // Compute handle. This will include the TIC as well as some additional + // info regarding the bound 3d surface layer, if applicable. + uint64_t handle = 0x100000000ULL | tic->id; + struct nv04_resource *res = nv04_resource(view->resource); + if (res->base.target == PIPE_TEXTURE_3D) { + handle |= 1 << 11; + handle |= view->u.tex.first_layer << (11 + 16); + } + return handle; fail: FREE(tic); @@ -1472,7 +1480,7 @@ gm107_make_image_handle_resident(struct pipe_context *pipe, uint64_t handle, res->flags = (access & 3) << 8; if (res->buf->base.target == PIPE_BUFFER && access & PIPE_IMAGE_ACCESS_WRITE) - util_range_add(&res->buf->valid_buffer_range, + util_range_add(&res->buf->base, &res->buf->valid_buffer_range, tic->pipe.u.buf.offset, tic->pipe.u.buf.offset + tic->pipe.u.buf.size); list_add(&res->list, &nvc0->img_head); diff --git a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_video.c b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_video.c index c5871f8a2..f3531da28 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_video.c +++ b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_video.c @@ -23,7 +23,7 @@ #include "nvc0/nvc0_video.h" #include "util/u_sampler.h" -#include "util/u_format.h" +#include "util/format/u_format.h" static void nvc0_decoder_begin_frame(struct pipe_video_codec *decoder, diff --git a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_winsys.h b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_winsys.h index 4d07546c3..811104932 100644 --- a/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_winsys.h +++ b/lib/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_winsys.h @@ -63,7 +63,7 @@ PUSH_REFN(struct nouveau_pushbuf *push, struct nouveau_bo *bo, uint32_t flags) #define NVC0_2D(n) SUBC_2D(NV50_2D_##n) #define SUBC_COPY(m) 4, (m) -#define NVE4_COPY(m) SUBC_COPY(NVE4_COPY_##n) +#define NVE4_COPY(n) SUBC_COPY(NVE4_COPY_##n) #define SUBC_SW(m) 7, (m) |