Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4509214rwd; Tue, 23 May 2023 08:35:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4OGL9tQnFmQP8AagradVRzGAqDf8ZUGAZM8aDWcKmQGG1VattmI6sZRnOXnwriWWMENta+ X-Received: by 2002:a17:903:26cb:b0:1ae:7421:82b5 with SMTP id jg11-20020a17090326cb00b001ae742182b5mr14535545plb.45.1684856144625; Tue, 23 May 2023 08:35:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684856144; cv=none; d=google.com; s=arc-20160816; b=qbctxhjlsZTp6Q0J3wWJXADh5icn7MdTbpXA0gvlFrYaWWVkvDxhs8FXCcqgky1ho7 nSH3f47dUCAemrvkwD5cxOzB207iqntM8Qot9BCr07z9JwN3VJyzttOUyK9Y0rOtbFiO 34Hfks7MJn8C3U/puHBfXwVfuu7c5PKPadCkqWGdhia6qSrj7BMq1Q4eWkrA9K0dXbg5 ElxS3859nOqf4JlFbt/C+nXoq0cyXaIf+oVjQf8MuNtjIyGxLivF3n4uk9BAZ9mNpGeo fEZArp1LsogEXiyHb0JrYNA1ky7xyiFoCYGueWq9aTintEO8wg8jkMWPPKgUZq5agYhb XReQ== 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; bh=LtY5sRV2royIvYJmQFhbBTCU0yrwXhWFXqkUzu39IRE=; b=ZtQmlzKZHx3GOPg1I44PDUtJgTgqJ3doaScX9iE1WJG7231m3mR1Qu9Y5zy2mLUzzc D9Iy6+BeY9+3xdNTgMtewgx1kQ9GuE7mj16ZjsR4A3mbApMZs8qSo64onfvcQmfYrqRW 4KYiePxTf2gQfpyavPNAGl7QJMCnny6vyVKKGvoBeBdEbdOqOU9YosSq1yr65ETTPkQl jxVXvS01U0mpADwxrf7ua5jMcWhS9Xr/B5fwK+feEo5oSytwyiTQSLAcQh2cZnUSq3F7 zw3pQ+vIcEDKgQiVHHaVm9gSrJgoiuKQexeJja5B9B4vDjLkXBfYEdjWfO4jwarmjz4f JEOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a170902cec100b001ac4c0de994si6853702plg.564.2023.05.23.08.35.28; Tue, 23 May 2023 08:35:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237030AbjEWPdO (ORCPT + 99 others); Tue, 23 May 2023 11:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236110AbjEWPdN (ORCPT ); Tue, 23 May 2023 11:33:13 -0400 X-Greylist: delayed 1650 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 23 May 2023 08:32:46 PDT Received: from weierstrass.telenet-ops.be (weierstrass.telenet-ops.be [195.130.137.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB870E43 for ; Tue, 23 May 2023 08:32:46 -0700 (PDT) Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by weierstrass.telenet-ops.be (Postfix) with ESMTPS id 4QQdc902Sjz4x1lW for ; Tue, 23 May 2023 17:32:41 +0200 (CEST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed30:b0ac:7afd:272:4cff]) by xavier.telenet-ops.be with bizsmtp id 0FXf2A00f0Jkz7G01FXfas; Tue, 23 May 2023 17:31:40 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1q1Tyu-002t3e-Jd; Tue, 23 May 2023 17:31:39 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1q1Tz9-00Ckax-1x; Tue, 23 May 2023 17:31:39 +0200 From: Geert Uytterhoeven To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Laurent Pinchart , Kieran Bingham Cc: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v3 3/5] drm: shmobile: Switch to drm_crtc_init_with_planes() Date: Tue, 23 May 2023 17:31:35 +0200 Message-Id: <2098de3d33bc479a8569da7dcbafdb685ff0a13a.1684854992.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The SH-Mobile DRM driver uses the legacy drm_crtc_init(), which advertizes only the formats in safe_modeset_formats[] (XR24 and AR24) as being supported. Switch to drm_crtc_init_with_planes(), and advertize all supported (A)RGB modes, so we can use RGB565 as the default mode for the console. Signed-off-by: Geert Uytterhoeven Reviewed-by: Thomas Zimmermann Reviewed-by: Laurent Pinchart --- v3: - No changes, v2: - Add Reviewed-by. --- drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 30 +++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c index 08dc1428aa16caf0..11dd2bc803e7cb62 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -478,16 +479,41 @@ static const struct drm_crtc_funcs crtc_funcs = { .disable_vblank = shmob_drm_disable_vblank, }; +static const uint32_t modeset_formats[] = { + DRM_FORMAT_RGB565, + DRM_FORMAT_RGB888, + DRM_FORMAT_ARGB8888, + DRM_FORMAT_XRGB8888, +}; + +static const struct drm_plane_funcs primary_plane_funcs = { + DRM_PLANE_NON_ATOMIC_FUNCS, +}; + int shmob_drm_crtc_create(struct shmob_drm_device *sdev) { struct drm_crtc *crtc = &sdev->crtc.crtc; + struct drm_plane *primary; int ret; sdev->crtc.dpms = DRM_MODE_DPMS_OFF; - ret = drm_crtc_init(sdev->ddev, crtc, &crtc_funcs); - if (ret < 0) + primary = __drm_universal_plane_alloc(sdev->ddev, sizeof(*primary), 0, + 0, &primary_plane_funcs, + modeset_formats, + ARRAY_SIZE(modeset_formats), + NULL, DRM_PLANE_TYPE_PRIMARY, + NULL); + if (IS_ERR(primary)) + return PTR_ERR(primary); + + ret = drm_crtc_init_with_planes(sdev->ddev, crtc, primary, NULL, + &crtc_funcs, NULL); + if (ret < 0) { + drm_plane_cleanup(primary); + kfree(primary); return ret; + } drm_crtc_helper_add(crtc, &crtc_helper_funcs); -- 2.34.1