mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 20:20:09 +01:00
i915g: kill relocs accouting
No one ever cared. libdrm does dynamic resizing of its reloc-table, anyway. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
ee7acf6493
commit
8f9e546fde
10 changed files with 20 additions and 36 deletions
|
|
@ -31,8 +31,8 @@
|
|||
#include "i915_batchbuffer.h"
|
||||
|
||||
|
||||
#define BEGIN_BATCH(dwords, relocs) \
|
||||
(i915_winsys_batchbuffer_check(i915->batch, dwords, relocs))
|
||||
#define BEGIN_BATCH(dwords) \
|
||||
(i915_winsys_batchbuffer_check(i915->batch, dwords))
|
||||
|
||||
#define OUT_BATCH(dword) \
|
||||
i915_winsys_batchbuffer_dword(i915->batch, dword)
|
||||
|
|
|
|||
|
|
@ -41,11 +41,9 @@ i915_winsys_batchbuffer_space(struct i915_winsys_batchbuffer *batch)
|
|||
|
||||
static INLINE boolean
|
||||
i915_winsys_batchbuffer_check(struct i915_winsys_batchbuffer *batch,
|
||||
size_t dwords,
|
||||
size_t relocs)
|
||||
size_t dwords)
|
||||
{
|
||||
return dwords * 4 <= i915_winsys_batchbuffer_space(batch) &&
|
||||
relocs <= (batch->max_relocs - batch->relocs);
|
||||
return dwords * 4 <= i915_winsys_batchbuffer_space(batch);
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ i915_fill_blit(struct i915_context *i915,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!BEGIN_BATCH(6, 1)) {
|
||||
if (!BEGIN_BATCH(6)) {
|
||||
FLUSH_BATCH(NULL);
|
||||
assert(BEGIN_BATCH(6, 1));
|
||||
assert(BEGIN_BATCH(6));
|
||||
}
|
||||
OUT_BATCH(CMD);
|
||||
OUT_BATCH(BR13);
|
||||
|
|
@ -143,9 +143,9 @@ i915_copy_blit(struct i915_context *i915,
|
|||
*/
|
||||
assert (dst_pitch > 0 && src_pitch > 0);
|
||||
|
||||
if (!BEGIN_BATCH(8, 2)) {
|
||||
if (!BEGIN_BATCH(8)) {
|
||||
FLUSH_BATCH(NULL);
|
||||
assert(BEGIN_BATCH(8, 2));
|
||||
assert(BEGIN_BATCH(8));
|
||||
}
|
||||
OUT_BATCH(CMD);
|
||||
OUT_BATCH(BR13);
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ static void i915_flush_pipe( struct pipe_context *pipe,
|
|||
if (flags & PIPE_FLUSH_TEXTURE_CACHE)
|
||||
flush |= FLUSH_MAP_CACHE;
|
||||
|
||||
if (!BEGIN_BATCH(1, 0)) {
|
||||
if (!BEGIN_BATCH(1)) {
|
||||
FLUSH_BATCH(NULL);
|
||||
assert(BEGIN_BATCH(1, 0));
|
||||
assert(BEGIN_BATCH(1));
|
||||
}
|
||||
OUT_BATCH( flush );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ emit_prim( struct draw_stage *stage,
|
|||
vertex_size = i915->current.vertex_info.size * 4; /* in bytes */
|
||||
assert(vertex_size >= 12); /* never smaller than 12 bytes */
|
||||
|
||||
if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) {
|
||||
if (!BEGIN_BATCH( 1 + nr * vertex_size / 4)) {
|
||||
FLUSH_BATCH(NULL);
|
||||
|
||||
/* Make sure state is re-emitted after a flush:
|
||||
|
|
@ -152,7 +152,7 @@ emit_prim( struct draw_stage *stage,
|
|||
i915_update_derived( i915 );
|
||||
i915_emit_hardware_state( i915 );
|
||||
|
||||
if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) {
|
||||
if (!BEGIN_BATCH( 1 + nr * vertex_size / 4)) {
|
||||
assert(0);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -465,7 +465,7 @@ draw_arrays_fallback(struct vbuf_render *render,
|
|||
if (i915->hardware_dirty)
|
||||
i915_emit_hardware_state(i915);
|
||||
|
||||
if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) {
|
||||
if (!BEGIN_BATCH(1 + (nr_indices + 1)/2)) {
|
||||
FLUSH_BATCH(NULL);
|
||||
|
||||
/* Make sure state is re-emitted after a flush:
|
||||
|
|
@ -474,7 +474,7 @@ draw_arrays_fallback(struct vbuf_render *render,
|
|||
i915_emit_hardware_state(i915);
|
||||
i915->vbo_flushed = 1;
|
||||
|
||||
if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) {
|
||||
if (!BEGIN_BATCH(1 + (nr_indices + 1)/2)) {
|
||||
assert(0);
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -514,7 +514,7 @@ i915_vbuf_render_draw_arrays(struct vbuf_render *render,
|
|||
if (i915->hardware_dirty)
|
||||
i915_emit_hardware_state(i915);
|
||||
|
||||
if (!BEGIN_BATCH(2, 0)) {
|
||||
if (!BEGIN_BATCH(2)) {
|
||||
FLUSH_BATCH(NULL);
|
||||
|
||||
/* Make sure state is re-emitted after a flush:
|
||||
|
|
@ -523,7 +523,7 @@ i915_vbuf_render_draw_arrays(struct vbuf_render *render,
|
|||
i915_emit_hardware_state(i915);
|
||||
i915->vbo_flushed = 1;
|
||||
|
||||
if (!BEGIN_BATCH(2, 0)) {
|
||||
if (!BEGIN_BATCH(2)) {
|
||||
assert(0);
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -635,7 +635,7 @@ i915_vbuf_render_draw_elements(struct vbuf_render *render,
|
|||
if (i915->hardware_dirty)
|
||||
i915_emit_hardware_state(i915);
|
||||
|
||||
if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) {
|
||||
if (!BEGIN_BATCH(1 + (nr_indices + 1)/2)) {
|
||||
FLUSH_BATCH(NULL);
|
||||
|
||||
/* Make sure state is re-emitted after a flush:
|
||||
|
|
@ -644,7 +644,7 @@ i915_vbuf_render_draw_elements(struct vbuf_render *render,
|
|||
i915_emit_hardware_state(i915);
|
||||
i915->vbo_flushed = 1;
|
||||
|
||||
if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) {
|
||||
if (!BEGIN_BATCH(1 + (nr_indices + 1)/2)) {
|
||||
assert(0);
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,13 +403,7 @@ void
|
|||
i915_emit_hardware_state(struct i915_context *i915 )
|
||||
{
|
||||
unsigned batch_space;
|
||||
/* XXX: there must be an easier way */
|
||||
const unsigned relocs = ( I915_TEX_UNITS +
|
||||
3
|
||||
) * 3/2; /* plus 50% margin */
|
||||
|
||||
uintptr_t save_ptr;
|
||||
size_t save_relocs;
|
||||
|
||||
if (I915_DBG_ON(DBG_ATOMS))
|
||||
i915_dump_hardware_dirty(i915, __FUNCTION__);
|
||||
|
|
@ -419,14 +413,13 @@ i915_emit_hardware_state(struct i915_context *i915 )
|
|||
assert(i915_validate_state(i915, &batch_space));
|
||||
}
|
||||
|
||||
if(!BEGIN_BATCH(batch_space, relocs)) {
|
||||
if(!BEGIN_BATCH(batch_space)) {
|
||||
FLUSH_BATCH(NULL);
|
||||
assert(i915_validate_state(i915, &batch_space));
|
||||
assert(BEGIN_BATCH(batch_space, relocs));
|
||||
assert(BEGIN_BATCH(batch_space));
|
||||
}
|
||||
|
||||
save_ptr = (uintptr_t)i915->batch->ptr;
|
||||
save_relocs = i915->batch->relocs;
|
||||
|
||||
#define EMIT_ATOM(atom, hw_dirty) \
|
||||
if (i915->hardware_dirty & hw_dirty) \
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ struct i915_winsys_batchbuffer {
|
|||
size_t size;
|
||||
|
||||
size_t relocs;
|
||||
size_t max_relocs;
|
||||
/*@}*/
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ i915_drm_batchbuffer_create(struct i915_winsys *iws)
|
|||
batch->base.size = 0;
|
||||
|
||||
batch->base.relocs = 0;
|
||||
batch->base.max_relocs = 300;/*INTEL_DEFAULT_RELOCS;*/
|
||||
|
||||
batch->base.iws = iws;
|
||||
|
||||
|
|
@ -104,8 +103,6 @@ i915_drm_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch,
|
|||
unsigned offset;
|
||||
int ret = 0;
|
||||
|
||||
assert(batch->base.relocs < batch->base.max_relocs);
|
||||
|
||||
switch (usage) {
|
||||
case I915_USAGE_SAMPLER:
|
||||
write_domain = 0;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ i915_sw_batchbuffer_create(struct i915_winsys *iws)
|
|||
batch->base.size = 0;
|
||||
|
||||
batch->base.relocs = 0;
|
||||
batch->base.max_relocs = 300;/*INTEL_DEFAULT_RELOCS;*/
|
||||
|
||||
batch->base.iws = iws;
|
||||
|
||||
|
|
@ -75,8 +74,6 @@ i915_sw_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch,
|
|||
struct i915_sw_batchbuffer *batch = i915_sw_batchbuffer(ibatch);
|
||||
int ret = 0;
|
||||
|
||||
assert(batch->base.relocs < batch->base.max_relocs);
|
||||
|
||||
if (usage == I915_USAGE_SAMPLER) {
|
||||
|
||||
} else if (usage == I915_USAGE_RENDER) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue