Re: [Mesa-dev] [PATCH] x11: Only report supported DRI3/Present versions

2018-03-30 Thread Daniel Stone
On 23 March 2018 at 13:03, Emil Velikov  wrote:
> On 22 March 2018 at 15:27, Daniel Stone  wrote:
>> The version passed to QueryVersion requests is the version that the
>> client supports. We were just passing in whatever version of XCB was
>> present on the system, which may not be a version that Mesa actually
>> explicitly supports, e.g. it might bring unwanted semantics.
>>
>> Set specific protocol versions which we support, and only pass those.
>>
>> Signed-off-by: Daniel Stone 
> Thanks for sorting this out Dan. With the small nitpicks, patch is
>
> Fixes: 7aeef2d4efd ("dri3: allow building against older xcb (v3)")
> Reviewed-by: Emil Velikov 

Thanks Emil, pushed with the whitespace/wording changes.

Cheers,
Daniel
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] x11: Only report supported DRI3/Present versions

2018-03-23 Thread Emil Velikov
On 22 March 2018 at 15:27, Daniel Stone  wrote:
> The version passed to QueryVersion requests is the version that the
> client supports. We were just passing in whatever version of XCB was
> present on the system, which may not be a version that Mesa actually
> explicitly supports, e.g. it might bring unwanted semantics.
>
> Set specific protocol versions which we support, and only pass those.
>
> Signed-off-by: Daniel Stone 
Thanks for sorting this out Dan. With the small nitpicks, patch is

Fixes: 7aeef2d4efd ("dri3: allow building against older xcb (v3)")
Reviewed-by: Emil Velikov 

> ---
>  src/egl/drivers/dri2/platform_x11_dri3.c | 19 +++
>  src/glx/dri3_glx.c   | 21 +++--
>  2 files changed, 30 insertions(+), 10 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
> b/src/egl/drivers/dri2/platform_x11_dri3.c
> index 5e531e21cb0..254c4441ef5 100644
> --- a/src/egl/drivers/dri2/platform_x11_dri3.c
> +++ b/src/egl/drivers/dri2/platform_x11_dri3.c
> @@ -520,6 +520,17 @@ struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
> .close_screen_notify = dri3_close_screen_notify,
>  };
>
> +/* Only advertise versions of these protocols which we actually support. */
s/advertise/request/  - here + dri3_glx.c

> +#define DRI3_SUPPORTED_MAJOR 1
> +#define PRESENT_SUPPORTED_MAJOR 1
Please add a blank line - here + dri3_glx.c

> +#ifdef HAVE_DRI3_MODIFIERS
> +#define DRI3_SUPPORTED_MINOR 2
> +#define PRESENT_SUPPORTED_MINOR 2
> +#else
> +#define PRESENT_SUPPORTED_MINOR 0
> +#define DRI3_SUPPORTED_MINOR 0
> +#endif
> +

At a later stage we could simplify the ifdef the way it's handled in Vulkan.

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


[Mesa-dev] [PATCH] x11: Only report supported DRI3/Present versions

2018-03-22 Thread Daniel Stone
The version passed to QueryVersion requests is the version that the
client supports. We were just passing in whatever version of XCB was
present on the system, which may not be a version that Mesa actually
explicitly supports, e.g. it might bring unwanted semantics.

Set specific protocol versions which we support, and only pass those.

Signed-off-by: Daniel Stone 
---
 src/egl/drivers/dri2/platform_x11_dri3.c | 19 +++
 src/glx/dri3_glx.c   | 21 +++--
 2 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
b/src/egl/drivers/dri2/platform_x11_dri3.c
index 5e531e21cb0..254c4441ef5 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -520,6 +520,17 @@ struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
.close_screen_notify = dri3_close_screen_notify,
 };
 
+/* Only advertise versions of these protocols which we actually support. */
+#define DRI3_SUPPORTED_MAJOR 1
+#define PRESENT_SUPPORTED_MAJOR 1
+#ifdef HAVE_DRI3_MODIFIERS
+#define DRI3_SUPPORTED_MINOR 2
+#define PRESENT_SUPPORTED_MINOR 2
+#else
+#define PRESENT_SUPPORTED_MINOR 0
+#define DRI3_SUPPORTED_MINOR 0
+#endif
+
 EGLBoolean
 dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
 {
@@ -542,12 +553,12 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy)
   return EGL_FALSE;
 
dri3_query_cookie = xcb_dri3_query_version(dri2_dpy->conn,
-  XCB_DRI3_MAJOR_VERSION,
-  XCB_DRI3_MINOR_VERSION);
+  DRI3_SUPPORTED_MAJOR,
+  DRI3_SUPPORTED_MINOR);
 
present_query_cookie = xcb_present_query_version(dri2_dpy->conn,
-XCB_PRESENT_MAJOR_VERSION,
-XCB_PRESENT_MINOR_VERSION);
+PRESENT_SUPPORTED_MAJOR,
+PRESENT_SUPPORTED_MINOR);
 
dri3_query =
   xcb_dri3_query_version_reply(dri2_dpy->conn, dri3_query_cookie, );
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index c48a8ba5327..97abbfd9973 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -1026,6 +1026,17 @@ dri3_destroy_display(__GLXDRIdisplay * dpy)
free(dpy);
 }
 
+/* Only advertise versions of these protocols which we actually support. */
+#define DRI3_SUPPORTED_MAJOR 1
+#define PRESENT_SUPPORTED_MAJOR 1
+#ifdef HAVE_DRI3_MODIFIERS
+#define DRI3_SUPPORTED_MINOR 2
+#define PRESENT_SUPPORTED_MINOR 2
+#else
+#define PRESENT_SUPPORTED_MINOR 0
+#define DRI3_SUPPORTED_MINOR 0
+#endif
+
 /** dri3_create_display
  *
  * Allocate, initialize and return a __DRIdisplayPrivate object.
@@ -1057,13 +1068,11 @@ dri3_create_display(Display * dpy)
   return NULL;
 
dri3_cookie = xcb_dri3_query_version(c,
-XCB_DRI3_MAJOR_VERSION,
-XCB_DRI3_MINOR_VERSION);
-
-
+DRI3_SUPPORTED_MAJOR,
+DRI3_SUPPORTED_MINOR);
present_cookie = xcb_present_query_version(c,
-   XCB_PRESENT_MAJOR_VERSION,
-   XCB_PRESENT_MINOR_VERSION);
+  PRESENT_SUPPORTED_MAJOR,
+  PRESENT_SUPPORTED_MINOR);
 
pdp = malloc(sizeof *pdp);
if (pdp == NULL)
-- 
2.16.2

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