[cogl] kms_winsys: Add cogl_kms_renderer_get_gbm api



commit 4835187ba71872145b809544afcebe2ed311a3c2
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Tue May 13 21:08:59 2014 +0200

    kms_winsys: Add cogl_kms_renderer_get_gbm api
    
    Applications might want to get the underlying gbm device so add a getter for it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730536

 cogl/cogl-kms-renderer.h          |    1 +
 cogl/winsys/cogl-winsys-egl-kms.c |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-kms-renderer.h b/cogl/cogl-kms-renderer.h
index b4dfc74..9d8eb9c 100644
--- a/cogl/cogl-kms-renderer.h
+++ b/cogl/cogl-kms-renderer.h
@@ -68,5 +68,6 @@ cogl_kms_renderer_set_kms_fd (CoglRenderer *renderer,
 int
 cogl_kms_renderer_get_kms_fd (CoglRenderer *renderer);
 
+struct gbm_device *cogl_kms_renderer_get_gbm (CoglRenderer *renderer);
 COGL_END_DECLS
 #endif /* __COGL_KMS_RENDERER_H__ */
diff --git a/cogl/winsys/cogl-winsys-egl-kms.c b/cogl/winsys/cogl-winsys-egl-kms.c
index eb89b60..5072d8e 100644
--- a/cogl/winsys/cogl-winsys-egl-kms.c
+++ b/cogl/winsys/cogl-winsys-egl-kms.c
@@ -1111,6 +1111,20 @@ cogl_kms_renderer_set_kms_fd (CoglRenderer *renderer,
   renderer->kms_fd = fd;
 }
 
+struct gbm_device *
+cogl_kms_renderer_get_gbm (CoglRenderer *renderer)
+{
+  _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL);
+  if (renderer->connected)
+    {
+      CoglRendererEGL *egl_renderer = renderer->winsys;
+      CoglRendererKMS *kms_renderer = egl_renderer->platform;
+      return kms_renderer->gbm;
+    }
+    else
+      return NULL;
+}
+
 int
 cogl_kms_renderer_get_kms_fd (CoglRenderer *renderer)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]