Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8538324imu; Tue, 4 Dec 2018 09:54:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wh72szBLCdT/1cxK7Q/VNC2n128sg//ZejJsU1Snbtp9ndHGg+kAK2zV9N4XS371Mlovc1 X-Received: by 2002:a63:7219:: with SMTP id n25mr17748916pgc.324.1543946057043; Tue, 04 Dec 2018 09:54:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543946057; cv=none; d=google.com; s=arc-20160816; b=KTlsKEGd7sHqLRD1WO1y/bppTJXny0F1xNY84hHxQYqDu3Ep1T7qCd5L/I9hZ9ye+C 5cJaLQpUtlImhS3bp+p1AkOUGm9hjI2gtclM5VsKVo1lcfj3cKjc8IC5GwqWhvw8Z+h2 n4seS2YW8A1fIIYha9uq68LaekBz5v9eNDWajHFAGacgeef4BIZmuiqqaABBdfXaHWkL 0XrkLvC5mQox4Gl2qGa/q8jprpQ4ibW+qTHG3xRyd7ANwZTNUwV8MOYoHY1Jhv6cRfEb bpa6mrUGdExbZraSj87F8qYaTXGI5kAOgdzOuX5WM7T+2fJ4h+Recg50XVuDpvNg4sO0 VVgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=R42DjKAI8HZt/+GHKWmTHwtkM9EDQ271BKpgJv3Ro0E=; b=w90R8M6HtHGcUH2WHVOxdcDnk/czp9pIldPjWDwWsLp+TuQw1st1fIT79ewlyEqyHg y/P+uNO4VqJAvx9y+pF9Yt84tuVfyABgqe4boBPXb/CmDxRMExjoDdMyTyujyekYMS/W fMDMMvIiALGy9NGBzgiSOx2n0e8SL5ogQVmCDydd7GDozhoAhNjydHvm+X9lUQCEW4k7 7NE/bxIymyFmWdj+8FMhxtTjddMQdhcuyJ1JzhzMXZo25DVwIRYMkZnffu0zZg1F6pcz NHeUOgoqqISd7TCMJfUtFPCjR6tmhAaWu6qX1zYnOu4KicKoswT1FW8hM0JxkOGtN63Z hIzQ== ARC-Authentication-Results: i=1; mx.google.com; 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 k5si7715872plt.111.2018.12.04.09.54.01; Tue, 04 Dec 2018 09:54:17 -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; 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 S1727391AbeLDRvm (ORCPT + 99 others); Tue, 4 Dec 2018 12:51:42 -0500 Received: from foss.arm.com ([217.140.101.70]:38126 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726073AbeLDRvl (ORCPT ); Tue, 4 Dec 2018 12:51:41 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 294E8A78; Tue, 4 Dec 2018 09:51:41 -0800 (PST) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CA4823F59C; Tue, 4 Dec 2018 09:51:40 -0800 (PST) Received: by e110455-lin.cambridge.arm.com (Postfix, from userid 1000) id 347996801C3; Tue, 4 Dec 2018 17:51:39 +0000 (GMT) Date: Tue, 4 Dec 2018 17:51:39 +0000 From: Liviu Dudau To: Ayan Halder Cc: 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" , nd Subject: Re: [RFC AFBC 10/12] drm/arm/malidp:- Use the newly introduced malidp_format_get_bpp() instead of relying on cpp for calculating framebuffer size Message-ID: <20181204175139.GR988@e110455-lin.cambridge.arm.com> References: <1543836703-8491-1-git-send-email-ayan.halder@arm.com> <1543836703-8491-11-git-send-email-ayan.halder@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1543836703-8491-11-git-send-email-ayan.halder@arm.com> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 03, 2018 at 11:32:04AM +0000, Ayan Halder wrote: > 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 Best regards, Liviu > --- > 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 = NULL; > u32 afbc_superblock_size = 0, afbc_superblock_height = 0; > u32 afbc_superblock_width = 0, afbc_size = 0; > + int bpp = 0; > > 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 = (mode_cmd->width / afbc_superblock_width) * > (mode_cmd->height / afbc_superblock_height); > > - afbc_superblock_size = info->cpp[0] * afbc_superblock_width * > - afbc_superblock_height; > + bpp = malidp_format_get_bpp(info->format); > + > + afbc_superblock_size = (bpp * afbc_superblock_width * afbc_superblock_height) / BITS_PER_BYTE; > > afbc_size = ALIGN(n_superblocks * AFBC_HEADER_SIZE, AFBC_SUPERBLK_ALIGNMENT); > afbc_size += n_superblocks * ALIGN(afbc_superblock_size, AFBC_SUPERBLK_ALIGNMENT); > > - if (mode_cmd->width * info->cpp[0] != mode_cmd->pitches[0]) { > - DRM_DEBUG_KMS("Invalid value of pitch (=%u) should be same as width (=%u) * cpp (=%u)\n", > - mode_cmd->pitches[0], mode_cmd->width, info->cpp[0]); > + if ((mode_cmd->width * bpp) != (mode_cmd->pitches[0] * BITS_PER_BYTE)) { > + DRM_DEBUG_KMS("Invalid value of (pitch * BITS_PER_BYTE) (=%u) " > + "should be same as width (=%u) * bpp (=%u)\n", > + (mode_cmd->pitches[0] * BITS_PER_BYTE), mode_cmd->width, bpp); > return false; > } > > -- > 2.7.4 > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯