[Piglit] [PATCH 2/8] piglit-dispatch: Install waffle procs during dispatch init

Daniel Kurtz djkurtz at chromium.org
Mon Jan 6 08:02:37 PST 2014


When using the PIGLIT_GL_TEST_CONFIG_* macros to create a test, a
piglit_gl_framework, 'gl_fw' is used to store gl framework state,
including core and extension gl dispatch handlers.

Just before running the actual test code, piglit_gl_test_run() gets
invoked to setup gl_fw by calling piglit_gl_framework_factory().

If using waffle, the get_wfl_*_proc dispatch handlers should be installed
during piglit_dispatch_init().  However, piglit_dispatch_init() is called
*during* piglit_gl_framework_factory(), so, gl_fw is always NULL and the
handlers are not installed.

The call chain during init looks like this:

main // from PIGLIT_GL_TEST_CONFIG_[BEGIN,END]
 piglit_gl_test_run
  piglit_gl_framework_factory
   piglit_winsys_framework_factory
    piglit_x11_framework_create
     piglit_winsys_framework_init
      piglit_wfl_framework_init
       make_context_current
        make_context_current_singlepass
         waffle_context_create() // Need to create context first
         piglit_dispatch_default_init() <= gl_fw still NULL, gl_fw not set
          piglit_dispatch_init
           piglit_get_gl_version
            glGetString() // piglit-dispatch will use non-WFL glGetString

Since gl_fw was NULL, piglit_default_init() fails to install the waffle
dispatch handlers, and the wrong glGetString() might be called to get the
GL_VERSION.

Fix this by installing get_wfl_*_proc() unconditionally.

Signed-off-by: Daniel Kurtz <djkurtz at chromium.org>
---
 tests/util/piglit-dispatch.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/util/piglit-dispatch.c b/tests/util/piglit-dispatch.c
index 5284b7d..7f9f910 100644
--- a/tests/util/piglit-dispatch.c
+++ b/tests/util/piglit-dispatch.c
@@ -233,10 +233,8 @@ piglit_dispatch_init(piglit_dispatch_api api,
 		break;
 	}
 
-	if (gl_fw) {
-		get_core_proc_address = get_wfl_core_proc;
-		get_ext_proc_address = get_wfl_ext_proc;
-	}
+	get_core_proc_address = get_wfl_core_proc;
+	get_ext_proc_address = get_wfl_ext_proc;
 #endif
 
 	/* No need to reset the dispatch pointers the first time */
-- 
1.8.5.1



More information about the Piglit mailing list