drm/i915: Use hash tables for the command parser
For clients that submit large batch buffers the command parser has a substantial impact on performance. On my HSW ULT system performance drops as much as ~20% on some tests. Most of the time is spent in the command lookup code. Converting that from the current naive search to a hash table lookup reduces the performance drop to ~10%. The choice of value for I915_CMD_HASH_ORDER allows all commands currently used in the parser tables to hash to their own bucket (except for one collision on the render ring). The tradeoff is that it wastes memory. Because the opcodes for the commands in the tables are not particularly well distributed, reducing the order still leaves many buckets empty. The increased collisions don't seem to have a huge impact on the performance gain, but for now anyhow, the parser trades memory for performance. NB: Ville noticed that the error paths through the ring init code will leak memory. I've not addressed that here. We can do a follow up pass to handle all of the leaks. v2: improved comment describing selection of hash key mask (Damien) replace a BUG_ON() with an error return (Tvrtko, Ville) commit message improvements Signed-off-by: Brad Volkin <bradley.d.volkin@intel.com> Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:

committed by
Daniel Vetter

parent
d3eedb1a04
commit
44e895a8a2
@@ -1455,7 +1455,9 @@ static int intel_init_ring_buffer(struct drm_device *dev,
|
||||
if (IS_I830(dev) || IS_845G(dev))
|
||||
ring->effective_size -= 2 * CACHELINE_BYTES;
|
||||
|
||||
i915_cmd_parser_init_ring(ring);
|
||||
ret = i915_cmd_parser_init_ring(ring);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return ring->init(ring);
|
||||
}
|
||||
@@ -1482,6 +1484,8 @@ void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring)
|
||||
ring->cleanup(ring);
|
||||
|
||||
cleanup_status_page(ring);
|
||||
|
||||
i915_cmd_parser_fini_ring(ring);
|
||||
}
|
||||
|
||||
static int intel_ring_wait_request(struct intel_ring_buffer *ring, int n)
|
||||
|
Reference in New Issue
Block a user