Re: [Mesa-dev] [PATCH] vl/dri3: remove the wait before getting back buffer

2019-03-25 Thread Michel Dänzer
On 2019-03-21 8:10 p.m., Liu, Leo wrote:
> On 2019-03-20 1:56 p.m., Michel Dänzer wrote:
>> On 2019-03-20 4:42 p.m., Liu, Leo wrote:
>>> The wait here is unnecessary since we got a pool of back buffers,
>>> and the wait for swap buffer will happen before the present pixmap,
>>> at the same time the previous back buffer will be put back to pool
>>> for reuse after the check for PresentIdleNotify event
>>>
>>> Signed-off-by: Leo Liu 
>>>
>>>   [...]
>>>
>>> @@ -626,13 +621,6 @@ vl_dri3_screen_texture_from_drawable(struct vl_screen 
>>> *vscreen, void *drawable)
>>>  if (!dri3_set_drawable(scrn, (Drawable)drawable))
>>> return NULL;
>>>   
>>> -   if (scrn->flushed) {
>>> -  while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
>>> - if (!dri3_wait_present_events(scrn))
>>> -return NULL;
>>> -   }
>>> -   scrn->flushed = false;
>>> -
>>>  buffer = (scrn->is_pixmap) ?
>>>   dri3_get_front_buffer(scrn) :
>>>   dri3_get_back_buffer(scrn);
>>>
>> Hmm. Is the wait here not necessary before getting a pixmap's front
>> buffer either though? Maybe wait only here for a pixmap, and only in
>> vl_dri3_flush_frontbuffer for a window?
>>
>> Sorry I didn't realize this earlier.
>>
> The pixmap case is used by Totem player, or previous GLX case for MPV 
> player, and the front buffer of the pixmap is a temporary buffer, and 
> later as source for GL to present.
> 
> For pixmap case, there is no need to wait,  and the dri3 present wait 
> before dri3_get_front_buffer() is not get called, because scrn->flushed 
> will never be true, since our presentation flush code is not used by 
> this case.

Makes sense, thanks.

Reviewed-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |  https://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] vl/dri3: remove the wait before getting back buffer

2019-03-21 Thread Liu, Leo

On 2019-03-20 1:56 p.m., Michel Dänzer wrote:
> On 2019-03-20 4:42 p.m., Liu, Leo wrote:
>> The wait here is unnecessary since we got a pool of back buffers,
>> and the wait for swap buffer will happen before the present pixmap,
>> at the same time the previous back buffer will be put back to pool
>> for reuse after the check for PresentIdleNotify event
>>
>> Signed-off-by: Leo Liu 
>>
>>   [...]
>>
>> @@ -626,13 +621,6 @@ vl_dri3_screen_texture_from_drawable(struct vl_screen 
>> *vscreen, void *drawable)
>>  if (!dri3_set_drawable(scrn, (Drawable)drawable))
>> return NULL;
>>   
>> -   if (scrn->flushed) {
>> -  while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
>> - if (!dri3_wait_present_events(scrn))
>> -return NULL;
>> -   }
>> -   scrn->flushed = false;
>> -
>>  buffer = (scrn->is_pixmap) ?
>>   dri3_get_front_buffer(scrn) :
>>   dri3_get_back_buffer(scrn);
>>
> Hmm. Is the wait here not necessary before getting a pixmap's front
> buffer either though? Maybe wait only here for a pixmap, and only in
> vl_dri3_flush_frontbuffer for a window?
>
> Sorry I didn't realize this earlier.
>
The pixmap case is used by Totem player, or previous GLX case for MPV 
player, and the front buffer of the pixmap is a temporary buffer, and 
later as source for GL to present.

For pixmap case, there is no need to wait,  and the dri3 present wait 
before dri3_get_front_buffer() is not get called, because scrn->flushed 
will never be true, since our presentation flush code is not used by 
this case.

Thanks,

Leo

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] vl/dri3: remove the wait before getting back buffer

2019-03-21 Thread Liu, Leo

On 2019-03-21 4:15 a.m., Ernst Sjöstrand wrote:
> What's the expected change in behavior?

The change will make vl_dri3_screen_texture_from_drawable() call not to 
hold the pipeline. Because of the multiple of back buffers,  we can get 
the texture of the ongoing presented back buffer, and no need to wait 
the last presenting back buffer.

> Does it fix any bugs?

Yeah. With some of relatively slower hardware to play 4k@60fps, the 
presentation will miss the targeted time, and make the duration of the 
playback longer than the actual. esp. like VDPAU with scheduled 
presentation.


Thanks,

Leo


>
> Regards
> //Ernst
>
> Den ons 20 mars 2019 kl 16:42 skrev Liu, Leo :
>> The wait here is unnecessary since we got a pool of back buffers,
>> and the wait for swap buffer will happen before the present pixmap,
>> at the same time the previous back buffer will be put back to pool
>> for reuse after the check for PresentIdleNotify event
>>
>> Signed-off-by: Leo Liu 
>> ---
>>   src/gallium/auxiliary/vl/vl_winsys_dri3.c | 18 +++---
>>   1 file changed, 3 insertions(+), 15 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
>> b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>> index 152d28e59fc..1558d832555 100644
>> --- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>> +++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
>> @@ -88,7 +88,6 @@ struct vl_dri3_screen
>>  uint64_t send_sbc, recv_sbc;
>>  int64_t last_ust, ns_frame, last_msc, next_msc;
>>
>> -   bool flushed;
>>  bool is_different_gpu;
>>   };
>>
>> @@ -570,11 +569,9 @@ vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
>>  if (!back)
>>  return;
>>
>> -   if (scrn->flushed) {
>> -  while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
>> - if (!dri3_wait_present_events(scrn))
>> -return;
>> -   }
>> +   while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
>> +  if (!dri3_wait_present_events(scrn))
>> + return;
>>
>>  rectangle.x = 0;
>>  rectangle.y = 0;
>> @@ -610,8 +607,6 @@ vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
>>
>>  xcb_flush(scrn->conn);
>>
>> -   scrn->flushed = true;
>> -
>>  return;
>>   }
>>
>> @@ -626,13 +621,6 @@ vl_dri3_screen_texture_from_drawable(struct vl_screen 
>> *vscreen, void *drawable)
>>  if (!dri3_set_drawable(scrn, (Drawable)drawable))
>> return NULL;
>>
>> -   if (scrn->flushed) {
>> -  while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
>> - if (!dri3_wait_present_events(scrn))
>> -return NULL;
>> -   }
>> -   scrn->flushed = false;
>> -
>>  buffer = (scrn->is_pixmap) ?
>>   dri3_get_front_buffer(scrn) :
>>   dri3_get_back_buffer(scrn);
>> --
>> 2.17.1
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] vl/dri3: remove the wait before getting back buffer

2019-03-21 Thread Michel Dänzer
On 2019-03-20 4:42 p.m., Liu, Leo wrote:
> The wait here is unnecessary since we got a pool of back buffers,
> and the wait for swap buffer will happen before the present pixmap,
> at the same time the previous back buffer will be put back to pool
> for reuse after the check for PresentIdleNotify event
> 
> Signed-off-by: Leo Liu 
> 
>  [...]
> 
> @@ -626,13 +621,6 @@ vl_dri3_screen_texture_from_drawable(struct vl_screen 
> *vscreen, void *drawable)
> if (!dri3_set_drawable(scrn, (Drawable)drawable))
>return NULL;
>  
> -   if (scrn->flushed) {
> -  while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
> - if (!dri3_wait_present_events(scrn))
> -return NULL;
> -   }
> -   scrn->flushed = false;
> -
> buffer = (scrn->is_pixmap) ?
>  dri3_get_front_buffer(scrn) :
>  dri3_get_back_buffer(scrn);
> 

Hmm. Is the wait here not necessary before getting a pixmap's front
buffer either though? Maybe wait only here for a pixmap, and only in
vl_dri3_flush_frontbuffer for a window?

Sorry I didn't realize this earlier.


-- 
Earthling Michel Dänzer   |  https://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] vl/dri3: remove the wait before getting back buffer

2019-03-21 Thread Ernst Sjöstrand
What's the expected change in behavior? Does it fix any bugs?

Regards
//Ernst

Den ons 20 mars 2019 kl 16:42 skrev Liu, Leo :
>
> The wait here is unnecessary since we got a pool of back buffers,
> and the wait for swap buffer will happen before the present pixmap,
> at the same time the previous back buffer will be put back to pool
> for reuse after the check for PresentIdleNotify event
>
> Signed-off-by: Leo Liu 
> ---
>  src/gallium/auxiliary/vl/vl_winsys_dri3.c | 18 +++---
>  1 file changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
> b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
> index 152d28e59fc..1558d832555 100644
> --- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
> +++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
> @@ -88,7 +88,6 @@ struct vl_dri3_screen
> uint64_t send_sbc, recv_sbc;
> int64_t last_ust, ns_frame, last_msc, next_msc;
>
> -   bool flushed;
> bool is_different_gpu;
>  };
>
> @@ -570,11 +569,9 @@ vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
> if (!back)
> return;
>
> -   if (scrn->flushed) {
> -  while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
> - if (!dri3_wait_present_events(scrn))
> -return;
> -   }
> +   while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
> +  if (!dri3_wait_present_events(scrn))
> + return;
>
> rectangle.x = 0;
> rectangle.y = 0;
> @@ -610,8 +607,6 @@ vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
>
> xcb_flush(scrn->conn);
>
> -   scrn->flushed = true;
> -
> return;
>  }
>
> @@ -626,13 +621,6 @@ vl_dri3_screen_texture_from_drawable(struct vl_screen 
> *vscreen, void *drawable)
> if (!dri3_set_drawable(scrn, (Drawable)drawable))
>return NULL;
>
> -   if (scrn->flushed) {
> -  while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
> - if (!dri3_wait_present_events(scrn))
> -return NULL;
> -   }
> -   scrn->flushed = false;
> -
> buffer = (scrn->is_pixmap) ?
>  dri3_get_front_buffer(scrn) :
>  dri3_get_back_buffer(scrn);
> --
> 2.17.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] vl/dri3: remove the wait before getting back buffer

2019-03-20 Thread Liu, Leo
The wait here is unnecessary since we got a pool of back buffers,
and the wait for swap buffer will happen before the present pixmap,
at the same time the previous back buffer will be put back to pool
for reuse after the check for PresentIdleNotify event

Signed-off-by: Leo Liu 
---
 src/gallium/auxiliary/vl/vl_winsys_dri3.c | 18 +++---
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c 
b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 152d28e59fc..1558d832555 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -88,7 +88,6 @@ struct vl_dri3_screen
uint64_t send_sbc, recv_sbc;
int64_t last_ust, ns_frame, last_msc, next_msc;
 
-   bool flushed;
bool is_different_gpu;
 };
 
@@ -570,11 +569,9 @@ vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
if (!back)
return;
 
-   if (scrn->flushed) {
-  while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
- if (!dri3_wait_present_events(scrn))
-return;
-   }
+   while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
+  if (!dri3_wait_present_events(scrn))
+ return;
 
rectangle.x = 0;
rectangle.y = 0;
@@ -610,8 +607,6 @@ vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
 
xcb_flush(scrn->conn);
 
-   scrn->flushed = true;
-
return;
 }
 
@@ -626,13 +621,6 @@ vl_dri3_screen_texture_from_drawable(struct vl_screen 
*vscreen, void *drawable)
if (!dri3_set_drawable(scrn, (Drawable)drawable))
   return NULL;
 
-   if (scrn->flushed) {
-  while (scrn->special_event && scrn->recv_sbc < scrn->send_sbc)
- if (!dri3_wait_present_events(scrn))
-return NULL;
-   }
-   scrn->flushed = false;
-
buffer = (scrn->is_pixmap) ?
 dri3_get_front_buffer(scrn) :
 dri3_get_back_buffer(scrn);
-- 
2.17.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev