diff options
author | Tobias Jakobi <tjakobi@math.uni-bielefeld.de> | 2015-05-06 14:29:33 +0200 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2015-05-28 16:02:28 +0100 |
commit | 360a7eacd4961ceab72554d36917f031a05ed030 (patch) | |
tree | ae4b81486f70720a0191d679b729b48232821012 | |
parent | 85ede61136d541038a941c1eee90379af33e987f (diff) |
modetest: only select plane with matching format
Don't assume that a plane supports any kind of pixelformat
but do a check first.
v2: Simplify the format check.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r-- | tests/modetest/modetest.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 57be810b..19ea1737 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -960,6 +960,18 @@ page_flip_handler(int fd, unsigned int frame, } } +static bool format_support(const drmModePlanePtr ovr, uint32_t fmt) +{ + unsigned int i; + + for (i = 0; i < ovr->count_formats; ++i) { + if (ovr->formats[i] == fmt) + return true; + } + + return false; +} + static int set_plane(struct device *dev, struct plane_arg *p) { drmModePlane *ovr; @@ -990,7 +1002,7 @@ static int set_plane(struct device *dev, struct plane_arg *p) for (i = 0; i < dev->resources->plane_res->count_planes && !plane_id; i++) { ovr = dev->resources->planes[i].plane; - if (!ovr) + if (!ovr || !format_support(ovr, p->fourcc)) continue; if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id) |