Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp232416pxb; Tue, 15 Feb 2022 12:03:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxu3f1rlHvz2tdvQ6rO0+yn9Mr0GUvDNvpf+/P2NpTR9WF3BDPnu3kdQ30jRyMUpg5SOppk X-Received: by 2002:a17:906:6a05:: with SMTP id qw5mr620003ejc.90.1644955423820; Tue, 15 Feb 2022 12:03:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644955423; cv=none; d=google.com; s=arc-20160816; b=uzHsc/zJNjFrIEtWZ0Pu7o1TsB2wm61yPMzGA48ctQuc05smOUKzoKeNjJ27STbt1J OD+ghEb+VqEv2bKGtjs4mCoBhpzXGwMvYflQRRVrogIpXDxE7+7pt43ra103bXkQsZ9b 2znP8kw6B/MczrGOILlM7vznTa4Gj6uTvM7lwArY5OKxeAcwZ1lFa1+L1d4bXCTiFRi0 qLv+mjAH0crIpkmwNbFBvWQ2eXYNLYoBjr5rnkjSmBCPfZrGrURimGrN5BBS68QIK2Cf eWDtqUwEFzKslMoHoyHwfpR01M63ymRmruyGFk4+abNGInrbkKJ20OYAIzsJ9+zS0e1O qmbg== 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=c76OA0lWb1A7dKKfZ93dbWWyp1oXuJ+ICmCP0WETYUg=; b=aBMCKG/MUFpH2gdiYZ0FInikYGODxh36roc7l8cOpYZJGefK8fpFGFovNXg1r9dJ5C pUu3+p+93mIFPw9Ll6sM+qEmXMh0pr/TevqDSHJR0KZcZmzCmKMAZntoPmqwr9v54o2k W5KQy99JNwg54ZR3Zht5MRlIkrDrZXgf8alfTCnOHDj9ptQ4nKM/nZ0WEhKke+N7AGtp hzFjaeOTM07GdIowg2GZfWqVIWlL2IviuY8TGD72VD8J2yXZF7w2UobgO7YwloaG6SCy fQstqVxIz48eNsT4M34dmTWPRGJ2G2A9ote+xqw3moW+t0ihcuENWfv0r1qNBIEw0s3F oZRg== 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 e13si2099514ejs.430.2022.02.15.12.03.11; Tue, 15 Feb 2022 12:03:43 -0800 (PST) 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 S241921AbiBOQwx (ORCPT + 99 others); Tue, 15 Feb 2022 11:52:53 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241879AbiBOQwp (ORCPT ); Tue, 15 Feb 2022 11:52:45 -0500 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A36D9D4DB for ; Tue, 15 Feb 2022 08:52:33 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:7534:e0be:5adf:2691]) by laurent.telenet-ops.be with bizsmtp id vUsV2600U18GbK101UsV5Z; Tue, 15 Feb 2022 17:52:31 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nK141-000tUp-3Z; Tue, 15 Feb 2022 17:52:29 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1nK140-00BUS0-2E; Tue, 15 Feb 2022 17:52:28 +0100 From: Geert Uytterhoeven To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Helge Deller , Javier Martinez Canillas Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 6/8] drm/gem-fb-helper: Use actual bpp for size calculations Date: Tue, 15 Feb 2022 17:52:24 +0100 Message-Id: <20220215165226.2738568-7-geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220215165226.2738568-1-geert@linux-m68k.org> References: <20220215165226.2738568-1-geert@linux-m68k.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 The AFBC helpers derive the number of bits per pixel from the deprecated drm_format_info.cpp[] field, which does not take into account block sizes. Fix this by using the actual number of bits per pixel instead. Signed-off-by: Geert Uytterhoeven --- Untested. After adding the missing block info, probably the whole function can just be dropped, in favor of drm_format_info_bpp()? --- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c index 746fd8c738451247..7eca09fce095abbe 100644 --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c @@ -499,11 +499,8 @@ static __u32 drm_gem_afbc_get_bpp(struct drm_device *dev, info = drm_get_format_info(dev, mode_cmd); - /* use whatever a driver has set */ - if (info->cpp[0]) - return info->cpp[0] * 8; - - /* guess otherwise */ + // FIXME DRM_FORMAT_* should provide proper block info in + // FIXME drivers/gpu/drm/drm_fourcc.c switch (info->format) { case DRM_FORMAT_YUV420_8BIT: return 12; @@ -512,11 +509,8 @@ static __u32 drm_gem_afbc_get_bpp(struct drm_device *dev, case DRM_FORMAT_VUY101010: return 30; default: - break; + return drm_format_info_bpp(info, 0); } - - /* all attempts failed */ - return 0; } static int drm_gem_afbc_min_size(struct drm_device *dev, -- 2.25.1