]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
drm/i915: Fixup the free space logic in ring_prepare
authorAkash Goel <akash.goel@intel.com>
Fri, 11 Mar 2016 09:26:42 +0000 (14:56 +0530)
committerJani Nikula <jani.nikula@intel.com>
Mon, 18 Apr 2016 09:35:49 +0000 (12:35 +0300)
commitd43f3ebf12f59c57782ec652da65ef61c2662b40
treef20f6023035e3d25d10305d38fb3a305cf9ef363
parent9aec6a08f1163fb24c23f9036891e1d5bab3f1be
drm/i915: Fixup the free space logic in ring_prepare

Currently for the case where there is enough space at the end of Ring
buffer for accommodating only the base request, the wrapround is done
immediately and as a result the base request gets added at the start
of Ring buffer. But there may not be enough free space at the beginning
to accommodate the base request, as before the wraparound, the wait was
effectively done for the reserved_size free space from the start of
Ring buffer. In such a case there is a potential of Ring buffer overflow,
the instructions at the head of Ring (ACTHD) can get overwritten.

Since the base request can fit in the remaining space, there is no need
to wraparound immediately. The wraparound will anyway happen later when
the reserved part starts getting used.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Akash Goel <akash.goel@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1457688402-10411-1-git-send-email-akash.goel@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
(cherry picked from commit 782f6bc0aba037436d6a04d19b23f8b61020a576)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/intel_lrc.c
drivers/gpu/drm/i915/intel_ringbuffer.c