#define __NOUVEAU_CONTEXT_H__
#include "pipe/p_context.h"
-#include <libdrm/nouveau.h>
+#include <nouveau.h>
#define NOUVEAU_MAX_SCRATCH_BUFS 4
struct nouveau_pushbuf *pushbuf;
boolean vbo_dirty;
- boolean cb_dirty;
void (*copy_data)(struct nouveau_context *,
struct nouveau_bo *dst, unsigned, unsigned,
unsigned base, unsigned size,
unsigned offset, unsigned words, const uint32_t *);
+ /* @return: @ref reduced by nr of references found in context */
+ int (*invalidate_resource_storage)(struct nouveau_context *,
+ struct pipe_resource *,
+ int ref);
+
struct {
uint8_t *map;
unsigned id;
unsigned end;
struct nouveau_bo *bo[NOUVEAU_MAX_SCRATCH_BUFS];
struct nouveau_bo *current;
- struct nouveau_bo **runout;
- unsigned nr_runout;
+ struct runout {
+ unsigned nr;
+ struct nouveau_bo *bo[0];
+ } *runout;
unsigned bo_size;
} scratch;
+
+ struct {
+ uint32_t buf_cache_count;
+ uint32_t buf_cache_frame;
+ } stats;
};
static INLINE struct nouveau_context *
nouveau_scratch_done(struct nouveau_context *nv)
{
nv->scratch.wrap = nv->scratch.id;
- if (unlikely(nv->scratch.nr_runout))
+ if (unlikely(nv->scratch.runout))
nouveau_scratch_runout_release(nv);
}
FREE(ctx);
}
+
+static INLINE void
+nouveau_context_update_frame_stats(struct nouveau_context *nv)
+{
+ nv->stats.buf_cache_frame <<= 1;
+ if (nv->stats.buf_cache_count) {
+ nv->stats.buf_cache_count = 0;
+ nv->stats.buf_cache_frame |= 1;
+ if ((nv->stats.buf_cache_frame & 0xf) == 0xf)
+ nv->screen->hint_buf_keep_sysmem_copy = TRUE;
+ }
+}
+
#endif