From patchwork Wed May 6 12:29:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Jakobi X-Patchwork-Id: 6349261 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1187A9F373 for ; Wed, 6 May 2015 12:29:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D5F8202DD for ; Wed, 6 May 2015 12:29:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6FBA4202A1 for ; Wed, 6 May 2015 12:29:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8865F6E667; Wed, 6 May 2015 05:29:28 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.math.uni-bielefeld.de (smtp.math.uni-bielefeld.de [129.70.45.10]) by gabe.freedesktop.org (Postfix) with ESMTP id 709386E667 for ; Wed, 6 May 2015 05:29:27 -0700 (PDT) Received: from chidori.math.uni-bielefeld.de (dhcp24-141.math.uni-bielefeld.de [129.70.24.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by smtp.math.uni-bielefeld.de (Postfix) with ESMTPSA id 907E360DB3; Wed, 6 May 2015 14:29:26 +0200 (CEST) From: Tobias Jakobi To: dri-devel@lists.freedesktop.org Subject: [PATCH v2] modetest: only select plane with matching format Date: Wed, 6 May 2015 14:29:33 +0200 Message-Id: <1430915373-5169-1-git-send-email-tjakobi@math.uni-bielefeld.de> X-Mailer: git-send-email 2.0.5 Cc: Tobias Jakobi , emil.l.velikov@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- tests/modetest/modetest.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 7f0c1cc..29d4c34 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -969,6 +969,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; @@ -999,7 +1011,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)