diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2017-02-16 07:23:25 -0500 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2017-02-17 06:39:59 -0500 |
commit | 9f235dfa495856ed7b264ee08920601df57333da (patch) | |
tree | a1df25ddb5b674ac8e111891b176d7713738b556 /drivers/gpu/drm/i915/intel_ringbuffer.c | |
parent | 097d4f1c121f324d655d17b9bc5238107f7a1761 (diff) |
drm/i915: Consolidate gen8_emit_pipe_control
We have a few open coded instances in the execlists code and an
almost suitable helper in intel_ringbuf.c
We can consolidate to a single helper if we change the existing
helper to emit directly to ring buffer memory and move the space
reservation outside it.
v2: Drop memcpy for memset. (Chris Wilson)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170216122325.31391-2-tvrtko.ursulin@linux.intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 629fe6584e61..d56f384938f7 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -334,35 +334,16 @@ gen7_render_ring_flush(struct drm_i915_gem_request *req, u32 mode) | |||
334 | } | 334 | } |
335 | 335 | ||
336 | static int | 336 | static int |
337 | gen8_emit_pipe_control(struct drm_i915_gem_request *req, | 337 | gen8_render_ring_flush(struct drm_i915_gem_request *req, u32 mode) |
338 | u32 flags, u32 scratch_addr) | ||
339 | { | 338 | { |
339 | u32 flags; | ||
340 | u32 *cs; | 340 | u32 *cs; |
341 | 341 | ||
342 | cs = intel_ring_begin(req, 6); | 342 | cs = intel_ring_begin(req, mode & EMIT_INVALIDATE ? 12 : 6); |
343 | if (IS_ERR(cs)) | 343 | if (IS_ERR(cs)) |
344 | return PTR_ERR(cs); | 344 | return PTR_ERR(cs); |
345 | 345 | ||
346 | *cs++ = GFX_OP_PIPE_CONTROL(6); | 346 | flags = PIPE_CONTROL_CS_STALL; |
347 | *cs++ = flags; | ||
348 | *cs++ = scratch_addr; | ||
349 | *cs++ = 0; | ||
350 | *cs++ = 0; | ||
351 | *cs++ = 0; | ||
352 | intel_ring_advance(req, cs); | ||
353 | |||
354 | return 0; | ||
355 | } | ||
356 | |||
357 | static int | ||
358 | gen8_render_ring_flush(struct drm_i915_gem_request *req, u32 mode) | ||
359 | { | ||
360 | u32 scratch_addr = | ||
361 | i915_ggtt_offset(req->engine->scratch) + 2 * CACHELINE_BYTES; | ||
362 | u32 flags = 0; | ||
363 | int ret; | ||
364 | |||
365 | flags |= PIPE_CONTROL_CS_STALL; | ||
366 | 347 | ||
367 | if (mode & EMIT_FLUSH) { | 348 | if (mode & EMIT_FLUSH) { |
368 | flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH; | 349 | flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH; |
@@ -381,15 +362,19 @@ gen8_render_ring_flush(struct drm_i915_gem_request *req, u32 mode) | |||
381 | flags |= PIPE_CONTROL_GLOBAL_GTT_IVB; | 362 | flags |= PIPE_CONTROL_GLOBAL_GTT_IVB; |
382 | 363 | ||
383 | /* WaCsStallBeforeStateCacheInvalidate:bdw,chv */ | 364 | /* WaCsStallBeforeStateCacheInvalidate:bdw,chv */ |
384 | ret = gen8_emit_pipe_control(req, | 365 | cs = gen8_emit_pipe_control(cs, |
385 | PIPE_CONTROL_CS_STALL | | 366 | PIPE_CONTROL_CS_STALL | |
386 | PIPE_CONTROL_STALL_AT_SCOREBOARD, | 367 | PIPE_CONTROL_STALL_AT_SCOREBOARD, |
387 | 0); | 368 | 0); |
388 | if (ret) | ||
389 | return ret; | ||
390 | } | 369 | } |
391 | 370 | ||
392 | return gen8_emit_pipe_control(req, flags, scratch_addr); | 371 | cs = gen8_emit_pipe_control(cs, flags, |
372 | i915_ggtt_offset(req->engine->scratch) + | ||
373 | 2 * CACHELINE_BYTES); | ||
374 | |||
375 | intel_ring_advance(req, cs); | ||
376 | |||
377 | return 0; | ||
393 | } | 378 | } |
394 | 379 | ||
395 | static void ring_setup_phys_status_page(struct intel_engine_cs *engine) | 380 | static void ring_setup_phys_status_page(struct intel_engine_cs *engine) |