From: Dave Gordon <david.s.gordon@intel.com>
To: intel-gfx@lists.freedesktop.org, "Harrison,
John C" <john.c.harrison@intel.com>,
"Elf, Tomas" <tomas.elf@intel.com>
Subject: Re: [PATCH] drm/i915: Reserve space improvements
Date: Fri, 26 Jun 2015 19:04:30 +0100 [thread overview]
Message-ID: <558D942E.1010906@intel.com> (raw)
In-Reply-To: <558C4AC3.6030707@intel.com>
On 25/06/15 19:38, Tomas Elf wrote:
> On 24/06/2015 18:03, John.C.Harrison@Intel.com wrote:
>> From: John Harrison <John.C.Harrison@Intel.com>
>>
>> An earlier patch was added to reserve space in the ring buffer for the
>> commands issued during 'add_request()'. The initial version was
>> pessimistic in the way it handled buffer wrapping and would cause
>> premature wraps and thus waste ring space.
>>
>> This patch updates the code to better handle the wrap case. It no
>> longer enforces that the space being asked for and the reserved space
>> are a single contiguous block. Instead, it allows the reserve to be on
>> the far end of a wrap operation. It still guarantees that the space is
>> available so when the wrap occurs, no wait will happen. Thus the wrap
>> cannot fail which is the whole point of the exercise.
>>
>> Also fixed a merge failure with some comments from the original patch.
>>
>> For: VIZ-5115
>> CC: Daniel Vetter <daniel@ffwll.ch>
>> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
>> ---
>> drivers/gpu/drm/i915/intel_lrc.c | 54 +++++++++++++-----------
>> drivers/gpu/drm/i915/intel_ringbuffer.c | 73
>> +++++++++++++++++++++------------
>> drivers/gpu/drm/i915/intel_ringbuffer.h | 4 +-
>> 3 files changed, 79 insertions(+), 52 deletions(-)
[snip]
>> @@ -748,31 +749,36 @@ static int logical_ring_wrap_buffer(struct
>> drm_i915_gem_request *req)
>> static int logical_ring_prepare(struct drm_i915_gem_request *req,
>> int bytes)
>> {
>> struct intel_ringbuffer *ringbuf = req->ringbuf;
>> - int ret;
>> -
>> - /*
>> - * Add on the reserved size to the request to make sure that after
>> - * the intended commands have been emitted, there is guaranteed to
>> - * still be enough free space to send them to the hardware.
>> - */
>> - if (!ringbuf->reserved_in_use)
>> - bytes += ringbuf->reserved_size;
>> + int ret, max_bytes;
>>
>
> It would be helpful if we could flesh out the flow through the
> ring_prepare functions and be more explicit about what is actually going
> on. Largely this is because there is a distinct lack of documentation
> for the entire ring buffer management code on top of a quite
> counter-intuitive legacy design, so this is not due to your changes.
> However, your changes make things even more complex and hard to
> understand. So I've suggested a few comments below. Feel free to reword
> or do whatever with them. It would be nice if we could be slightly more
> clear about what is going on here, though. The same comments apply to
> both legacy and execlist function implementations obviously.
It would be simpler to understand if the unnecessary complication of
unlikely(wait-for-space-and-wrap) followed by unlikely(wait-for-space)
were simplified into a single process of "precalculate space required,
allowing for wrapping where necessary; wait for that much space; finally
fill the tail of the ring if we determined that wrapping was necessary".
This change can be applied before any of the complications of "reserving
space". See
http://lists.freedesktop.org/archives/intel-gfx/2015-June/068545.html
Secondly, a simpler way to implement "reserved space" is just to have
the "calculate remaining space" function intel_ring_space() deduct the
amount-reserved-for-add-request from its result UNLESS the
"use-reserved-space" flag has been set. It already deducts
I915_RING_FREE_SPACE, which represents the h/w limitation of the minimum
space required between tail and head, so conditionally deducting the
extra amount would be easy; then all other code could continue to use
the value it returns when checking for enough space. Nothing else would
have to know about "reserved space" at all.
.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-06-26 18:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-24 17:03 [PATCH] drm/i915: Reserve space improvements John.C.Harrison
2015-06-25 18:38 ` Tomas Elf
2015-06-26 18:04 ` Dave Gordon [this message]
2015-06-28 21:11 ` shuang.he
2015-06-29 16:36 ` John.C.Harrison
2015-06-30 7:26 ` shuang.he
2015-06-30 11:33 ` Tomas Elf
2015-06-30 11:40 ` John.C.Harrison
2015-06-30 14:43 ` Tomas Elf
2015-06-30 15:53 ` John Harrison
2015-06-30 16:15 ` Tomas Elf
2015-07-01 10:44 ` Tomas Elf
2015-07-01 12:29 ` Daniel Vetter
2015-07-01 22:18 ` shuang.he
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=558D942E.1010906@intel.com \
--to=david.s.gordon@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=john.c.harrison@intel.com \
--cc=tomas.elf@intel.com \
/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