[igt-dev] [PATCH i-g-t 01/12] lib/igt_fb: Make igt_remove_fb more robust
Maarten Lankhorst
maarten.lankhorst at linux.intel.com
Tue Feb 6 10:14:06 UTC 2018
This will make it easier for tests to unconditionally call
igt_remove_fb, without first checking whether the FB is allocated.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
lib/igt_fb.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 6fecdd6699a5..35a928b9281d 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1623,9 +1623,13 @@ void igt_put_cairo_ctx(int fd, struct igt_fb *fb, cairo_t *cr)
*/
void igt_remove_fb(int fd, struct igt_fb *fb)
{
+ if (!fb || !fb->fb_id)
+ return;
+
cairo_surface_destroy(fb->cairo_surface);
do_or_die(drmModeRmFB(fd, fb->fb_id));
gem_close(fd, fb->gem_handle);
+ fb->fb_id = 0;
}
/**
--
2.16.1
More information about the igt-dev
mailing list