sna/gen2: Cap number of vertices emitted in a single 3DPRIM

There's a maximum of 2^18 dwords in a single command, or else we
overflow the lenth field.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99620
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2017-02-05 20:58:37 +00:00
parent 8572955b01
commit 38ac6b556d
1 changed files with 7 additions and 0 deletions

View File

@ -49,6 +49,7 @@
#define MAX_3D_SIZE 2048
#define MAX_3D_PITCH 8192
#define MAX_INLINE (1 << 18)
#define BATCH(v) batch_emit(sna, v)
#define BATCH_F(v) batch_emit_float(sna, v)
@ -1165,6 +1166,9 @@ inline static int gen2_get_rectangles(struct sna *sna,
{
int rem = batch_space(sna), size, need;
if (rem > MAX_INLINE)
rem = MAX_INLINE;
DBG(("%s: want=%d, floats_per_vertex=%d, rem=%d\n",
__FUNCTION__, want, op->floats_per_vertex, rem));
@ -3230,6 +3234,9 @@ gen2_get_inline_rectangles(struct sna *sna, int want, int floats_per_vertex)
int size = floats_per_vertex * 3;
int rem = batch_space(sna) - 1;
if (rem > MAX_INLINE)
rem = MAX_INLINE;
if (size * want > rem)
want = rem / size;