<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 26, 2019 at 12:56 PM Axel Davy <<a href="mailto:davyaxel0@gmail.com">davyaxel0@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 26/04/2019 10:08, Michel Dänzer wrote:<br>
> On 2019-04-26 4:06 a.m., Marek Olšák wrote:<br>
>> From: Marek Olšák <<a href="mailto:marek.olsak@amd.com" target="_blank">marek.olsak@amd.com</a>><br>
>><br>
>> It's done by:<br>
>> - decrease the number of frames in flight by 1<br>
>> - flush before throttling in SwapBuffers<br>
>>    (instead of wait-then-flush, do flush-then-wait)<br>
>><br>
>> The improvement is apparent with Unigine Heaven.<br>
>><br>
>> Previously:<br>
>>      draw frame 2<br>
>>      wait frame 0<br>
>>      flush frame 2<br>
>>      present frame 2<br>
>><br>
>>      The input lag is 2 frames.<br>
>><br>
>> Now:<br>
>>      draw frame 2<br>
>>      flush frame 2<br>
>>      wait frame 1<br>
>>      present frame 2<br>
>><br>
>>      The input lag is 1 frame. Flushing is done before waiting, because<br>
>>      otherwise the device would be idle after waiting.<br>
> Nice idea. Not sure offhand about all ramifications, but certainly worth<br>
> a go.<br>
><br>
><br>
>> Nine is affected because it also uses the pipe cap.<br>
>> ---<br>
>>   src/gallium/auxiliary/util/u_screen.c         |  2 +-<br>
>>   src/gallium/state_trackers/dri/dri_drawable.c | 20 +++++++++----------<br>
>>   2 files changed, 11 insertions(+), 11 deletions(-)<br>
>><br>
>> diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c<br>
>> index 27f51e0898e..410f17421e6 100644<br>
>> --- a/src/gallium/auxiliary/util/u_screen.c<br>
>> +++ b/src/gallium/auxiliary/util/u_screen.c<br>
>> @@ -349,21 +349,21 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,<br>
>>      case PIPE_CAP_MAX_VARYINGS:<br>
>>         return 8;<br>
>>   <br>
>>      case PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK:<br>
>>         return 0;<br>
>>   <br>
>>      case PIPE_CAP_COMPUTE_SHADER_DERIVATIVES:<br>
>>         return 0;<br>
>>   <br>
>>      case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:<br>
>> -      return 2;<br>
>> +      return 1;<br>
> This might be slightly misleading, as there can still be two frames in<br>
> flight (on the GPU) at the same time. Might be better to leave this at 2<br>
> (so Nine isn't affected) and adjust its treatment in<br>
> src/gallium/state_trackers/dri/dri_drawable.c .<br>
><br>
><br>
Checking what gallium nine does currently, it seems we already do flush <br>
then wait,<br>
however we call swap_fences_pop_front and swap_fences_push_back in the <br>
reverse order compared to your patch.<br>
We compensate by taking PIPE_CAP_MAX_FRAMES_IN_FLIGHT + 1<br>
<br>
In conclusion, with the proposed patch, gl and nine should have the same <br>
behaviour (and thus if gl benefits from a value of 1, nine should as well).<br>
I haven't have noticed input lag, I guess I have to test on heaven if <br>
you see a difference.<br>
How can I slow down my gpu to test that ? I use to use the <br>
/sys/kernel/debug/dri/0/ vars to force low dpm, but it doesn't seem to <br>
be possible anymore as the related files are gone (rx480) ?<br></blockquote><div><br></div><div>I set maximum settings, windowed, resolution: custom, and I type in the 4K resolution (I don't have a 4K monitor). When it's running, I enable wireframe. It should be pretty slow.</div><div><br></div><div>Marek<br></div></div></div>