summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-06-20 19:27:36 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-06-23 16:57:59 +0200
commitd0a67411c7e9294b636766ec2f3f3d722c347eaf (patch)
tree1d0c664267dd20444e7146ec704d69e08e66745c
parent26e652e6f10b7a1b69ec07f1c3644594f76ad366 (diff)
Make use of gbm_bo in source from eglimagegbm
-rw-r--r--configure.ac2
-rw-r--r--src/wfdsource.c17
2 files changed, 14 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 695899d..3db6bd4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ LT_INIT
PKG_PROG_PKG_CONFIG()
-PKG_CHECK_MODULES(OWFDRM, [libudev libdrm egl])
+PKG_CHECK_MODULES(OWFDRM, [libudev libdrm egl gbm])
PKG_CHECK_MODULES(TEST, [egl gl])
if test "x$GCC" = "xyes"; then
diff --git a/src/wfdsource.c b/src/wfdsource.c
index 5756179..7e7a251 100644
--- a/src/wfdsource.c
+++ b/src/wfdsource.c
@@ -28,6 +28,7 @@
#include "wfddevice.h"
#include "wfdsource.h"
+#include <gbm.h>
#define EGL_EGLEXT_PROTOTYPES
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -37,21 +38,29 @@ struct wfd_source {
uint32_t pitch;
};
+/* provided by mesa, but not part of the public api */
+struct gbm_device *
+_gbm_mesa_get_device(int fd);
+
static int
egl_image_export(struct wfd_device *device,
EGLImageKHR image,
uint32_t *handle, uint32_t *pitch)
{
int fd = wfd_device_get_attribi(device, WFD_DEVICE_ID);
- EGLDisplay dpy = eglGetDRMDisplayMESA(fd);
+ struct gbm_device *gbm = _gbm_mesa_get_device(fd);
+ struct gbm_bo *bo;
- eglExportDRMImageMESA(dpy, image,
- NULL, (EGLint *) handle, (EGLint *) pitch);
+ bo = gbm_bo_create_from_egl_image(gbm, eglGetDisplay(gbm), image,
+ 1, 1, GBM_BO_USE_SCANOUT);
+ *handle = gbm_bo_get_handle(bo).u32;
+ *pitch = gbm_bo_get_pitch(bo);
+ gbm_bo_destroy(bo);
+ gbm_device_destroy(gbm);
return 0;
}
-
void
wfd_source_destroy(struct wfd_device *device,
struct wfd_source *source)