Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6827480imu; Mon, 3 Dec 2018 03:33:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/URHkRLTHGGXREZA0js0wqBVFWY1tmUxSJcUmCJGjYUWqANd2hj+ZN4GaF++KNnBFDMdoQN X-Received: by 2002:a63:495b:: with SMTP id y27mr12927319pgk.32.1543836813332; Mon, 03 Dec 2018 03:33:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543836813; cv=none; d=google.com; s=arc-20160816; b=ZDRiUUZB+GKzWgBxHFg4wKnqmVCqvR6xFpGB/gXTi/e1PuyIs6Wfy0C/CsacmG3oa0 sszwAAb6CuPT/jJE9a0EplLI+6WufgSzjiPcJdyaakRAltbyYT/8cZVq1KqDrk9jjX6o DY8gYqDa2CVRZbb9JxY2Hx8mY7N1gWvfVxJ+iJzjG+64AdRck018EKEr8T1YeMU1M+Kl qAi7mZAwMu48tmRQmTH3a+RPvWSdBNQLAzUf+60jjsP5TdU6c8yCg5FSamB03C5LoiAU osA+YRK6nImQR1PmomKf2pE97bkbWGD72F4t5bjvMdXR+4Wf6/PzqgLQyoOxxB1jH415 Z9kQ== 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 :spamdiagnosticmetadata:spamdiagnosticoutput:nodisclaimer :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=Kdh3NHny5Jk/CWNQBJv7x1e9taL4sFVzooXeEhz+Vqo=; b=F7IThfDu57I7rzmwyhuaGxDIMVpoxBwtyjsHlvB2YufNXMITDdKnrG3T16Cw3VzmPm EHX1VrVwQKV75dRU+muivgGTGDhx5s/sYSokcbiWRQ7dDwXbnGksBVdoW4+76GBM35PX 6mSMPOioUw4WgQQ3bpek+fgau6CbL4fHmnlK00j24lPV4khn9nSw7PFqoEMCVJ4hPH/Y 8kwlE0XoSP9E2D8lT6Pg8H0PgzqjkdajWL4qqx58N1k3NbbKTv7omUs2460w6Ma4vXdw Oet+FkaSs6G6R9XqbqMPpz85228UTIkUJKbl/UkIJzMFgqiVHJrbwKL4B0aeCzsP4ZqL /CmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=rJ5oAQDt; 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 h88si14912180pfa.49.2018.12.03.03.33.17; Mon, 03 Dec 2018 03:33:33 -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=rJ5oAQDt; 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 S1726503AbeLCLc5 (ORCPT + 99 others); Mon, 3 Dec 2018 06:32:57 -0500 Received: from mail-eopbgr20052.outbound.protection.outlook.com ([40.107.2.52]:21376 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726386AbeLCLcz (ORCPT ); Mon, 3 Dec 2018 06:32:55 -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=Kdh3NHny5Jk/CWNQBJv7x1e9taL4sFVzooXeEhz+Vqo=; b=rJ5oAQDt2VY/YXYLmnbkw14gydZMDKZk1tyJrHZ4Z9cd7aEUhCN1N4mZj6yStU9F53Cy0P6QzFN9vg3cu5dpecmMKjC67xcvTc2SHRauLegXRCpxm3yhOZQuV3LL7knvyQEaqfQz+exPXPe9UB3YCc3XEUnoqsdNRmeuB7HeTWU= Received: from AM0PR08MB3891.eurprd08.prod.outlook.com (20.178.82.147) by AM0PR08MB3491.eurprd08.prod.outlook.com (20.177.108.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.18; Mon, 3 Dec 2018 11:32:04 +0000 Received: from AM0PR08MB3891.eurprd08.prod.outlook.com ([fe80::896a:710:2a8c:e2fa]) by AM0PR08MB3891.eurprd08.prod.outlook.com ([fe80::896a:710:2a8c:e2fa%6]) with mapi id 15.20.1382.020; Mon, 3 Dec 2018 11:32:04 +0000 From: Ayan Halder To: Ayan Halder , Liviu Dudau , Brian Starkey , "malidp@foss.arm.com" , "airlied@linux.ie" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "maxime.ripard@bootlin.com" , "sean@poorly.run" , "maarten.lankhorst@linux.intel.com" , "corbet@lwn.net" , "mchehab+samsung@kernel.org" , "gregkh@linuxfoundation.org" , "davem@davemloft.net" , "akpm@linux-foundation.org" , "nicolas.ferre@microchip.com" , "arnd@arndb.de" , "linux-doc@vger.kernel.org" CC: nd Subject: [RFC AFBC 10/12] drm/arm/malidp:- Use the newly introduced malidp_format_get_bpp() instead of relying on cpp for calculating framebuffer size Thread-Topic: [RFC AFBC 10/12] drm/arm/malidp:- Use the newly introduced malidp_format_get_bpp() instead of relying on cpp for calculating framebuffer size Thread-Index: AQHUivvQHh1qBrcHw0685ENPd/8CJw== Date: Mon, 3 Dec 2018 11:32:04 +0000 Message-ID: <1543836703-8491-11-git-send-email-ayan.halder@arm.com> References: <1543836703-8491-1-git-send-email-ayan.halder@arm.com> In-Reply-To: <1543836703-8491-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: LO2P265CA0279.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::27) 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-originating-ip: [217.140.106.55] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM0PR08MB3491;6:NUslAUKtdecZW3YYPqKRqNlJmBfcPwLKBq1f4ZuCB4mQaUvhtAQa+zzeaKIjT/wedEy7k3z7MPFe4zoTtKl4mzZb8sDpwHESqTQDSw2Lu33iHfWmCLbVkbc/iZrHu+RnLrCgXp2Ds9MxKOjaD3b6FvZ9xe+6S2kI+k7dXw2NRkN6i3DO6jKFeG4oWghuKwlLabcoJxsQKy4F6zQ2Bfb5WHOz284PrOJ2Oh6q5v/HueseHGGy/1FiIPDGYb/gja9Wmc09/bET1TIPemeDpAxJOSjYRLmGnINEI755rK3pHQwQlPVjqgmCzwg43vImBurGlC/V1nBCf2Ag2yKsUfziHGvlPkhhVD17w/XoZt87mSa4TL38QrKOqt/5SLhv3YvuZ3mzwgE7N2kLRd8nVwUU1OabMaO1DJoeKxkjzCl1L1yLIYCbV7Eagr3UWhA3of/brXUqSfA4Amk89C4IZsv0SQ==;5:R4l6j5Edzw7m5Xq4PNLcncoMnzHsd8yYFEGLzwggcNve790FIBtOx/RmTkCWrYvOyx89ZV2NQd/EahBdPonAR12KbtQdMRMKzsBfnxJWOMXULTRRby5pAH+2NKW86IL1Xig8pkAvfjrKbMMRWSZ4UdSH9ZYHdNCwo9PL3JTp9RU=;7:8afJYT0bStmkBCFaqXq2472iwlvSyFaVHTALz6bQesM3Xq7rU4/JtlMKbt84rd4epEl+G3e3XU2Uwe2BqLrRQw3fmIFdMxbMro1HuV9CX34LLGgFbLdVgKJj/zZw2cheHP4Y9Nn5xCy5gkP+JLRbcg== x-ms-office365-filtering-correlation-id: 952ef909-aa1e-4f94-0d48-08d65912f32d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:AM0PR08MB3491; x-ms-traffictypediagnostic: AM0PR08MB3491: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231455)(999002)(944501493)(52105112)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051)(76991095);SRVR:AM0PR08MB3491;BCL:0;PCL:0;RULEID:;SRVR:AM0PR08MB3491; x-forefront-prvs: 08756AC3C8 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(39860400002)(376002)(136003)(346002)(366004)(199004)(189003)(99286004)(4326008)(71190400001)(97736004)(36756003)(71200400001)(106356001)(6486002)(68736007)(72206003)(256004)(14454004)(66066001)(478600001)(7416002)(5660300001)(81166006)(8936002)(7736002)(25786009)(2201001)(81156014)(305945005)(3846002)(6116002)(26005)(102836004)(316002)(186003)(6436002)(11346002)(486006)(2906002)(2501003)(8676002)(14444005)(575784001)(2616005)(44832011)(476003)(6512007)(105586002)(217873002)(53936002)(52116002)(446003)(386003)(6506007)(86362001)(110136005)(76176011)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR08MB3491;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-microsoft-antispam-message-info: 4+EIBAmEimz6u8kHCFNHbu9R73gnpQO0YEkV661pKFbBuFq1zHPp93dH1Qhcvw28MM7in0a33ff4F7OUjTqGeqA3NAMsDDVY/AYROLIfuhZEW9eg4jr/VPewyI6YplN1sEuPNQePxUdum8FoTBOiHhksUbztPBoKPK8J56v4U6RT+hxpSCEFMvPCIjzbaMD7DwfKuFt7EW/5FsuU/iWeeyXkYFFU5hTGoWJD1OPCcUEaSUMApsKMHWfMgjUhRHFlmbGhtP5z5E+WRiYkrObLegVVkNRTTBuB6EiiNY3i9s+iKPAjs0adRhOS8PajR8V1hTHjPp+YevtxQy6jZ+ww+YUvkNOIfPMynTSWxtOGoF8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: 952ef909-aa1e-4f94-0d48-08d65912f32d X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Dec 2018 11:32:04.6085 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3491 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/gpu/drm/arm/malidp_drv.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_= drv.c index 2f0b553..b2b97db 100644 --- a/drivers/gpu/drm/arm/malidp_drv.c +++ b/drivers/gpu/drm/arm/malidp_drv.c @@ -297,6 +297,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: @@ -313,15 +314,17 @@ 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