[Mesa-dev] [PATCH 07/57] i965/fs: Replace fs_inst::regs_written with ::size_written field in bytes.

Francisco Jerez currojerez at riseup.net
Fri Sep 9 01:44:25 UTC 2016


Iago Toral <itoral at igalia.com> writes:

> On Wed, 2016-09-07 at 18:48 -0700, Francisco Jerez wrote:
> (...)
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
>> b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
>> index 12ab7b3..a678351 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
>> @@ -363,7 +363,7 @@ fs_generator::generate_fb_read(fs_inst *inst,
>> struct brw_reg dst,
>>        prog_data->binding_table.render_target_start + inst->target;
>>  
>>     gen9_fb_READ(p, dst, payload, surf_index,
>> -                inst->header_size, inst->regs_written,
>> +                inst->header_size, inst->size_written / REG_SIZE,
>
> DIV_ROUND_UP?
>
>>                  prog_data->persample_dispatch);
>>  
>>     brw_mark_surface_used(&prog_data->base, surf_index);
>> @@ -467,7 +467,7 @@ fs_generator::generate_urb_read(fs_inst *inst,
>>        brw_inst_set_urb_per_slot_offset(p->devinfo, send, true);
>>  
>>     brw_inst_set_mlen(p->devinfo, send, inst->mlen);
>> -   brw_inst_set_rlen(p->devinfo, send, inst->regs_written);
>> +   brw_inst_set_rlen(p->devinfo, send, inst->size_written /
>> REG_SIZE);
>
> DIV_ROUND_UP?
>
>>     brw_inst_set_header_present(p->devinfo, send, true);
>>     brw_inst_set_urb_global_offset(p->devinfo, send, inst->offset);
>>  }
>> @@ -895,7 +895,7 @@ fs_generator::generate_tex(fs_inst *inst, struct
>> brw_reg dst, struct brw_reg src
>>                   surface + base_binding_table_index,
>>                   sampler % 16,
>>                   msg_type,
>> -                 inst->regs_written,
>> +                 inst->size_written / REG_SIZE,
>
> DIV_ROUND_UP?
>
>>                   inst->mlen,
>>                   inst->header_size != 0,
>>                   simd_mode,
>> @@ -932,7 +932,7 @@ fs_generator::generate_tex(fs_inst *inst, struct
>> brw_reg dst, struct brw_reg src
>>                                0 /* surface */,
>>                                0 /* sampler */,
>>                                msg_type,
>> -                              inst->regs_written,
>> +                              inst->size_written / REG_SIZE,
>
> DIV_ROUND_UP?
>
>>                                inst->mlen /* mlen */,
>>                                inst->header_size != 0 /* header */,
>>                                simd_mode,
>> @@ -1263,7 +1263,7 @@
>> fs_generator::generate_varying_pull_constant_load_gen4(fs_inst *inst,
>>         */
>>        msg_type = BRW_SAMPLER_MESSAGE_SIMD16_LD;
>>        assert(inst->mlen == 3);
>> -      assert(inst->regs_written == 8);
>> +      assert(inst->size_written == 8 * REG_SIZE);
>>        rlen = 8;
>>        simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD16;
>>     }
>> @@ -1408,7 +1408,7 @@
>> fs_generator::generate_pixel_interpolator_query(fs_inst *inst,
>>           msg_type,
>>           msg_data,
>>           inst->mlen,
>> -         inst->regs_written);
>> +         inst->size_written / REG_SIZE);
>
> DIV_ROUND_UP?

In all cases above you have the requirement that the amount of data
written is an exact multiple of REG_SIZE, because SEND messages can only
represent return payload sizes as an integer in GRF units, so if
fs_inst::size_written ends up not being a multiple of REG_SIZE in any of
these cases something has gone seriously wrong along the way.  Would you
like me to sprinkle in some assertions to verify that?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160908/1505c488/attachment.sig>


More information about the mesa-dev mailing list