[waffle] json, approach 2, version 2

Chad Versace chad.versace at intel.com
Tue Jun 14 22:41:05 UTC 2016


On Thu 21 Apr 2016, Frank Henigman wrote:
> Thanks Emil and Chad for reviewing my json series.  All suggestions
> implemented in v2, except where I replied inline.  I'll hold off
> sending in case there's more back-and-forth over the first set of
> comments.  Would also be nice if Chad merged his get-current branch
> into master, as I use it in v2.

Hi Frank, I think now is a good time to send v2.

Since the patches are not on the list yet, I'll say a few comments here:

	core: add JSON library
		Overall, looks good. The only problem I see is
		a potential buffer overflow in put().

	waffle: add waffle_display_info_json()
		For simplicity's sake, please drop the 'platform_too'
		parameter to waffle_display_info_json(). Waffle should
		return all the info, and the client the should ignore
		any keys (such as platform-specific keys) that it does
		not recognize.

		The patch has some problems regarding "current-ness".
		It says the new function "returns a JSON string
		containing information about the current context on the
		given display". As defined by EGL and GLX, though,
		current-ness is a mapping of (thread) -> (display,
		context, surfaces), and not a mapping of
		(thread, display) -> (context, surfaces).

		As a consequence, the waffle_display_info_json()
		signature is incorrect because due to its 'display'
		parameter. If the function has a display parameter, then
		that allows the user to do undefined things such as
		below:

			struct waffle_display *dpy1 = ...;
			struct waffle_display *ctx1 = ...;

			struct waffle_display *dpy2 = ...;
			struct waffle_display *ctx2 = ...;

			waffle_make_current(dpy1, NULL, ctx1);
			// use ctx1
			waffle_make_current(dpy2, NULL, ctx2);
			// use ctx2

			// Now dpy2 and ctx2 are bound to the thread.
			// So what should waffle_display_info_json() do
			// when given dpy1?
			waffle_display_info_json(dpy1);

	wflinfo: another option for JSON output
		As far as I can tell, the two JSON formats are identical
		except for formatting, as they should be :). Since
		they're identical, I don't understand the need to add
		the new format 'json2'.

		At the end of this patch series, your json is Waffle's
		*real* json. So I expected this patch to remove Dylan's
		json code from wflinfo.c and replace it with yours. Then
		--format=json would return your json.

> When comparing my json output to the landed json output I noticed that
> the landed version omits the context flags found in the old format.
> Was that deliberate?  If so I'll remove it from my json.

It's an accident that wflinfo does not currently report the context
flags. I'd like to see them in the wflinfo output.

> Not sure if I did the right thing with glx info.  Seems like all three
> sections (server, client, common) show about the same list of
> extensions.  That can wait until I send v2, or if anyone wants to look
> now:
> https://github.com/fjhenigman/waffle/commit/b358ac50c00ce51fae6546b1e96c9adc32fcbdc7

As Emil said earlier: wflinfo should report all three sections, as they
do sometimes differ.


More information about the waffle mailing list