[Piglit] [PATCH 04/14] piglit: Prefer waffle's getprocaddress/dlsym() support to our own.

Paul Berry stereotype441 at gmail.com
Wed Jun 12 13:32:01 PDT 2013


On 5 June 2013 16:14, Eric Anholt <eric at anholt.net> wrote:

> Notably, waffle has EGL bits which this stuff doesn't.  We can't
> globally enable this and remove the old platform-specific
> dlsym/getprocaddress code, because waffle isn't always built against
> yet, and even when we're building against it, it's not used in some of
> the EGL/GLX tests (yet, at least).
> ---
>  tests/util/piglit-dispatch.c     | 62
> ++++++++++++++++++++++++++++++++++++++++
>  tests/util/piglit-framework-gl.c |  2 +-
>  tests/util/piglit-framework-gl.h |  1 +
>  3 files changed, 64 insertions(+), 1 deletion(-)
>
> diff --git a/tests/util/piglit-dispatch.c b/tests/util/piglit-dispatch.c
> index 4b7f4fa..3ce89f7 100644
> --- a/tests/util/piglit-dispatch.c
> +++ b/tests/util/piglit-dispatch.c
> @@ -23,6 +23,12 @@
>  #include "piglit-dispatch.h"
>  #include "piglit-util-gl-common.h"
>
> +#if defined(PIGLIT_USE_WAFFLE)
> +#include <waffle.h>
> +#include "piglit-util-waffle.h"
> +#include "piglit-framework-gl.h"
> +#endif
> +
>  #ifdef _WIN32
>  #define inline __inline
>  #endif
> @@ -82,6 +88,43 @@ check_initialized()
>         exit(1);
>  }
>
> +#ifdef PIGLIT_USE_WAFFLE
> +static enum waffle_enum piglit_waffle_dl = WAFFLE_DL_OPENGL;
> +
> +/**
> + * Generated code calls this function to retrieve the address of a
> + * core function.
> + */
> +static piglit_dispatch_function_ptr
> +get_wfl_core_proc(const char *name, int gl_10x_version)
> +{
> +       piglit_dispatch_function_ptr func;
> +
> +       func =
> (piglit_dispatch_function_ptr)waffle_dl_sym(piglit_waffle_dl,
> +                                                          name);
> +       if (!func)
> +               wfl_log_error(__FUNCTION__);
> +
> +       return func;
> +}
> +
> +/**
> + * Generated code calls this function to retrieve the address of a
> + * core function.
> + */
> +static piglit_dispatch_function_ptr
> +get_wfl_ext_proc(const char *name)
> +{
> +       piglit_dispatch_function_ptr func;
> +
> +       func = (piglit_dispatch_function_ptr)waffle_get_proc_address(name);
> +       if (!func)
> +               wfl_log_error(__FUNCTION__);
> +
> +       return func;
> +}
> +#endif
> +
>  /**
>   * Generated code calls this function to retrieve the address of a
>   * core function.
> @@ -171,6 +214,25 @@ piglit_dispatch_init(piglit_dispatch_api api,
>         unsupported = unsupported_proc;
>         get_proc_address_failure = failure_proc;
>
> +#ifdef PIGLIT_USE_WAFFLE
> +       switch (api) {
> +       case PIGLIT_DISPATCH_GL:
> +               piglit_waffle_dl = WAFFLE_DL_OPENGL;
> +               break;
> +       case PIGLIT_DISPATCH_ES1:
> +               piglit_waffle_dl = WAFFLE_DL_OPENGL_ES1;
> +               break;
> +       case PIGLIT_DISPATCH_ES2:
> +               piglit_waffle_dl = WAFFLE_DL_OPENGL_ES2;
> +               break;
> +       }
> +
> +       if (gl_fw) {
> +               get_core_proc_address = get_wfl_core_proc;
> +               get_ext_proc_address = get_wfl_ext_proc;
> +       }
> +#endif
> +
>

Can we update the comment above this function to say that
get_core_proc_address and get_ext_proc_address are ignored when Waffle is
in use?

With that, this patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


>         /* No need to reset the dispatch pointers the first time */
>         if (is_initialized) {
>                 reset_dispatch_pointers();
> diff --git a/tests/util/piglit-framework-gl.c
> b/tests/util/piglit-framework-gl.c
> index 441e271..077d370 100644
> --- a/tests/util/piglit-framework-gl.c
> +++ b/tests/util/piglit-framework-gl.c
> @@ -30,7 +30,7 @@
>  #include "piglit-util-gl-common.h"
>  #include "piglit-framework-gl/piglit_gl_framework.h"
>
> -static struct piglit_gl_framework *gl_fw;
> +struct piglit_gl_framework *gl_fw;
>
>  bool piglit_use_fbo = false;
>  int piglit_automatic = 0;
> diff --git a/tests/util/piglit-framework-gl.h
> b/tests/util/piglit-framework-gl.h
> index 4406c1b..5e1723b 100644
> --- a/tests/util/piglit-framework-gl.h
> +++ b/tests/util/piglit-framework-gl.h
> @@ -234,6 +234,7 @@ extern int piglit_width;
>  extern int piglit_height;
>  extern bool piglit_use_fbo;
>  extern unsigned int piglit_winsys_fbo;
> +extern struct piglit_gl_framework *gl_fw;
>
>  void piglit_swap_buffers(void);
>  void piglit_present_results();
> --
> 1.8.3.rc0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20130612/43ba7252/attachment-0001.html>


More information about the Piglit mailing list