Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp156588rwl; Tue, 4 Apr 2023 21:07:03 -0700 (PDT) X-Google-Smtp-Source: AKy350aSb9XGJpbQn1nDo4Dt1oBH06a4403jkR07GDPTDHUx2DW7lpvjEksizNb8i2REj8F6NNgh X-Received: by 2002:a17:903:234a:b0:19d:f7e:9864 with SMTP id c10-20020a170903234a00b0019d0f7e9864mr6452926plh.57.1680667623347; Tue, 04 Apr 2023 21:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680667623; cv=none; d=google.com; s=arc-20160816; b=lnGCaohlXZwJtxCrCFyUTEDb+Ite3RIkOwEPPxfraq1S8MtWMTGk0eYewcAiiKVMDm H2v5qp4nPgtaqLtcOS8oPt4wX6sokDGBz824zoNCpmm9Y89toOuJU4AG3rutX2HI4Dq3 olN+vds0Y6k6mo7UICx71nKtt/I9howg8t0WaJ3ujEQO6daZwas5IMOjAwXuSQlHfPct bpA40AgVBaO+E2H+w531WA5Mpl46woZVsIkLFEGxlzdazHEOPL1896F/SqE26RNLC4+o lBCI6kj4dByTXqxYveGAm0r6nCrR0KswPuC3VZB2g82QGrElBtfARtp4H9WvESdTEMVC sO3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OdSLlhdn5sy42yvDaj3kXjUJ781MtOLGJX3yaG8j2IQ=; b=qGcTr5EAGbyGQHAmwZVRKTcsosDeFLnOash/K0TZkzL3NQ88RggCOEaIo70WPPWrF0 6au6uL8aDylVgef7lZzdqs41jvcW3zn4o7FbssBG69jDsOSpF++ypif0ikRlcek5/POs QN2Dmms2/j9nkccXvp8sPov0dD3pGUc/tzfeXrHQOcdN7gdzytA0tanCrDtkSiM/69De S+k159bwzLLs0yCWP57l8JJ8WLDD3YyixG0kFU8v3hFHXVBfUtp428OLNraeFyNKgBKT QC6NUUwwjzF80TanHTCpji9Tw4ty8IoULu3cLFTNxyOvo+JewyQeF75wQ9MeLhDh5pAJ N8Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PflqIUVB; 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 v18-20020a170902f0d200b00192c4055e78si10757361pla.544.2023.04.04.21.06.45; Tue, 04 Apr 2023 21:07:03 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=PflqIUVB; 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 S236711AbjDED7z (ORCPT + 99 others); Tue, 4 Apr 2023 23:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236700AbjDED7s (ORCPT ); Tue, 4 Apr 2023 23:59:48 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10B3330ED; Tue, 4 Apr 2023 20:59:47 -0700 (PDT) Received: from pendragon.ideasonboard.com (fp76f193f3.tkyc206.ap.nuro.jp [118.241.147.243]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0B76C905; Wed, 5 Apr 2023 05:59:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1680667185; bh=Dxm79oyRJT9b8gKrOzRwmkfugRaKtT8JuVJT6m5bmPI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PflqIUVBytlCg/mnUlz2Ripb1HKoq+KPIyBjcpKkQh/fkoLDQPonMbaKh/n934pJj hwifEitd/j17VXEWQ65Qk15EGoo1OhWQWW3gdgcm+OBVcayKu2jAQVC1FtGgEysmhk jTXJ3+mJCPoqToU8Mzf1Eq8uER/2UYLFH00Tnpp8= Date: Wed, 5 Apr 2023 06:59:52 +0300 From: Laurent Pinchart To: Geert Uytterhoeven Cc: Kieran Bingham , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] drm: shmobile: Switch to drm_crtc_init_with_planes() Message-ID: <20230405035952.GI9915@pendragon.ideasonboard.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 Hi Geert, Thank you for the patch. On Fri, Mar 31, 2023 at 04:48:09PM +0200, Geert Uytterhoeven wrote: > 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 > --- > 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); This seems like a bit of a hack to me. Why don't you use the planes created by shmob_drm_plane_create() instead of allocating a new one ? > + > + 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); > -- Regards, Laurent Pinchart