Re: [Mesa-dev] [PATCH] dri3: Stricter SBC wraparound handling

2018-05-24 Thread Michel Dänzer
On 2018-05-24 09:24 AM, Juan A. Suarez Romero wrote:
> On Wed, 2018-05-16 at 11:10 +0200, Michel Dänzer wrote:
>> From: Michel Dänzer 
>>
>> Prevents spuriously bumping the upper 32 bits of the SBC, which results
>> in hangs with the modesetting driver from xserver 1.20.
>>
> 
> I've picked this patch for 18.0, as it was nominated when pushed to master.
> 
> Nevertheless, the patch didn't apply cleanly in branch, so I've resolved
> conflicts.
> 
> 
> You can find the commited solved patch at
> 
> https://github.com/Igalia/release-mesa/commit/b582b8fc93697d193365bf11cd9f336d78
> 6d7f8d

Looks good, thanks! Looks like it didn't apply cleanly because 18.0
doesn't have commit 3160cb86aa92 "egl/x11: Re-allocate buffers if format
is suboptimal".


-- 
Earthling Michel Dänzer   |   http://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] dri3: Stricter SBC wraparound handling

2018-05-24 Thread Juan A. Suarez Romero
On Wed, 2018-05-16 at 11:10 +0200, Michel Dänzer wrote:
> From: Michel Dänzer 
> 
> Prevents spuriously bumping the upper 32 bits of the SBC, which results
> in hangs with the modesetting driver from xserver 1.20.
> 

I've picked this patch for 18.0, as it was nominated when pushed to master.

Nevertheless, the patch didn't apply cleanly in branch, so I've resolved
conflicts.


You can find the commited solved patch at

https://github.com/Igalia/release-mesa/commit/b582b8fc93697d193365bf11cd9f336d78
6d7f8d


If you think the patch was solved wrongly, please, send me a fixed version.
Thanks in advance!


J.A.


> Bugzilla: https://bugs.freedesktop.org/106351
> Tested-by: Mike Lothian 
> Signed-off-by: Michel Dänzer 
> ---
>  src/loader/loader_dri3_helper.c | 14 +++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
> index 6db8303d26d..f0ff2f07bde 100644
> --- a/src/loader/loader_dri3_helper.c
> +++ b/src/loader/loader_dri3_helper.c
> @@ -370,9 +370,17 @@ dri3_handle_present_event(struct loader_dri3_drawable 
> *draw,
> * checking for wrap.
> */
>if (ce->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP) {
> - draw->recv_sbc = (draw->send_sbc & 0xLL) | 
> ce->serial;
> - if (draw->recv_sbc > draw->send_sbc)
> -draw->recv_sbc -= 0x1;
> + uint64_t recv_sbc = (draw->send_sbc & 0xLL) | 
> ce->serial;
> +
> + /* Only assume wraparound if that results in exactly the previous
> +  * SBC + 1, otherwise ignore received SBC > sent SBC (those are
> +  * probably from a previous loader_dri3_drawable instance) to avoid
> +  * calculating bogus target MSC values in 
> loader_dri3_swap_buffers_msc
> +  */
> + if (recv_sbc <= draw->send_sbc)
> +draw->recv_sbc = recv_sbc;
> + else if (recv_sbc == (draw->recv_sbc + 0x10001ULL))
> +draw->recv_sbc = recv_sbc - 0x1ULL;
>  
>   /* When moving from flip to copy, we assume that we can allocate in
>* a more optimal way if we don't need to cater for the display
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri3: Stricter SBC wraparound handling

2018-05-19 Thread Mike Lothian
I had hoped this would land in 18.1.0

Any signs of a review and can we get this backported asap?

On Wed, 16 May 2018, 15:49 Michel Dänzer,  wrote:

> On 2018-05-16 01:39 PM, Mike Lothian wrote:
> > Can this be added to stable too?
>
> Right, I meant add that but forgot, thanks for the reminder. Consider it
> done.
>
>
> --
> Earthling Michel Dänzer   |   http://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] dri3: Stricter SBC wraparound handling

2018-05-16 Thread Michel Dänzer
On 2018-05-16 01:39 PM, Mike Lothian wrote:
> Can this be added to stable too?

Right, I meant add that but forgot, thanks for the reminder. Consider it
done.


-- 
Earthling Michel Dänzer   |   http://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] dri3: Stricter SBC wraparound handling

2018-05-16 Thread Mike Lothian
Can this be added to stable too?

On Wed, 16 May 2018 at 10:33 Michel Dänzer  wrote:

> On 2018-05-16 11:14 AM, Axel Davy wrote:
> > Hi,
> >
> > Shouldn't this be fixed on the xserver or the ddx side, rather than in
> > Mesa ?
> No, it's a Mesa bug, the X server is doing what it's asked. (This wasn't
> noticed earlier because Xorg drivers using the old DRM_IOCTL_WAIT_VBLANK
> ioctl effectively ignore the upper 32 bits of the target MSC value).
>
>
> --
> Earthling Michel Dänzer   |   http://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
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] dri3: Stricter SBC wraparound handling

2018-05-16 Thread Michel Dänzer
On 2018-05-16 11:14 AM, Axel Davy wrote:
> Hi,
> 
> Shouldn't this be fixed on the xserver or the ddx side, rather than in
> Mesa ?
No, it's a Mesa bug, the X server is doing what it's asked. (This wasn't
noticed earlier because Xorg drivers using the old DRM_IOCTL_WAIT_VBLANK
ioctl effectively ignore the upper 32 bits of the target MSC value).


-- 
Earthling Michel Dänzer   |   http://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] dri3: Stricter SBC wraparound handling

2018-05-16 Thread Axel Davy

Hi,

Shouldn't this be fixed on the xserver or the ddx side, rather than in 
Mesa ?


Yours,

Axel Davy

On 16/05/2018 11:10, Michel Dänzer wrote:

From: Michel Dänzer 

Prevents spuriously bumping the upper 32 bits of the SBC, which results
in hangs with the modesetting driver from xserver 1.20.

Bugzilla: https://bugs.freedesktop.org/106351
Tested-by: Mike Lothian 
Signed-off-by: Michel Dänzer 
---
  src/loader/loader_dri3_helper.c | 14 +++---
  1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 6db8303d26d..f0ff2f07bde 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -370,9 +370,17 @@ dri3_handle_present_event(struct loader_dri3_drawable 
*draw,
 * checking for wrap.
 */
if (ce->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP) {
- draw->recv_sbc = (draw->send_sbc & 0xLL) | ce->serial;
- if (draw->recv_sbc > draw->send_sbc)
-draw->recv_sbc -= 0x1;
+ uint64_t recv_sbc = (draw->send_sbc & 0xLL) | 
ce->serial;
+
+ /* Only assume wraparound if that results in exactly the previous
+  * SBC + 1, otherwise ignore received SBC > sent SBC (those are
+  * probably from a previous loader_dri3_drawable instance) to avoid
+  * calculating bogus target MSC values in loader_dri3_swap_buffers_msc
+  */
+ if (recv_sbc <= draw->send_sbc)
+draw->recv_sbc = recv_sbc;
+ else if (recv_sbc == (draw->recv_sbc + 0x10001ULL))
+draw->recv_sbc = recv_sbc - 0x1ULL;
  
   /* When moving from flip to copy, we assume that we can allocate in

* a more optimal way if we don't need to cater for the display



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


[Mesa-dev] [PATCH] dri3: Stricter SBC wraparound handling

2018-05-16 Thread Michel Dänzer
From: Michel Dänzer 

Prevents spuriously bumping the upper 32 bits of the SBC, which results
in hangs with the modesetting driver from xserver 1.20.

Bugzilla: https://bugs.freedesktop.org/106351
Tested-by: Mike Lothian 
Signed-off-by: Michel Dänzer 
---
 src/loader/loader_dri3_helper.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 6db8303d26d..f0ff2f07bde 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -370,9 +370,17 @@ dri3_handle_present_event(struct loader_dri3_drawable 
*draw,
* checking for wrap.
*/
   if (ce->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP) {
- draw->recv_sbc = (draw->send_sbc & 0xLL) | ce->serial;
- if (draw->recv_sbc > draw->send_sbc)
-draw->recv_sbc -= 0x1;
+ uint64_t recv_sbc = (draw->send_sbc & 0xLL) | 
ce->serial;
+
+ /* Only assume wraparound if that results in exactly the previous
+  * SBC + 1, otherwise ignore received SBC > sent SBC (those are
+  * probably from a previous loader_dri3_drawable instance) to avoid
+  * calculating bogus target MSC values in loader_dri3_swap_buffers_msc
+  */
+ if (recv_sbc <= draw->send_sbc)
+draw->recv_sbc = recv_sbc;
+ else if (recv_sbc == (draw->recv_sbc + 0x10001ULL))
+draw->recv_sbc = recv_sbc - 0x1ULL;
 
  /* When moving from flip to copy, we assume that we can allocate in
   * a more optimal way if we don't need to cater for the display
-- 
2.17.0

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