From 93bcd0dd58d61b93b584558cba8f616448ab883e Mon Sep 17 00:00:00 2001 From: Adel Gadllah Date: Wed, 21 May 2014 20:24:52 +0200 Subject: 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 77219c29..05222c35 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 9d8eb9c4..3b38b046 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 5072d8e7..c70f5c13 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, @@ -1232,3 +1232,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; + } + } +} -- cgit v1.2.1