summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2/ecore_drm2_fb.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-05-12 14:42:02 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-05-12 17:51:34 -0500
commit44b57b5dfac1a61dcbfe7192f62460ab2e9ef5ca (patch)
tree5d0e80530121cec7fd391c3d2dd6a4a3d4b51ebb /src/lib/ecore_drm2/ecore_drm2_fb.c
parentedcbff59b72ef8b26af99c1cb3c38f4ffb48282a (diff)
ecore_drm2: Add some safety checks for accessing dead fbs
Accessing an fb after discarding it is bad karma, so we should log something if it ever happens.
Diffstat (limited to '')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_fb.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c
index b5161c67c2..8ef2d82bd9 100644
--- a/src/lib/ecore_drm2/ecore_drm2_fb.c
+++ b/src/lib/ecore_drm2/ecore_drm2_fb.c
@@ -195,6 +195,7 @@ EAPI void *
195ecore_drm2_fb_data_get(Ecore_Drm2_Fb *fb) 195ecore_drm2_fb_data_get(Ecore_Drm2_Fb *fb)
196{ 196{
197 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL); 197 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL);
198 EINA_SAFETY_ON_TRUE_RETURN_VAL(fb->dead, NULL);
198 return fb->mmap; 199 return fb->mmap;
199} 200}
200 201
@@ -202,6 +203,7 @@ EAPI unsigned int
202ecore_drm2_fb_size_get(Ecore_Drm2_Fb *fb) 203ecore_drm2_fb_size_get(Ecore_Drm2_Fb *fb)
203{ 204{
204 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, 0); 205 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, 0);
206 EINA_SAFETY_ON_TRUE_RETURN_VAL(fb->dead, 0);
205 return fb->sizes[0]; 207 return fb->sizes[0];
206} 208}
207 209
@@ -209,6 +211,8 @@ EAPI unsigned int
209ecore_drm2_fb_stride_get(Ecore_Drm2_Fb *fb) 211ecore_drm2_fb_stride_get(Ecore_Drm2_Fb *fb)
210{ 212{
211 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, 0); 213 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, 0);
214 EINA_SAFETY_ON_TRUE_RETURN_VAL(fb->dead, 0);
215
212 return fb->strides[0]; 216 return fb->strides[0];
213} 217}
214 218
@@ -217,6 +221,7 @@ ecore_drm2_fb_dirty(Ecore_Drm2_Fb *fb, Eina_Rectangle *rects, unsigned int count
217{ 221{
218 EINA_SAFETY_ON_NULL_RETURN(fb); 222 EINA_SAFETY_ON_NULL_RETURN(fb);
219 EINA_SAFETY_ON_NULL_RETURN(rects); 223 EINA_SAFETY_ON_NULL_RETURN(rects);
224 EINA_SAFETY_ON_TRUE_RETURN(fb->dead);
220 225
221#ifdef DRM_MODE_FEATURE_DIRTYFB 226#ifdef DRM_MODE_FEATURE_DIRTYFB
222 drmModeClip *clip; 227 drmModeClip *clip;
@@ -573,6 +578,7 @@ EAPI Eina_Bool
573ecore_drm2_fb_busy_get(Ecore_Drm2_Fb *fb) 578ecore_drm2_fb_busy_get(Ecore_Drm2_Fb *fb)
574{ 579{
575 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, EINA_FALSE); 580 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, EINA_FALSE);
581 EINA_SAFETY_ON_TRUE_RETURN_VAL(fb->dead, EINA_FALSE);
576 582
577 return !!(fb->ref - 1); 583 return !!(fb->ref - 1);
578} 584}
@@ -616,6 +622,8 @@ EAPI void *
616ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb) 622ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb)
617{ 623{
618 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL); 624 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL);
625 EINA_SAFETY_ON_TRUE_RETURN_VAL(fb->dead, NULL);
626
619 return fb->gbm_bo; 627 return fb->gbm_bo;
620} 628}
621 629