[cogl/cogl-1.18] kms-winsys: Add api that tells cogl to ignore a crtc



commit d9afc6dada485b26eddb0cd0f8e61253cb16d5c4
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Wed May 21 20:24:52 2014 +0200

    kms-winsys: Add api that tells cogl to ignore a crtc
    
    An application might for whatever reason want to control a specific output
    directly and have cogl only swap the other outputs if any. So add an api that
    allows setting a crtc to be ignored.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730536

 cogl/cogl-kms-display.h           |   18 ++++++++++++++++++
 cogl/cogl-kms-renderer.h          |    3 ++-
 cogl/winsys/cogl-winsys-egl-kms.c |   23 ++++++++++++++++++++++-
 3 files changed, 42 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl-kms-display.h b/cogl/cogl-kms-display.h
index 2192a9f..05226df 100644
--- a/cogl/cogl-kms-display.h
+++ b/cogl/cogl-kms-display.h
@@ -67,6 +67,8 @@ typedef struct {
 
   uint32_t *connectors;
   uint32_t  count;
+ 
+  CoglBool  ignore;
 } CoglKmsCrtc;
 
 /**
@@ -97,5 +99,21 @@ cogl_kms_display_set_layout (CoglDisplay *display,
                              int n_crtcs,
                              CoglError **error);
 
+
+/**
+ * cogl_kms_display_set_layout:
+ * @onscreen: a #CoglDisplay
+ * @id: KMS output id
+ * @ignore: Ignore ouput or not
+ *
+ * Tells cogl to ignore (or stop ignoring) a ctrc which means
+ * it never flips buffers at this crtc.
+ *
+ * Stability: unstable
+ */
+void
+cogl_kms_display_set_ignore_crtc (CoglDisplay *display,
+                                  uint32_t id,
+                                  CoglBool ignore);
 COGL_END_DECLS
 #endif /* __COGL_KMS_DISPLAY_H__ */
diff --git a/cogl/cogl-kms-renderer.h b/cogl/cogl-kms-renderer.h
index 2a61938..4e4948e 100644
--- a/cogl/cogl-kms-renderer.h
+++ b/cogl/cogl-kms-renderer.h
@@ -68,6 +68,7 @@ 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);
+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 a40518d..9be1df1 100644
--- a/cogl/winsys/cogl-winsys-egl-kms.c
+++ b/cogl/winsys/cogl-winsys-egl-kms.c
@@ -582,7 +582,7 @@ flip_all_crtcs (CoglDisplay *display, CoglFlipKMS *flip, int fb_id)
       CoglKmsCrtc *crtc = l->data;
       int ret;
 
-      if (crtc->count == 0)
+      if (crtc->count == 0 || crtc->ignore)
         continue;
 
       ret = drmModePageFlip (kms_renderer->fd,
@@ -1238,3 +1238,24 @@ cogl_kms_display_set_layout (CoglDisplay *display,
 
   return TRUE;
 }
+
+
+void
+cogl_kms_display_set_ignore_crtc (CoglDisplay *display,
+                                  uint32_t id,
+                                  CoglBool ignore)
+{
+  CoglDisplayEGL *egl_display = display->winsys;
+  CoglDisplayKMS *kms_display = egl_display->platform;
+  GList *l;
+
+  for (l = kms_display->crtcs; l; l = l->next)
+  {
+    CoglKmsCrtc *crtc = l->data;
+    if (crtc->id == id)
+      {
+        crtc->ignore = ignore;
+        break;
+      }
+  }
+}


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