From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rodrigo Vivi Subject: Re: [PATCH 2/4] drm/i915: Extract CFB threshold calculation Date: Mon, 30 Jun 2014 17:16:15 -0700 Message-ID: References: <1403204773-7112-1-git-send-email-benjamin.widawsky@intel.com> <1403204773-7112-2-git-send-email-benjamin.widawsky@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0271545725==" Return-path: Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 357936E412 for ; Mon, 30 Jun 2014 17:16:16 -0700 (PDT) Received: by mail-ve0-f172.google.com with SMTP id jz11so8897206veb.17 for ; Mon, 30 Jun 2014 17:16:15 -0700 (PDT) In-Reply-To: <1403204773-7112-2-git-send-email-benjamin.widawsky@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Ben Widawsky Cc: Intel GFX , Ben Widawsky List-Id: intel-gfx@lists.freedesktop.org --===============0271545725== Content-Type: multipart/alternative; boundary=001a11c2cb1219223404fd16aff1 --001a11c2cb1219223404fd16aff1 Content-Type: text/plain; charset=UTF-8 Reviewed-by: Rodrigo Vivi On Thu, Jun 19, 2014 at 12:06 PM, Ben Widawsky wrote: > Right now, there is no threshold (0 means fail, 1 means 1:1 compression > limit). This is to split the function/non-functional change of the next > patch. > > The next patch will start to attempt to reduce the amount of CFB space > we need for dire situations. It will be contained within this function. > > Signed-off-by: Ben Widawsky > --- > drivers/gpu/drm/i915/i915_gem_stolen.c | 26 ++++++++++++++++++++------ > 1 file changed, 20 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c > b/drivers/gpu/drm/i915/i915_gem_stolen.c > index 642fd36..a86b331 100644 > --- a/drivers/gpu/drm/i915/i915_gem_stolen.c > +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c > @@ -103,22 +103,36 @@ static unsigned long i915_stolen_to_physical(struct > drm_device *dev) > return base; > } > > -static int i915_setup_compression(struct drm_device *dev, int size) > +static int find_compression_threshold(struct drm_device *dev, > + struct drm_mm_node *node, > + int size) > { > struct drm_i915_private *dev_priv = dev->dev_private; > - struct drm_mm_node *uninitialized_var(compressed_llb); > + const int compression_threshold = 1; > int ret; > > /* Try to over-allocate to reduce reallocations and fragmentation > */ > - ret = drm_mm_insert_node(&dev_priv->mm.stolen, > - &dev_priv->fbc.compressed_fb, > + ret = drm_mm_insert_node(&dev_priv->mm.stolen, node, > size <<= 1, 4096, DRM_MM_SEARCH_DEFAULT); > if (ret) > - ret = drm_mm_insert_node(&dev_priv->mm.stolen, > - &dev_priv->fbc.compressed_fb, > + ret = drm_mm_insert_node(&dev_priv->mm.stolen, node, > size >>= 1, 4096, > DRM_MM_SEARCH_DEFAULT); > if (ret) > + return 0; > + else > + return compression_threshold; > +} > + > +static int i915_setup_compression(struct drm_device *dev, int size) > +{ > + struct drm_i915_private *dev_priv = dev->dev_private; > + struct drm_mm_node *uninitialized_var(compressed_llb); > + int ret; > + > + ret = find_compression_threshold(dev, &dev_priv->fbc.compressed_fb, > + size); > + if (!ret) > goto err_llb; > > if (HAS_PCH_SPLIT(dev)) > -- > 2.0.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx > -- Rodrigo Vivi Blog: http://blog.vivi.eng.br --001a11c2cb1219223404fd16aff1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>


On Thu, Jun 19, 2014 at 12:06 PM, = Ben Widawsky <benjamin.widawsky@intel.com> wrote:<= br>
Right now, there is no threshold (0 means fa= il, 1 means 1:1 compression
limit). This is to split the function/non-functional change of the next
patch.

The next patch will start to attempt to reduce the amount of CFB space
we need for dire situations. It will be contained within this function.

Signed-off-by: Ben Widawsky <ben@bwi= dawsk.net>
---
=C2=A0drivers/gpu/drm/i915/i915_gem_stolen.c | 26 ++++++++++++++++++++-----= -
=C2=A01 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/= i915_gem_stolen.c
index 642fd36..a86b331 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -103,22 +103,36 @@ static unsigned long i915_stolen_to_physical(struct d= rm_device *dev)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return base;
=C2=A0}

-static int i915_setup_compression(struct drm_device *dev, int size)
+static int find_compression_threshold(struct drm_device *dev,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct drm_mm_node *no= de,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 int size)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 struct drm_i915_private *dev_priv =3D dev->d= ev_private;
- =C2=A0 =C2=A0 =C2=A0 struct drm_mm_node *uninitialized_var(compressed_llb= );
+ =C2=A0 =C2=A0 =C2=A0 const int compression_threshold =3D 1;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 int ret;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Try to over-allocate to reduce reallocations= and fragmentation */
- =C2=A0 =C2=A0 =C2=A0 ret =3D drm_mm_insert_node(&dev_priv->mm.stol= en,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&dev_priv->fbc.compressed_fb,<= br> + =C2=A0 =C2=A0 =C2=A0 ret =3D drm_mm_insert_node(&dev_priv->mm.stol= en, node,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0size <<=3D 1, 4096, DRM_= MM_SEARCH_DEFAULT);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ret)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D drm_mm_insert_no= de(&dev_priv->mm.stolen,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&dev_= priv->fbc.compressed_fb,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D drm_mm_insert_no= de(&dev_priv->mm.stolen, node,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0si= ze >>=3D 1, 4096,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0DR= M_MM_SEARCH_DEFAULT);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ret)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;
+ =C2=A0 =C2=A0 =C2=A0 else
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return compression_thres= hold;
+}
+
+static int i915_setup_compression(struct drm_device *dev, int size)
+{
+ =C2=A0 =C2=A0 =C2=A0 struct drm_i915_private *dev_priv =3D dev->dev_pr= ivate;
+ =C2=A0 =C2=A0 =C2=A0 struct drm_mm_node *uninitialized_var(compressed_llb= );
+ =C2=A0 =C2=A0 =C2=A0 int ret;
+
+ =C2=A0 =C2=A0 =C2=A0 ret =3D find_compression_threshold(dev, &dev_pri= v->fbc.compressed_fb,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0size); + =C2=A0 =C2=A0 =C2=A0 if (!ret)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto err_llb;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (HAS_PCH_SPLIT(dev))
--
2.0.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesk= top.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx



--
Rodrigo Vivi
=C2=A0
--001a11c2cb1219223404fd16aff1-- --===============0271545725== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============0271545725==--