From patchwork Fri Mar 28 10:15:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien DESSENNE X-Patchwork-Id: 3901831 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5FA269F2E8 for ; Fri, 28 Mar 2014 10:36:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 662FF202A7 for ; Fri, 28 Mar 2014 10:36:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0C683202EC for ; Fri, 28 Mar 2014 10:36:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1CEAF6EC3C; Fri, 28 Mar 2014 03:36:16 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1174 seconds by postgrey-1.34 at gabe; Fri, 28 Mar 2014 03:36:14 PDT Received: from mx08-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 97B526EC3C for ; Fri, 28 Mar 2014 03:36:14 -0700 (PDT) Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id s2SA9hi2011105; Fri, 28 Mar 2014 11:16:37 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 1jvdkbgb50-1 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Fri, 28 Mar 2014 11:16:37 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5EAB74E; Fri, 28 Mar 2014 10:16:22 +0000 (GMT) Received: from mail7.sgp.st.com (unknown [164.129.223.81]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4111B1639D; Fri, 28 Mar 2014 10:16:22 +0000 (GMT) Received: from lmenx311.lme.st.com (lmenx311.lme.st.com [10.201.23.25]) by mail7.sgp.st.com (MOS 4.3.3-GA) with ESMTP id BYZ24780 (AUTH fabien.dessenne@st.com); Fri, 28 Mar 2014 11:16:06 +0100 From: Fabien DESSENNE To: dri-devel@lists.freedesktop.org Subject: [PATCH] modetest: consider supported formats before selecting a DRM plane Date: Fri, 28 Mar 2014 11:15:48 +0100 Message-Id: <1396001748-8147-1-git-send-email-fabien.dessenne@st.com> X-Mailer: git-send-email 1.9.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.11.87, 1.0.14, 0.0.0000 definitions=2014-03-28_04:2014-03-28, 2014-03-28, 1970-01-01 signatures=0 Cc: Vincent Abriou , Benjamin Gaignard X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 This fixes an issue where the DRM planes do not support the same pixel formats. The current implementation selects a DRM plane without checking whether the pixel format is supported or not. As a consequence modetest may try to set up a plane not supporting the user request-format, which fails. Modetest has to check the supported formats accross the plane list before selecting a candidate. Signed-off-by: Fabien Dessenne Reviewed-by: Daniel Kurtz --- tests/modetest/modetest.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 4761c60..866ea82 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -951,7 +951,7 @@ static int set_plane(struct device *dev, struct plane_arg *p) int crtc_x, crtc_y, crtc_w, crtc_h; struct crtc *crtc = NULL; unsigned int pipe; - unsigned int i; + unsigned int i, j; /* Find an unused plane which can be connected to our CRTC. Find the * CRTC index first, then iterate over available planes. @@ -974,8 +974,11 @@ static int set_plane(struct device *dev, struct plane_arg *p) if (!ovr) continue; - if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id) - plane_id = ovr->plane_id; + if ((ovr->possible_crtcs & (1 << pipe)) && !ovr->crtc_id) { + for (j = 0; j < ovr->count_formats; j++) + if (!strncmp(p->format_str, (char *) &ovr->formats[j], 4)) + plane_id = ovr->plane_id; + } } if (!plane_id) {