[cairo] [PATCH 62/71] drm: added surface function for crtc_id retrieval
Enrico Weigelt, metux IT consult
enrico.weigelt at gr13.net
Mon Apr 17 16:57:41 UTC 2017
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 907610dcd..daef8adef 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 b2b83d319..2101f1dfc 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 9742e559f..ea85a0975 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.11.0.rc0.7.gbe5a750
More information about the cairo
mailing list