[Mesa-dev] [PATCH 4/7] gk110/ir: add emission for OP_SUEAU, OP_SUBFM and OP_SUCLAMP
Ilia Mirkin
imirkin at alum.mit.edu
Wed Apr 20 20:42:54 UTC 2016
On Wed, Apr 20, 2016 at 4:41 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
>
>
> On 04/20/2016 10:35 PM, Ilia Mirkin wrote:
>>
>> On Wed, Apr 20, 2016 at 4:25 PM, Samuel Pitoiset
>> <samuel.pitoiset at gmail.com> wrote:
>>>
>>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>>> ---
>>> .../drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp | 87
>>> ++++++++++++++++++++++
>>> 1 file changed, 87 insertions(+)
>>>
>>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
>>> b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
>>> index 56c28e8..15280df 100644
>>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
>>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp
>>> @@ -137,6 +137,8 @@ private:
>>>
>>> void emitSULDGB(const TexInstruction *);
>>> void emitSUSTGx(const TexInstruction *);
>>> + void emitSUCLAMPMode(uint16_t);
>>> + void emitSUCalc(Instruction *);
>>>
>>> inline void defId(const ValueDef&, const int pos);
>>> inline void srcId(const ValueRef&, const int pos);
>>> @@ -1594,6 +1596,86 @@ CodeEmitterGK110::emitSUSTGx(const TexInstruction
>>> *i)
>>> }
>>>
>>> void
>>> +CodeEmitterGK110::emitSUCLAMPMode(uint16_t subOp)
>>> +{
>>> + uint8_t m;
>>> + switch (subOp & ~NV50_IR_SUBOP_SUCLAMP_2D) {
>>> + case NV50_IR_SUBOP_SUCLAMP_SD(0, 1): m = 0; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_SD(1, 1): m = 1; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_SD(2, 1): m = 2; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_SD(3, 1): m = 3; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_SD(4, 1): m = 4; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_PL(0, 1): m = 5; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_PL(1, 1): m = 6; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_PL(2, 1): m = 7; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_PL(3, 1): m = 8; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_PL(4, 1): m = 9; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_BL(0, 1): m = 10; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_BL(1, 1): m = 11; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_BL(2, 1): m = 12; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_BL(3, 1): m = 13; break;
>>> + case NV50_IR_SUBOP_SUCLAMP_BL(4, 1): m = 14; break;
>>> + default:
>>> + return;
>>> + }
>>> + code[1] |= m << 20;
>>> + if (subOp & NV50_IR_SUBOP_SUCLAMP_2D)
>>> + code[1] |= 1 << 24;
>>> +}
>>> +
>>> +void
>>> +CodeEmitterGK110::emitSUCalc(Instruction *i)
>>> +{
>>> + ImmediateValue *imm = NULL;
>>> + uint64_t opc1, opc2;
>>> +
>>> + if (i->srcExists(2)) {
>>> + imm = i->getSrc(2)->asImm();
>>> + if (imm)
>>> + i->setSrc(2, NULL); // special case, make emitForm_21 not
>>> assert
>>
>>
>> oooof. i don't like this. please come up with a different way to
>> handle this. the IR shouldn't be getting modified here, this could
>> upset the sched calculations (not 100% sure when those happen
>> exactly), etc.
>
>
> Well, I don't really like this too, but it's loosely based on nvc0. Will try
> to find a better way for that.
Oh I see. It resets it at the end. That's actually not SO bad then.
And you do the same thing here. In that case it's actually fine, if
hacky.
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
More information about the mesa-dev
mailing list