Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4919975pxb; Tue, 5 Oct 2021 13:19:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoJ2zTTilCEw8WN+br3EPRihBFLji8yVc9QC/KRKFpxmGqnHxnxc7eo7B+dg1L5cizhjdg X-Received: by 2002:a62:aa1a:0:b0:44c:a0a4:661a with SMTP id e26-20020a62aa1a000000b0044ca0a4661amr522482pff.66.1633465172638; Tue, 05 Oct 2021 13:19:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633465172; cv=none; d=google.com; s=arc-20160816; b=G4uSUvJUTdEjk3Sz0QxkIbyD8zvUq7PGDMCZCg/X2i/a5QqAZewtexlmdWGC7jFd6K sZljlU9tV/VBxN9mKAwrbsuBOO6oeFYHEil6EGfaSoER18P7s4ukhIuETe6zpkHjYjkT Hg/sT83PdTbLA9IKevZxQ4csZtThoZOzEyn5bDWU/PRMwjs/PvwCVMFSk2YRPKERFugZ iugRjfd4ZZH3Mh6rrH2GsZzba675x54YrV33zced/iOPvrZLawPs6FyMgEi7rZv4Hyg6 YUlBafJbBqWLphAU2OWtLHE9HE0b+pAWelkgdcr6zM38m0ZBYZHhy5S2iZOQoM75P75B O82A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Hw6zQBB3a/F2ZAgG/KXWLByNsFS27rGehUO+SIvRQ4Q=; b=iL9oqeEE7lY//dDk5clno29b6a+jUIPngVYWQBB1UWJFtbzWwAd6SDdHP9fSPb34iA 5oVnhnUpIW3GUKQtsjY2lhDM5+GsjIIH05VOQdFzTfqpzo3HRnUah8Ow/D5y7CmbrshQ tEUnLNbLfMenx3Bl9r6e/T6jiGSTBNhTtaWJzzhNcFJAIM5nCN+M9+uhbS46Kc3ExIb5 ERHVS8pWE+SwAwuydA0/0wC/tfJX6Hs4m91h1uUh3BOkzO7pqlUvhMdwOB7uDEc1VvOk wgS4IxVTcpGxMnUaH95/baGjVtYwQkL6d9KYcrS5mAr8+HDsoWZt2j/sy3KfodOSZWDC 74VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=o9CDrrkO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h3si26139988plk.427.2021.10.05.13.19.19; Tue, 05 Oct 2021 13:19:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=o9CDrrkO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236053AbhJEUTh (ORCPT + 99 others); Tue, 5 Oct 2021 16:19:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236068AbhJEUTe (ORCPT ); Tue, 5 Oct 2021 16:19:34 -0400 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FB72C061753 for ; Tue, 5 Oct 2021 13:17:43 -0700 (PDT) Received: by mail-qv1-xf34.google.com with SMTP id a9so510549qvf.0 for ; Tue, 05 Oct 2021 13:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Hw6zQBB3a/F2ZAgG/KXWLByNsFS27rGehUO+SIvRQ4Q=; b=o9CDrrkODu+wta3WyPeh0D3N/zFw7tVgLZKNGjEHDkWJknzmsPiuQNguvSgXowtTfV /N2hv+AzfyBtt9LT6zfyPLctDdAuQLCQUzo3SkEu7blfSDcKT5nNY9CL+HpTPA/oFOuW fxGGsmUSY7zb3OKPsP75JlmkQMvG8Z/IqIleMgIF6KeSq015G74aY+dQr7lo0WQSAWnr eSrNyqCHhU6RNYVL28Wj2crxyNWzlQl9NKBkyeqyoOm/qONpiAlaiDWeFcqRqHtTYoSM U1SE0Ak8TxIteLUZMEvG/SVoUxJ9uMFX0eGUIKDUnNu5Xmw56I4TdEuYoaHRKQ/CTzjM un8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hw6zQBB3a/F2ZAgG/KXWLByNsFS27rGehUO+SIvRQ4Q=; b=m2XqgyIUPuFqo0MtGSyJ+YIIUYGEeOzpxdq89oq99PEysIsNWn/AT6LsAkO6YR6igU lULVJsdEPdj5R7G0alNjDIQofcpddAvV17jCCuZtWw5vXB6ZyZv504C4TIB9AxHyqQms qIqdt3MEHakk5YwV/C3LGkyWlgQF9JbtGJX58zG3kt5ppIstC7gTOLXLai7cuozdx3+Z djBYJljqMrd9Z7f5Pw4IrdkHbnYWurevThheyzWPQPvHGYMySM+wa4GejtULJHmRG2/U YoeogKXcr2ui8RfcVtMC7TCXJKDjq4aDsNgTJ4TgDxOJLiV3FbxdbBZlPGmoIwDVsxzz uShA== X-Gm-Message-State: AOAM531orkKFYa97lFNoMgr42kySDuGyIncQyTNtcElbjWHfql53FP9u Ggw+pjxC9KldDSNqeomLR4g= X-Received: by 2002:a0c:ea90:: with SMTP id d16mr24485qvp.18.1633465062843; Tue, 05 Oct 2021 13:17:42 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:125:9b98::1007]) by smtp.googlemail.com with ESMTPSA id j2sm13056905qta.84.2021.10.05.13.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 13:17:42 -0700 (PDT) From: Igor Matheus Andrade Torrente To: rodrigosiqueiramelo@gmail.com, melissa.srw@gmail.com Cc: Igor Matheus Andrade Torrente , hamohammed.sa@gmail.com, daniel@ffwll.ch, airlied@linux.ie, contact@emersion.fr, leandro.ribeiro@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org Subject: [PATCH 5/6] drm: vkms: Prepare `vkms_wb_encoder_atomic_check` to accept multiple formats Date: Tue, 5 Oct 2021 17:16:36 -0300 Message-Id: <20211005201637.58563-6-igormtorrente@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211005201637.58563-1-igormtorrente@gmail.com> References: <20211005201637.58563-1-igormtorrente@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the vkms atomic check only goes through the first position of the `vkms_wb_formats` vector. This change prepares the atomic_check to check the entire vector. Signed-off-by: Igor Matheus Andrade Torrente --- drivers/gpu/drm/vkms/vkms_writeback.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c index 5a3e12f105dc..56978f499203 100644 --- a/drivers/gpu/drm/vkms/vkms_writeback.c +++ b/drivers/gpu/drm/vkms/vkms_writeback.c @@ -30,6 +30,8 @@ static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder, { struct drm_framebuffer *fb; const struct drm_display_mode *mode = &crtc_state->mode; + bool format_supported = false; + int i; if (!conn_state->writeback_job || !conn_state->writeback_job->fb) return 0; @@ -41,7 +43,14 @@ static int vkms_wb_encoder_atomic_check(struct drm_encoder *encoder, return -EINVAL; } - if (fb->format->format != vkms_wb_formats[0]) { + for (i = 0; i < ARRAY_SIZE(vkms_wb_formats); i++) { + if (fb->format->format == vkms_wb_formats[i]) { + format_supported = true; + break; + } + } + + if (!format_supported) { DRM_DEBUG_KMS("Invalid pixel format %p4cc\n", &fb->format->format); return -EINVAL; -- 2.30.2