From: Dave Gordon <david.s.gordon@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
intel-gfx@lists.freedesktop.org,
Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: Re: [PATCH v3 1/3] drm/i915: simplify allocation of driver-internal requests
Date: Thu, 7 Jan 2016 12:34:39 +0000 [thread overview]
Message-ID: <568E5B5F.8020109@intel.com> (raw)
In-Reply-To: <20160107115846.GI652@nuc-i3427.alporthouse.com>
On 07/01/16 11:58, Chris Wilson wrote:
> On Thu, Jan 07, 2016 at 10:20:50AM +0000, Dave Gordon wrote:
>> There are a number of places where the driver needs a request, but isn't
>> working on behalf of any specific user or in a specific context. At
>> present, we associate them with the per-engine default context. A future
>> patch will abolish those per-engine context pointers; but we can already
>> eliminate a lot of the references to them, just by making the allocator
>> allow NULL as a shorthand for "an appropriate context for this ring",
>> which will mean that the callers don't need to know anything about how
>> the "appropriate context" is found (e.g. per-ring vs per-device, etc).
>>
>> So this patch renames the existing i915_gem_request_alloc(), and makes
>> it local (static inline), and replaces it with a wrapper that provides
>> a default if the context is NULL, and also has a nicer calling
>> convention (doesn't require a pointer to an output parameter). Then we
>> change all callers to use the new convention:
>> OLD:
>> err = i915_gem_request_alloc(ring, user_ctx, &req);
>> if (err) ...
>> NEW:
>> req = i915_gem_request_alloc(ring, user_ctx);
>> if (IS_ERR(req)) ...
>> OLD:
>> err = i915_gem_request_alloc(ring, ring->default_context, &req);
>> if (err) ...
>> NEW:
>> req = i915_gem_request_alloc(ring, NULL);
>> if (IS_ERR(req)) ...
>
> Nak. You haven't fixed i915_gem_request_alloc() at all.
>
> http://cgit.freedesktop.org/~ickle/linux-2.6/commit/?h=breadcrumbs&id=82c72e1a2b4385f0ab07dccee45acef38303e96f
> is the patch I have been carrying ever since.
> -Chris
I think you'll find that the version of i915_gem_request_alloc() I've
implemented is equivalent to yours, with the *additional* (and better)
semantic of not requiring the caller to specify (ring->default_param) as
the context parameter (which is the main point, as far as I'm concerned;
making the calling convention nicer was just incidental).
*MINE*:
diff --git a/drivers/gpu/drm/i915/i915_drv.h
b/drivers/gpu/drm/i915/i915_drv.h
index c6dd4db..c2b000a 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2260,9 +2260,9 @@ struct drm_i915_gem_request {
};
-int i915_gem_request_alloc(struct intel_engine_cs *ring,
- struct intel_context *ctx,
- struct drm_i915_gem_request **req_out);
+struct drm_i915_gem_request * __must_check
+i915_gem_request_alloc(struct intel_engine_cs *engine,
+ struct intel_context *ctx);
void i915_gem_request_cancel(struct drm_i915_gem_request *req);
void i915_gem_request_free(struct kref *req_ref);
int i915_gem_request_add_to_client(struct drm_i915_gem_request *req,
...
*YOURS*:
diff --git a/drivers/gpu/drm/i915/i915_gem_request.h
b/drivers/gpu/drm/i915/i915_gem_request.h
index 0869505..2da9e0b 100644
--- a/drivers/gpu/drm/i915/i915_gem_request.h
+++ b/drivers/gpu/drm/i915/i915_gem_request.h
@@ -118,9 +118,9 @@ struct drm_i915_gem_request {
int elsp_submitted;
};
-int i915_gem_request_alloc(struct intel_engine_cs *ring,
- struct intel_context *ctx,
- struct drm_i915_gem_request **req_out);
+struct drm_i915_gem_request *
+i915_gem_request_alloc(struct intel_engine_cs *ring,
+ struct intel_context *ctx);
void i915_gem_request_cancel(struct drm_i915_gem_request *req);
int i915_gem_request_add_to_client(struct drm_i915_gem_request *req,
struct drm_file *file);
...
You seem to have done EXACTLY THE SAME transformation of the function
signature (except I remembered to add __must_check, and wrote some
kerneldoc for it), so what's not to like?
I haven't done anything to {__}i915_gem_object_sync(), but that's a
separate issue that you can fix on top of this.
.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-01-07 12:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-07 10:20 [PATCH v3 0/3] improve handling of the driver's internal (default) context Dave Gordon
2016-01-07 10:20 ` [PATCH v3 1/3] drm/i915: simplify allocation of driver-internal requests Dave Gordon
2016-01-07 11:58 ` Chris Wilson
2016-01-07 12:34 ` Dave Gordon [this message]
2016-01-07 16:56 ` Chris Wilson
2016-01-11 12:45 ` Dave Gordon
2016-01-07 16:49 ` Jesse Barnes
2016-01-07 16:53 ` Chris Wilson
2016-01-12 13:02 ` Dave Gordon
2016-01-12 13:50 ` Daniel Vetter
2016-01-12 13:56 ` Chris Wilson
2016-01-12 14:27 ` Chris Wilson
2016-01-13 13:27 ` Dave Gordon
2016-01-13 13:41 ` Chris Wilson
2016-01-13 18:46 ` Dave Gordon
2016-01-13 20:23 ` Chris Wilson
2016-01-18 16:16 ` Nick Hoath
2016-01-07 10:20 ` [PATCH v3 2/3] drm/i915: abolish separate per-ring default_context pointers Dave Gordon
2016-01-12 13:51 ` Daniel Vetter
2016-01-18 16:16 ` Nick Hoath
2016-01-19 8:54 ` Daniel Vetter
2016-01-07 10:20 ` [PATCH v3 3/3] drm/i915: tidy up a few leftovers Dave Gordon
2016-01-12 13:53 ` Daniel Vetter
2016-01-13 12:41 ` Dave Gordon
2016-01-18 16:17 ` Nick Hoath
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=568E5B5F.8020109@intel.com \
--to=david.s.gordon@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.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 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.