[Mesa-dev] [PATCH] st/egl: Fix build after changes in src/egl/wayland/
Michel Dänzer
michel at daenzer.net
Tue Mar 19 03:07:25 PDT 2013
From: Michel Dänzer <michel.daenzer at amd.com>
Not sure it actually works though, some buffer callbacks seem to have rotted
before.
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/gallium/state_trackers/egl/drm/native_drm.c | 8 +++++++-
src/gallium/state_trackers/egl/wayland/native_drm.c | 8 +++++++-
src/gallium/state_trackers/egl/x11/native_dri2.c | 14 +++++++++++++-
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c
index f0c0f54..65c91cf 100644
--- a/src/gallium/state_trackers/egl/drm/native_drm.c
+++ b/src/gallium/state_trackers/egl/drm/native_drm.c
@@ -207,13 +207,19 @@ drm_display_bind_wayland_display(struct native_display *ndpy,
struct wl_display *wl_dpy)
{
struct drm_display *drmdpy = drm_display(ndpy);
+ int ret, flags = 0;
+ uint64_t cap;
if (drmdpy->wl_server_drm)
return FALSE;
+ ret = drmGetCap(drmdpy->fd, DRM_CAP_PRIME, &cap);
+ if (ret == 0 && cap == (DRM_PRIME_CAP_IMPORT | DRM_PRIME_CAP_EXPORT))
+ flags |= WAYLAND_DRM_PRIME;
+
drmdpy->wl_server_drm = wayland_drm_init(wl_dpy,
drmdpy->device_name,
- &wl_drm_callbacks, ndpy);
+ &wl_drm_callbacks, ndpy, flags);
if (!drmdpy->wl_server_drm)
return FALSE;
diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c b/src/gallium/state_trackers/egl/wayland/native_drm.c
index 3801fac..7633379 100644
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -265,13 +265,19 @@ wayland_drm_display_bind_wayland_display(struct native_display *ndpy,
struct wl_display *wl_dpy)
{
struct wayland_drm_display *drmdpy = wayland_drm_display(ndpy);
+ int ret, flags = 0;
+ uint64_t cap;
if (drmdpy->wl_server_drm)
return FALSE;
+ ret = drmGetCap(drmdpy->fd, DRM_CAP_PRIME, &cap);
+ if (ret == 0 && cap == (DRM_PRIME_CAP_IMPORT | DRM_PRIME_CAP_EXPORT))
+ flags |= WAYLAND_DRM_PRIME;
+
drmdpy->wl_server_drm =
wayland_drm_init(wl_dpy, drmdpy->device_name,
- &wl_drm_callbacks, ndpy);
+ &wl_drm_callbacks, ndpy, flags);
if (!drmdpy->wl_server_drm)
return FALSE;
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index a989f9e..67ecb60 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -40,6 +40,7 @@
#include "common/native_helper.h"
#ifdef HAVE_WAYLAND_BACKEND
+#include <xf86drm.h>
#include "common/native_wayland_drm_bufmgr_helper.h"
#endif
@@ -63,6 +64,7 @@ struct dri2_display {
struct util_hash_table *surfaces;
#ifdef HAVE_WAYLAND_BACKEND
struct wl_drm *wl_server_drm; /* for EGL_WL_bind_wayland_display */
+ int fd;
#endif
};
@@ -817,6 +819,10 @@ dri2_display_init_screen(struct native_display *ndpy)
return FALSE;
}
+#ifdef HAVE_WAYLAND_BACKEND
+ dri2dpy->fd = fd;
+#endif
+
return TRUE;
}
@@ -855,13 +861,19 @@ dri2_display_bind_wayland_display(struct native_display *ndpy,
struct wl_display *wl_dpy)
{
struct dri2_display *dri2dpy = dri2_display(ndpy);
+ int ret, flags = 0;
+ uint64_t cap;
if (dri2dpy->wl_server_drm)
return FALSE;
+ ret = drmGetCap(dri2dpy->fd, DRM_CAP_PRIME, &cap);
+ if (ret == 0 && cap == (DRM_PRIME_CAP_IMPORT | DRM_PRIME_CAP_EXPORT))
+ flags |= WAYLAND_DRM_PRIME;
+
dri2dpy->wl_server_drm = wayland_drm_init(wl_dpy,
x11_screen_get_device_name(dri2dpy->xscr),
- &wl_drm_callbacks, ndpy);
+ &wl_drm_callbacks, ndpy, flags);
if (!dri2dpy->wl_server_drm)
return FALSE;
--
1.8.2.rc3
More information about the mesa-dev
mailing list