summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-09-01 14:18:50 +0100
committerEmil Velikov <[email protected]>2017-09-19 19:02:34 +0100
commit1d0be5b3fe548ee33d4520092f583c76d42510a6 (patch)
treea098e41a6accf7dcf42ccbfb880a5d11f390febd /src
parent0007195d8114c5028395de208d45e5c429c12851 (diff)
wayland-drm: constify the callbacks struct
Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c14
-rw-r--r--src/egl/wayland/wayland-drm/wayland-drm.c4
2 files changed, 7 insertions, 11 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 8f589926963..f109400bfab 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2718,17 +2718,16 @@ dri2_wl_release_buffer(void *user_data, struct wl_drm_buffer *buffer)
dri2_dpy->image->destroyImage(buffer->driver_buffer);
}
-static struct wayland_drm_callbacks wl_drm_callbacks = {
- .authenticate = NULL,
- .reference_buffer = dri2_wl_reference_buffer,
- .release_buffer = dri2_wl_release_buffer
-};
-
static EGLBoolean
dri2_bind_wayland_display_wl(_EGLDriver *drv, _EGLDisplay *disp,
struct wl_display *wl_dpy)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+ const struct wayland_drm_callbacks wl_drm_callbacks = {
+ .authenticate = (int(*)(void *, uint32_t)) dri2_dpy->vtbl->authenticate;
+ .reference_buffer = dri2_wl_reference_buffer,
+ .release_buffer = dri2_wl_release_buffer
+ };
int flags = 0;
uint64_t cap;
@@ -2737,9 +2736,6 @@ dri2_bind_wayland_display_wl(_EGLDriver *drv, _EGLDisplay *disp,
if (dri2_dpy->wl_server_drm)
return EGL_FALSE;
- wl_drm_callbacks.authenticate =
- (int(*)(void *, uint32_t)) dri2_dpy->vtbl->authenticate;
-
if (drmGetCap(dri2_dpy->fd, DRM_CAP_PRIME, &cap) == 0 &&
cap == (DRM_PRIME_CAP_IMPORT | DRM_PRIME_CAP_EXPORT) &&
dri2_dpy->image->base.version >= 7 &&
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 2e256aea6d5..5c17b4386b5 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/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;
+ const struct wayland_drm_callbacks *callbacks;
struct wl_buffer_interface buffer_interface;
};
@@ -259,7 +259,7 @@ wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource)
struct wl_drm *
wayland_drm_init(struct wl_display *display, char *device_name,
- struct wayland_drm_callbacks *callbacks, void *user_data,
+ const struct wayland_drm_callbacks *callbacks, void *user_data,
uint32_t flags)
{
struct wl_drm *drm;