@@ -969,6 +969,22 @@ page_flip_handler(int fd, unsigned int frame,
}
}
+static bool format_support(const drmModePlanePtr ovr, uint32_t fmt)
+{
+ unsigned int i;
+ bool ret = false;
+
+ for (i = 0; i < ovr->count_formats; ++i) {
+ if (ovr->formats[i] != fmt)
+ continue;
+
+ ret = true;
+ break;
+ }
+
+ return ret;
+}
+
static int set_plane(struct device *dev, struct plane_arg *p)
{
drmModePlane *ovr;
@@ -999,7 +1015,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)
Don't assume that a plane supports any kind of pixelformat but do a check first. Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> --- tests/modetest/modetest.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)