mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 21:33:00 +00:00
drm/i915: Ensure OLS & PLR are always in sync
The aim is to replace seqno values with request structures. A step along the way is to switch to using the PLR in preference to the OLS. That requires the PLR to only be valid when and only when the OLS is also valid. I.e., the two must be kept in lock step. Then, code which was using the OLS can be safely switched over to using the PLR instead. For: VIZ-4377 Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Reviewed-by: Thomas Daniel <Thomas.Daniel@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
f61ccae333
commit
9eba5d4a1d
@ -879,13 +879,19 @@ void intel_lr_context_unpin(struct intel_engine_cs *ring,
|
|||||||
static int logical_ring_alloc_seqno(struct intel_engine_cs *ring,
|
static int logical_ring_alloc_seqno(struct intel_engine_cs *ring,
|
||||||
struct intel_context *ctx)
|
struct intel_context *ctx)
|
||||||
{
|
{
|
||||||
|
struct drm_i915_gem_request *request;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (ring->outstanding_lazy_seqno)
|
/* XXX: The aim is to replace seqno values with request structures.
|
||||||
return 0;
|
* A step along the way is to switch to using the PLR in preference
|
||||||
|
* to the OLS. That requires the PLR to only be valid when the OLS is
|
||||||
|
* also valid. I.e., the two must be kept in step. */
|
||||||
|
|
||||||
if (ring->preallocated_lazy_request == NULL) {
|
if (ring->outstanding_lazy_seqno) {
|
||||||
struct drm_i915_gem_request *request;
|
WARN_ON(ring->preallocated_lazy_request == NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
WARN_ON(ring->preallocated_lazy_request != NULL);
|
||||||
|
|
||||||
request = kmalloc(sizeof(*request), GFP_KERNEL);
|
request = kmalloc(sizeof(*request), GFP_KERNEL);
|
||||||
if (request == NULL)
|
if (request == NULL)
|
||||||
@ -899,6 +905,13 @@ static int logical_ring_alloc_seqno(struct intel_engine_cs *ring,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = i915_gem_get_seqno(ring->dev, &ring->outstanding_lazy_seqno);
|
||||||
|
if (ret) {
|
||||||
|
intel_lr_context_unpin(ring, ctx);
|
||||||
|
kfree(request);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Hold a reference to the context this request belongs to
|
/* Hold a reference to the context this request belongs to
|
||||||
* (we will need it when the time comes to emit/retire the
|
* (we will need it when the time comes to emit/retire the
|
||||||
* request).
|
* request).
|
||||||
@ -907,9 +920,7 @@ static int logical_ring_alloc_seqno(struct intel_engine_cs *ring,
|
|||||||
i915_gem_context_reference(request->ctx);
|
i915_gem_context_reference(request->ctx);
|
||||||
|
|
||||||
ring->preallocated_lazy_request = request;
|
ring->preallocated_lazy_request = request;
|
||||||
}
|
return 0;
|
||||||
|
|
||||||
return i915_gem_get_seqno(ring->dev, &ring->outstanding_lazy_seqno);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf,
|
static int logical_ring_wait_request(struct intel_ringbuffer *ringbuf,
|
||||||
|
@ -2024,20 +2024,33 @@ int intel_ring_idle(struct intel_engine_cs *ring)
|
|||||||
static int
|
static int
|
||||||
intel_ring_alloc_seqno(struct intel_engine_cs *ring)
|
intel_ring_alloc_seqno(struct intel_engine_cs *ring)
|
||||||
{
|
{
|
||||||
if (ring->outstanding_lazy_seqno)
|
int ret;
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (ring->preallocated_lazy_request == NULL) {
|
|
||||||
struct drm_i915_gem_request *request;
|
struct drm_i915_gem_request *request;
|
||||||
|
|
||||||
|
/* XXX: The aim is to replace seqno values with request structures.
|
||||||
|
* A step along the way is to switch to using the PLR in preference
|
||||||
|
* to the OLS. That requires the PLR to only be valid when the OLS
|
||||||
|
* is also valid. I.e., the two must be kept in step. */
|
||||||
|
|
||||||
|
if (ring->outstanding_lazy_seqno) {
|
||||||
|
WARN_ON(ring->preallocated_lazy_request == NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
WARN_ON(ring->preallocated_lazy_request != NULL);
|
||||||
|
|
||||||
request = kmalloc(sizeof(*request), GFP_KERNEL);
|
request = kmalloc(sizeof(*request), GFP_KERNEL);
|
||||||
if (request == NULL)
|
if (request == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ring->preallocated_lazy_request = request;
|
ret = i915_gem_get_seqno(ring->dev, &ring->outstanding_lazy_seqno);
|
||||||
|
if (ret) {
|
||||||
|
kfree(request);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i915_gem_get_seqno(ring->dev, &ring->outstanding_lazy_seqno);
|
ring->preallocated_lazy_request = request;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __intel_ring_prepare(struct intel_engine_cs *ring,
|
static int __intel_ring_prepare(struct intel_engine_cs *ring,
|
||||||
|
Loading…
Reference in New Issue
Block a user