Re: [waffle] deprecate waffle email list? - Re: [ANNOUNCE] waffle 1.6.0

2019-06-10 Thread Dylan Baker
Acked-by: Dylan Baker 

Quoting Jordan Justen (2019-06-10 00:39:25)
> On 2019-06-07 15:48:54, Dylan Baker wrote:
> > 
> > Release remain available at waffle-gl.org,
> > http://www.waffle-gl.org/releases.html.
> > 
> > In the future we will do announcements of waffle releases through
> > mesa-annou...@lits.freedkestop.org, and not through
> > waffle@lists.freedesktop.org.
> 
> I agree that this makes sense.
> 
> It also seems like we've essentially switched to merge-requests rather
> than email based patches. Therefore, I'm not sure this email list has
> much purpose anymore.
> 
> I guess we don't need to delete the list or anything, but I think we
> should update HACKING.txt to say that patches should be contributed
> via merge request, and remove the email list from the website.
> 
> I'm guess I will hear crickets from this email. :) If so, I'll plan to
> move forward with this plan after a few days with no NACKs.
> 
> -Jordan


signature.asc
Description: signature
___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle

[waffle] [ANNOUNCE] waffle 1.6.0

2019-06-07 Thread Dylan Baker
Hi everyone,

I'd like to announce that waffle 1.6.0 is now available from it's new home on
gitlab.freedesktop.org, https://gitlab.freedesktop.org/mesa/waffle.

You will find a number of useful additions, including:
 - nacl support in cmake
 - a shiny new meson build system
 - json output from wflinfo
 - EGL/GBM modifiers support
 - Out of the box FreeBSD support when using meson

Also included are a number of behind the scenes changes from Emil, in particular
a massive refactoring/improvement of the unit tests.

Release remain available at waffle-gl.org,
http://www.waffle-gl.org/releases.html.

In the future we will do announcements of waffle releases through
mesa-annou...@lits.freedkestop.org, and not through
waffle@lists.freedesktop.org.

Dylan


signature.asc
Description: signature
___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle

[waffle] [PATCH] wayland: add support for wl_proxy_marshal_constructor_versioned

2016-04-14 Thread Dylan Baker
This fixes waffle to build against wayland 1.10.

Thanks to Jason Eckstrand for help getting this working.

Fixes #38

cc: Chad Versace <chad.vers...@linux.intel.com>
cc: Mark Janes <mark.a.ja...@intel.com>
Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com>
---
 src/waffle/wayland/wayland_wrapper.c | 1 +
 src/waffle/wayland/wayland_wrapper.h | 8 
 2 files changed, 9 insertions(+)

diff --git a/src/waffle/wayland/wayland_wrapper.c 
b/src/waffle/wayland/wayland_wrapper.c
index 6ffd5a9..06fa336 100644
--- a/src/waffle/wayland/wayland_wrapper.c
+++ b/src/waffle/wayland/wayland_wrapper.c
@@ -106,6 +106,7 @@ wayland_wrapper_init(void)
 RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_add_listener);
 RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal);
 RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor);
+RETRIEVE_WL_CLIENT_SYMBOL(wl_proxy_marshal_constructor_versioned);
 #undef RETRIEVE_WL_CLIENT_SYMBOL
 
 error:
diff --git a/src/waffle/wayland/wayland_wrapper.h 
b/src/waffle/wayland/wayland_wrapper.h
index 40a581a..e45ff64 100644
--- a/src/waffle/wayland/wayland_wrapper.h
+++ b/src/waffle/wayland/wayland_wrapper.h
@@ -75,6 +75,13 @@ struct wl_proxy *
 const struct wl_interface *interface,
 ...);
 
+struct wl_proxy *
+(*wfl_wl_proxy_marshal_constructor_versioned)(struct wl_proxy *proxy,
+  uint32_t opcode,
+  const struct wl_interface 
*interface,
+  uint32_t version,
+  ...);
+
 #ifdef _WAYLAND_CLIENT_H
 #error Do not include wayland-client.h ahead of wayland_wrapper.h
 #endif
@@ -92,3 +99,4 @@ struct wl_proxy *
 #define wl_proxy_add_listener (*wfl_wl_proxy_add_listener)
 #define wl_proxy_marshal (*wfl_wl_proxy_marshal)
 #define wl_proxy_marshal_constructor (*wfl_wl_proxy_marshal_constructor)
+#define wl_proxy_marshal_constructor_versioned 
(*wfl_wl_proxy_marshal_constructor_versioned)
-- 
2.8.0

___
waffle mailing list
waffle@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH v2 3/4] wflinfo.c: split version, renderer, and vendor checks

2016-01-06 Thread Dylan Baker
On Wed, Jan 6, 2016 at 1:30 PM, Emil Velikov <emil.l.veli...@gmail.com>
wrote:

> On 5 January 2016 at 19:46,  <baker.dyla...@gmail.com> wrote:
> > From: Dylan Baker <baker.dyla...@gmail.com>
> >
> > Pull these out into helper functions, this change will be used in a
> > following patch to add a JSON printer.
> >
> > Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com>
> >
> > v2: - change "const char * name" to "const char *name" (Frank)
> > ---
> >  src/utils/wflinfo.c | 50
> --
> >  1 file changed, 36 insertions(+), 14 deletions(-)
> >
> > diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
> > index 4b9..8ee95c6 100644
> > --- a/src/utils/wflinfo.c
> > +++ b/src/utils/wflinfo.c
> > @@ -460,6 +460,39 @@ parse_version(const char *version)
> >  return (major * 10) + minor;
> >  }
> >
> > +static const char *
> > +get_vendor(void)
> > +{
> > +const char *vendor = (const char *) glGetString(GL_VENDOR);
> > +if (glGetError() != GL_NO_ERROR || vendor == NULL) {
> > +vendor = "WFLINFO_GL_ERROR";
> > +}
> > +
> Wish I caught you before re-spinning things. This and the other two
> can loose the brackets - those were added due to bugs in MSVC's C99
> parser. This comment is another "if things ever get to v3".
>
> -Emil
>

After learning GO I'm always going to use brackets, because being in a good
habit of using brackets prevents an entire class of bugs (like apple's ssl
return bug). Unless Chad really objects to having the brackets I prefer
them.
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH 00/12] JSON and platform-specific wflinfo

2016-01-06 Thread Dylan Baker
On Wed, Jan 6, 2016 at 4:12 PM, Frank Henigman <fjhenig...@google.com>
wrote:

> On Wed, Jan 6, 2016 at 6:43 PM, Dylan Baker <baker.dyla...@gmail.com>
> wrote:
> > Okay, I have some comments:
> >
> > When I run wflinfo -p gbm -a gl -f json | jsontidy (a small python
> script I
> > have that formats JSON to be human readable)
> > I get this:
> > {
> > "generic": {
> > "waffle": {
> > "api": "WAFFLE_CONTEXT_OPENGL",
> > "platform": "WAFFLE_PLATFORM_GBM"
> > },
> > "extensions": [
> > "GL_3DFX_texture_compression_FXT1",
> > ... (truncated for readability)
> > "GL_SUN_multi_draw_arrays"
> > ],
> > "opengl": {
> > "renderer": "Mesa DRI Intel(R) Haswell Mobile ",
> > "version": "3.0 Mesa 11.1.0",
> > "vendor": "Intel Open Source Technology Center"
> > },
> > "shading_language_version": "1.30"
> > }
> > }
> >
> > I think the shading_language_version and extensions belong in the opengl
> > dictionary.
>
> I didn't give much thought at the time to structure nor key names.
> Figured there
> would some debate in any case.  (-:
> Makes sense to put gl extensions in the "opengl" block.
> How about a glsl block?  Seems like there might be other stuff in it some
> day,
> and adds consistency to the use of "version" i.e.
>   "glsl" : {
> "version" : "1.30"
>   }
> I'm not as sure about putting it inside the opengl block, but not
> fussy about it either.
> If there's no dissent I'll do as you suggest.
>

Putting it an a "glsl" block sounds better to me.


>
> > Other than that the output seems reasonable and quite usable for my
> > purposes.
>
> Once again sorry for not sending mine out sooner.  If none of your patch
> makes
> it in, hopefully it had some value to you as an exercise.
>

It did have that.
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH 00/12] JSON and platform-specific wflinfo

2016-01-06 Thread Dylan Baker
Hi Frank,

It looks like your series is going to achieve the same result (for my use)
as mine did, but yours is probably better. With that in mind I'll be
withdrawing mine in favour of yours.

Dylan

On Wed, Jan 6, 2016 at 11:56 AM, Frank Henigman 
wrote:

> This patch set does two main things, the second of which could just as
> well be a separate patch set.
> 1-6: Move wflinfo functionality into the api, info returned as a json
> string.
> 7-12: Extend the functionality to include platform-specific info, such as
>   provided by glxinfo.
>
> After 1-6 wflinfo can be gutted to just get json from the api and present
> it as desired (dump the json, legacy wflinfo format, glxinfo compatibility
> format, verbose or not).  I do not have a patch for that yet.
>
> Since another json patch set was recently posted, I'll point out how
> this one differs...
> This set moves wflinfo functionality into the api, the other extends
> the wflinfo program.  Both options were discussed on the mailing list
> in Feb 2015 and the former was favored.  This set includes a small
> library for constructing json strings, with the aim of keeping string
> building code as clear and simple as possible.  It also tries to write
> one key:value per line to allow grepping in lieu of full json parsing.
> Finally this set adds additional platform-specific info, though as
> stated above that could be considered a follow-on.
>
>
> Frank Henigman (12):
>   core: store platform type in wcore_platform
>   core: store context API in wcore_context
>   core: store current context in wcore_display
>   core: add JSON library
>   waffle: add waffle_display_info_json()
>   wflinfo: add option for JSON output
>   waffle: support platform-specific information
>   wflinfo: add flag for platform-specific info
>   glx: implement platform-specific information
>   egl: implement platform-specific information
>   gbm: implement platform-specific information
>   x11_egl: implement platform-specific information
>
>  include/waffle/waffle.h  |   5 +
>  man/waffle_display.3.xml |  19 +++
>  src/utils/wflinfo.c  |  50 ++-
>  src/waffle/CMakeLists.txt|   1 +
>  src/waffle/api/waffle_display.c  | 292
> ++-
>  src/waffle/api/waffle_gl_misc.c  |  11 +-
>  src/waffle/api/waffle_init.c |  32 +++--
>  src/waffle/core/json.c   | 235 +++
>  src/waffle/core/json.h   |  93 +
>  src/waffle/core/wcore_context.h  |   2 +
>  src/waffle/core/wcore_display.c  |   1 +
>  src/waffle/core/wcore_display.h  |   2 +
>  src/waffle/core/wcore_platform.h |   5 +
>  src/waffle/egl/wegl_display.c|  32 -
>  src/waffle/egl/wegl_display.h|   4 +
>  src/waffle/egl/wegl_platform.h   |   3 +
>  src/waffle/gbm/wgbm_platform.c   |   1 +
>  src/waffle/glx/glx_display.c |  41 ++
>  src/waffle/glx/glx_display.h |   4 +
>  src/waffle/glx/glx_platform.c|   4 +
>  src/waffle/glx/glx_platform.h|   3 +
>  src/waffle/waffle.def.in |   1 +
>  src/waffle/xegl/xegl_platform.c  |   1 +
>  23 files changed, 820 insertions(+), 22 deletions(-)
>  create mode 100644 src/waffle/core/json.c
>  create mode 100644 src/waffle/core/json.h
>
> --
> 2.6.0.rc2.230.g3dd15c0
>
> ___
> waffle mailing list
> waffle@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/waffle
>
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH 00/12] JSON and platform-specific wflinfo

2016-01-06 Thread Dylan Baker
Okay, I have some comments:

When I run wflinfo -p gbm -a gl -f json | jsontidy (a small python script I
have that formats JSON to be human readable)
I get this:
{
"generic": {
"waffle": {
"api": "WAFFLE_CONTEXT_OPENGL",
"platform": "WAFFLE_PLATFORM_GBM"
},
"extensions": [
"GL_3DFX_texture_compression_FXT1",
... (truncated for readability)
"GL_SUN_multi_draw_arrays"
],
"opengl": {
"renderer": "Mesa DRI Intel(R) Haswell Mobile ",
"version": "3.0 Mesa 11.1.0",
"vendor": "Intel Open Source Technology Center"
},
"shading_language_version": "1.30"
}
}

I think the shading_language_version and extensions belong in the opengl
dictionary.

Other than that the output seems reasonable and quite usable for my
purposes.


On Wed, Jan 6, 2016 at 3:06 PM, Dylan Baker <baker.dyla...@gmail.com> wrote:

> Hi Frank,
>
> It looks like your series is going to achieve the same result (for my use)
> as mine did, but yours is probably better. With that in mind I'll be
> withdrawing mine in favour of yours.
>
> Dylan
>
> On Wed, Jan 6, 2016 at 11:56 AM, Frank Henigman <fjhenig...@google.com>
> wrote:
>
>> This patch set does two main things, the second of which could just as
>> well be a separate patch set.
>> 1-6: Move wflinfo functionality into the api, info returned as a json
>> string.
>> 7-12: Extend the functionality to include platform-specific info, such as
>>   provided by glxinfo.
>>
>> After 1-6 wflinfo can be gutted to just get json from the api and present
>> it as desired (dump the json, legacy wflinfo format, glxinfo compatibility
>> format, verbose or not).  I do not have a patch for that yet.
>>
>> Since another json patch set was recently posted, I'll point out how
>> this one differs...
>> This set moves wflinfo functionality into the api, the other extends
>> the wflinfo program.  Both options were discussed on the mailing list
>> in Feb 2015 and the former was favored.  This set includes a small
>> library for constructing json strings, with the aim of keeping string
>> building code as clear and simple as possible.  It also tries to write
>> one key:value per line to allow grepping in lieu of full json parsing.
>> Finally this set adds additional platform-specific info, though as
>> stated above that could be considered a follow-on.
>>
>>
>> Frank Henigman (12):
>>   core: store platform type in wcore_platform
>>   core: store context API in wcore_context
>>   core: store current context in wcore_display
>>   core: add JSON library
>>   waffle: add waffle_display_info_json()
>>   wflinfo: add option for JSON output
>>   waffle: support platform-specific information
>>   wflinfo: add flag for platform-specific info
>>   glx: implement platform-specific information
>>   egl: implement platform-specific information
>>   gbm: implement platform-specific information
>>   x11_egl: implement platform-specific information
>>
>>  include/waffle/waffle.h  |   5 +
>>  man/waffle_display.3.xml |  19 +++
>>  src/utils/wflinfo.c  |  50 ++-
>>  src/waffle/CMakeLists.txt|   1 +
>>  src/waffle/api/waffle_display.c  | 292
>> ++-
>>  src/waffle/api/waffle_gl_misc.c  |  11 +-
>>  src/waffle/api/waffle_init.c |  32 +++--
>>  src/waffle/core/json.c   | 235 +++
>>  src/waffle/core/json.h   |  93 +
>>  src/waffle/core/wcore_context.h  |   2 +
>>  src/waffle/core/wcore_display.c  |   1 +
>>  src/waffle/core/wcore_display.h  |   2 +
>>  src/waffle/core/wcore_platform.h |   5 +
>>  src/waffle/egl/wegl_display.c|  32 -
>>  src/waffle/egl/wegl_display.h|   4 +
>>  src/waffle/egl/wegl_platform.h   |   3 +
>>  src/waffle/gbm/wgbm_platform.c   |   1 +
>>  src/waffle/glx/glx_display.c |  41 ++
>>  src/waffle/glx/glx_display.h |   4 +
>>  src/waffle/glx/glx_platform.c|   4 +
>>  src/waffle/glx/glx_platform.h|   3 +
>>  src/waffle/waffle.def.in |   1 +
>>  src/waffle/xegl/xegl_platform.c  |   1 +
>>  23 files changed, 820 insertions(+), 22 deletions(-)
>>  create mode 100644 src/waffle/core/json.c
>>  create mode 100644 src/waffle/core/json.h
>>
>> --
>> 2.6.0.rc2.230.g3dd15c0
>>
>> ___
>> waffle mailing list
>> waffle@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/waffle
>>
>
>
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [RFC 3/3] wflinfo.c: Add a --json flag that prints json

2016-01-05 Thread Dylan Baker
Okay. I'll send out a v2 shortly.

On Tue, Jan 5, 2016 at 9:24 AM, Chad Versace <chad.vers...@intel.com> wrote:

> On 12/31/2015 09:51 AM, Dylan Baker wrote:
> >
> >
> > On Wed, Dec 30, 2015 at 4:32 PM, Chad Versace <chad.vers...@intel.com
> <mailto:chad.vers...@intel.com>> wrote:
> >
> > On 12/27/2015 07:49 AM, Frank Henigman wrote:
> > > On Wed, Dec 16, 2015 at 8:37 PM,  <baker.dyla...@gmail.com
> <mailto:baker.dyla...@gmail.com>> wrote:
> > >> From: Dylan Baker <baker.dyla...@gmail.com  baker.dyla...@gmail.com>>
> > >>
> > >> This adds some code to print a JSON formatted version of data
> provided
> > >> by wflinfo.
> > >>
> > >> Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com  dylanx.c.ba...@intel.com>>
> > >> ---
> > >>  src/utils/wflinfo.c | 174
> +++-
> >
> >
> >
> > >> +static void
> > >> +json_print_context_flags(void)
> > >> +{
> > >> +int flag_count = sizeof(flags) / sizeof(flags[0]);
> >
> > This should be
> >
> > const int flag_count = ARRAY_SIZE(flags);
> >
> > Optionally, you could even remove the flag_count variable altogether
> > and use ARRAY_SIZE(flags) everywhere. But it doesn't really matter.
> >
> >
> > This was copied from the original print_context_flags function. Should I
> chang ethat to ARRAY_SIZE as well (presumably in a separate patch)?
>
> Yes. It would be nice if you cleaned up print_context_flags in a separate
> patch.
>
> > >> +
> > >> +printf("[\n");
> > >> +for (int i = 0; i < flag_count; i++) {
> > >> +if ((flags[i].flag & context_flags) != 0) {
> > >> +printf("\"%s\"", flags[i].str);
> > >> +context_flags = context_flags & ~flags[i].flag;
> > >> +if (i != flag_count) {
> > >> +printf(",\n");
> > >> +}
> > >> +}
> > >> +}
> > >> +for (int i = 0; context_flags != 0; context_flags >>= 1,
> i++) {
> > >> +if ((context_flags & 1) != 0) {
> > >> +printf(",\n");
> > >> +printf("0x%x", 1 << i);
> > >> +}
> > >> +}
> > >> +printf("]");
> >
> > Like Frank said, it would be nice if the json code didn't duplicate
> so much of the
> > original code. But, because you're not confident yet in C (as you
> say in the cover letter),
> > I'll accept the duplication in this function. I'll offer to
> deduplicate the code myself if the patches
> > go upstream.
> >
> >
> > I'm curious what the (or a) good approach would be to fix this. I
> > tried making a similar implementaiton in python (which I'm more
> > comfortable with) and still had a hard time coming up with a good way
> > to share code.
> >
> > Personally I find being thrown in the deep in the best way to learn
> > to swim, so if you could point me in the right (or at least a good)
> > direction I'd like to take a stab at it.
>
> Honestly, I also don't see a clean way to deduplicate the code for the
> variable-length fields. Perhaps careful use of template strings that the
> loops fill out with sprintf.
>
> I suggest you don't worry about deduplication in this patch series, and
> we can revisit it after the patches land. It would be silly to stall the
> json
> output due to duplication of a tiny chunk of code.
>
>
> > > I think some key strings should be a bit more specific or nested,
> like
> > > "opengl version:" or "opengl : { version :" instead of just
> "version"
> > > in case we expand some day to include things like egl version.
> >
> > I agree. I also think the non-OpenGL key strings ("platform" and
> "api")
> > should be prefixed with "waffle", just as they are in the normal
> wflinfo
> > output.
> >
> >
> > I started changing this locally after Frank's comments. My plan was
> > to nest waffle specific information inside a waffle dict, OpenGL
> > (including ES) inside of an opengl dict, and then leave room for
> > other information to be in it's own data structures (say glx or egl)
> >
> > something like:
> > {
> >  "waffle": {
> >   "platform": "gbm"
> >  },
> >  "gl": {
> >   "version": 3.1,
> >   "profile": "core"
> >  }
> > }
> >
> > Does that seem reasonable?
>
> That looks good to me.
>
>
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [RFC 3/3] wflinfo.c: Add a --json flag that prints json

2015-12-31 Thread Dylan Baker
On Wed, Dec 30, 2015 at 4:32 PM, Chad Versace <chad.vers...@intel.com>
wrote:

> On 12/27/2015 07:49 AM, Frank Henigman wrote:
> > On Wed, Dec 16, 2015 at 8:37 PM,  <baker.dyla...@gmail.com> wrote:
> >> From: Dylan Baker <baker.dyla...@gmail.com>
> >>
> >> This adds some code to print a JSON formatted version of data provided
> >> by wflinfo.
> >>
> >> Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com>
> >> ---
> >>  src/utils/wflinfo.c | 174
> +++-
>
>
>
> >> +static void
> >> +json_print_context_flags(void)
> >> +{
> >> +int flag_count = sizeof(flags) / sizeof(flags[0]);
>
> This should be
>
> const int flag_count = ARRAY_SIZE(flags);
>
> Optionally, you could even remove the flag_count variable altogether
> and use ARRAY_SIZE(flags) everywhere. But it doesn't really matter.
>

This was copied from the original print_context_flags function. Should I
chang ethat to ARRAY_SIZE as well (presumably in a separate patch)?


>
> >> +GLint context_flags = 0;
> >> +
> >> +printf("\"context flags\": ");
> >> +
> >> +glGetIntegerv(GL_CONTEXT_FLAGS, _flags);
> >> +if (glGetError() != GL_NO_ERROR) {
> >> +printf("\"WFLINFO_GL_ERROR\"\n");
> >> +return;
> >> +}
> >> +
> >> +if (context_flags == 0) {
> >> +printf("\"0x0\"\n");
> >> +return;
> >> +}
>
> The json type of the "context flags" value is sometimes a string,
> sometimes an array.
> It should always be the same type, an array. When there are no flags, I
> think it should
> be an empty array.
>
>
You're right. Piglit doesn't use that information, so I didn't double check
it.

I've made that change locally


> >> +
> >> +printf("[\n");
> >> +for (int i = 0; i < flag_count; i++) {
> >> +if ((flags[i].flag & context_flags) != 0) {
> >> +printf("\"%s\"", flags[i].str);
> >> +context_flags = context_flags & ~flags[i].flag;
> >> +if (i != flag_count) {
> >> +printf(",\n");
> >> +}
> >> +}
> >> +}
> >> +for (int i = 0; context_flags != 0; context_flags >>= 1, i++) {
> >> +if ((context_flags & 1) != 0) {
> >> +printf(",\n");
> >> +printf("0x%x", 1 << i);
> >> +}
> >> +}
> >> +printf("]");
>
> Like Frank said, it would be nice if the json code didn't duplicate so
> much of the
> original code. But, because you're not confident yet in C (as you say in
> the cover letter),
> I'll accept the duplication in this function. I'll offer to deduplicate
> the code myself if the patches
> go upstream.
>

I'm curious what the (or a) good approach would be to fix this. I tried
making a similar implementaiton in python (which I'm more comfortable with)
and still had a hard time coming up with a good way to share code.

Personally I find being thrown in the deep in the best way to learn to
swim, so if you could point me in the right (or at least a good) direction
I'd like to take a stab at it.


>
> >> +
> >> +return;
>
> In C, (at least in the C projects I've worked with), the dominant code
> style omits
> the final return in void functions. The return is implicit.
>

Okay, I've dropped that.


>
> >> +}
>
>
>
> >> +const char * vendor =  get_vendor();
> >> +const char * renderer = get_renderer();
> >> +const char * version_str = get_version();
>
> In Waffle, there should be no trailing space after the '*'. In other
> words, the
> correct style is:
>
> const char *vendor = ...
>

I've fixed that, and one other case of the same thing locally.


>
>
>
> > I think some key strings should be a bit more specific or nested, like
> > "opengl version:" or "opengl : { version :" instead of just "version"
> > in case we expand some day to include things like egl version.
>
> I agree. I also think the non-OpenGL key strings ("platform" and "api")
> should be prefixed with "waffle", just as they are in the normal wflinfo
> output.
>
>
I started changing this locally after Frank's comments. My plan was to nest
waffle specific information inside a waffle dict, OpenGL (including ES)
inside of an opengl dict, and then leave room for other information to be
in it's own data structures (say glx or egl)

something like:
{
 "waffle": {
  "platform": "gbm"
 },
 "gl": {
  "version": 3.1,
  "profile": "core"
 }
}

Does that seem reasonable?

Dylan
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [RFC 1/3] wflinfo.c: split out flags struct

2015-12-29 Thread Dylan Baker
I'll take that out. It's probably a rebasing artifact anyway.

On Sun, Dec 27, 2015 at 7:43 AM, Frank Henigman <fjhenig...@google.com>
wrote:

> On Wed, Dec 16, 2015 at 8:37 PM,  <baker.dyla...@gmail.com> wrote:
> > From: Dylan Baker <baker.dyla...@gmail.com>
> >
> > This is groundwork for adding a json interface to wflinfo.
> > ---
> >  src/utils/wflinfo.c | 19 +++
> >  1 file changed, 11 insertions(+), 8 deletions(-)
> >
> > diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
> > index 268d4b8..905fd90 100644
> > --- a/src/utils/wflinfo.c
> > +++ b/src/utils/wflinfo.c
> > @@ -487,17 +487,18 @@ print_extensions(bool use_stringi)
> >  printf("\n");
> >  }
> >
> > +static struct {
> > +GLint flag;
> > +char *str;
> > +} flags[] = {
> > +{ GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, "FORWARD_COMPATIBLE" },
> > +{ GL_CONTEXT_FLAG_DEBUG_BIT, "DEBUG" },
> > +{ GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB, "ROBUST_ACCESS" },
> > +};
> > +
> >  static void
> >  print_context_flags(void)
> >  {
> > -static struct {
> > -GLint flag;
> > -char *str;
> > -} flags[] = {
> > -{ GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, "FORWARD_COMPATIBLE"
> },
> > -{ GL_CONTEXT_FLAG_DEBUG_BIT, "DEBUG" },
> > -{ GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB, "ROBUST_ACCESS" },
> > -};
> >  int flag_count = sizeof(flags) / sizeof(flags[0]);
> >  GLint context_flags = 0;
> >
> > @@ -526,6 +527,8 @@ print_context_flags(void)
> >  }
> >  }
> >  printf("\n");
> > +
> > +return;
>
> Not a big deal but I don't see the point of adding this return.
>
> >  }
> >
> >  /// @brief Print out information about the context that was created.
> > --
> > 2.6.4
> >
> > ___
> > waffle mailing list
> > waffle@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/waffle
>
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [RFC 2/3] wflinfo.c: split version, renderer, and vendor checks

2015-12-29 Thread Dylan Baker
Okay, I can fix that too.

On Sun, Dec 27, 2015 at 7:43 AM, Frank Henigman <fjhenig...@google.com>
wrote:

> On Wed, Dec 16, 2015 at 8:37 PM,  <baker.dyla...@gmail.com> wrote:
> > From: Dylan Baker <baker.dyla...@gmail.com>
> >
> > Pull these out into helper functions, this change will be used in a
> > following patch to add a json printer.
> >
> > Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com>
> > ---
> >  src/utils/wflinfo.c | 50
> --
> >  1 file changed, 36 insertions(+), 14 deletions(-)
> >
> > diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
> > index 905fd90..b843757 100644
> > --- a/src/utils/wflinfo.c
> > +++ b/src/utils/wflinfo.c
> > @@ -458,6 +458,39 @@ parse_version(const char *version)
> >  return (major * 10) + minor;
> >  }
> >
> > +static const char *
> > +get_vendor(void)
> > +{
> > +const char *vendor = (const char *) glGetString(GL_VENDOR);
> > +if (glGetError() != GL_NO_ERROR || vendor == NULL) {
> > +vendor = "WFLINFO_GL_ERROR";
> > +}
> > +
> > +return vendor;
> > +}
> > +
> > +static const char *
> > +get_renderer(void)
> > +{
> > +const char *renderer = (const char *) glGetString(GL_RENDERER);
> > +if (glGetError() != GL_NO_ERROR || renderer == NULL) {
> > +renderer = "WFLINFO_GL_ERROR";
> > +}
> > +
> > +return renderer;
> > +}
> > +
> > +static const char *
> > +get_version(void)
> > +{
> > +const char *version_str = (const char *) glGetString(GL_VERSION);
> > +if (glGetError() != GL_NO_ERROR || version_str == NULL) {
> > +version_str = "WFLINFO_GL_ERROR";
> > +}
> > +
> > +return version_str;
> > +}
> > +
> >  static void
> >  print_extensions(bool use_stringi)
> >  {
> > @@ -539,20 +572,9 @@ print_wflinfo(const struct options *opts)
> >  /* Clear all errors */
> >  }
> >
> > -const char *vendor = (const char *) glGetString(GL_VENDOR);
> > -if (glGetError() != GL_NO_ERROR || vendor == NULL) {
> > -vendor = "WFLINFO_GL_ERROR";
> > -}
> > -
> > -const char *renderer = (const char *) glGetString(GL_RENDERER);
> > -if (glGetError() != GL_NO_ERROR || renderer == NULL) {
> > -renderer = "WFLINFO_GL_ERROR";
> > -}
> > -
> > -const char *version_str = (const char *) glGetString(GL_VERSION);
> > -if (glGetError() != GL_NO_ERROR || version_str == NULL) {
> > -version_str = "WFLINFO_GL_ERROR";
> > -}
> > +const char * vendor =  get_vendor();
> > +const char * renderer = get_renderer();
> > +const char * version_str = get_version();
>
> nit: usually no space after *
>
> >  const char *platform = enum_map_to_str(platform_map,
> opts->platform);
> >  assert(platform != NULL);
> > --
> > 2.6.4
> >
> > ___
> > waffle mailing list
> > waffle@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/waffle
>
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [wflinfo] [RFC] platform-specific info from wflinfo

2015-04-22 Thread Dylan Baker
  I think I'd prefer to not convert wflinfo to python.
 
 I also hesitate to convert wflinfo to python. After we push all the
 complexity of wflinfo.c into a library call, then wflinfo.c will largely
 consist of argparsing and a minimal json parser. wflinfo.c will then be
 so small that I don't expect to gain much benefit in moving it to
 wflinfo.py. (I expect moving it to Python might make it *more*
 complicated if its argparsing code attempts to be python-2-and-3
 compatible).

I don't have a dog in the race, but:
Having written a python2.x/3.x compatible code it's not very hard as
long as you don't have to support python  2.5 or 3.0 - 3.1
argparse is available from 2.7 and 3.1, which is the best way to work,
and is available as a pip installable module for 2.6.

Honestly at this point for a new project trying to support anything
 2.7 is silly, so it should be pretty simple.

All that said, I think that leaving it in C makes more sense. I think
that the cython or cffi code to plug the two together would be more
complex than the pure c code would be.

Dylan


signature.asc
Description: Digital signature
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [wflinfo] [RFC] platform-specific info from wflinfo

2015-02-19 Thread Dylan Baker
I don't know how I missed this,

I don't care if the output is character for character with glxinfo, as
long as it conveys the same information.

On Wed, Feb 11, 2015 at 06:01:26PM -0800, Chad Versace wrote:
 On 02/10/2015 01:20 PM, Frank Henigman wrote:
  On Tue, Feb 10, 2015 at 4:08 PM, Frank Henigman fjhenig...@google.com 
  wrote:
 
  Looks like Issue #3 is the format of the information.  I thought it
  was given we should duplicate existing glxinfo/eglinfo/etc as closely
  as possible, in order to be a drop-in replacement, but if I follow the
  suggestions Chad made on github
  (https://github.com/fjhenigman/waffle/commit/d0b45bb9850e6ae29ee379a2d3e8ba14afc1b872)
  we'll be diverging.  Improving on existing tools is ok with me - I
  don't have a huge investment in code to parse their output - but I
  wonder if others feel differently.
 
 (+Jordan, +Dylan, questions below)
 
 Oh, when I made those Github comments, I didn't know you were trying to
 duplicate glxinfo output verbatim. Now I understand why the GLX lines
 look so different from wflinfo's current output.
 
 glxinfo wraps long lines for extension strings and separates extension names 
 with commas.
 wflinfo intentionally prints extensions strings in their original form: 
 single line,
 extension names separated by spaces. If I recall correctly, Jordan and Dylan 
 wanted
 that format so that consumers who parsed wflinfo text output would be 
 guaranteed a stable
 format.
 
 If wflinfo has mixed line formats (some lines are comma-separated and 
 wrapped, some
 are space-separated), I fear that may cause problems for already-existing 
 consumers.
 Dylan, Jordan, do you have an opinion here? Does this really matter?
 




signature.asc
Description: Digital signature
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


[waffle] Use cmake config files instead of find

2014-12-29 Thread Dylan Baker
This is the 3rd, and hopefully final, iteration of these patches.

Changes from version 2:
- rearrange the new code to be with the pkgconfig code in the cmake
  file
- use CMAKE_BINARY_DIR
- Drop patch 3 (use windows registry)

I have tested this on linux with ninja and make backends with both in
tree and out of tree builds.

This is available at my github:
https://github.com/dcbaker/waffle submit/cmake-config

___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


[waffle] [Patch v3 2/3] cmake: Add cmake PackageConfig files

2014-12-29 Thread Dylan Baker
This creates and installs a package version file and a package config
file. These are used by find_package with the CONFIG option, and are
roughly equivalent to pkgconfig, but is cmake specific rather than linux
specific.

v2: - Use configure_package_config_file() instead of config_file(),
  which generates helper macros and resolves relative paths allowing
  the entire install to be moved.
- Update WaffleConfig.cmake.in to take advantage of
  configure_package_config_file()
- Use SameMajorVersion instead of AnyNewerVersion for version
  compatibility. Since waffle uses apache's numbering scheme 2.0.0
  should not fulfill a requirement of 1.5.0 and vice versa.
v3: - Use CMAKE_BINARY_DIR (Jordan)
- Move generation of cmake config to the same area of the cmake file
  as pkgconfig

Signed-off-by: Dylan Baker dylanx.c.ba...@intel.com
Reviewed-by: Jordan Justen jordan.l.jus...@intel.com
---
 CMakeLists.txt  | 27 ++-
 cmake/Modules/.gitignore|  2 ++
 cmake/Modules/WaffleConfig.cmake.in | 12 
 3 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 cmake/Modules/.gitignore
 create mode 100644 cmake/Modules/WaffleConfig.cmake.in

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bde8096..6fabb54 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -128,7 +128,8 @@ if(waffle_build_examples)
 endif()
 
 # 
--
-# Install packaging files: waffle.pc, FindWaffle.cmake
+# Install packaging files: waffle.pc, FindWaffle.cmake,
+# WaffleConfigVersion.cmake, and WaffleConfig.cmake
 # 
--
 
 configure_file(waffle.pc.in ${waffle_libname}.pc @ONLY)
@@ -145,6 +146,30 @@ install(
 COMPONENT cmakefind
 )
 
+set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/Waffle)
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+${CMAKE_BINARY_DIR}/cmake/Modules/WaffleConfigVersion.cmake
+VERSION ${waffle_version}
+COMPATIBILITY SameMajorVersion
+)
+
+configure_package_config_file(
+cmake/Modules/WaffleConfig.cmake.in
+cmake/Modules/WaffleConfig.cmake
+INSTALL_DESTINATION ${ConfigPackageLocation}
+PATH_VARS CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR
+NO_CHECK_REQUIRED_COMPONENTS_MACRO
+)
+
+install(
+FILES
+${CMAKE_BINARY_DIR}/cmake/Modules/WaffleConfigVersion.cmake
+${CMAKE_BINARY_DIR}/cmake/Modules/WaffleConfig.cmake
+DESTINATION ${ConfigPackageLocation}
+COMPONENT devel
+)
+
 # 
--
 # Install core documentation
 # 
--
diff --git a/cmake/Modules/.gitignore b/cmake/Modules/.gitignore
new file mode 100644
index 000..9742f46
--- /dev/null
+++ b/cmake/Modules/.gitignore
@@ -0,0 +1,2 @@
+WaffleConfigVersion.cmake
+WaffleConfig.cmake
diff --git a/cmake/Modules/WaffleConfig.cmake.in 
b/cmake/Modules/WaffleConfig.cmake.in
new file mode 100644
index 000..b60b470
--- /dev/null
+++ b/cmake/Modules/WaffleConfig.cmake.in
@@ -0,0 +1,12 @@
+# Config module for Waffle
+#
+# Provides the following variables
+# Waffle_INCLUDE_DIRS - Directories to include
+# Waffle_LIBRARIES- Libraries to link
+# Waffle_LIBRARY_DIRS - Library directories to search for link libraries
+
+@PACKAGE_INIT@
+
+set_and_check(Waffle_INCLUDE_DIRS 
@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@/@waffle_libname@)
+set_and_check(Waffle_LIBRARY_DIRS @PACKAGE_CMAKE_INSTALL_LIBDIR@)
+set(Waffle_LIBRARIES @waffle_libname@)
-- 
2.2.1

___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


[waffle] [Patch v3 3/3] cmake: remove FindWaffle.cmake

2014-12-29 Thread Dylan Baker
This is superseded by the WaffleConfig and WaffleConfigVersion cmake
files.

Signed-off-by: Dylan Baker dylanx.c.ba...@intel.com
Reviewed-by: Jordan Justen jordan.l.jus...@intel.com
---
 CMakeLists.txt | 10 ++
 cmake/Modules/FindWaffle.cmake | 78 --
 2 files changed, 2 insertions(+), 86 deletions(-)
 delete mode 100644 cmake/Modules/FindWaffle.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6fabb54..9bbe387 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -128,8 +128,8 @@ if(waffle_build_examples)
 endif()
 
 # 
--
-# Install packaging files: waffle.pc, FindWaffle.cmake,
-# WaffleConfigVersion.cmake, and WaffleConfig.cmake
+# Install packaging files: waffle.pc WaffleConfigVersion.cmake, and
+# WaffleConfig.cmake
 # 
--
 
 configure_file(waffle.pc.in ${waffle_libname}.pc @ONLY)
@@ -140,12 +140,6 @@ install(
 COMPONENT pkgconfig
 )
 
-install(
-FILES cmake/Modules/FindWaffle.cmake
-DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules
-COMPONENT cmakefind
-)
-
 set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/Waffle)
 include(CMakePackageConfigHelpers)
 write_basic_package_version_file(
diff --git a/cmake/Modules/FindWaffle.cmake b/cmake/Modules/FindWaffle.cmake
deleted file mode 100644
index 4e16c4e..000
--- a/cmake/Modules/FindWaffle.cmake
+++ /dev/null
@@ -1,78 +0,0 @@
-# - Locate the Waffle library and headers.
-# This module defines the following variables:
-# WAFFLE_INCLUDE_DIRSFull path to directory of the main Waffle header, 
waffle.h.
-# WAFFLE_LIBRARIES   Full path to the Waffle library.
-# WAFFLE_FOUND   True if Waffle was found.
-# WAFFLE_VERSION_STRING  Waffle's version in form Major.Minor.Patch.
-
-#=
-# Copyright 2012 Intel Corporation
-#
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# - Redistributions of source code must retain the above copyright notice, this
-#   list of conditions and the following disclaimer.
-#
-# - Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#=
-
-# See /usr/share/cmake/Modules/readme.txt for CMake official guidelines for
-# FindXXX.cmake files.
-
-if(NOT DEFINED WAFFLE_FIND_VERSION_MAJOR)
-set(WAFFLE_FIND_VERSION_MAJOR 1)
-endif()
-
-find_path(WAFFLE_INCLUDE_DIRS
-NAMES waffle.h
-PATH_SUFFIXES waffle-${WAFFLE_FIND_VERSION_MAJOR}
- )
-
-find_library(WAFFLE_LIBRARIES
-NAMES waffle-${WAFFLE_FIND_VERSION_MAJOR}
-)
-
-if(WAFFLE_INCLUDE_DIRS AND EXISTS ${WAFFLE_INCLUDE_DIRS}/waffle_version.h)
-file(STRINGS ${WAFFLE_INCLUDE_DIRS}/waffle_version.h WAFFLE_VERSION_H)
-string(REGEX REPLACE ^.*WAFFLE_MAJOR_VERSION ([0-9]+).*$ \\1 
WAFFLE_MAJOR_VERSION ${WAFFLE_VERSION_H})
-string(REGEX REPLACE ^.*WAFFLE_MINOR_VERSION ([0-9]+).*$ \\1 
WAFFLE_MINOR_VERSION ${WAFFLE_VERSION_H})
-string(REGEX REPLACE ^.*WAFFLE_PATCH_VERSION ([0-9]+).*$ \\1 
WAFFLE_PATCH_VERSION ${WAFFLE_VERSION_H})
-set(WAFFLE_VERSION_STRING 
${WAFFLE_MAJOR_VERSION}.${WAFFLE_MINOR_VERSION}.${WAFFLE_PATCH_VERSION})
-endif()
-
-# handle the 'QUIETLY' and 'REQUIRED' arguments and
-# set 'WAFFLE_FOUND' to TRUE if all listed variables are TRUE
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Waffle
-REQUIRED_VARS WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS
-VERSION_VAR WAFFLE_VERSION_STRING
-)
-
-mark_as_advanced(WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS)
-
-# Don't expose these variables.
-#
-# Some were set in the cache and some were not. To be safe, remove the
-# variables from the cache *and* local scope.
-#
-unset(WAFFLE_FIND_VERSION_MAJOR CACHE

Re: [waffle] [PATCH 3/4] cmake: Add the installed package files to the registry on windows

2014-12-29 Thread Dylan Baker
On Monday, December 29, 2014 05:33:43 PM Jose Fonseca wrote:
 On 29/12/14 17:07, Dylan Baker wrote:
  On Monday, December 29, 2014 11:35:20 AM Jose Fonseca wrote:
  On 22/12/14 22:36, Dylan Baker wrote:
  This adds the locations of the package files to the registry on windows,
  which should allow them to be auto detected by cmake on windows when
  linking against waffle in other projects.
 
  Signed-off-by: Dylan Baker dylanx.c.ba...@intel.com
  ---
 
  This patch is completely untested (I don't have access to a windows
  development machine, nor do I want to maintain one), I've sent this as a
  courtesy to windows users, and hopefully it can point an interested part
  in the correct direction.
 
  Note that this installs into the local machine registry, and there is
  also the option of using local user registry instead, and that can be
  done by changing waffle to use export(), though I'm not exactly sure how
  that works either
 
 CMakeLists.txt | 10 ++
 1 file changed, 10 insertions(+)
 
  diff --git a/CMakeLists.txt b/CMakeLists.txt
  index 729ebc1..0ac2d4b 100644
  --- a/CMakeLists.txt
  +++ b/CMakeLists.txt
  @@ -182,6 +182,16 @@ install(
 COMPONENT Devel
 )
 
  +# If running on windows add waffle to the registry so it can be auto 
  detected
  +# by consuming projects
  +if (WIN32)
 
  This will break cross-compiling from Linux to Windows (via MinGW),
  because WIN32 is true.
 
  Replacing it with
 
  if (WIN32 AND NOT CMAKE_CROSSCOMPILING)
 
  should do the trick.
 
 
  +execute_process(
  +COMMAND REG ADD 
  HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\Waffle /v Waffle-1 /t 
  REG_SZ /d ${ConfigPackageLocation} /f
 
  I suspect this will fail when there are spaces in the path (e.g., when
  waffle is in C:\Program Files\...
 
 
  +ERROR_QUIET
  +OUTPUT_QUIET
  +)
  +endif ()
 
  Also I believe execute_process() will execute the command when
  configuring -- not when building --, or even better, not when installing.
 
 
 
 
  I'm not sure this is a great idea overall.  Are any other packages doing
  anything like this?  It all seems very non-standard, so I wonder if this
  will really simplify things or be too surprising.
 
  I can't say whether it is a good idea or not, it's suggested by the
  cmake documentation as the right way to do things on windows. I don't
  have a strong opinion either way, and, like you, I doubt this works
  correctly in it's current form. I provided mostly as a way to say hey,
  you can do this if you want, but I no problem dropping it.
 
 Thanks.  I actually forgot to say in my reply that I appreciate you 
 taking the time and energy to looking into this.
 
 If CMake documentation recommends, then it might be possible to find a 
 more comprehensive example in some open source project that does this, 
 that we can use as reference.  I confess I never came across one, but my 
 sampling universe is limited.
 
 http://www.cmake.org/Wiki/CMake/Tutorials/Package_Registry explains some 
 of this, but doesn't actually explain how to set.  My guess is that the 
 registry key is typically set by full-blown Windows pakcages installers 
 like Windows Installer or NSIS, but we don't use them here.
 
 We could though, as cpack supports NSIS -- 
 http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#NSIS --, so we 
 could produce a NSIS installer for waffle, which would set the registry 
 key enabling waffle consumers to automatically pick up the right locations.
 
 In short, I think there might be some merit in this idea, but there a 
 few open issues.  In the meanwhile we should hold on.
 
 Jose

That sounds reasonable, I've spun a v3 that doesn't include this patch,
it will be here if we want to clean it up later.

Dylan


signature.asc
Description: This is a digitally signed message part.
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH 1/2] cmake: Install FindWaffle.cmake under system configured path

2014-12-27 Thread Dylan Baker
I haven't tested on gentoo yet. I'll do that.

However, I think we should be putting the find and config modules in
${PREFIX}/lib${arch}/share/cmake, since they are not architecture agnostic
(waffle compiled for x86 does not fullfil x64, while python fulfills python
no matter what version). Cmake supports this setup [0], and looking at that
list closely I don't think its recomended to install directly into
usr/share/cmake.

[0]
http://www.cmake.org/cmake/help/v3.0/command/find_package.html#command:find_package

On Fri, Dec 26, 2014 at 12:11 PM, Jordan Justen jordan.l.jus...@intel.com
wrote:

 By default cmake modules will be under a versioned path such as
 $PREFIX/share/cmake-3.0/Modules. Although, in the case of gentoo (at
 least), the $PREFIX/share/cmake/Modules path is used.

 This change should be compatible with both styles since it uses
 ${CMAKE_ROOT}.

 Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
 Cc: Dylan Baker baker.dyla...@gmail.com
 ---
 Dylan, does this work on gentoo?

 I guess we can do the same thing with WaffleConfig*, right?

  CMakeLists.txt | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

 diff --git a/CMakeLists.txt b/CMakeLists.txt
 index bde8096..aa0ee2f 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -139,9 +139,11 @@ install(
  COMPONENT pkgconfig
  )

 +get_filename_component(CMAKE_ROOT_LAST_DIR ${CMAKE_ROOT} NAME)
 +
  install(
  FILES cmake/Modules/FindWaffle.cmake
 -DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules
 +DESTINATION
 ${CMAKE_INSTALL_DATAROOTDIR}/${CMAKE_ROOT_LAST_DIR}/Modules
  COMPONENT cmakefind
  )

 --
 2.1.3


___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


[waffle] [PATCH 2/4] cmake: Add cmake PackageConfig files

2014-12-22 Thread Dylan Baker
This creates and installs a package version file and a package config
file. These are used by find_package with the CONFIG option, and are
roughly equivalent to pkgconfig, but is cmake specific rather than linux
specific.

Signed-off-by: Dylan Baker dylanx.c.ba...@intel.com
---

 CMakeLists.txt  | 24 
 cmake/Modules/.gitignore|  2 ++
 cmake/Modules/WaffleConfig.cmake.in | 13 +
 3 files changed, 39 insertions(+)
 create mode 100644 cmake/Modules/.gitignore
 create mode 100644 cmake/Modules/WaffleConfig.cmake.in

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bde8096..729ebc1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -158,6 +158,30 @@ install(
 COMPONENT coredocs
 )
 
+
+# 
--
+# Create Package config and version files
+# 
--
+
+set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/Waffle)
+configure_file(cmake/Modules/WaffleConfig.cmake.in
+   cmake/Modules/WaffleConfig.cmake @ONLY)
+
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+cmake/Modules/WaffleConfigVersion.cmake
+VERSION ${waffle_version}
+COMPATIBILITY AnyNewerVersion
+)
+
+install(
+FILES
+cmake/Modules/WaffleConfigVersion.cmake
+cmake/Modules/WaffleConfig.cmake
+DESTINATION ${ConfigPackageLocation}
+COMPONENT Devel
+)
+
 # 
--
 
 include(WafflePrintConfigurationSummary)
diff --git a/cmake/Modules/.gitignore b/cmake/Modules/.gitignore
new file mode 100644
index 000..9742f46
--- /dev/null
+++ b/cmake/Modules/.gitignore
@@ -0,0 +1,2 @@
+WaffleConfigVersion.cmake
+WaffleConfig.cmake
diff --git a/cmake/Modules/WaffleConfig.cmake.in 
b/cmake/Modules/WaffleConfig.cmake.in
new file mode 100644
index 000..50544f2
--- /dev/null
+++ b/cmake/Modules/WaffleConfig.cmake.in
@@ -0,0 +1,13 @@
+# Config module for Waffle
+#
+# Provides the following variables
+# Waffle_INCLUDE_DIRS - Directories to include
+# Waffle_LIBRARIES- Libraries to link
+# Waffle_LIBRARY_DIRS - Library directories to search for link libraries
+
+get_filename_component(PREFIX ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+set(Waffle_FOUND 1)
+set(Waffle_INCLUDE_DIRS 
@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@waffle_libname@)
+set(Waffle_LIBRARIES @waffle_libname@)
+set(Waffle_LIBRARY_DIRS ${PREFIX}/@CMAKE_INSTALL_LIBDIR@)
-- 
2.2.1

___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


[waffle] [PATCH 1/4] cmake: fix version search

2014-12-22 Thread Dylan Baker
Currently the cmake file uses both WAFFLE_INCLUDE_DIR and
WAFFLE_INCLUDE_DIRS, but only the DIRS version is actually defined.
cmake doesn't complain about the undefined variable, instead it treats
it as a blank string. This leads to the version never being checked.

This patch replaces DIR with DIRS, which corrects the problem.

Fixes: https://github.com/waffle-gl/waffle/issues/27
Signed-off-by: Dylan Baker dylanx.c.ba...@intel.com
---

 cmake/Modules/FindWaffle.cmake | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/cmake/Modules/FindWaffle.cmake b/cmake/Modules/FindWaffle.cmake
index 972bdfe..4e16c4e 100644
--- a/cmake/Modules/FindWaffle.cmake
+++ b/cmake/Modules/FindWaffle.cmake
@@ -48,8 +48,8 @@ find_library(WAFFLE_LIBRARIES
 NAMES waffle-${WAFFLE_FIND_VERSION_MAJOR}
 )
 
-if(WAFFLE_INCLUDE_DIR AND EXISTS ${WAFFLE_INCLUDE_DIR}/waffle_version.h)
-file(STRINGS ${WAFFLE_INCLUDE_DIR}/waffle_version.h WAFFLE_VERSION_H)
+if(WAFFLE_INCLUDE_DIRS AND EXISTS ${WAFFLE_INCLUDE_DIRS}/waffle_version.h)
+file(STRINGS ${WAFFLE_INCLUDE_DIRS}/waffle_version.h WAFFLE_VERSION_H)
 string(REGEX REPLACE ^.*WAFFLE_MAJOR_VERSION ([0-9]+).*$ \\1 
WAFFLE_MAJOR_VERSION ${WAFFLE_VERSION_H})
 string(REGEX REPLACE ^.*WAFFLE_MINOR_VERSION ([0-9]+).*$ \\1 
WAFFLE_MINOR_VERSION ${WAFFLE_VERSION_H})
 string(REGEX REPLACE ^.*WAFFLE_PATCH_VERSION ([0-9]+).*$ \\1 
WAFFLE_PATCH_VERSION ${WAFFLE_VERSION_H})
@@ -72,9 +72,7 @@ mark_as_advanced(WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS)
 # variables from the cache *and* local scope.
 #
 unset(WAFFLE_FIND_VERSION_MAJOR CACHE)
-unset(WAFFLE_INCLUDE_DIR CACHE)
 unset(WAFFLE_VERSION_H CACHE)
 
 unset(WAFFLE_FIND_VERSION_MAJOR)
-unset(WAFFLE_INCLUDE_DIR)
 unset(WAFFLE_VERSION_H)
-- 
2.2.1

___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


[waffle] [PATCH 4/4] cmake: remove FindWaffle.cmake

2014-12-22 Thread Dylan Baker
This is superseded by the WaffleConfig and WaffleConfigVersion cmake
files.
---
 CMakeLists.txt |  8 +
 cmake/Modules/FindWaffle.cmake | 78 --
 2 files changed, 1 insertion(+), 85 deletions(-)
 delete mode 100644 cmake/Modules/FindWaffle.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0ac2d4b..1e5a9fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -128,7 +128,7 @@ if(waffle_build_examples)
 endif()
 
 # 
--
-# Install packaging files: waffle.pc, FindWaffle.cmake
+# Install packaging files: waffle.pc
 # 
--
 
 configure_file(waffle.pc.in ${waffle_libname}.pc @ONLY)
@@ -139,12 +139,6 @@ install(
 COMPONENT pkgconfig
 )
 
-install(
-FILES cmake/Modules/FindWaffle.cmake
-DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules
-COMPONENT cmakefind
-)
-
 # 
--
 # Install core documentation
 # 
--
diff --git a/cmake/Modules/FindWaffle.cmake b/cmake/Modules/FindWaffle.cmake
deleted file mode 100644
index 4e16c4e..000
--- a/cmake/Modules/FindWaffle.cmake
+++ /dev/null
@@ -1,78 +0,0 @@
-# - Locate the Waffle library and headers.
-# This module defines the following variables:
-# WAFFLE_INCLUDE_DIRSFull path to directory of the main Waffle header, 
waffle.h.
-# WAFFLE_LIBRARIES   Full path to the Waffle library.
-# WAFFLE_FOUND   True if Waffle was found.
-# WAFFLE_VERSION_STRING  Waffle's version in form Major.Minor.Patch.
-
-#=
-# Copyright 2012 Intel Corporation
-#
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# - Redistributions of source code must retain the above copyright notice, this
-#   list of conditions and the following disclaimer.
-#
-# - Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#=
-
-# See /usr/share/cmake/Modules/readme.txt for CMake official guidelines for
-# FindXXX.cmake files.
-
-if(NOT DEFINED WAFFLE_FIND_VERSION_MAJOR)
-set(WAFFLE_FIND_VERSION_MAJOR 1)
-endif()
-
-find_path(WAFFLE_INCLUDE_DIRS
-NAMES waffle.h
-PATH_SUFFIXES waffle-${WAFFLE_FIND_VERSION_MAJOR}
- )
-
-find_library(WAFFLE_LIBRARIES
-NAMES waffle-${WAFFLE_FIND_VERSION_MAJOR}
-)
-
-if(WAFFLE_INCLUDE_DIRS AND EXISTS ${WAFFLE_INCLUDE_DIRS}/waffle_version.h)
-file(STRINGS ${WAFFLE_INCLUDE_DIRS}/waffle_version.h WAFFLE_VERSION_H)
-string(REGEX REPLACE ^.*WAFFLE_MAJOR_VERSION ([0-9]+).*$ \\1 
WAFFLE_MAJOR_VERSION ${WAFFLE_VERSION_H})
-string(REGEX REPLACE ^.*WAFFLE_MINOR_VERSION ([0-9]+).*$ \\1 
WAFFLE_MINOR_VERSION ${WAFFLE_VERSION_H})
-string(REGEX REPLACE ^.*WAFFLE_PATCH_VERSION ([0-9]+).*$ \\1 
WAFFLE_PATCH_VERSION ${WAFFLE_VERSION_H})
-set(WAFFLE_VERSION_STRING 
${WAFFLE_MAJOR_VERSION}.${WAFFLE_MINOR_VERSION}.${WAFFLE_PATCH_VERSION})
-endif()
-
-# handle the 'QUIETLY' and 'REQUIRED' arguments and
-# set 'WAFFLE_FOUND' to TRUE if all listed variables are TRUE
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Waffle
-REQUIRED_VARS WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS
-VERSION_VAR WAFFLE_VERSION_STRING
-)
-
-mark_as_advanced(WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS)
-
-# Don't expose these variables.
-#
-# Some were set in the cache and some were not. To be safe, remove the
-# variables from the cache *and* local scope.
-#
-unset(WAFFLE_FIND_VERSION_MAJOR CACHE)
-unset(WAFFLE_VERSION_H CACHE)
-
-unset(WAFFLE_FIND_VERSION_MAJOR)
-unset(WAFFLE_VERSION_H)
-- 
2.2.1

___

Re: [waffle] [RFC] Use cmake config files instead of find

2014-12-22 Thread Dylan Baker
In case you want to see my piglit build using these patches its
available here:

This is available at my github:
https://github.com/dcbaker/piglit wip/cmake-cleanups-v2 

I'd like to wait to send out piglit patches until we've landed this
code, to avoid painful lock-stepping problems.

On Monday, December 22, 2014 02:36:04 PM Dylan Baker wrote:
 This patch series adds a cmake PackageConfig file and
 PackageConfigVersion file, cmake uses these files much like autotools
 uses pkgconfig.
 
 I have tested this against a modified version of piglit, I can push that
 branch and provide it for anyone who is interested, I just need to clean
 up the patches such that they're ready for mainline.
 
 If/when this series lands it should probably be applied against at least
 the 1.4 branch, if not also the 1.3 branch. Since it would be ideal if
 downstream projects could rely on this even if they don't need 1.4/1.5
 features.
 


signature.asc
Description: This is a digitally signed message part.
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [RFC v2] wflinfo: add GLSL version information to wflinfo

2014-11-17 Thread Dylan Baker
On Monday, November 17, 2014 01:27:45 PM Jordan Justen wrote:
 On 2014-11-17 10:15:54, Chad Versace wrote:
  On Sun 16 Nov 2014, Jordan Justen wrote:
  On 2014-11-15 12:47:05, Emil Velikov wrote:
   Hi Dylan,
   On 14/11/14 17:39, Dylan Baker wrote:
v2: - Don't print for gles1, since gles1 doesn't have a shading 
language
  and will always return FLINFO_GL_ERROR
   
Signed-off-by: Dylan Baker dylanx.c.ba...@intel.com
---
   
This addresses Jordan's comments, but from the point of view of having 
a
parsable output not printing the string 'OpenGL shading language...'
seems suboptimal. Would it be better to add an additional block to the
assignment if and look for fixed-functions versions and set the value 
of
shading langauge to 'Fixed Function' or 'None' instead?
   
   I'm not sure how Chad and Jordan feel about it but making gles1's shader
   langugage version return None sounds good imho.`
  
  I'd rather not give output for things that are not applicable based on
  the platform or api.
  
  Maybe ... N/A for situation like this would make sense in verbose mode
  though.
  
  If wflinfo does print anything for the GLES1 GLSL version, I prefer
  it to be None. If it printed N/A, I predict that some user will
  get confused by over-interpreting the meaning of N/A. On the
  contrary, None is straightforward and asks for no further
  interpretation.
 
 None seems fine. (Python inspired? :)
 
  Like Emil and Dylan, I have a slight preference that wflinfo print
  None for the GLES1 GLSL version rather than be silent. But it's
  only a slight preference; it doesn't matter much to me.
 
 Can we just print it in verbose mode?
 
 It kind of seems like we are telling the user something that they
 didn't ask for. They asked for info about the gles1 installation, and
 we told them that gles1 doesn't support GLSL. It seems possible for
 them to figure that out independently. :)
 
 But, with verbose mode, it we could try to print out more (all?)
 fields.

That seems reasonable to me.

 
 A related question could be: should we print out something for the
 context flags when we are not in gl = 3.1? Today, we don't print
 anything.
 
 -Jordan
 
  Dylan, why in the original patch did you decide to print anything at all 
  for the GLES1 GLSL version? You vaguely mention parseability. Can you 
  say more about any parsing issues you forsee, and how those issues might 
  affect Piglit?
  
  I don't want this thread to devolve into a bikeshed. I just want know if
  you have concrete concerns about the silence vs None decision before 
  any patch gets committed.
  
@@ -561,6 +567,10 @@ print_wflinfo(const struct options *opts)
 printf(OpenGL vendor string: %s\n, vendor);
 printf(OpenGL renderer string: %s\n, renderer);
 printf(OpenGL version string: %s\n, version_str);
+ // Do not print WFLINFO_GL_ERROR for gles1, there is not GLSL 
for GL ES 1.x
+ if (strcmp(api, gles1) != 0) {
+ printf(OpenGL shading language version string: %s\n, 
language_str);
+ }
  
  How about a new function, and call it like this:
  if (opts-context_api != WAFFLE_CONTEXT_OPENGL_ES1) {
  print_glsl_info();
  }
  
  That would avoid calling glGetString(GL_SHADING_LANGUAGE_VERSION) for
  gles1.
  
  Agreed. If wflinfo prints no GLES1 GLSL info in the final patch, then 
  wflinfo shouldn't call glGetString(GL_SHADING_LANGUAGE_VERSION) at all 
  for GLES1. It's just a good idea to avoid producing GL errors when 
  possible.


signature.asc
Description: This is a digitally signed message part.
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [PATCH 2/2] wflinfo: Properly handle minor versions 9

2014-04-29 Thread Dylan Baker
On Tuesday, April 29, 2014 08:39:19 Jordan Justen wrote:
 Previously -V 1.40 would be treated the same as -V 5.0.

 Instead, whenever a minor version is requested greater
 than 9, bump the major version, and use 0 for the minor
 version.

 This leads to -V 1.40 being interpreted as -V 2.0.

 Alternatively, we might treat minor versions greater
 than 9 as an error.

 Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
 ---
  src/utils/wflinfo.c | 6 ++
  1 file changed, 6 insertions(+)

 diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
 index 386bdd0..982311d 100644
 --- a/src/utils/wflinfo.c
 +++ b/src/utils/wflinfo.c
 @@ -336,6 +336,12 @@ parse_args(int argc, char *argv[], struct options *opts)
  usage_error_printf('%s' is not a valid OpenGL version,
 optarg);
  }
 +if (minor  9) {
 +// If a minor version greater than 9 was requested, then
 +// bump the major version and use 0 for the minor.
 +major++;
 +minor = 0;
 +}
  opts-context_version = 10 * major + minor;
  break;
  }


As a consumer of wflinfo I would prefer to see a bad version treated as an 
error.


signature.asc
Description: This is a digitally signed message part.
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle