summaryrefslogtreecommitdiff
path: root/lib/mesa/src/egl/wayland
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2017-12-31 06:39:08 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2017-12-31 06:39:08 +0000
commit2dae6fe6f74cf7fb9fd65285302c0331d9786b00 (patch)
tree04651e732331dc50a34e063cbaa0c394ccfcd327 /lib/mesa/src/egl/wayland
parentb90fb74e3c85f2799d21d1e07bf91c5fb8359eb8 (diff)
Import Mesa 17.2.8
Diffstat (limited to 'lib/mesa/src/egl/wayland')
-rw-r--r--lib/mesa/src/egl/wayland/wayland-drm/wayland-drm-protocol.c2
-rw-r--r--lib/mesa/src/egl/wayland/wayland-drm/wayland-drm.c10
-rw-r--r--lib/mesa/src/egl/wayland/wayland-drm/wayland-drm.xml3
-rw-r--r--lib/mesa/src/egl/wayland/wayland-egl/Makefile.am6
-rw-r--r--lib/mesa/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c235
-rw-r--r--lib/mesa/src/egl/wayland/wayland-egl/wayland-egl.c4
6 files changed, 252 insertions, 8 deletions
diff --git a/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm-protocol.c b/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm-protocol.c
index 15aeb7c52..4bef1f0c3 100644
--- a/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm-protocol.c
+++ b/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm-protocol.c
@@ -1,4 +1,4 @@
-/* Generated by wayland-scanner 1.13.0 */
+/* Generated by wayland-scanner 1.14.0 */
/*
* Copyright © 2008-2011 Kristian Høgsberg
diff --git a/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm.c b/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm.c
index 4fc12521d..674cd102d 100644
--- a/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -47,7 +47,7 @@ struct wl_drm {
char *device_name;
uint32_t flags;
- struct wayland_drm_callbacks *callbacks;
+ struct wayland_drm_callbacks callbacks;
struct wl_buffer_interface buffer_interface;
};
@@ -58,7 +58,7 @@ destroy_buffer(struct wl_resource *resource)
struct wl_drm_buffer *buffer = resource->data;
struct wl_drm *drm = buffer->drm;
- drm->callbacks->release_buffer(drm->user_data, buffer);
+ drm->callbacks.release_buffer(drm->user_data, buffer);
free(buffer);
}
@@ -97,7 +97,7 @@ create_buffer(struct wl_client *client, struct wl_resource *resource,
buffer->offset[2] = offset2;
buffer->stride[2] = stride2;
- drm->callbacks->reference_buffer(drm->user_data, name, fd, buffer);
+ drm->callbacks.reference_buffer(drm->user_data, name, fd, buffer);
if (buffer->driver_buffer == NULL) {
wl_resource_post_error(resource,
WL_DRM_ERROR_INVALID_NAME,
@@ -189,7 +189,7 @@ drm_authenticate(struct wl_client *client,
{
struct wl_drm *drm = resource->data;
- if (drm->callbacks->authenticate(drm->user_data, id) < 0)
+ if (drm->callbacks.authenticate(drm->user_data, id) < 0)
wl_resource_post_error(resource,
WL_DRM_ERROR_AUTHENTICATE_FAIL,
"authenicate failed");
@@ -270,7 +270,7 @@ wayland_drm_init(struct wl_display *display, char *device_name,
drm->display = display;
drm->device_name = strdup(device_name);
- drm->callbacks = callbacks;
+ drm->callbacks = *callbacks;
drm->user_data = user_data;
drm->flags = flags;
diff --git a/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm.xml b/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm.xml
index 5e64622df..83aa56155 100644
--- a/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm.xml
+++ b/lib/mesa/src/egl/wayland/wayland-drm/wayland-drm.xml
@@ -39,7 +39,8 @@
<enum name="format">
<!-- The drm format codes match the #defines in drm_fourcc.h.
The formats actually supported by the compositor will be
- reported by the format event. -->
+ reported by the format event. New codes must not be added,
+ unless directly taken from drm_fourcc.h. -->
<entry name="c8" value="0x20203843"/>
<entry name="rgb332" value="0x38424752"/>
<entry name="bgr233" value="0x38524742"/>
diff --git a/lib/mesa/src/egl/wayland/wayland-egl/Makefile.am b/lib/mesa/src/egl/wayland/wayland-egl/Makefile.am
index 8c45e8e26..846fa6247 100644
--- a/lib/mesa/src/egl/wayland/wayland-egl/Makefile.am
+++ b/lib/mesa/src/egl/wayland/wayland-egl/Makefile.am
@@ -14,7 +14,11 @@ libwayland_egl_la_LDFLAGS = \
$(GC_SECTIONS) \
$(LD_NO_UNDEFINED)
-TESTS = wayland-egl-symbols-check
+TESTS = wayland-egl-symbols-check \
+ wayland-egl-abi-check
+
EXTRA_DIST = wayland-egl-symbols-check
+check_PROGRAMS = wayland-egl-abi-check
+
include $(top_srcdir)/install-lib-links.mk
diff --git a/lib/mesa/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c b/lib/mesa/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c
new file mode 100644
index 000000000..4ea38542a
--- /dev/null
+++ b/lib/mesa/src/egl/wayland/wayland-egl/wayland-egl-abi-check.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stddef.h> // offsetof
+#include <stdio.h> // printf
+
+#include "wayland-egl-priv.h" // Current struct wl_egl_window implementation
+
+/*
+ * Following are previous implementations of wl_egl_window.
+ *
+ * DO NOT EVER CHANGE!
+ */
+
+/* From: 214fc6e850 - Benjamin Franzke : egl: Implement libwayland-egl */
+struct wl_egl_window_v0 {
+ struct wl_surface *surface;
+
+ int width;
+ int height;
+ int dx;
+ int dy;
+
+ int attached_width;
+ int attached_height;
+};
+
+/* From: ca3ed3e024 - Ander Conselvan de Oliveira : egl/wayland: Don't invalidate drawable on swap buffers */
+struct wl_egl_window_v1 {
+ struct wl_surface *surface;
+
+ int width;
+ int height;
+ int dx;
+ int dy;
+
+ int attached_width;
+ int attached_height;
+
+ void *private;
+ void (*resize_callback)(struct wl_egl_window *, void *);
+};
+
+/* From: 690ead4a13 - Stencel, Joanna : egl/wayland-egl: Fix for segfault in dri2_wl_destroy_surface. */
+#define WL_EGL_WINDOW_VERSION_v2 2
+struct wl_egl_window_v2 {
+ struct wl_surface *surface;
+
+ int width;
+ int height;
+ int dx;
+ int dy;
+
+ int attached_width;
+ int attached_height;
+
+ void *private;
+ void (*resize_callback)(struct wl_egl_window *, void *);
+ void (*destroy_window_callback)(void *);
+};
+
+/* From: 2d5d61bc49 - Miguel A. Vico : wayland-egl: Make wl_egl_window a versioned struct */
+#define WL_EGL_WINDOW_VERSION_v3 3
+struct wl_egl_window_v3 {
+ const intptr_t version;
+
+ int width;
+ int height;
+ int dx;
+ int dy;
+
+ int attached_width;
+ int attached_height;
+
+ void *private;
+ void (*resize_callback)(struct wl_egl_window *, void *);
+ void (*destroy_window_callback)(void *);
+
+ struct wl_surface *surface;
+};
+
+
+/* This program checks we keep a backwards-compatible struct wl_egl_window
+ * definition whenever it is modified in wayland-egl-priv.h.
+ *
+ * The previous definition should be added above as a new struct
+ * wl_egl_window_vN, and the appropriate checks should be added below
+ */
+
+#define MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
+
+#define CHECK_RENAMED_MEMBER(a_ver, b_ver, a_member, b_member) \
+ do { \
+ if (offsetof(struct wl_egl_window ## a_ver, a_member) != \
+ offsetof(struct wl_egl_window ## b_ver, b_member)) { \
+ printf("Backards incompatible change detected!\n " \
+ "offsetof(struct wl_egl_window" #a_ver "::" #a_member ") != " \
+ "offsetof(struct wl_egl_window" #b_ver "::" #b_member ")\n"); \
+ return 1; \
+ } \
+ \
+ if (MEMBER_SIZE(struct wl_egl_window ## a_ver, a_member) != \
+ MEMBER_SIZE(struct wl_egl_window ## b_ver, b_member)) { \
+ printf("Backards incompatible change detected!\n " \
+ "MEMBER_SIZE(struct wl_egl_window" #a_ver "::" #a_member ") != " \
+ "MEMBER_SIZE(struct wl_egl_window" #b_ver "::" #b_member ")\n"); \
+ return 1; \
+ } \
+ } while (0)
+
+#define CHECK_MEMBER(a_ver, b_ver, member) CHECK_RENAMED_MEMBER(a_ver, b_ver, member, member)
+#define CHECK_MEMBER_CURRENT(a_ver, member) CHECK_MEMBER(a_ver,, member)
+
+#define CHECK_SIZE(a_ver, b_ver) \
+ do { \
+ if (sizeof(struct wl_egl_window ## a_ver) > \
+ sizeof(struct wl_egl_window ## b_ver)) { \
+ printf("Backards incompatible change detected!\n " \
+ "sizeof(struct wl_egl_window" #a_ver ") > " \
+ "sizeof(struct wl_egl_window" #b_ver ")\n"); \
+ return 1; \
+ } \
+ } while (0)
+
+#define CHECK_SIZE_CURRENT(a_ver) \
+ do { \
+ if (sizeof(struct wl_egl_window ## a_ver) != \
+ sizeof(struct wl_egl_window)) { \
+ printf("Backards incompatible change detected!\n " \
+ "sizeof(struct wl_egl_window" #a_ver ") != " \
+ "sizeof(struct wl_egl_window)\n"); \
+ return 1; \
+ } \
+ } while (0)
+
+#define CHECK_VERSION(a_ver, b_ver) \
+ do { \
+ if ((WL_EGL_WINDOW_VERSION ## a_ver) >= \
+ (WL_EGL_WINDOW_VERSION ## b_ver)) { \
+ printf("Backards incompatible change detected!\n " \
+ "WL_EGL_WINDOW_VERSION" #a_ver " >= " \
+ "WL_EGL_WINDOW_VERSION" #b_ver "\n"); \
+ return 1; \
+ } \
+ } while (0)
+
+#define CHECK_VERSION_CURRENT(a_ver) \
+ do { \
+ if ((WL_EGL_WINDOW_VERSION ## a_ver) != \
+ (WL_EGL_WINDOW_VERSION)) { \
+ printf("Backards incompatible change detected!\n " \
+ "WL_EGL_WINDOW_VERSION" #a_ver " != " \
+ "WL_EGL_WINDOW_VERSION\n"); \
+ return 1; \
+ } \
+ } while (0)
+
+int main(int argc, char **argv)
+{
+ /* Check wl_egl_window_v1 ABI against wl_egl_window_v0 */
+ CHECK_MEMBER(_v0, _v1, surface);
+ CHECK_MEMBER(_v0, _v1, width);
+ CHECK_MEMBER(_v0, _v1, height);
+ CHECK_MEMBER(_v0, _v1, dx);
+ CHECK_MEMBER(_v0, _v1, dy);
+ CHECK_MEMBER(_v0, _v1, attached_width);
+ CHECK_MEMBER(_v0, _v1, attached_height);
+
+ CHECK_SIZE(_v0, _v1);
+
+ /* Check wl_egl_window_v2 ABI against wl_egl_window_v1 */
+ CHECK_MEMBER(_v1, _v2, surface);
+ CHECK_MEMBER(_v1, _v2, width);
+ CHECK_MEMBER(_v1, _v2, height);
+ CHECK_MEMBER(_v1, _v2, dx);
+ CHECK_MEMBER(_v1, _v2, dy);
+ CHECK_MEMBER(_v1, _v2, attached_width);
+ CHECK_MEMBER(_v1, _v2, attached_height);
+ CHECK_MEMBER(_v1, _v2, private);
+ CHECK_MEMBER(_v1, _v2, resize_callback);
+
+ CHECK_SIZE(_v1, _v2);
+
+ /* Check wl_egl_window_v3 ABI against wl_egl_window_v2 */
+ CHECK_RENAMED_MEMBER(_v2, _v3, surface, version);
+ CHECK_MEMBER (_v2, _v3, width);
+ CHECK_MEMBER (_v2, _v3, height);
+ CHECK_MEMBER (_v2, _v3, dx);
+ CHECK_MEMBER (_v2, _v3, dy);
+ CHECK_MEMBER (_v2, _v3, attached_width);
+ CHECK_MEMBER (_v2, _v3, attached_height);
+ CHECK_MEMBER (_v2, _v3, private);
+ CHECK_MEMBER (_v2, _v3, resize_callback);
+ CHECK_MEMBER (_v2, _v3, destroy_window_callback);
+
+ CHECK_SIZE (_v2, _v3);
+ CHECK_VERSION(_v2, _v3);
+
+ /* Check current wl_egl_window ABI against wl_egl_window_v3 */
+ CHECK_MEMBER_CURRENT(_v3, version);
+ CHECK_MEMBER_CURRENT(_v3, width);
+ CHECK_MEMBER_CURRENT(_v3, height);
+ CHECK_MEMBER_CURRENT(_v3, dx);
+ CHECK_MEMBER_CURRENT(_v3, dy);
+ CHECK_MEMBER_CURRENT(_v3, attached_width);
+ CHECK_MEMBER_CURRENT(_v3, attached_height);
+ CHECK_MEMBER_CURRENT(_v3, private);
+ CHECK_MEMBER_CURRENT(_v3, resize_callback);
+ CHECK_MEMBER_CURRENT(_v3, destroy_window_callback);
+ CHECK_MEMBER_CURRENT(_v3, surface);
+
+ CHECK_SIZE_CURRENT (_v3);
+ CHECK_VERSION_CURRENT(_v3);
+
+ return 0;
+}
diff --git a/lib/mesa/src/egl/wayland/wayland-egl/wayland-egl.c b/lib/mesa/src/egl/wayland/wayland-egl/wayland-egl.c
index 4a4701a2d..f16324c9f 100644
--- a/lib/mesa/src/egl/wayland/wayland-egl/wayland-egl.c
+++ b/lib/mesa/src/egl/wayland/wayland-egl/wayland-egl.c
@@ -28,6 +28,7 @@
*/
#include <stdlib.h>
+#include <string.h>
#include <wayland-client.h>
#include "wayland-egl.h"
@@ -54,6 +55,7 @@ WL_EGL_EXPORT struct wl_egl_window *
wl_egl_window_create(struct wl_surface *surface,
int width, int height)
{
+ struct wl_egl_window _INIT_ = { .version = WL_EGL_WINDOW_VERSION };
struct wl_egl_window *egl_window;
if (width <= 0 || height <= 0)
@@ -63,6 +65,8 @@ wl_egl_window_create(struct wl_surface *surface,
if (!egl_window)
return NULL;
+ memcpy(egl_window, &_INIT_, sizeof *egl_window);
+
egl_window->surface = surface;
egl_window->private = NULL;
egl_window->resize_callback = NULL;