Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp796049imw; Fri, 8 Jul 2022 11:53:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uF6UlV181WGegwlW/a8MzquDf/4wgPcyo+/fShQ2xABBXSbgniLi4qfWAz8aFJGTq2IJRQ X-Received: by 2002:a17:907:271b:b0:72a:72bb:6f47 with SMTP id w27-20020a170907271b00b0072a72bb6f47mr4962770ejk.634.1657306393301; Fri, 08 Jul 2022 11:53:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657306393; cv=none; d=google.com; s=arc-20160816; b=yutOcBsRd7VNceWXQfGkid84fg03j3CgaEZjeCA/QywocXPpRjySo4A0uqKZj/TKTO SjcdHrGTBktwj862mMOGYdEDaxZUH8XZxOzjHopMgkwKE8DQCyI45Fc9wGtKFsAZV3gj dZCheTM+3VjA2LRiZSaNSgKoMjyWpKHmMFVsBNW1EyHZRLcKv8nmTH7SlIDlUbmCik+o 7/FnjDndHG3L+9jPnbEkNVgBrkmO1d0YiOJLPznGiC/TZ8XgzqX9GkpAfxBdaT+dcBm/ NUjx1B5rwel4KSzQYjzFYKh85wJ8cGycOD/oCwyL43qvRMcNrvJJsc8q/OiBMv7liBJg 6D3Q== 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=U3b3bzRioiBoHAMQnQ5hjjsu/eQVJFSeLQtkHPVrqOM=; b=IUaNUAyK3Q48e3c9oPn92gEezV/8MBXFrYYC3IeLQMd3YYaPCrEnGkh7CnU+u+jvg4 olBb7CVCLTs8cFN36UBGUCel2SQeF8Y2dbIOgvb+bg2luWNIUqrVplTXluU9KBCYogIV tcCBK1qCBcy2rDjIVt7UCRyTzXHTdNi047m0cM6w4rnv8Y/8LBUPQiAXuq/1AQj9UObH VUbLx2NExNc6RLGa25y7fGBYSQICOiCxftu4yHRwRosqUMPMiyhamA2f1ze1Vt2Nptvk evmKffGonYrW7thqxdGxJB9/qYOImM8inAof4H+U9R+I/PJ38ndhtIge5QUAR2T1wrNc KOQA== 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 di12-20020a170906730c00b0072b00cfc671si9881177ejc.837.2022.07.08.11.52.48; Fri, 08 Jul 2022 11:53:13 -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 S239233AbiGHSVi (ORCPT + 99 others); Fri, 8 Jul 2022 14:21:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239134AbiGHSVQ (ORCPT ); Fri, 8 Jul 2022 14:21:16 -0400 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 210F88239C for ; Fri, 8 Jul 2022 11:21:10 -0700 (PDT) Received: from ramsan.of.borg ([84.195.186.194]) by laurent.telenet-ops.be with bizsmtp id siM72700B4C55Sk01iM7mp; Fri, 08 Jul 2022 20:21:08 +0200 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 1o9sbC-002fGf-QL; Fri, 08 Jul 2022 20:21:06 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1o9sbC-00BtJU-Ca; Fri, 08 Jul 2022 20:21:06 +0200 From: Geert Uytterhoeven To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , Javier Martinez Canillas Subject: [PATCH v3 04/10] drm/framebuffer: Use actual bpp for DRM_IOCTL_MODE_GETFB Date: Fri, 8 Jul 2022 20:20:49 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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 Reviewed-by: Javier Martinez Canillas --- v3: - Add Reviewed-by, v2: - No changes. --- 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 4562a8b865792456..9899bf1485b299ad 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