mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-25 21:10:11 +01:00
modetest: clear buffer and framebuffer for planes
Currently we don't destroy buffer and remove framebuffer for planes when closing modetest. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> [Emil Velikov: Tweak the commit message. fb_id = 0 is unused] Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
parent
21170a8c63
commit
4d760d7f46
1 changed files with 20 additions and 0 deletions
|
|
@ -736,6 +736,7 @@ struct plane_arg {
|
|||
uint32_t w, h;
|
||||
double scale;
|
||||
unsigned int fb_id;
|
||||
struct bo *bo;
|
||||
char format_str[5]; /* need to leave room for terminating \0 */
|
||||
unsigned int fourcc;
|
||||
};
|
||||
|
|
@ -1018,6 +1019,8 @@ static int set_plane(struct device *dev, struct plane_arg *p)
|
|||
if (plane_bo == NULL)
|
||||
return -1;
|
||||
|
||||
p->bo = plane_bo;
|
||||
|
||||
/* just use single plane format for now.. */
|
||||
if (drmModeAddFB2(dev->fd, p->w, p->h, p->fourcc,
|
||||
handles, pitches, offsets, &p->fb_id, plane_flags)) {
|
||||
|
|
@ -1050,6 +1053,19 @@ static int set_plane(struct device *dev, struct plane_arg *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void clear_planes(struct device *dev, struct plane_arg *p, unsigned int count)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (p[i].fb_id)
|
||||
drmModeRmFB(dev->fd, p[i].fb_id);
|
||||
if (p[i].bo)
|
||||
bo_destroy(p[i].bo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void set_mode(struct device *dev, struct pipe_arg *pipes, unsigned int count)
|
||||
{
|
||||
uint32_t handles[4] = {0}, pitches[4] = {0}, offsets[4] = {0};
|
||||
|
|
@ -1523,6 +1539,7 @@ int main(int argc, char **argv)
|
|||
if (parse_plane(&plane_args[plane_count], optarg) < 0)
|
||||
usage(argv[0]);
|
||||
|
||||
plane_args[plane_count].fb_id = 0;
|
||||
plane_count++;
|
||||
break;
|
||||
case 'p':
|
||||
|
|
@ -1655,6 +1672,9 @@ int main(int argc, char **argv)
|
|||
if (test_cursor)
|
||||
clear_cursors(&dev);
|
||||
|
||||
if (plane_count)
|
||||
clear_planes(&dev, plane_args, plane_count);
|
||||
|
||||
if (count)
|
||||
clear_mode(&dev);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue