Re: [Mesa-dev] [PATCH 1/5] glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC==0 correctly.

2014-12-04 Thread Axel Davy

On 02/12/2014 20:53, Mario Kleiner wrote :

targetSBC == 0 is a special case, which asks the function
to block until all pending OpenGL bufferswap requests have
completed.

Currently the function just falls through for targetSBC == 0,
returning bogus results.

This breaks applications originally written and tested against
DRI2 which also rely on this not regressing under DRI3/Present,
e.g., Neuro-Science software like Psychtoolbox-3.

This patch fixes the problem.

Cc: 10.3 10.4 mesa-sta...@lists.freedesktop.org
Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com
---
  src/glx/dri3_glx.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index a9ff73b..b4ac278 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -529,7 +529,8 @@ dri3_wait_for_sbc(__GLXDRIdrawable *pdraw, int64_t 
target_sbc, int64_t *ust,
  {
 struct dri3_drawable *priv = (struct dri3_drawable *) pdraw;
  
-   while (priv-recv_sbc  target_sbc) {

+   while ((target_sbc != 0  priv-recv_sbc  target_sbc) ||
+  (target_sbc == 0  priv-recv_sbc  priv-send_sbc)) {
if (!dri3_wait_for_event(pdraw))
   return 0;
 }

Looks good to me.

Reviewed-by: Axel Davy axel.d...@ens.fr
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/5] glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC==0 correctly.

2014-12-04 Thread Axel Davy

Le 04/12/2014 11:44, Axel Davy a écrit :

On 02/12/2014 20:53, Mario Kleiner wrote :

targetSBC == 0 is a special case, which asks the function
to block until all pending OpenGL bufferswap requests have
completed.

Currently the function just falls through for targetSBC == 0,
returning bogus results.

This breaks applications originally written and tested against
DRI2 which also rely on this not regressing under DRI3/Present,
e.g., Neuro-Science software like Psychtoolbox-3.

This patch fixes the problem.

Cc: 10.3 10.4 mesa-sta...@lists.freedesktop.org
Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com
---
  src/glx/dri3_glx.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index a9ff73b..b4ac278 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -529,7 +529,8 @@ dri3_wait_for_sbc(__GLXDRIdrawable *pdraw, 
int64_t target_sbc, int64_t *ust,

  {
 struct dri3_drawable *priv = (struct dri3_drawable *) pdraw;
  -   while (priv-recv_sbc  target_sbc) {
+   while ((target_sbc != 0  priv-recv_sbc  target_sbc) ||
+  (target_sbc == 0  priv-recv_sbc  priv-send_sbc)) {
if (!dri3_wait_for_event(pdraw))
   return 0;
 }

Looks good to me.

Reviewed-by: Axel Davy axel.d...@ens.fr
___


Just an additional thought:

it would probably better to do instead:

if (!target_sbc)
target_sbc = priv-send_sbc;
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/5] glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC==0 correctly.

2014-12-04 Thread Mario Kleiner

On 12/04/2014 11:48 AM, Axel Davy wrote:

Le 04/12/2014 11:44, Axel Davy a écrit :

On 02/12/2014 20:53, Mario Kleiner wrote :

targetSBC == 0 is a special case, which asks the function
to block until all pending OpenGL bufferswap requests have
completed.

Currently the function just falls through for targetSBC == 0,
returning bogus results.

This breaks applications originally written and tested against
DRI2 which also rely on this not regressing under DRI3/Present,
e.g., Neuro-Science software like Psychtoolbox-3.

This patch fixes the problem.

Cc: 10.3 10.4 mesa-sta...@lists.freedesktop.org
Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com
---
  src/glx/dri3_glx.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index a9ff73b..b4ac278 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -529,7 +529,8 @@ dri3_wait_for_sbc(__GLXDRIdrawable *pdraw, 
int64_t target_sbc, int64_t *ust,

  {
 struct dri3_drawable *priv = (struct dri3_drawable *) pdraw;
  -   while (priv-recv_sbc  target_sbc) {
+   while ((target_sbc != 0  priv-recv_sbc  target_sbc) ||
+  (target_sbc == 0  priv-recv_sbc  priv-send_sbc)) {
if (!dri3_wait_for_event(pdraw))
   return 0;
 }

Looks good to me.

Reviewed-by: Axel Davy axel.d...@ens.fr
___


Just an additional thought:

it would probably better to do instead:

if (!target_sbc)
target_sbc = priv-send_sbc;


Yep. Will change it. Will also make the other suggested changes for the 
other patches and then send out a new series.


thanks,
-mario

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


Re: [Mesa-dev] [PATCH 1/5] glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC==0 correctly.

2014-12-04 Thread Eric Anholt
Mario Kleiner mario.kleiner...@gmail.com writes:

 On 12/04/2014 11:48 AM, Axel Davy wrote:
 Le 04/12/2014 11:44, Axel Davy a écrit :
 On 02/12/2014 20:53, Mario Kleiner wrote :
 targetSBC == 0 is a special case, which asks the function
 to block until all pending OpenGL bufferswap requests have
 completed.

 Currently the function just falls through for targetSBC == 0,
 returning bogus results.

 This breaks applications originally written and tested against
 DRI2 which also rely on this not regressing under DRI3/Present,
 e.g., Neuro-Science software like Psychtoolbox-3.

 This patch fixes the problem.

 Cc: 10.3 10.4 mesa-sta...@lists.freedesktop.org
 Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com
 ---
   src/glx/dri3_glx.c | 3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
 index a9ff73b..b4ac278 100644
 --- a/src/glx/dri3_glx.c
 +++ b/src/glx/dri3_glx.c
 @@ -529,7 +529,8 @@ dri3_wait_for_sbc(__GLXDRIdrawable *pdraw, 
 int64_t target_sbc, int64_t *ust,
   {
  struct dri3_drawable *priv = (struct dri3_drawable *) pdraw;
   -   while (priv-recv_sbc  target_sbc) {
 +   while ((target_sbc != 0  priv-recv_sbc  target_sbc) ||
 +  (target_sbc == 0  priv-recv_sbc  priv-send_sbc)) {
 if (!dri3_wait_for_event(pdraw))
return 0;
  }
 Looks good to me.

 Reviewed-by: Axel Davy axel.d...@ens.fr
 ___

 Just an additional thought:

 it would probably better to do instead:

 if (!target_sbc)
 target_sbc = priv-send_sbc;

 Yep. Will change it. Will also make the other suggested changes for the 
 other patches and then send out a new series.

It can be nice to add spec citations so the next reader knows why odd
things are there, like:

/* From the GLX_OML_sync_control spec:
 *
 * If target_sbc = 0, the function will block until all previous
 *  swaps requested with glXSwapBuffersMscOML for that window have
 *  completed.
 */

Bonus points if you add it, but either way the simplified lines here
get:

Reviewed-by: Eric Anholt e...@anholt.net


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/5] glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC==0 correctly. (v2)

2014-12-04 Thread Mario Kleiner
targetSBC == 0 is a special case, which asks the function
to block until all pending OpenGL bufferswap requests have
completed.

Currently the function just falls through for targetSBC == 0,
returning bogus results.

This breaks applications originally written and tested against
DRI2 which also rely on this not regressing under DRI3/Present,
e.g., Neuro-Science software like Psychtoolbox-3.

This patch fixes the problem.

v2: Simplify as suggested by Axel Davy. Add comments proposed
by Eric Anholt.

Cc: 10.3 10.4 mesa-sta...@lists.freedesktop.org
Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com
Reviewed-by: Axel Davy axel.d...@ens.fr
Reviewed-by: Eric Anholt e...@anholt.net
---
 src/glx/dri3_glx.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index a9ff73b..15d874d 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -529,6 +529,15 @@ dri3_wait_for_sbc(__GLXDRIdrawable *pdraw, int64_t 
target_sbc, int64_t *ust,
 {
struct dri3_drawable *priv = (struct dri3_drawable *) pdraw;
 
+   /* From the GLX_OML_sync_control spec:
+*
+* If target_sbc = 0, the function will block until all previous
+*  swaps requested with glXSwapBuffersMscOML for that window have
+*  completed.
+*/
+   if (!target_sbc)
+  target_sbc = priv-send_sbc;
+
while (priv-recv_sbc  target_sbc) {
   if (!dri3_wait_for_event(pdraw))
  return 0;
-- 
2.1.0

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


[Mesa-dev] [PATCH 1/5] glx/dri3: Fix glXWaitForSbcOML() to handle targetSBC==0 correctly.

2014-12-02 Thread Mario Kleiner
targetSBC == 0 is a special case, which asks the function
to block until all pending OpenGL bufferswap requests have
completed.

Currently the function just falls through for targetSBC == 0,
returning bogus results.

This breaks applications originally written and tested against
DRI2 which also rely on this not regressing under DRI3/Present,
e.g., Neuro-Science software like Psychtoolbox-3.

This patch fixes the problem.

Cc: 10.3 10.4 mesa-sta...@lists.freedesktop.org
Signed-off-by: Mario Kleiner mario.kleiner...@gmail.com
---
 src/glx/dri3_glx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index a9ff73b..b4ac278 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -529,7 +529,8 @@ dri3_wait_for_sbc(__GLXDRIdrawable *pdraw, int64_t 
target_sbc, int64_t *ust,
 {
struct dri3_drawable *priv = (struct dri3_drawable *) pdraw;
 
-   while (priv-recv_sbc  target_sbc) {
+   while ((target_sbc != 0  priv-recv_sbc  target_sbc) ||
+  (target_sbc == 0  priv-recv_sbc  priv-send_sbc)) {
   if (!dri3_wait_for_event(pdraw))
  return 0;
}
-- 
1.9.1

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