Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp773674img; Tue, 26 Feb 2019 08:22:14 -0800 (PST) X-Google-Smtp-Source: AHgI3IbHW1s7ifPh/bkuGiW3suwNFYHm4qjyjOmmqGV1o//QnYkqOr9WHL1sAFzG3Jefc8jlD6jf X-Received: by 2002:a63:814a:: with SMTP id t71mr25421194pgd.257.1551198133920; Tue, 26 Feb 2019 08:22:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551198133; cv=none; d=google.com; s=arc-20160816; b=MBUrHHIwO0ISsaghREmlnQjc0i5OjLrIa7p2YX97dk3RuH9Xc9wRpJSMXDcEUXJbIp +A31BZ7Wrt1rZbfHwFBV32hO2nldg7Zl1OOviaRhTUwem2RIJHiyVn8vq4rsJKnze1fb nrXa60UPSj1qe9nC2u+3IsLAKYwn9JtSSQlvToMS5365iIW759fZSVZDAWFKEqPyJfCF XG+TGqO6i/DMyQZWD6PG6BgltTn/WUFNkC2ggiJpmheOcIrJWFeL1Th1g+if6Bu6sJ5O DBVOn6/zQHwU5At0MAXIJfAwDudIsJSxsqZ/8NuYBlVKWOxAqzixUZTEuMk9oCuBiM1d Npdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :nodisclaimer:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature; bh=L1mkF1ohZiKCiBmjZSvBHvHZADOJTrYEJ3Xmjd7Tn0w=; b=Oz6wvkr4iQUH183CfxUAMsuvOg0P+vhx+2f2olR5OWmV3GvDrpmwk74S8V37qGVq87 OhydwVptrZZoRcBlsJR7pbO5YbmpGuT8hGp+F316kt3zRewdgkdlklruGQB6349ATthK lJvePGOMcue+87Yy3i7pVEkZoXSzZNDRSk7ivDy3jVsqWUOAFIS0inZlUGCG0KwQdPne nYA2A6Qq7dO653u+UGo5V1cZoykCseA16wvsIzl37JqfihqDwywMSJjeJwv3gcvnM01t PMajhZgKXvoulGwhh8YfdF8NdUb0wk5rhdExMnqhKGDm7YamgiymeWHBNR/0a2gq5Lu5 6fmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=J+dIuxsE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si9707717pll.332.2019.02.26.08.21.59; Tue, 26 Feb 2019 08:22:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=J+dIuxsE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728796AbfBZQVO (ORCPT + 99 others); Tue, 26 Feb 2019 11:21:14 -0500 Received: from mail-eopbgr30060.outbound.protection.outlook.com ([40.107.3.60]:63296 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727456AbfBZQVK (ORCPT ); Tue, 26 Feb 2019 11:21:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L1mkF1ohZiKCiBmjZSvBHvHZADOJTrYEJ3Xmjd7Tn0w=; b=J+dIuxsEd/40NMgpecUh5Bb/Sctful3ZB0AQLbrTZf5ndf6VOyjHAZg2b9cZb6tOUux/aAC1S5709jQbSopR2ZsVSzRf0GwZPfSOLzQFrI7/V2vxoBIuEauW8/i6huSsGoiMw1xpT6o+4u5wurRUb+HrwgAY9ir5dG1ZSb2DB4E= Received: from AM0PR08MB3891.eurprd08.prod.outlook.com (20.178.82.147) by AM0PR08MB3682.eurprd08.prod.outlook.com (20.178.21.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.15; Tue, 26 Feb 2019 16:20:59 +0000 Received: from AM0PR08MB3891.eurprd08.prod.outlook.com ([fe80::910a:5553:5cd9:6b41]) by AM0PR08MB3891.eurprd08.prod.outlook.com ([fe80::910a:5553:5cd9:6b41%4]) with mapi id 15.20.1643.019; Tue, 26 Feb 2019 16:20:59 +0000 From: Ayan Halder To: Ayan Halder , Liviu Dudau , Brian Starkey , "malidp@foss.arm.com" , "maarten.lankhorst@linux.intel.com" , "maxime.ripard@bootlin.com" , "sean@poorly.run" , "airlied@linux.ie" , "daniel@ffwll.ch" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" CC: nd Subject: [PATCH 08/10] drm/arm/malidp:- Use the newly introduced malidp_format_get_bpp() instead of relying on cpp for calculating framebuffer size Thread-Topic: [PATCH 08/10] drm/arm/malidp:- Use the newly introduced malidp_format_get_bpp() instead of relying on cpp for calculating framebuffer size Thread-Index: AQHUze9CPOLKNoMBdUeUyRg1WVYusg== Date: Tue, 26 Feb 2019 16:20:59 +0000 Message-ID: <1551198042-4314-9-git-send-email-ayan.halder@arm.com> References: <1551198042-4314-1-git-send-email-ayan.halder@arm.com> In-Reply-To: <1551198042-4314-1-git-send-email-ayan.halder@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0244.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::16) To AM0PR08MB3891.eurprd08.prod.outlook.com (2603:10a6:208:109::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ayan.Halder@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [217.140.106.55] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2e3cbb5e-e812-42ef-8a97-08d69c066478 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR08MB3682; x-ms-traffictypediagnostic: AM0PR08MB3682: nodisclaimer: True x-microsoft-exchange-diagnostics: 1;AM0PR08MB3682;20:1yG1MbiveYeY4AfxhfznIudWID4ctwA0RqwWCwA9AiBLGROcw6Vh871Qzc1dogmw34rOu5BT2qurmjS8FAR5DGJtaWVkAakMFArXQjh6N/iQ0xsdWyNZrHgwipC3EKTEWTeu+YM3ZWz9xZISSWJuq2E/qEwXcGkv9eB6a82X93A= x-microsoft-antispam-prvs: x-forefront-prvs: 096029FF66 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(366004)(346002)(376002)(39860400002)(136003)(199004)(189003)(6116002)(8936002)(50226002)(76176011)(2906002)(99286004)(36756003)(25786009)(2501003)(97736004)(52116002)(3846002)(4326008)(68736007)(11346002)(256004)(14444005)(6486002)(446003)(6436002)(478600001)(44832011)(2616005)(486006)(476003)(26005)(105586002)(186003)(53936002)(6512007)(66066001)(7736002)(305945005)(102836004)(316002)(110136005)(71190400001)(81156014)(81166006)(71200400001)(386003)(6506007)(14454004)(5660300002)(106356001)(2201001)(86362001)(72206003)(8676002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR08MB3682;H:AM0PR08MB3891.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: GcA8E6zPy5gGLdYKAvbkO55Vp5Sfj5hu4V8PrJOdybwrQGncZVO8AcimnBe0QCg7Y8FTv613TJReHHzGWpnbkMyHsbuT8uAwqoGse4W5Y8PK+bbcFaC6y0e4KNmmqeyf8whOrHTYXHac56+1DDRmLsZNnZuRiWhHnS2Kz1OgXE9cEpKrqoUfuZ01oBnuNGCgSqBRGIYLIhadrTdghXgVXBExQ7SwTNHt15JpNGRQ3F3uo6RNJFnTbxmbQgsVAYI+NprKDa3qO8YQQSa2aL2sv1pEt5PtzU0uUOTH41KhE1Um5mIjkae9BXGvGUIHtdtXar53y3NOLNpfpCZEi0yPb1BbFQylOTfnMeZcQfRNfkQiB25v2ZE5nmjGK0lR1S0xG/BTyH86lxFeOEq6KPHZG5pof0O+INbbB9kqH7Yzhc0= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e3cbb5e-e812-42ef-8a97-08d69c066478 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2019 16:20:58.6890 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3682 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ayan Kumar Halder Formats like DRM_FORMAT_VUY101010, DRM_FORMAT_YUV420_8BIT and DRM_FORMAT_YUV420_10BIT are expressed in bits per pixel as they have a non integer value of cpp (thus denoted as '0' in drm_format_info[]). Therefore, the calculation of AFBC framebuffer size needs to use malidp_format_get_bpp= (). Signed-off-by: Ayan Kumar halder Reviewed-by: Liviu Dudau --- drivers/gpu/drm/arm/malidp_drv.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_= drv.c index c697664..4106f5d 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -298,6 +298,7 @@ malidp_verify_afbc_framebuffer_size(struct drm_device *= dev, struct drm_gem_object *objs =3D NULL; u32 afbc_superblock_size =3D 0, afbc_superblock_height =3D 0; u32 afbc_superblock_width =3D 0, afbc_size =3D 0; + int bpp =3D 0; =20 switch (mode_cmd->modifier[0] & AFBC_SIZE_MASK) { case AFBC_SIZE_16X16: @@ -314,15 +315,19 @@ malidp_verify_afbc_framebuffer_size(struct drm_device= *dev, n_superblocks =3D (mode_cmd->width / afbc_superblock_width) * (mode_cmd->height / afbc_superblock_height); =20 - afbc_superblock_size =3D info->cpp[0] * afbc_superblock_width * - afbc_superblock_height; + bpp =3D malidp_format_get_bpp(info->format); + + afbc_superblock_size =3D (bpp * afbc_superblock_width * afbc_superblock_h= eight) + / BITS_PER_BYTE; =20 afbc_size =3D ALIGN(n_superblocks * AFBC_HEADER_SIZE, AFBC_SUPERBLK_ALIGN= MENT); afbc_size +=3D n_superblocks * ALIGN(afbc_superblock_size, AFBC_SUPERBLK_= ALIGNMENT); =20 - if (mode_cmd->width * info->cpp[0] !=3D mode_cmd->pitches[0]) { - DRM_DEBUG_KMS("Invalid value of pitch (=3D%u) should be same as width (= =3D%u) * cpp (=3D%u)\n", - mode_cmd->pitches[0], mode_cmd->width, info->cpp[0]); + if ((mode_cmd->width * bpp) !=3D (mode_cmd->pitches[0] * BITS_PER_BYTE)) = { + DRM_DEBUG_KMS("Invalid value of (pitch * BITS_PER_BYTE) (=3D%u) " + "should be same as width (=3D%u) * bpp (=3D%u)\n", + (mode_cmd->pitches[0] * BITS_PER_BYTE), + mode_cmd->width, bpp); return false; } =20 --=20 2.7.4