[Mesa-dev] [PATCH] loader/dri3: Avoid freeing renderbuffers in use

Thomas Hellstrom thellstrom at vmware.com
Fri Jan 12 06:40:27 UTC 2018


On 01/11/2018 04:32 PM, Michel Dänzer wrote:
> On 2018-01-11 10:53 AM, Thomas Hellstrom wrote:
>> Upon reception of an event that lowered the number of active back buffers,
>> the code would immediately try to free all back buffers with an id equal to or
>> higher than the new number of active back buffers.
>>
>> However, that could lead to an active or to-be-active back buffer being freed,
>> since the old number of back buffers was used when obtaining an idle back
>> buffer for use.
>>
>> This lead to crashes when lowering the number of active back buffers by
>> transitioning from page-flipping to non-page-flipping presents.
>>
>> Fix this by computing the number of active back buffers only when trying to
>> obtain a new back buffer.
>>
>> Fixes: 15e208c4cc ("loader/dri3: Don't accidently free buffer holding new back content")
>> Bugzilla: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D104214&d=DwIDaQ&c=uilaK90D4TOVoH58JNXRgQ&r=wnSlgOCqfpNS4d02vP68_E9q2BNMCwfD2OZ_6dCFVQQ&m=9HcYeSD_Icbfrmtsk2Opj_2kYsyb6xfcoE81n8lODzc&s=lObZAF_CMRHJk8C3_gsSJLnjZRBb6WAWotpNW70UMK4&e=
>> Cc: "17.3" <mesa-stable at lists.freedesktop.org>
>> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
> [...]
>
>> @@ -402,7 +400,8 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
>>               buf->busy = 0;
>>   
>>            if (buf && draw->num_back <= b && b < LOADER_DRI3_MAX_BACK &&
>> -             draw->cur_blit_source != b) {
>> +             draw->cur_blit_source != b &&
>> +             buf->busy == 0) {
>>               dri3_free_render_buffer(draw, buf);
>>               draw->buffers[b] = NULL;
>>            }
> Maybe write this as !buf->busy for consistency with dri3_find_back.
> Either way,

Thanks for reviewing, Michel. I'll incorporate that, resend and push.

/Thomas


> Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
>
>



More information about the mesa-dev mailing list