All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Tvrtko Ursulin <tursulin@ursulin.net>
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 13/14] drm/i915: Use binary search when looking for shadowed registers
Date: Mon, 03 Oct 2016 11:05:35 +0300	[thread overview]
Message-ID: <1475481935.3067.21.camel@linux.intel.com> (raw)
In-Reply-To: <20160930180809.GM9653@nuc-i3427.alporthouse.com>

On pe, 2016-09-30 at 19:08 +0100, Chris Wilson wrote:
> On Fri, Sep 30, 2016 at 06:48:48PM +0100, Tvrtko Ursulin wrote: 
> > +static int mmio_reg_cmp(const void *key, const void *elt)
> > +{
> > +	u32 offset = (u32)(unsigned long)key;
> > +	i915_reg_t *reg = (i915_reg_t *)elt;
> > +
> > +	if (offset < i915_mmio_reg_offset(*reg))
> > +		return -1;
> > +	else if (offset > i915_mmio_reg_offset(*reg))
> > +		return 1;
> > +	else
> > +		return 0;
> 
> There's no issue with using
> 
> 	return offset - i915_mmio_reg_offset(*reg)
> 
> here.
> 

Why not?

> > +	reg = bsearch((void *)(unsigned long)offset,
> > +		      (const void *)gen8_shadowed_regs,
> > +		      ARRAY_SIZE(gen8_shadowed_regs),
> > +		      sizeof(i915_reg_t),
> > +		      mmio_reg_cmp);
> > +
> > +	return reg;
> 
> Or just return bseearch() ? (Probably like this for easing future
> patches.)

Suggested that too, but obviously he has something in mind.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-10-03  8:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30 17:48 [PATCH v2 00/14] Forcewake binary search & code shrink Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 01/14] drm/i915: Remove redundant hsw_write* mmio functions Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 02/14] drm/i915: Keep track of active forcewake domains in a bitmask Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 03/14] drm/i915: Do not inline forcewake taking in mmio accessors Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 04/14] drm/i915: Data driven register to forcewake domains lookup Tvrtko Ursulin
2016-10-03  7:58   ` Joonas Lahtinen
2016-10-26  9:24     ` Mika Kuoppala
2016-09-30 17:48 ` [PATCH 05/14] drm/i915: Sort forcewake mapping tables Tvrtko Ursulin
2016-09-30 18:05   ` Chris Wilson
2016-10-03  8:37     ` Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 06/14] drm/i915: Use binary search when looking up forcewake domains Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 07/14] drm/i915: Eliminate Gen9 special case Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 08/14] drm/i915: Store the active forcewake range table pointer Tvrtko Ursulin
2016-10-03  8:39   ` Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 09/14] drm/i915: Remove identical macros Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 10/14] drm/i915: Remove identical mmio read functions Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 11/14] drm/i915: Remove identical write mmmio functions Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 12/14] drm/i915: Sort the shadow register table Tvrtko Ursulin
2016-10-03  8:40   ` Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 13/14] drm/i915: Use binary search when looking for shadowed registers Tvrtko Ursulin
2016-09-30 18:08   ` Chris Wilson
2016-10-03  8:05     ` Joonas Lahtinen [this message]
2016-10-03  8:33       ` Tvrtko Ursulin
2016-09-30 17:48 ` [PATCH 14/14] drm/i915: Inline binary search Tvrtko Ursulin
2016-09-30 18:09 ` [PATCH v2 00/14] Forcewake binary search & code shrink Chris Wilson
2016-09-30 18:49 ` ✗ Fi.CI.BAT: warning for Forcewake binary search & code shrink (rev3) Patchwork
2016-10-03  9:27 ` ✗ Fi.CI.BAT: warning for Forcewake binary search & code shrink (rev6) Patchwork
2016-10-04  8:46   ` Tvrtko Ursulin
2016-10-04  8:55     ` Chris Wilson
2016-10-04  9:18       ` Tvrtko Ursulin
2016-10-04  9:37         ` Joonas Lahtinen
2016-10-04 10:17           ` Tvrtko Ursulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475481935.3067.21.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=tursulin@ursulin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.