summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-06-15 12:55:03 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-06-23 08:15:40 -0500
commita3eed7865a4508c3fe52c3b022216008801b5506 (patch)
tree2ade78bde988399fd79800b6ea49f5eaec7d81a9 /src/lib/ecore_drm2
parentbd0774206f8b9780f6825dbf52c2381fe8ef1e6f (diff)
ecore_drm2: Add ecore_drm2_fb_status_handler_set
The old per output release handler is no longer complicated enough. In the near future we'll need to be able to tell an engine that its fb has been placed on scanout via hardware plane, or removed from a hardware plane. It's simpler to provide that information as well as release information through a single callback.
Diffstat (limited to 'src/lib/ecore_drm2')
-rw-r--r--src/lib/ecore_drm2/Ecore_Drm2.h25
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_fb.c7
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_private.h3
3 files changed, 35 insertions, 0 deletions
diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
index f5768e3584..cae2c4a263 100644
--- a/src/lib/ecore_drm2/Ecore_Drm2.h
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -37,6 +37,13 @@ typedef enum _Ecore_Drm2_Rotation
37 ECORE_DRM2_ROTATION_REFLECT_Y = 32 37 ECORE_DRM2_ROTATION_REFLECT_Y = 32
38} Ecore_Drm2_Rotation; 38} Ecore_Drm2_Rotation;
39 39
40typedef enum _Ecore_Drm2_Fb_Status
41{
42 ECORE_DRM2_FB_STATUS_SCANOUT_ON = 1,
43 ECORE_DRM2_FB_STATUS_SCANOUT_OFF = 2,
44 ECORE_DRM2_FB_STATUS_RELEASE = 4,
45} Ecore_Drm2_Fb_Status;
46
40/* opaque structure to represent a drm device */ 47/* opaque structure to represent a drm device */
41typedef struct _Ecore_Drm2_Device Ecore_Drm2_Device; 48typedef struct _Ecore_Drm2_Device Ecore_Drm2_Device;
42 49
@@ -85,6 +92,7 @@ EAPI extern int ECORE_DRM2_EVENT_OUTPUT_CHANGED;
85EAPI extern int ECORE_DRM2_EVENT_ACTIVATE; 92EAPI extern int ECORE_DRM2_EVENT_ACTIVATE;
86 93
87typedef void (*Ecore_Drm2_Release_Handler)(void *data, Ecore_Drm2_Fb *b); 94typedef void (*Ecore_Drm2_Release_Handler)(void *data, Ecore_Drm2_Fb *b);
95typedef void (*Ecore_Drm2_Fb_Status_Handler)(Ecore_Drm2_Fb *b, Ecore_Drm2_Fb_Status status, void *data);
88 96
89/** 97/**
90 * @file 98 * @file
@@ -1061,6 +1069,23 @@ EAPI void ecore_drm2_plane_destination_set(Ecore_Drm2_Plane *plane, int x, int y
1061 */ 1069 */
1062EAPI Eina_Bool ecore_drm2_plane_fb_set(Ecore_Drm2_Plane *plane, Ecore_Drm2_Fb *fb); 1070EAPI Eina_Bool ecore_drm2_plane_fb_set(Ecore_Drm2_Plane *plane, Ecore_Drm2_Fb *fb);
1063 1071
1072/**
1073 * Register a callback for buffer status updates
1074 *
1075 * When a flip completes ecore_drm2 may release a buffer. Use this callback
1076 * if you need to do bookkeeping or locking on buffer release.
1077 *
1078 * Additionally, an fb may be placed on scanout or removed from scanout by
1079 * evas. When this happens a compositor needs to ensure the buffers aren't
1080 * released back to a client while they're on scanout.
1081 *
1082 * @param fb The fb to register the callback on
1083 * @param handler The function to handle the callback
1084 * @param data The user data to pass to the callback
1085 * @ingroup Ecore_Drm2_Output_Group
1086 * @since 1.20
1087 */
1088EAPI void ecore_drm2_fb_status_handler_set(Ecore_Drm2_Fb *fb, Ecore_Drm2_Fb_Status_Handler handler, void *data);
1064# endif 1089# endif
1065 1090
1066#endif 1091#endif
diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c
index 56b397ece8..b97634d1a4 100644
--- a/src/lib/ecore_drm2/ecore_drm2_fb.c
+++ b/src/lib/ecore_drm2/ecore_drm2_fb.c
@@ -670,3 +670,10 @@ fail:
670 free(fb); 670 free(fb);
671 return NULL; 671 return NULL;
672} 672}
673
674EAPI void
675ecore_drm2_fb_status_handler_set(Ecore_Drm2_Fb *fb, Ecore_Drm2_Fb_Status_Handler handler, void *data)
676{
677 fb->status_handler = handler;
678 fb->status_data = data;
679}
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 6270b2d7a4..c335095c77 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -162,6 +162,9 @@ struct _Ecore_Drm2_Fb
162 void *gbm_bo; 162 void *gbm_bo;
163 void *mmap; 163 void *mmap;
164 164
165 Ecore_Drm2_Fb_Status_Handler status_handler;
166 void *status_data;
167
165 Eina_Bool gbm : 1; 168 Eina_Bool gbm : 1;
166 Eina_Bool dmabuf : 1; 169 Eina_Bool dmabuf : 1;
167 Eina_Bool dead : 1; 170 Eina_Bool dead : 1;