aboutsummaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen2
diff options
context:
space:
mode:
authorGrigory Kletsko <grigory.kletsko@cogentembedded.com>2016-11-02 17:41:54 +0300
committerYusuke Nakamura <ynakamura@jp.adit-jv.com>2016-12-15 10:14:16 +0000
commitbaeac5c376980853149a85eab528a60f28d74bcf (patch)
tree27a1ea2a3154689c87d8b44e24aae7648ce232d8 /meta-rcar-gen2
parent55899bf739f36f1e692c42d9219020720e836e73 (diff)
patch libgbm to retrieve DMA fd for gbm_surface
This patch enables handling buffer object as file descriptor This patch will be used for meter cluster demo for CES2017 Change-Id: Ib83d69ba887ef9b5b03e99708aedf9b2a97f4d8a Signed-off-by: Grigory Kletsko <grigory.kletsko@cogentembedded.com>
Diffstat (limited to 'meta-rcar-gen2')
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/libgbm.bb4
-rw-r--r--meta-rcar-gen2/recipes-graphics/wayland/libgbm/0001-Add-gbm_bo_get_fd-function.patch90
2 files changed, 94 insertions, 0 deletions
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/libgbm.bb b/meta-rcar-gen2/recipes-graphics/wayland/libgbm.bb
index 329e972..b0ddcaf 100644
--- a/meta-rcar-gen2/recipes-graphics/wayland/libgbm.bb
+++ b/meta-rcar-gen2/recipes-graphics/wayland/libgbm.bb
@@ -7,6 +7,10 @@ LIC_FILES_CHKSUM = "file://gbm.c;beginline=4;endline=22;md5=5cdaac262c876e98e477
SRCREV = "d5a58c689932d42add1301c5cd323da5244374af"
SRC_URI = "git://github.com/thayama/libgbm;protocol=git;branch=master"
+SRC_URI_append = " \
+ file://0001-Add-gbm_bo_get_fd-function.patch \
+"
+
S = "${WORKDIR}/git"
COMPATIBLE_MACHINE = "(r8a7790|r8a7791|r8a7793|r8a7794)"
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/libgbm/0001-Add-gbm_bo_get_fd-function.patch b/meta-rcar-gen2/recipes-graphics/wayland/libgbm/0001-Add-gbm_bo_get_fd-function.patch
new file mode 100644
index 0000000..e688cde
--- /dev/null
+++ b/meta-rcar-gen2/recipes-graphics/wayland/libgbm/0001-Add-gbm_bo_get_fd-function.patch
@@ -0,0 +1,90 @@
+From e6d4594481a2c7d9625d1f4abf898cd461c30c42 Mon Sep 17 00:00:00 2001
+From: Grigory Kletsko <grigory.kletsko@cogentembedded.com>
+Date: Wed, 2 Nov 2016 16:17:16 +0300
+Subject: [PATCH] Add gbm_bo_get_fd() function
+
+---
+ backend_kms.c | 8 ++++++++
+ gbm.c | 15 +++++++++++++++
+ gbm.h | 3 +++
+ gbmint.h | 1 +
+ 4 files changed, 27 insertions(+)
+
+diff --git a/backend_kms.c b/backend_kms.c
+index cfee3b0..3fc1d66 100644
+--- a/backend_kms.c
++++ b/backend_kms.c
+@@ -339,6 +339,13 @@ static int gbm_kms_surface_has_free_buffers(struct gbm_surface *_surface)
+ return ((!surface->bo[0]->locked) || (!surface->bo[1]->locked));
+ }
+
++static int gbm_kms_bo_get_fd(struct gbm_bo *_bo)
++{
++ struct gbm_kms_bo *bo = (struct gbm_kms_bo*)_bo;
++
++ return bo->fd;
++}
++
+ struct gbm_device kms_gbm_device = {
+ .name = "kms",
+
+@@ -349,6 +356,7 @@ struct gbm_device kms_gbm_device = {
+ .bo_import = gbm_kms_bo_import,
+ .bo_write = gbm_kms_bo_write,
+ .bo_destroy = gbm_kms_bo_destroy,
++ .bo_get_fd = gbm_kms_bo_get_fd,
+
+ .surface_create = gbm_kms_surface_create,
+ .surface_lock_front_buffer = gbm_kms_surface_lock_front_buffer,
+diff --git a/gbm.c b/gbm.c
+index c58576d..458fac0 100644
+--- a/gbm.c
++++ b/gbm.c
+@@ -470,3 +470,18 @@ gbm_surface_has_free_buffers(struct gbm_surface *surf)
+ {
+ return surf->gbm->surface_has_free_buffers(surf);
+ }
++
++/** Get a DMA-BUF file descriptor for the buffer object
++ *
++ * This function creates a DMA-BUF (also known as PRIME) file descriptor
++ * handle for the buffer object. Eeach call to gbm_bo_get_fd() returns a new
++ * file descriptor and the caller is responsible for closing the file
++ * descriptor.
++ * \param bo The buffer object
++ * \return Returns a file descriptor referring to the underlying buffer
++ */
++GBM_EXPORT int
++gbm_bo_get_fd(struct gbm_bo *bo)
++{
++ return bo->gbm->bo_get_fd(bo);
++}
+diff --git a/gbm.h b/gbm.h
+index 9d2a030..ad92935 100644
+--- a/gbm.h
++++ b/gbm.h
+@@ -285,6 +285,9 @@ gbm_surface_has_free_buffers(struct gbm_surface *surface);
+ void
+ gbm_surface_destroy(struct gbm_surface *surface);
+
++int
++gbm_bo_get_fd(struct gbm_bo *bo);
++
+ #ifdef __cplusplus
+ }
+ #endif
+diff --git a/gbmint.h b/gbmint.h
+index a467bea..70a8d4a 100644
+--- a/gbmint.h
++++ b/gbmint.h
+@@ -70,6 +70,7 @@ struct gbm_device {
+ void *buffer, uint32_t usage);
+ int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data);
+ void (*bo_destroy)(struct gbm_bo *bo);
++ int (*bo_get_fd)(struct gbm_bo *_bo);
+
+ struct gbm_surface *(*surface_create)(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+--
+2.7.4
+