Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp259094pxb; Tue, 15 Feb 2022 12:42:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwj0st12A6G1+dBSGgItaLcK1j0XAsp5EBY9PTYjrCLnqtimOlVJaEmg17d9MZ+ybX5WpYH X-Received: by 2002:a05:6a02:18f:: with SMTP id bj15mr524472pgb.603.1644957743859; Tue, 15 Feb 2022 12:42:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644957743; cv=none; d=google.com; s=arc-20160816; b=DBw48t2ywgO7Hx/fmmv4UQSPp49NPpYd5Qdx1V3GCKp8v8sLwSQPLnp5+ehLizI6tA 31nqtpgxOaZijat4k8jHfzMPs7M7SImYT/s+d6J/v36E+ICqBMtxe83Y36f54ZhWL+Rp R2UunEijf1bOkh5ifBT0CHY810zqNfkuPlaMP1WPHkntuKN3QX8SS0HsRTe8eTp4e17y R739ay8j+GXJ11GYtCzj/tXjyAtn4+AiWoOOPbJy8s71oKyoylwG9Mh9YJnc5gWpRgp3 BBo/9vq0gxeYknP5A/Q2i1UidKnqxHjpbEKBiKSbaj3+IQiJzP/xExxfQYM0bjnAUrC0 DHZQ== 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=MCxhJ0twYPbLv8S/5i5GaxJoYm+vNPaYOsGqgMdsMgE=; b=R1k4x/fPD5fYh17G6yz7Kxb1kZrhtmxmMpQPlBOPEcFYgIOR6vQItB3P42HgDJMroV 61r5+kcFpUBth5cEHYvx4dOM8Xo+9b5PAykVx+yfkMW2hbdDoxogHO3FEhUzPqDNPIKo 2X+YxhzAqNTF1f//NZX8AXBfDLAh1ccstWJf2cqJZOAGgp4ZJJxpY0QqI5rYXhDeqb78 jp8t4i0uyK0NEU12a8v+1JvkZ8vHM5tOQQYsGT/YCfbmZH5M3EE1J7rbl4VGf9mIp6ns g6lqtQgUk5P1DzZrOQEn8LJMM4rJ+OQ9k/7aI8A23wQAiq6upoH0NsVVpD4cz6b0qjz+ 3E1g== 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 nh2si15494406pjb.19.2022.02.15.12.42.06; Tue, 15 Feb 2022 12:42:23 -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 S241970AbiBOQxG (ORCPT + 99 others); Tue, 15 Feb 2022 11:53:06 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241836AbiBOQwq (ORCPT ); Tue, 15 Feb 2022 11:52:46 -0500 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A50F9DD62 for ; Tue, 15 Feb 2022 08:52:34 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:7534:e0be:5adf:2691]) by michel.telenet-ops.be with bizsmtp id vUsV2600U18GbK106UsVDd; Tue, 15 Feb 2022 17:52:32 +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-000tUo-9B; Tue, 15 Feb 2022 17:52:29 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1nK140-00BURt-1Z; 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 5/8] drm/framebuffer: Use actual bpp for DRM_IOCTL_MODE_GETFB Date: Tue, 15 Feb 2022 17:52:23 +0100 Message-Id: <20220215165226.2738568-6-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 When userspace queries the properties of a frame buffer, the number of bits per pixel is derived 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. --- drivers/gpu/drm/drm_framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 07f5abc875e97b96..4b9d7b01cb99c03d 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev, r->height = fb->height; r->width = fb->width; r->depth = fb->format->depth; - r->bpp = fb->format->cpp[0] * 8; + r->bpp = drm_format_info_bpp(fb->format, 0); r->pitch = fb->pitches[0]; /* GET_FB() is an unprivileged ioctl so we must not return a -- 2.25.1