[cairo] [PATCH v8 66/71] drm: added surface function for crtc_id retrieval

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Thu Jun 30 15:46:44 UTC 2016


applications might need to know which crtc the surface's
framebuffer is currently assigned to (eg. cursor control)

Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
 src/cairo-drm.h             |  5 +++++
 src/drm/cairo-drm-private.h |  4 ++++
 src/drm/cairo-drm-surface.c | 11 +++++++++++
 3 files changed, 20 insertions(+)

diff --git a/src/cairo-drm.h b/src/cairo-drm.h
index 907610d..daef8ad 100644
--- a/src/cairo-drm.h
+++ b/src/cairo-drm.h
@@ -33,6 +33,8 @@
 #ifndef CAIRO_DRM_H
 #define CAIRO_DRM_H
 
+#include <stdint.h>
+
 #include "cairo.h"
 
 #if CAIRO_HAS_DRM_SURFACE
@@ -92,6 +94,9 @@ cairo_drm_surface_get_height (cairo_surface_t *surface);
 cairo_public int
 cairo_drm_surface_get_stride (cairo_surface_t *surface);
 
+cairo_public uint32_t
+cairo_drm_surface_get_crtc_id (cairo_surface_t *surface);
+
 /* XXX map/unmap, general surface layer? */
 
 /* Rough outline, culled from a conversation on IRC:
diff --git a/src/drm/cairo-drm-private.h b/src/drm/cairo-drm-private.h
index b2b83d3..2101f1d 100644
--- a/src/drm/cairo-drm-private.h
+++ b/src/drm/cairo-drm-private.h
@@ -91,6 +91,9 @@ typedef cairo_status_t
 typedef cairo_surface_t *
 (*cairo_drm_surface_map_to_image_func_t) (void *surface);
 
+typedef uint32_t
+(*cairo_drm_surface_get_crtc_id_func_t) (cairo_drm_surface_t *surface);
+
 typedef struct _cairo_drm_bo_backend {
     void (*release) (cairo_drm_device_t *device, cairo_drm_bo_t *bo);
     void *(*map)    (const cairo_drm_device_t *device, cairo_drm_bo_t *bo);
@@ -110,6 +113,7 @@ typedef struct _cairo_drm_surface_backend {
     cairo_drm_surface_flink_func_t flink;
     cairo_drm_surface_enable_scan_out_func_t enable_scan_out;
     cairo_drm_surface_map_to_image_func_t map_to_image;
+    cairo_drm_surface_get_crtc_id_func_t get_crtc_id;
 } cairo_drm_surface_backend_t;
 
 struct _cairo_drm_bo {
diff --git a/src/drm/cairo-drm-surface.c b/src/drm/cairo-drm-surface.c
index 9742e55..ea85a09 100644
--- a/src/drm/cairo-drm-surface.c
+++ b/src/drm/cairo-drm-surface.c
@@ -605,3 +605,14 @@ _cairo_drm_surface_flush (void *abstract_surface,
 
     return status;
 }
+
+uint32_t
+cairo_drm_surface_get_crtc_id (cairo_surface_t *sf)
+{
+    cairo_drm_device_t *drm_dev = _cairo_device_cast_drm (sf->device);
+
+    if (!drm_dev->surface.get_crtc_id)
+	return 0;
+
+    return drm_dev->surface.get_crtc_id (_cairo_surface_cast_drm (sf));
+}
-- 
2.6.4.442.g545299f



More information about the cairo mailing list