[PATCH libdrm 2/5] modetest: add to use drmModeRmFB

Joonyoung Shim jy0922.shim at samsung.com
Mon Apr 13 01:32:15 PDT 2015


It's proper to remove added framebuffer before destroy buffer.

Signed-off-by: Joonyoung Shim <jy0922.shim at samsung.com>
---
 tests/modetest/modetest.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index b59f6b5..6377459 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -1055,6 +1055,7 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
 
 	dev->mode.width = 0;
 	dev->mode.height = 0;
+	dev->mode.fb_id = -1;
 
 	for (i = 0; i < count; i++) {
 		struct pipe_arg *pipe = &pipes[i];
@@ -1115,6 +1116,8 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
 
 static void clear_mode(struct device *dev)
 {
+	if (dev->mode.fb_id != -1)
+		drmModeRmFB(dev->fd, dev->mode.fb_id);
 	if (dev->mode.bo)
 		bo_destroy(dev->mode.bo);
 }
@@ -1255,6 +1258,7 @@ static void test_page_flip(struct device *dev, struct pipe_arg *pipes, unsigned
 		drmHandleEvent(dev->fd, &evctx);
 	}
 
+	drmModeRmFB(dev->fd, other_fb_id);
 	bo_destroy(other_bo);
 }
 
-- 
1.9.1



More information about the dri-devel mailing list