From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 60/73] drm/i915: Update i915_gem_get_ggtt_size/_alignment to use drm_i915_private
Date: Mon, 01 Aug 2016 15:30:13 +0300 [thread overview]
Message-ID: <1470054613.4174.13.camel@linux.intel.com> (raw)
In-Reply-To: <1470042681-25318-61-git-send-email-chris@chris-wilson.co.uk>
On ma, 2016-08-01 at 10:11 +0100, Chris Wilson wrote:
> For consistency, internal functions should take drm_i915_private rather
> than drm_device. Now that we are subclassing drm_device, there are no
> more size wins, but being consistent is its own blessing.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_drv.h | 5 +++--
> drivers/gpu/drm/i915/i915_gem.c | 30 ++++++++++++++++--------------
> drivers/gpu/drm/i915/i915_gem_tiling.c | 8 ++++----
> 3 files changed, 23 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index b6e56ecb8637..3d73394b52d7 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3241,8 +3241,9 @@ int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj,
> int i915_gem_open(struct drm_device *dev, struct drm_file *file);
> void i915_gem_release(struct drm_device *dev, struct drm_file *file);
>
> -u64 i915_gem_get_ggtt_size(struct drm_device *dev, u64 size, int tiling_mode);
> -u64 i915_gem_get_ggtt_alignment(struct drm_device *dev, u64 size,
> +u64 i915_gem_get_ggtt_size(struct drm_i915_private *dev_priv, u64 size,
> + int tiling_mode);
> +u64 i915_gem_get_ggtt_alignment(struct drm_i915_private *dev_priv, u64 size,
> int tiling_mode, bool fenced);
>
> int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 432868eafa60..f11bf6c4f86a 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1846,25 +1846,26 @@ i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv)
>
> /**
> * i915_gem_get_ggtt_size - return required global GTT size for an object
> - * @dev: drm device
> + * @dev_priv: i915 device
> * @size: object size
> * @tiling_mode: tiling mode
> *
> * Return the required GTT size for an object, taking into account
> * potential fence register mapping.
> */
> -u64 i915_gem_get_ggtt_size(struct drm_device *dev, u64 size, int tiling_mode)
> +u64 i915_gem_get_ggtt_size(struct drm_i915_private *dev_priv,
> + u64 size, int tiling_mode)
> {
> u64 ggtt_size;
>
> GEM_BUG_ON(size == 0);
>
> - if (INTEL_GEN(dev) >= 4 ||
> + if (INTEL_GEN(dev_priv) >= 4 ||
> tiling_mode == I915_TILING_NONE)
> return size;
>
> /* Previous chips need a power-of-two fence region when tiling */
> - if (IS_GEN3(dev))
> + if (IS_GEN3(dev_priv))
> ggtt_size = 1024*1024;
> else
> ggtt_size = 512*1024;
> @@ -1877,7 +1878,7 @@ u64 i915_gem_get_ggtt_size(struct drm_device *dev, u64 size, int tiling_mode)
>
> /**
> * i915_gem_get_ggtt_alignment - return required GTT alignment for an object
> - * @dev: drm device
> + * @dev_priv: i915 device
> * @size: object size
> * @tiling_mode: tiling mode
> * @fenced: is fenced alignemned required or not
> @@ -1885,7 +1886,7 @@ u64 i915_gem_get_ggtt_size(struct drm_device *dev, u64 size, int tiling_mode)
> * Return the required GTT alignment for an object, taking into account
> * potential fence register mapping.
> */
> -u64 i915_gem_get_ggtt_alignment(struct drm_device *dev, u64 size,
> +u64 i915_gem_get_ggtt_alignment(struct drm_i915_private *dev_priv, u64 size,
> int tiling_mode, bool fenced)
> {
> GEM_BUG_ON(size == 0);
> @@ -1894,7 +1895,7 @@ u64 i915_gem_get_ggtt_alignment(struct drm_device *dev, u64 size,
> * Minimum alignment is 4k (GTT page size), but might be greater
> * if a fence register is needed for the object.
> */
> - if (INTEL_GEN(dev) >= 4 || (!fenced && IS_G33(dev)) ||
> + if (INTEL_GEN(dev_priv) >= 4 || (!fenced && IS_G33(dev_priv)) ||
> tiling_mode == I915_TILING_NONE)
> return 4096;
>
> @@ -1902,7 +1903,7 @@ u64 i915_gem_get_ggtt_alignment(struct drm_device *dev, u64 size,
> * Previous chips need to be aligned to the size of the smallest
> * fence register that can contain the object.
> */
> - return i915_gem_get_ggtt_size(dev, size, tiling_mode);
> + return i915_gem_get_ggtt_size(dev_priv, size, tiling_mode);
> }
>
> static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)
> @@ -2991,14 +2992,14 @@ i915_gem_object_insert_into_vm(struct drm_i915_gem_object *obj,
>
> view_size = i915_ggtt_view_size(obj, ggtt_view);
>
> - fence_size = i915_gem_get_ggtt_size(dev,
> + fence_size = i915_gem_get_ggtt_size(dev_priv,
> view_size,
> obj->tiling_mode);
> - fence_alignment = i915_gem_get_ggtt_alignment(dev,
> + fence_alignment = i915_gem_get_ggtt_alignment(dev_priv,
> view_size,
> obj->tiling_mode,
> true);
> - unfenced_alignment = i915_gem_get_ggtt_alignment(dev,
> + unfenced_alignment = i915_gem_get_ggtt_alignment(dev_priv,
> view_size,
> obj->tiling_mode,
> false);
> @@ -3702,13 +3703,14 @@ i915_vma_misplaced(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
> void __i915_vma_set_map_and_fenceable(struct i915_vma *vma)
> {
> struct drm_i915_gem_object *obj = vma->obj;
> + struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
> bool mappable, fenceable;
> u32 fence_size, fence_alignment;
>
> - fence_size = i915_gem_get_ggtt_size(obj->base.dev,
> + fence_size = i915_gem_get_ggtt_size(dev_priv,
> obj->base.size,
> obj->tiling_mode);
> - fence_alignment = i915_gem_get_ggtt_alignment(obj->base.dev,
> + fence_alignment = i915_gem_get_ggtt_alignment(dev_priv,
> obj->base.size,
> obj->tiling_mode,
> true);
> @@ -3717,7 +3719,7 @@ void __i915_vma_set_map_and_fenceable(struct i915_vma *vma)
> (vma->node.start & (fence_alignment - 1)) == 0);
>
> mappable = (vma->node.start + fence_size <=
> - to_i915(obj->base.dev)->ggtt.mappable_end);
> + dev_priv->ggtt.mappable_end);
>
> obj->map_and_fenceable = mappable && fenceable;
> }
> diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
> index 4e42da691e4e..b7f9875f69b4 100644
> --- a/drivers/gpu/drm/i915/i915_gem_tiling.c
> +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
> @@ -117,15 +117,16 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
> static bool
> i915_gem_object_fence_ok(struct drm_i915_gem_object *obj, int tiling_mode)
> {
> + struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
> u32 size;
>
> if (tiling_mode == I915_TILING_NONE)
> return true;
>
> - if (INTEL_INFO(obj->base.dev)->gen >= 4)
> + if (INTEL_GEN(dev_priv) >= 4)
> return true;
>
> - if (IS_GEN3(obj->base.dev)) {
> + if (IS_GEN3(dev_priv)) {
> if (i915_gem_obj_ggtt_offset(obj) & ~I915_FENCE_START_MASK)
> return false;
> } else {
> @@ -133,8 +134,7 @@ i915_gem_object_fence_ok(struct drm_i915_gem_object *obj, int tiling_mode)
> return false;
> }
>
> - size = i915_gem_get_ggtt_size(obj->base.dev,
> - obj->base.size, tiling_mode);
> + size = i915_gem_get_ggtt_size(dev_priv, obj->base.size, tiling_mode);
> if (i915_gem_obj_ggtt_size(obj) != size)
> return false;
>
--
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
next prev parent reply other threads:[~2016-08-01 12:30 UTC|newest]
Thread overview: 94+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-01 9:10 A few bug fixes leading to exporting prime fences [mostly reviewed] Chris Wilson
2016-08-01 9:10 ` [PATCH 01/73] drm/i915: Unify intel_logical_ring_emit and intel_ring_emit Chris Wilson
2016-08-01 9:10 ` [PATCH 02/73] drm/i915: Rename request->ringbuf to request->ring Chris Wilson
2016-08-01 9:10 ` [PATCH 03/73] drm/i915: Rename intel_context[engine].ringbuf Chris Wilson
2016-08-01 9:10 ` [PATCH 04/73] drm/i915: Rename struct intel_ringbuffer to struct intel_ring Chris Wilson
2016-08-01 9:10 ` [PATCH 05/73] drm/i915: Rename residual ringbuf parameters Chris Wilson
2016-08-01 9:10 ` [PATCH 06/73] drm/i915: Rename intel_pin_and_map_ring() Chris Wilson
2016-08-01 9:10 ` [PATCH 07/73] drm/i915: Remove obsolete engine->gpu_caches_dirty Chris Wilson
2016-08-01 9:10 ` [PATCH 08/73] drm/i915: Reduce engine->emit_flush() to a single mode parameter Chris Wilson
2016-08-01 9:10 ` [PATCH 09/73] drm/i915: Simplify request_alloc by returning the allocated request Chris Wilson
2016-08-01 9:10 ` [PATCH 10/73] drm/i915: Unify legacy/execlists emission of MI_BATCHBUFFER_START Chris Wilson
2016-08-01 9:10 ` [PATCH 11/73] drm/i915: Remove intel_ring_get_tail() Chris Wilson
2016-08-01 9:10 ` [PATCH 12/73] drm/i915: Convert engine->write_tail to operate on a request Chris Wilson
2016-08-01 9:10 ` [PATCH 13/73] drm/i915: Move the modulus for ring emission to the register write Chris Wilson
2016-08-01 10:07 ` Joonas Lahtinen
2016-08-01 10:15 ` Chris Wilson
2016-08-01 14:28 ` Joonas Lahtinen
2016-08-01 16:17 ` Chris Wilson
2016-08-01 16:23 ` Chris Wilson
2016-08-01 16:32 ` Chris Wilson
2016-08-02 9:42 ` Dave Gordon
2016-08-02 10:14 ` Chris Wilson
2016-08-01 10:21 ` Chris Wilson
2016-08-01 9:10 ` [PATCH 14/73] drm/i915: Unify request submission Chris Wilson
2016-08-01 14:30 ` Joonas Lahtinen
2016-08-01 17:17 ` [PATCH v2] " Chris Wilson
2016-08-01 9:10 ` [PATCH 15/73] drm/i915/lrc: Update function names to match request flow Chris Wilson
2016-08-01 9:10 ` [PATCH 16/73] drm/i915: Stop passing caller's num_dwords to engine->semaphore.signal() Chris Wilson
2016-08-01 9:10 ` [PATCH 17/73] drm/i915: Reuse legacy breadcrumbs + tail emission Chris Wilson
2016-08-01 9:10 ` [PATCH 18/73] drm/i915/ringbuffer: Specialise SNB+ request emission for semaphores Chris Wilson
2016-08-01 9:10 ` [PATCH 19/73] drm/i915: Remove duplicate golden render state init from execlists Chris Wilson
2016-08-01 9:10 ` [PATCH 20/73] drm/i915: Refactor golden render state emission to unconfuse gcc Chris Wilson
2016-08-01 9:10 ` [PATCH 21/73] drm/i915: Unify legacy/execlists submit_execbuf callbacks Chris Wilson
2016-08-01 9:10 ` [PATCH 22/73] drm/i915: Simplify calling engine->sync_to Chris Wilson
2016-08-01 9:10 ` [PATCH 23/73] drm/i915: Rename engine->semaphore.sync_to, engine->sempahore.signal locals Chris Wilson
2016-08-01 9:10 ` [PATCH 24/73] drm/i915: Amalgamate GGTT/ppGTT vma debug list walkers Chris Wilson
2016-08-01 9:10 ` [PATCH 25/73] drm/i915: Split early global GTT initialisation Chris Wilson
2016-08-01 9:10 ` [PATCH 26/73] drm/i915: Store owning file on the i915_address_space Chris Wilson
2016-08-01 9:10 ` [PATCH 27/73] drm/i915: Count how many VMA are bound for an object Chris Wilson
2016-08-01 9:10 ` [PATCH 28/73] drm/i915: Be more careful when unbinding vma Chris Wilson
2016-08-01 9:10 ` [PATCH 29/73] drm/i915: Kill drop_pages() Chris Wilson
2016-08-01 9:10 ` [PATCH 30/73] drm/i915: Introduce i915_gem_active for request tracking Chris Wilson
2016-08-01 9:10 ` [PATCH 31/73] drm/i915: Prepare i915_gem_active for annotations Chris Wilson
2016-08-01 9:10 ` [PATCH 32/73] drm/i915: Mark up i915_gem_active for locking annotation Chris Wilson
2016-08-01 9:10 ` [PATCH 33/73] drm/i915: Refactor blocking waits Chris Wilson
2016-08-01 9:10 ` [PATCH 34/73] drm/i915: Rename request->list to link for consistency Chris Wilson
2016-08-01 9:10 ` [PATCH 35/73] drm/i915: Remove obsolete i915_gem_object_flush_active() Chris Wilson
2016-08-01 9:10 ` [PATCH 36/73] drm/i915: Refactor activity tracking for requests Chris Wilson
2016-08-01 12:52 ` Joonas Lahtinen
2016-08-01 9:10 ` [PATCH 37/73] drm/i915: Track requests inside each intel_ring Chris Wilson
2016-08-01 9:10 ` [PATCH 38/73] drm/i915: Convert intel_overlay to request tracking Chris Wilson
2016-08-01 9:10 ` [PATCH 39/73] drm/i915: Move the special case wait-request handling to its one caller Chris Wilson
2016-08-01 9:10 ` [PATCH 40/73] drm/i915: Disable waitboosting for a saturated engine Chris Wilson
2016-08-01 9:10 ` [PATCH 41/73] drm/i915: s/__i915_wait_request/i915_wait_request/ Chris Wilson
2016-08-01 9:10 ` [PATCH 42/73] drm/i915: Double check activity before relocations Chris Wilson
2016-08-01 9:10 ` [PATCH 43/73] drm/i915: Move request list retirement to i915_gem_request.c Chris Wilson
2016-08-01 9:10 ` [PATCH 44/73] drm/i915: i915_vma_move_to_active prep patch Chris Wilson
2016-08-01 9:10 ` [PATCH 45/73] drm/i915: Track active vma requests Chris Wilson
2016-08-01 9:10 ` [PATCH 46/73] drm/i915: Release vma when the handle is closed Chris Wilson
2016-08-01 11:26 ` Joonas Lahtinen
2016-08-01 9:10 ` [PATCH 47/73] drm/i915: Mark the context and address space as closed Chris Wilson
2016-08-01 9:10 ` [PATCH 48/73] Revert "drm/i915: Clean up associated VMAs on context destruction" Chris Wilson
2016-08-01 9:10 ` [PATCH 49/73] drm/i915: Combine loops within i915_gem_evict_something Chris Wilson
2016-08-01 9:10 ` [PATCH 50/73] drm/i915: Remove surplus drm_device parameter to i915_gem_evict_something() Chris Wilson
2016-08-01 9:10 ` [PATCH 51/73] drm/i915: Double check the active status on the batch pool Chris Wilson
2016-08-01 9:11 ` [PATCH 52/73] drm/i915: Remove request retirement before each batch Chris Wilson
2016-08-01 9:11 ` [PATCH 53/73] drm/i915: Remove i915_gem_execbuffer_retire_commands() Chris Wilson
2016-08-01 9:11 ` [PATCH 54/73] drm/i915: Fix up vma alignment to be u64 Chris Wilson
2016-08-01 12:21 ` Joonas Lahtinen
2016-08-01 9:11 ` [PATCH 55/73] drm/i915: Pad GTT views of exec objects up to user specified size Chris Wilson
2016-08-01 9:11 ` [PATCH 56/73] drm/i915: Reduce WARN(i915_gem_valid_gtt_space) to a debug-only check Chris Wilson
2016-08-01 9:11 ` [PATCH 57/73] drm/i915: Split insertion/binding of an object into the VM Chris Wilson
2016-08-01 9:11 ` [PATCH 58/73] drm/i915: Convert 4096 alignment request to 0 for drm_mm allocations Chris Wilson
2016-08-01 9:11 ` [PATCH 59/73] drm/i915: Update the GGTT size/alignment query functions Chris Wilson
2016-08-01 12:27 ` Joonas Lahtinen
2016-08-01 9:11 ` [PATCH 60/73] drm/i915: Update i915_gem_get_ggtt_size/_alignment to use drm_i915_private Chris Wilson
2016-08-01 12:30 ` Joonas Lahtinen [this message]
2016-08-01 9:11 ` [PATCH 61/73] drm/i915: Record allocated vma size Chris Wilson
2016-08-01 12:36 ` Joonas Lahtinen
2016-08-01 12:44 ` Chris Wilson
2016-08-01 9:11 ` [PATCH 62/73] drm/i915: Wrap vma->pin_count accessors with small inline helpers Chris Wilson
2016-08-01 9:11 ` [PATCH 63/73] drm/i915: Start passing around i915_vma from execbuffer Chris Wilson
2016-08-01 9:11 ` [PATCH 64/73] drm/i915: Combine all i915_vma bitfields into a single set of flags Chris Wilson
2016-08-01 9:11 ` [PATCH 65/73] drm/i915: Make i915_vma_pin() small and inline Chris Wilson
2016-08-01 9:11 ` [PATCH 66/73] drm/i915: Remove highly confusing i915_gem_obj_ggtt_pin() Chris Wilson
2016-08-01 9:11 ` [PATCH 67/73] drm/i915: Make fb_tracking.lock a spinlock Chris Wilson
2016-08-01 9:11 ` [PATCH 68/73] drm/i915: Use atomics to manipulate obj->frontbuffer_bits Chris Wilson
2016-08-01 9:11 ` [PATCH 69/73] drm/i915: Use dev_priv consistently through the intel_frontbuffer interface Chris Wilson
2016-08-01 9:11 ` [PATCH 70/73] drm/i915: Move obj->active:5 to obj->flags Chris Wilson
2016-08-01 12:46 ` Joonas Lahtinen
2016-08-01 9:11 ` [PATCH 71/73] drm/i915: Move i915_gem_object_wait_rendering() Chris Wilson
2016-08-01 9:11 ` [PATCH 72/73] drm/i915: Enable lockless lookup of request tracking via RCU Chris Wilson
2016-08-01 9:11 ` [PATCH 73/73] drm/i915: Export our request as a dma-buf fence on the reservation object Chris Wilson
2016-08-01 11:45 ` ✗ Ro.CI.BAT: failure for series starting with [01/73] drm/i915: Unify intel_logical_ring_emit and intel_ring_emit Patchwork
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=1470054613.4174.13.camel@linux.intel.com \
--to=joonas.lahtinen@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox