summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-07-21 12:12:53 +0000
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-07-21 12:12:53 +0000
commit0cc1c4613cd27691eee9b57aaa30df2f8ea46a26 (patch)
tree21dcc683aac6ea2db8fd46d66c9b7267194cfb1f
parent5b88f270c151df7f39efaea47358149bc2d860f9 (diff)
va/wayland: Destroy drm interface early [HACK]
So egl can initialize without us getting there wl_drm events. va-wayland needs to be initalized before egl therefor.
-rw-r--r--va/wayland/va_wayland.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/va/wayland/va_wayland.c b/va/wayland/va_wayland.c
index 6d660b7..bae6d23 100644
--- a/va/wayland/va_wayland.c
+++ b/va/wayland/va_wayland.c
@@ -143,6 +143,13 @@ surface_get_id(struct wl_surface *surface)
return object->id;
}
+static inline struct wl_drm *
+wl_drm_create_without_bind(struct wl_display *display, uint32_t id)
+{
+ return (struct wl_drm *)
+ wl_proxy_create_for_id(display, &wl_drm_interface, id);
+}
+
static inline int
align(int value, int alignment)
{
@@ -229,10 +236,17 @@ wldrm_swap_buffer(struct VADriverContext *ctx,
assert(wbuf);
if (!wbuf->buf) {
+ if (!wctx->drm) {
+ int id = wl_display_get_global(display, "wl_drm", 1);
+ assert(id != 0);
+ wctx->drm = wl_drm_create_without_bind(display, id);
+ }
wbuf->buf =
wl_drm_create_buffer(wctx->drm, wbuf->base.dri2.name,
win->width, win->height,
wbuf->base.dri2.pitch, win->visual);
+ wl_drm_destroy(wctx->drm);
+ wctx->drm = NULL;
}
wl_buffer_damage(wbuf->buf, 0, 0, win->width, win->height);
@@ -358,6 +372,9 @@ wldrm_display_ctx_get_driver_name(struct VADisplayContext *display_ctx,
drm_state->swapBuffer = wldrm_swap_buffer;
drm_state->getDrawable = wldrm_get_drawable;
+ wl_drm_destroy(wctx->drm);
+ wctx->drm = NULL;
+
return VA_STATUS_SUCCESS;
cleanup_fd: