diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-04-10 06:52:50 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-04-12 15:14:10 -0400 |
commit | f84131905b9b3b02b1c5061c0720e503c8d22778 (patch) | |
tree | 405f14482ee9b64ac8f0a95e90ae4a87b06b7e3a /drivers/gpu/drm | |
parent | 211c568bc6a1ebd51e35724f6d733e76717ce368 (diff) |
drm/i915: Allow concurrent read access between CPU and GPU domain
Similar to allowing a buffer to be simultaneously read by the GPU and
through the GTT, we wish to allow readback of the pages through the CPU
domain whilst they are also being read by the GPU. Domain coherency
is managed by allowing multiple readers, but only a single writer.
This is used by mesa for its program cache which it may search for every
new program every frame and then renews should it need to add. During
renewal, mesa copies the program bo currently executing through a CPU
mapping onto the new bo. This patch allows the search and that copy to
proceed without causing a stall on the current batch.
Testcase: i-g-t/tests/gem_cpu_concurrent_blit
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index d75a6577b97a..1bfb0d28e438 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -3068,9 +3068,11 @@ i915_gem_object_set_to_cpu_domain(struct drm_i915_gem_object *obj, bool write) | |||
3068 | if (ret) | 3068 | if (ret) |
3069 | return ret; | 3069 | return ret; |
3070 | 3070 | ||
3071 | ret = i915_gem_object_wait_rendering(obj); | 3071 | if (write || obj->pending_gpu_write) { |
3072 | if (ret) | 3072 | ret = i915_gem_object_wait_rendering(obj); |
3073 | return ret; | 3073 | if (ret) |
3074 | return ret; | ||
3075 | } | ||
3074 | 3076 | ||
3075 | i915_gem_object_flush_gtt_write_domain(obj); | 3077 | i915_gem_object_flush_gtt_write_domain(obj); |
3076 | 3078 | ||