On 02/12/2016 11:55 PM, Emil Velikov wrote:
On 12 February 2016 at 05:34, Tapani Pälli <tapani.pa...@intel.com> wrote:
On 02/12/2016 02:54 AM, Emil Velikov wrote:
On 11 February 2016 at 12:04, Tapani Pälli <tapani.pa...@intel.com> wrote:
From: Bernard Kilarski <bernard.r.kilar...@intel.com>

Signed-off-by: Bernard Kilarski <bernard.r.kilar...@intel.com>
Signed-off-by: Matt Roper <matthew.d.ro...@intel.com>
Cc: "11.0 11.1" <mesa-sta...@lists.freedesktop.org
---
   src/glx/glxcmds.c                         | 2 +-
   src/glx/query_renderer.c                  | 4 ++--
   src/glx/tests/query_renderer_unittest.cpp | 4 ++++
   3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 93e8db5..4db67ec 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -1727,7 +1727,7 @@ __glXSwapIntervalSGI(int interval)
      CARD32 *interval_ptr;
      CARD8 opcode;

-   if (gc == NULL) {
+   if (gc == NULL || gc == &dummyContext) {
         return GLX_BAD_CONTEXT;
      }

diff --git a/src/glx/query_renderer.c b/src/glx/query_renderer.c
index 9108ec2..d49b8fe 100644
--- a/src/glx/query_renderer.c
+++ b/src/glx/query_renderer.c
@@ -106,7 +106,7 @@ glXQueryCurrentRendererIntegerMESA(int attribute,
unsigned int *value)
   {
      struct glx_context *gc = __glXGetCurrentContext();

-   if (gc == NULL)
+   if (gc == NULL || gc == &dummyContext)
         return False;

      return __glXQueryRendererInteger(gc->psc, attribute, value);
@@ -166,7 +166,7 @@ glXQueryCurrentRendererStringMESA(int attribute)
   {
      struct glx_context *gc = __glXGetCurrentContext();

-   if (gc == NULL)
+   if (gc == NULL || gc == &dummyContext)
Unless I'm missing something __glXGetCurrentContext() can never return
NULL, right ?

This was my initial impression also ... but I'm not sure what happens here
but unit tests (glx-test) for some reason completely explode if you take out
the null check and try running 'make check'.

I think that is why also the dummyContext is introduced in those tests. I
played around a bit with this change and linking phase with glx-test starts
to print quite weird errors, actually complete unrelated ones, I guess
because it cannot find the 'extern' declared 'dummyContext'. I'm not sure if
this is actually problem with the tests rather than this code.

Double checking - the tests are going crazy when you remove the null
check, even with the current/extra dummyContext ? That does sound
quite strange.

Yep that's the case.

// Tapani

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

Reply via email to