From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 415B3C43603 for ; Thu, 12 Dec 2019 16:00:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1FABC2073B for ; Thu, 12 Dec 2019 16:00:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FABC2073B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B7D9C89022; Thu, 12 Dec 2019 16:00:52 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C02A89022 for ; Thu, 12 Dec 2019 16:00:51 +0000 (UTC) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Dec 2019 08:00:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,306,1571727600"; d="scan'208";a="216156470" Received: from invictus.jf.intel.com (HELO InViCtUs) ([10.54.75.159]) by orsmga006.jf.intel.com with ESMTP; 12 Dec 2019 08:00:48 -0800 Date: Thu, 12 Dec 2019 08:00:58 -0800 From: Radhakrishna Sripada To: intel-gfx@lists.freedesktop.org Message-ID: <20191212160058.GE21507@InViCtUs> References: <20191126002635.5779-1-radhakrishna.sripada@intel.com> <20191126002635.5779-6-radhakrishna.sripada@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191126002635.5779-6-radhakrishna.sripada@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [Intel-gfx] [PATCH v7 5/7] drm/i915: Extract framebufer CCS offset checks into a function X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ville.syrjala@intel.com, nanley.g.chery@intel.com, dhinakaran.pandiyan@intel.com Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Mon, Nov 25, 2019 at 04:26:33PM -0800, Radhakrishna Sripada wrote: > From: Dhinakaran Pandiyan > = > intel_fill_fb_info() has grown quite large and wrapping the offset checks > into a separate function makes the loop a bit easier to follow. > = > Cc: Ville Syrj=E4l=E4 > Cc: Matt Roper Reviewed-by: Radhakrishna Sripada > Signed-off-by: Dhinakaran Pandiyan > --- > drivers/gpu/drm/i915/display/intel_display.c | 69 ++++++++++++-------- > 1 file changed, 40 insertions(+), 29 deletions(-) > = > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/d= rm/i915/display/intel_display.c > index 1ef1988b9e12..6c4274c1564d 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -2742,6 +2742,43 @@ static bool intel_plane_needs_remap(const struct i= ntel_plane_state *plane_state) > return stride > max_stride; > } > = > +static int > +intel_fb_check_ccs_xy(struct drm_framebuffer *fb, int x, int y) > +{ > + struct intel_framebuffer *intel_fb =3D to_intel_framebuffer(fb); > + int hsub =3D fb->format->hsub; > + int vsub =3D fb->format->vsub; > + int tile_width, tile_height; > + int ccs_x, ccs_y; > + int main_x, main_y; > + > + intel_tile_dims(fb, 1, &tile_width, &tile_height); > + > + tile_width *=3D hsub; > + tile_height *=3D vsub; > + > + ccs_x =3D (x * hsub) % tile_width; > + ccs_y =3D (y * vsub) % tile_height; > + main_x =3D intel_fb->normal[0].x % tile_width; > + main_y =3D intel_fb->normal[0].y % tile_height; > + > + /* > + * CCS doesn't have its own x/y offset register, so the intra CCS tile > + * x/y offsets must match between CCS and the main surface. > + */ > + if (main_x !=3D ccs_x || main_y !=3D ccs_y) { > + DRM_DEBUG_KMS("Bad CCS x/y (main %d,%d ccs %d,%d) full (main %d,%d ccs= %d,%d)\n", > + main_x, main_y, > + ccs_x, ccs_y, > + intel_fb->normal[0].x, > + intel_fb->normal[0].y, > + x, y); > + return -EINVAL; > + } > + > + return 0; > +} > + > static int > intel_fill_fb_info(struct drm_i915_private *dev_priv, > struct drm_framebuffer *fb) > @@ -2773,35 +2810,9 @@ intel_fill_fb_info(struct drm_i915_private *dev_pr= iv, > } > = > if (is_ccs_modifier(fb->modifier) && i =3D=3D 1) { > - int hsub =3D fb->format->hsub; > - int vsub =3D fb->format->vsub; > - int tile_width, tile_height; > - int main_x, main_y; > - int ccs_x, ccs_y; > - > - intel_tile_dims(fb, i, &tile_width, &tile_height); > - > - tile_width *=3D hsub; > - tile_height *=3D vsub; > - > - ccs_x =3D (x * hsub) % tile_width; > - ccs_y =3D (y * vsub) % tile_height; > - main_x =3D intel_fb->normal[0].x % tile_width; > - main_y =3D intel_fb->normal[0].y % tile_height; > - > - /* > - * CCS doesn't have its own x/y offset register, so the intra CCS tile > - * x/y offsets must match between CCS and the main surface. > - */ > - if (main_x !=3D ccs_x || main_y !=3D ccs_y) { > - DRM_DEBUG_KMS("Bad CCS x/y (main %d,%d ccs %d,%d) full (main %d,%d c= cs %d,%d)\n", > - main_x, main_y, > - ccs_x, ccs_y, > - intel_fb->normal[0].x, > - intel_fb->normal[0].y, > - x, y); > - return -EINVAL; > - } > + ret =3D intel_fb_check_ccs_xy(fb, x, y); > + if (ret) > + return ret; > } > = > /* > -- = > 2.20.1 > = > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx