[Mesa-stable] [PATCH] st/nine: Immediately upload user provided textures

Axel Davy davyaxel0 at gmail.com
Wed Mar 6 19:27:09 UTC 2019


On 06/03/2019 20:13, Dylan Baker wrote:
> Quoting Axel Davy (2019-01-22 12:08:05)
>> Fixes regression caused by
>> 42d672fa6a766363e5703f119607f7c7975918aa
>> st/nine: Bind src not dst in nine_context_box_upload
>>
>> Before that patch, for user provided textures,
>> when the texture was destroyed, the safety
>> check for pending uploads, which according to
>> the code "Following condition cannot happen currently",
>> was flushing the queue and thus triggering the upload.
>>
>> After the patch, the texture destruction was delayed after
>> the upload. However the user frees the texture buffer,
>> as it thinks the texture released.
>>
>> Instead of reverting the faulty patch,
>> this patch instead flushes the csmt queue right away
>> after queuing the upload for this type of textures.
>> This is more future-proof, as we may want to bind the
>> surface for other reasons in the future.
>>
>> Signed-off-by: Axel Davy <davyaxel0 at gmail.com>
>> Cc: 18.3 <mesa-stable at lists.freedesktop.org>
>> ---
>> The regression affects Mesa 18.3.2. At least HL2 lost coast
>> is affected, has artifacts and crashes at the menu.
>>
>>   src/gallium/state_trackers/nine/surface9.c | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
>> index f94f7c62583..7f4ecf559e8 100644
>> --- a/src/gallium/state_trackers/nine/surface9.c
>> +++ b/src/gallium/state_trackers/nine/surface9.c
>> @@ -668,6 +668,19 @@ NineSurface9_CopyMemToDefault( struct NineSurface9 *This,
>>                               From->data, From->stride,
>>                               0, /* depth = 1 */
>>                               &src_box);
>> +    if (From->texture == D3DRTYPE_TEXTURE) {
>> +        struct NineTexture9 *tex =
>> +            NineTexture9(From->base.base.container);
>> +        /* D3DPOOL_SYSTEMMEM with buffer content passed
>> +         * from the user: execute the upload right now.
>> +         * It is possible it is enough to delay upload
>> +         * until the surface refcount is 0, but the
>> +         * bind refcount may not be 0, and thus the dtor
>> +         * is not executed (and doesn't trigger the
>> +         * pending_uploads_counter check). */
>> +        if (!tex->managed_buffer)
>> +            nine_csmt_process(This->base.base.device);
>> +    }
>>   
>>       if (This->data_conversion)
>>           (void) util_format_translate(This->format_conversion,
>> -- 
>> 2.20.1
>>
> Should I pick this to 19.0 as well after it lands?
>
> Dylan

Well, it looks like to be already in the 19.0 tree:
https://cgit.freedesktop.org/mesa/mesa/commit/?h=19.0&id=d7433c22e6c9624ca5275a3cd35be79caed9fffc


Yours,


Axel Davy



More information about the mesa-stable mailing list