Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3963377imm; Mon, 20 Aug 2018 07:37:14 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwJ1WYhaCpWBcLQHZohkTbLT3hsJ3gLuiaMllxMKQSGpUyWRSTAnKL3YE2d+QnQCqJAgijD X-Received: by 2002:aa7:818f:: with SMTP id g15-v6mr47834261pfi.71.1534775834452; Mon, 20 Aug 2018 07:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534775834; cv=none; d=google.com; s=arc-20160816; b=zNQUJNtn3ByRPat7OCDyBe+0/rft1zCSBuTCqQwKVuv0WhZt39Dt8LNukCHxIzX6mt Wd+Hy0vWcmYkq4gAveSM24XOEC17T1MOonfi/zZlzmiXGrfs2bH8Gj5Pa1wjJm83NBaG 2/gvNLI5kK322NbSWw/YmTW6hLDU5ZG3bfsCH61o875qJFocEK5WqCc20gvQRAeuEuwN yYOubGtWAS4H9NlsfFkg3pHx3v+D5rMyHYMPq8AA3R3qnGtUoWmjdS58VAHqh/4QUr1d Rq7capZh5rY2yv1Glc+QncDhsriZOACyY5DOsuZgLwRAdKUZNBUhKCSNPGlwUZewVg98 xujA== 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 :arc-authentication-results; bh=bdc6d+0u6jvSnAB15LvlRkbIRtB5z2/76L/hgKYt5gM=; b=D2Ht2zQLUNz+quTYDGGygEKYZpSTW0ILEGmwGfWB2Y9wkZcufIWZMZ3W66alYvXSKy 7v54b0yvIrLb90uZ750qjuhncJnhGA83/Bp8QLohznRnvjtWDIlwYfTVOFjWrdgAlH9V +cQA1pOf1HpwnqIWPvygMHEShvQLGloy4smf8g0P53EIXiPPV4/FEvNye76xuuxyX8tL 5AjPpoTzX9sv874QrYzg5h4X3FoqTyfZh5h623XKF3uDFwEfsk4/9o4LFLbauKCKOcBO 4RuFq+LD0QwSiEcf5864hix/6FLiAelHjvA+w3r9jztM8uqTwLs4FiM+Q6BeHTVzWFNF Pb+Q== 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 o12-v6si9803496pgi.112.2018.08.20.07.36.59; Mon, 20 Aug 2018 07:37:14 -0700 (PDT) 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 S1727290AbeHTQjr (ORCPT + 99 others); Mon, 20 Aug 2018 12:39:47 -0400 Received: from foss.arm.com ([217.140.101.70]:37520 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726615AbeHTQjr (ORCPT ); Mon, 20 Aug 2018 12:39:47 -0400 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 9245EED1; Mon, 20 Aug 2018 06:24:09 -0700 (PDT) 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 6267D3F5BC; Mon, 20 Aug 2018 06:24:09 -0700 (PDT) Received: by e110455-lin.cambridge.arm.com (Postfix, from userid 1000) id BBD47680881; Mon, 20 Aug 2018 14:24:07 +0100 (BST) Date: Mon, 20 Aug 2018 14:24:07 +0100 From: Liviu Dudau To: Ayan Halder Cc: airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, seanpaul@chromium.org, nd@arm.com Subject: Re: [PATCH] drm: Use horizontal and vertical chroma subsampling factor while calculating offsets in the physical address of framebuffer Message-ID: <20180820132407.GY907@e110455-lin.cambridge.arm.com> References: <1534527184-24552-1-git-send-email-ayan.halder@arm.com> <20180820110319.GV907@e110455-lin.cambridge.arm.com> <20180820123859.GA2054@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180820123859.GA2054@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 20, 2018 at 01:38:59PM +0100, Ayan Halder wrote: > On Mon, Aug 20, 2018 at 12:03:19PM +0100, Liviu Dudau wrote: > > On Fri, Aug 17, 2018 at 06:33:04PM +0100, Ayan Kumar Halder wrote: > > > For multi-planar formats, while calculating offsets in planes with index greater than 0 > > > (ie second plane, third plane, etc), one needs to divide (src_x * cpp) with horizontal > > > chroma subsampling factor and (src_y * pitch) with vertical chroma subsampling factor. > > > > > > The reason being that the planes contain subsampled (ie reduced) data (by a factor of 2) and thus the > > > > drop the extraneous "the" at the end of the line. > > > > > while calculating the byte position coresponding to the x and y co-ordinates, one needs to be > > > > and drop the extraneous "be" at the end of this line. > > > > > divide it with the sampling factor. > > > > > > Signed-off-by: Ayan Kumar halder > > > > Otherwise, it looks good to me! > > > > Reviewed-by: Liviu Dudau > > > Thanks Liviu. I will update the commit message and push this in > drm-misc-next. Worth waiting for another review before pushing. Best regards, Liviu > > > Best regards, > > Liviu > > > > > --- > > > drivers/gpu/drm/drm_fb_cma_helper.c | 11 +++++++++-- > > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c > > > index b127061..47e0e2f 100644 > > > --- a/drivers/gpu/drm/drm_fb_cma_helper.c > > > +++ b/drivers/gpu/drm/drm_fb_cma_helper.c > > > @@ -86,14 +86,21 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, > > > { > > > struct drm_gem_cma_object *obj; > > > dma_addr_t paddr; > > > + u8 h_div = 1, v_div = 1; > > > > > > obj = drm_fb_cma_get_gem_obj(fb, plane); > > > if (!obj) > > > return 0; > > > > > > paddr = obj->paddr + fb->offsets[plane]; > > > - paddr += fb->format->cpp[plane] * (state->src_x >> 16); > > > - paddr += fb->pitches[plane] * (state->src_y >> 16); > > > + > > > + if (plane > 0) { > > > + h_div = fb->format->hsub; > > > + v_div = fb->format->vsub; > > > + } > > > + > > > + paddr += (fb->format->cpp[plane] * (state->src_x >> 16)) / h_div; > > > + paddr += (fb->pitches[plane] * (state->src_y >> 16)) / v_div; > > > > > > return paddr; > > > } > > > -- > > > 2.7.4 > > > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯