[Mesa-dev] [PATCH 09/25] radeonsi: add code for combining and uploading shaders from 3 shader parts

Nicolai Hähnle nhaehnle at gmail.com
Tue Feb 16 16:12:40 UTC 2016


On 16.02.2016 11:10, Marek Olšák wrote:
> On Tue, Feb 16, 2016 at 4:53 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
>> On 15.02.2016 18:59, Marek Olšák wrote:
>>>
>>> From: Marek Olšák <marek.olsak at amd.com>
>>>
>>> ---
>>>    src/gallium/drivers/radeonsi/si_shader.c | 35
>>> ++++++++++++++++++++++++--------
>>>    src/gallium/drivers/radeonsi/si_shader.h |  9 ++++++++
>>>    2 files changed, 36 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/src/gallium/drivers/radeonsi/si_shader.c
>>> b/src/gallium/drivers/radeonsi/si_shader.c
>>> index dbb9217..a6a0984 100644
>>> --- a/src/gallium/drivers/radeonsi/si_shader.c
>>> +++ b/src/gallium/drivers/radeonsi/si_shader.c
>>> @@ -4036,26 +4036,45 @@ void si_shader_apply_scratch_relocs(struct
>>> si_context *sctx,
>>>
>>>    int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader
>>> *shader)
>>>    {
>>> -       const struct radeon_shader_binary *binary = &shader->binary;
>>> -       unsigned code_size = binary->code_size + binary->rodata_size;
>>> +       const struct radeon_shader_binary *prolog =
>>> +               shader->prolog ? &shader->prolog->binary : NULL;
>>> +       const struct radeon_shader_binary *epilog =
>>> +               shader->epilog ? &shader->epilog->binary : NULL;
>>> +       const struct radeon_shader_binary *mainb = &shader->binary;
>>> +       unsigned bo_size =
>>> +               (prolog ? prolog->code_size : 0) +
>>> +               mainb->code_size +
>>> +               (epilog ? epilog->code_size : mainb->rodata_size);
>>>          unsigned char *ptr;
>>>
>>> +       assert(!prolog || !prolog->rodata_size);
>>> +       assert((!prolog && !epilog) || !mainb->rodata_size);
>>> +       assert(!epilog || !epilog->rodata_size);
>>
>>
>> Strictly speaking it should be possible for main to have rodata if there is
>> a prolog but no epilog, right? In any case, patches 1-9 are
>
> Yes. The thing is, the epilog is always present and can't be removed.
> If it's empty, it must contain s_endpgm at least.
>
> On the other hand, empty prologs aren't even compiled and
> shader->prolog is NULL in that case.
>
> We could support rodata for main if the compiler reserved some free
> space for the epilog between the code and rodata.

Ah, thanks for the explanation, I forgot about the s_endpgm.

>
> Marek
>


More information about the mesa-dev mailing list