modetest: fix the error path handling
Remove the framebuffer and destroy the bo when error occurs on set_mode and test_page_flip. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> [Emil Velikov: Tweak the commit message.] Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>main
parent
bcaaa75cf4
commit
21170a8c63
|
@ -1080,6 +1080,8 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
|
|||
if (bo == NULL)
|
||||
return;
|
||||
|
||||
dev->mode.bo = bo;
|
||||
|
||||
ret = drmModeAddFB2(dev->fd, dev->mode.width, dev->mode.height,
|
||||
pipes[0].fourcc, handles, pitches, offsets, &fb_id, 0);
|
||||
if (ret) {
|
||||
|
@ -1088,6 +1090,8 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
|
|||
return;
|
||||
}
|
||||
|
||||
dev->mode.fb_id = fb_id;
|
||||
|
||||
x = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
struct pipe_arg *pipe = &pipes[i];
|
||||
|
@ -1115,9 +1119,6 @@ static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int co
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dev->mode.bo = bo;
|
||||
dev->mode.fb_id = fb_id;
|
||||
}
|
||||
|
||||
static void clear_mode(struct device *dev)
|
||||
|
@ -1198,7 +1199,7 @@ static void test_page_flip(struct device *dev, struct pipe_arg *pipes, unsigned
|
|||
&other_fb_id, 0);
|
||||
if (ret) {
|
||||
fprintf(stderr, "failed to add fb: %s\n", strerror(errno));
|
||||
return;
|
||||
goto err;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
|
@ -1212,7 +1213,7 @@ static void test_page_flip(struct device *dev, struct pipe_arg *pipes, unsigned
|
|||
pipe);
|
||||
if (ret) {
|
||||
fprintf(stderr, "failed to page flip: %s\n", strerror(errno));
|
||||
return;
|
||||
goto err_rmfb;
|
||||
}
|
||||
gettimeofday(&pipe->start, NULL);
|
||||
pipe->swap_count = 0;
|
||||
|
@ -1264,7 +1265,9 @@ static void test_page_flip(struct device *dev, struct pipe_arg *pipes, unsigned
|
|||
drmHandleEvent(dev->fd, &evctx);
|
||||
}
|
||||
|
||||
err_rmfb:
|
||||
drmModeRmFB(dev->fd, other_fb_id);
|
||||
err:
|
||||
bo_destroy(other_bo);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue