mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
ilo: use slab allocator for transfers
Slab allocator is perfect for transfer. Improved OpenArena performance by 1% with several casual runs.
This commit is contained in:
parent
09f62a13fc
commit
7142da6dd1
4 changed files with 39 additions and 28 deletions
|
|
@ -96,6 +96,8 @@ ilo_context_destroy(struct pipe_context *pipe)
|
|||
if (ilo->last_cp_bo)
|
||||
ilo->last_cp_bo->unreference(ilo->last_cp_bo);
|
||||
|
||||
util_slab_destroy(&ilo->transfer_mempool);
|
||||
|
||||
if (ilo->blitter)
|
||||
util_blitter_destroy(ilo->blitter);
|
||||
if (ilo->hw3d)
|
||||
|
|
@ -134,6 +136,9 @@ ilo_context_create(struct pipe_screen *screen, void *priv)
|
|||
ilo_cp_set_flush_callback(ilo->cp,
|
||||
ilo_context_cp_flushed, (void *) ilo);
|
||||
|
||||
util_slab_create(&ilo->transfer_mempool,
|
||||
sizeof(struct ilo_transfer), 64, UTIL_SLAB_SINGLETHREADED);
|
||||
|
||||
ilo->dirty = ILO_DIRTY_ALL;
|
||||
|
||||
ilo->base.screen = screen;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#define ILO_CONTEXT_H
|
||||
|
||||
#include "pipe/p_context.h"
|
||||
#include "util/u_slab.h"
|
||||
|
||||
#include "ilo_gpe.h"
|
||||
#include "ilo_common.h"
|
||||
|
|
@ -50,6 +51,8 @@ struct ilo_context {
|
|||
struct ilo_cp *cp;
|
||||
struct intel_bo *last_cp_bo;
|
||||
|
||||
struct util_slab_mempool transfer_mempool;
|
||||
|
||||
struct ilo_shader_cache *shader_cache;
|
||||
struct ilo_3d *hw3d;
|
||||
struct blitter_context *blitter;
|
||||
|
|
|
|||
|
|
@ -34,32 +34,6 @@
|
|||
#include "ilo_resource.h"
|
||||
#include "ilo_transfer.h"
|
||||
|
||||
enum ilo_transfer_map_method {
|
||||
/* map() / map_gtt() / map_unsynchronized() */
|
||||
ILO_TRANSFER_MAP_CPU,
|
||||
ILO_TRANSFER_MAP_GTT,
|
||||
ILO_TRANSFER_MAP_UNSYNC,
|
||||
|
||||
/* use staging system buffer */
|
||||
ILO_TRANSFER_MAP_SW_CONVERT,
|
||||
ILO_TRANSFER_MAP_SW_ZS,
|
||||
};
|
||||
|
||||
struct ilo_transfer {
|
||||
struct pipe_transfer base;
|
||||
|
||||
enum ilo_transfer_map_method method;
|
||||
void *ptr;
|
||||
|
||||
void *staging_sys;
|
||||
};
|
||||
|
||||
static inline struct ilo_transfer *
|
||||
ilo_transfer(struct pipe_transfer *transfer)
|
||||
{
|
||||
return (struct ilo_transfer *) transfer;
|
||||
}
|
||||
|
||||
static bool
|
||||
is_bo_busy(struct ilo_context *ilo, struct intel_bo *bo, bool *need_flush)
|
||||
{
|
||||
|
|
@ -993,7 +967,8 @@ ilo_transfer_unmap(struct pipe_context *pipe,
|
|||
tex_unmap(ilo, xfer);
|
||||
|
||||
pipe_resource_reference(&xfer->base.resource, NULL);
|
||||
FREE(xfer);
|
||||
|
||||
util_slab_free(&ilo->transfer_mempool, xfer);
|
||||
}
|
||||
|
||||
static void *
|
||||
|
|
@ -1008,7 +983,7 @@ ilo_transfer_map(struct pipe_context *pipe,
|
|||
struct ilo_transfer *xfer;
|
||||
bool success;
|
||||
|
||||
xfer = MALLOC_STRUCT(ilo_transfer);
|
||||
xfer = util_slab_alloc(&ilo->transfer_mempool);
|
||||
if (!xfer) {
|
||||
*transfer = NULL;
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,38 @@
|
|||
#ifndef ILO_TRANSFER_H
|
||||
#define ILO_TRANSFER_H
|
||||
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
#include "ilo_common.h"
|
||||
|
||||
enum ilo_transfer_map_method {
|
||||
/* map() / map_gtt() / map_unsynchronized() */
|
||||
ILO_TRANSFER_MAP_CPU,
|
||||
ILO_TRANSFER_MAP_GTT,
|
||||
ILO_TRANSFER_MAP_UNSYNC,
|
||||
|
||||
/* use staging system buffer */
|
||||
ILO_TRANSFER_MAP_SW_CONVERT,
|
||||
ILO_TRANSFER_MAP_SW_ZS,
|
||||
};
|
||||
|
||||
struct ilo_transfer {
|
||||
struct pipe_transfer base;
|
||||
|
||||
enum ilo_transfer_map_method method;
|
||||
void *ptr;
|
||||
|
||||
void *staging_sys;
|
||||
};
|
||||
|
||||
struct ilo_context;
|
||||
|
||||
static inline struct ilo_transfer *
|
||||
ilo_transfer(struct pipe_transfer *transfer)
|
||||
{
|
||||
return (struct ilo_transfer *) transfer;
|
||||
}
|
||||
|
||||
void
|
||||
ilo_init_transfer_functions(struct ilo_context *ilo);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue