gallium/rbug: replace simple_list.h with list.h
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15418>
This commit is contained in:
parent
820e6e01fd
commit
dac8dc9ece
|
@ -29,7 +29,6 @@
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
#include "util/u_memory.h"
|
#include "util/u_memory.h"
|
||||||
#include "util/u_inlines.h"
|
#include "util/u_inlines.h"
|
||||||
#include "util/simple_list.h"
|
|
||||||
|
|
||||||
#include "rbug/rbug_context.h"
|
#include "rbug/rbug_context.h"
|
||||||
|
|
||||||
|
@ -1287,7 +1286,7 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
|
||||||
cnd_init(&rb_pipe->draw_cond);
|
cnd_init(&rb_pipe->draw_cond);
|
||||||
(void) mtx_init(&rb_pipe->call_mutex, mtx_plain);
|
(void) mtx_init(&rb_pipe->call_mutex, mtx_plain);
|
||||||
(void) mtx_init(&rb_pipe->list_mutex, mtx_plain);
|
(void) mtx_init(&rb_pipe->list_mutex, mtx_plain);
|
||||||
make_empty_list(&rb_pipe->shaders);
|
list_inithead(&rb_pipe->shaders);
|
||||||
|
|
||||||
rb_pipe->base.screen = _screen;
|
rb_pipe->base.screen = _screen;
|
||||||
rb_pipe->base.priv = pipe->priv; /* expose wrapped data */
|
rb_pipe->base.priv = pipe->priv; /* expose wrapped data */
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct rbug_context {
|
||||||
|
|
||||||
struct pipe_context *pipe;
|
struct pipe_context *pipe;
|
||||||
|
|
||||||
struct rbug_list list;
|
struct list_head list;
|
||||||
|
|
||||||
/* call locking */
|
/* call locking */
|
||||||
mtx_t call_mutex;
|
mtx_t call_mutex;
|
||||||
|
@ -76,7 +76,7 @@ struct rbug_context {
|
||||||
/* list of state objects */
|
/* list of state objects */
|
||||||
mtx_t list_mutex;
|
mtx_t list_mutex;
|
||||||
unsigned num_shaders;
|
unsigned num_shaders;
|
||||||
struct rbug_list shaders;
|
struct list_head shaders;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct rbug_context *
|
static inline struct rbug_context *
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "util/u_string.h"
|
#include "util/u_string.h"
|
||||||
#include "util/u_inlines.h"
|
#include "util/u_inlines.h"
|
||||||
#include "util/u_memory.h"
|
#include "util/u_memory.h"
|
||||||
#include "util/simple_list.h"
|
|
||||||
#include "util/u_network.h"
|
#include "util/u_network.h"
|
||||||
#include "util/os_time.h"
|
#include "util/os_time.h"
|
||||||
|
|
||||||
|
@ -67,11 +66,9 @@ rbug_thread(void *void_rbug);
|
||||||
static struct rbug_context *
|
static struct rbug_context *
|
||||||
rbug_get_context_locked(struct rbug_screen *rb_screen, rbug_context_t ctx)
|
rbug_get_context_locked(struct rbug_screen *rb_screen, rbug_context_t ctx)
|
||||||
{
|
{
|
||||||
struct rbug_context *rb_context = NULL;
|
struct rbug_context *rb_context;
|
||||||
struct rbug_list *ptr;
|
|
||||||
|
|
||||||
foreach(ptr, &rb_screen->contexts) {
|
LIST_FOR_EACH_ENTRY(rb_context, &rb_screen->contexts, list) {
|
||||||
rb_context = container_of(ptr, struct rbug_context, list);
|
|
||||||
if (ctx == VOID2U64(rb_context))
|
if (ctx == VOID2U64(rb_context))
|
||||||
break;
|
break;
|
||||||
rb_context = NULL;
|
rb_context = NULL;
|
||||||
|
@ -83,11 +80,9 @@ rbug_get_context_locked(struct rbug_screen *rb_screen, rbug_context_t ctx)
|
||||||
static struct rbug_shader *
|
static struct rbug_shader *
|
||||||
rbug_get_shader_locked(struct rbug_context *rb_context, rbug_shader_t shdr)
|
rbug_get_shader_locked(struct rbug_context *rb_context, rbug_shader_t shdr)
|
||||||
{
|
{
|
||||||
struct rbug_shader *tr_shdr = NULL;
|
struct rbug_shader *tr_shdr;
|
||||||
struct rbug_list *ptr;
|
|
||||||
|
|
||||||
foreach(ptr, &rb_context->shaders) {
|
LIST_FOR_EACH_ENTRY(tr_shdr, &rb_context->shaders, list) {
|
||||||
tr_shdr = container_of(ptr, struct rbug_shader, list);
|
|
||||||
if (shdr == VOID2U64(tr_shdr))
|
if (shdr == VOID2U64(tr_shdr))
|
||||||
break;
|
break;
|
||||||
tr_shdr = NULL;
|
tr_shdr = NULL;
|
||||||
|
@ -175,15 +170,13 @@ static int
|
||||||
rbug_texture_list(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
|
rbug_texture_list(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
|
||||||
{
|
{
|
||||||
struct rbug_screen *rb_screen = tr_rbug->rb_screen;
|
struct rbug_screen *rb_screen = tr_rbug->rb_screen;
|
||||||
struct rbug_resource *tr_tex = NULL;
|
struct rbug_resource *tr_tex;
|
||||||
struct rbug_list *ptr;
|
|
||||||
rbug_texture_t *texs;
|
rbug_texture_t *texs;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
mtx_lock(&rb_screen->list_mutex);
|
mtx_lock(&rb_screen->list_mutex);
|
||||||
texs = MALLOC(rb_screen->num_resources * sizeof(rbug_texture_t));
|
texs = MALLOC(rb_screen->num_resources * sizeof(rbug_texture_t));
|
||||||
foreach(ptr, &rb_screen->resources) {
|
LIST_FOR_EACH_ENTRY(tr_tex, &rb_screen->resources, list) {
|
||||||
tr_tex = container_of(ptr, struct rbug_resource, list);
|
|
||||||
texs[i++] = VOID2U64(tr_tex);
|
texs[i++] = VOID2U64(tr_tex);
|
||||||
}
|
}
|
||||||
mtx_unlock(&rb_screen->list_mutex);
|
mtx_unlock(&rb_screen->list_mutex);
|
||||||
|
@ -198,15 +191,13 @@ static int
|
||||||
rbug_texture_info(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
|
rbug_texture_info(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
|
||||||
{
|
{
|
||||||
struct rbug_screen *rb_screen = tr_rbug->rb_screen;
|
struct rbug_screen *rb_screen = tr_rbug->rb_screen;
|
||||||
struct rbug_resource *tr_tex = NULL;
|
struct rbug_resource *tr_tex;
|
||||||
struct rbug_proto_texture_info *gpti = (struct rbug_proto_texture_info *)header;
|
struct rbug_proto_texture_info *gpti = (struct rbug_proto_texture_info *)header;
|
||||||
struct rbug_list *ptr;
|
|
||||||
struct pipe_resource *t;
|
struct pipe_resource *t;
|
||||||
uint16_t num_layers;
|
uint16_t num_layers;
|
||||||
|
|
||||||
mtx_lock(&rb_screen->list_mutex);
|
mtx_lock(&rb_screen->list_mutex);
|
||||||
foreach(ptr, &rb_screen->resources) {
|
LIST_FOR_EACH_ENTRY(tr_tex, &rb_screen->resources, list) {
|
||||||
tr_tex = container_of(ptr, struct rbug_resource, list);
|
|
||||||
if (gpti->texture == VOID2U64(tr_tex))
|
if (gpti->texture == VOID2U64(tr_tex))
|
||||||
break;
|
break;
|
||||||
tr_tex = NULL;
|
tr_tex = NULL;
|
||||||
|
@ -244,8 +235,7 @@ rbug_texture_read(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_
|
||||||
struct rbug_proto_texture_read *gptr = (struct rbug_proto_texture_read *)header;
|
struct rbug_proto_texture_read *gptr = (struct rbug_proto_texture_read *)header;
|
||||||
|
|
||||||
struct rbug_screen *rb_screen = tr_rbug->rb_screen;
|
struct rbug_screen *rb_screen = tr_rbug->rb_screen;
|
||||||
struct rbug_resource *tr_tex = NULL;
|
struct rbug_resource *tr_tex;
|
||||||
struct rbug_list *ptr;
|
|
||||||
|
|
||||||
struct pipe_context *context = rb_screen->private_context;
|
struct pipe_context *context = rb_screen->private_context;
|
||||||
struct pipe_resource *tex;
|
struct pipe_resource *tex;
|
||||||
|
@ -254,8 +244,7 @@ rbug_texture_read(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_
|
||||||
void *map;
|
void *map;
|
||||||
|
|
||||||
mtx_lock(&rb_screen->list_mutex);
|
mtx_lock(&rb_screen->list_mutex);
|
||||||
foreach(ptr, &rb_screen->resources) {
|
LIST_FOR_EACH_ENTRY(tr_tex, &rb_screen->resources, list) {
|
||||||
tr_tex = container_of(ptr, struct rbug_resource, list);
|
|
||||||
if (gptr->texture == VOID2U64(tr_tex))
|
if (gptr->texture == VOID2U64(tr_tex))
|
||||||
break;
|
break;
|
||||||
tr_tex = NULL;
|
tr_tex = NULL;
|
||||||
|
@ -294,15 +283,13 @@ static int
|
||||||
rbug_context_list(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
|
rbug_context_list(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial)
|
||||||
{
|
{
|
||||||
struct rbug_screen *rb_screen = tr_rbug->rb_screen;
|
struct rbug_screen *rb_screen = tr_rbug->rb_screen;
|
||||||
struct rbug_list *ptr;
|
struct rbug_context *rb_context, *next;
|
||||||
struct rbug_context *rb_context = NULL;
|
|
||||||
rbug_context_t *ctxs;
|
rbug_context_t *ctxs;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
mtx_lock(&rb_screen->list_mutex);
|
mtx_lock(&rb_screen->list_mutex);
|
||||||
ctxs = MALLOC(rb_screen->num_contexts * sizeof(rbug_context_t));
|
ctxs = MALLOC(rb_screen->num_contexts * sizeof(rbug_context_t));
|
||||||
foreach(ptr, &rb_screen->contexts) {
|
LIST_FOR_EACH_ENTRY_SAFE(rb_context, next, &rb_screen->contexts, list) {
|
||||||
rb_context = container_of(ptr, struct rbug_context, list);
|
|
||||||
ctxs[i++] = VOID2U64(rb_context);
|
ctxs[i++] = VOID2U64(rb_context);
|
||||||
}
|
}
|
||||||
mtx_unlock(&rb_screen->list_mutex);
|
mtx_unlock(&rb_screen->list_mutex);
|
||||||
|
@ -513,8 +500,7 @@ rbug_shader_list(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t
|
||||||
|
|
||||||
struct rbug_screen *rb_screen = tr_rbug->rb_screen;
|
struct rbug_screen *rb_screen = tr_rbug->rb_screen;
|
||||||
struct rbug_context *rb_context = NULL;
|
struct rbug_context *rb_context = NULL;
|
||||||
struct rbug_shader *tr_shdr = NULL;
|
struct rbug_shader *tr_shdr, *next;
|
||||||
struct rbug_list *ptr;
|
|
||||||
rbug_shader_t *shdrs;
|
rbug_shader_t *shdrs;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -528,8 +514,7 @@ rbug_shader_list(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t
|
||||||
|
|
||||||
mtx_lock(&rb_context->list_mutex);
|
mtx_lock(&rb_context->list_mutex);
|
||||||
shdrs = MALLOC(rb_context->num_shaders * sizeof(rbug_shader_t));
|
shdrs = MALLOC(rb_context->num_shaders * sizeof(rbug_shader_t));
|
||||||
foreach(ptr, &rb_context->shaders) {
|
LIST_FOR_EACH_ENTRY_SAFE(tr_shdr, next, &rb_context->shaders, list) {
|
||||||
tr_shdr = container_of(ptr, struct rbug_shader, list);
|
|
||||||
shdrs[i++] = VOID2U64(tr_shdr);
|
shdrs[i++] = VOID2U64(tr_shdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
|
|
||||||
#include "util/u_inlines.h"
|
#include "util/u_inlines.h"
|
||||||
#include "util/u_memory.h"
|
#include "util/u_memory.h"
|
||||||
#include "util/simple_list.h"
|
|
||||||
|
|
||||||
#include "tgsi/tgsi_parse.h"
|
#include "tgsi/tgsi_parse.h"
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct rbug_resource
|
||||||
|
|
||||||
struct pipe_resource *resource;
|
struct pipe_resource *resource;
|
||||||
|
|
||||||
struct rbug_list list;
|
struct list_head list;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ enum rbug_shader_type
|
||||||
|
|
||||||
struct rbug_shader
|
struct rbug_shader
|
||||||
{
|
{
|
||||||
struct rbug_list list;
|
struct list_head list;
|
||||||
|
|
||||||
void *shader;
|
void *shader;
|
||||||
void *tokens;
|
void *tokens;
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include "pipe/p_state.h"
|
#include "pipe/p_state.h"
|
||||||
#include "util/u_memory.h"
|
#include "util/u_memory.h"
|
||||||
#include "util/u_debug.h"
|
#include "util/u_debug.h"
|
||||||
#include "util/simple_list.h"
|
|
||||||
|
|
||||||
#include "rbug_public.h"
|
#include "rbug_public.h"
|
||||||
#include "rbug_screen.h"
|
#include "rbug_screen.h"
|
||||||
|
@ -452,10 +451,10 @@ rbug_screen_create(struct pipe_screen *screen)
|
||||||
return screen;
|
return screen;
|
||||||
|
|
||||||
(void) mtx_init(&rb_screen->list_mutex, mtx_plain);
|
(void) mtx_init(&rb_screen->list_mutex, mtx_plain);
|
||||||
make_empty_list(&rb_screen->contexts);
|
list_inithead(&rb_screen->contexts);
|
||||||
make_empty_list(&rb_screen->resources);
|
list_inithead(&rb_screen->resources);
|
||||||
make_empty_list(&rb_screen->surfaces);
|
list_inithead(&rb_screen->surfaces);
|
||||||
make_empty_list(&rb_screen->transfers);
|
list_inithead(&rb_screen->transfers);
|
||||||
|
|
||||||
#define SCR_INIT(_member) \
|
#define SCR_INIT(_member) \
|
||||||
rb_screen->base._member = screen->_member ? rbug_screen_##_member : NULL
|
rb_screen->base._member = screen->_member ? rbug_screen_##_member : NULL
|
||||||
|
|
|
@ -30,14 +30,10 @@
|
||||||
|
|
||||||
#include "pipe/p_screen.h"
|
#include "pipe/p_screen.h"
|
||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
|
#include "util/list.h"
|
||||||
|
|
||||||
#include "os/os_thread.h"
|
#include "os/os_thread.h"
|
||||||
|
|
||||||
struct rbug_list {
|
|
||||||
struct rbug_list *next;
|
|
||||||
struct rbug_list *prev;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct rbug_screen
|
struct rbug_screen
|
||||||
{
|
{
|
||||||
|
@ -54,10 +50,10 @@ struct rbug_screen
|
||||||
int num_resources;
|
int num_resources;
|
||||||
int num_surfaces;
|
int num_surfaces;
|
||||||
int num_transfers;
|
int num_transfers;
|
||||||
struct rbug_list contexts;
|
struct list_head contexts;
|
||||||
struct rbug_list resources;
|
struct list_head resources;
|
||||||
struct rbug_list surfaces;
|
struct list_head surfaces;
|
||||||
struct rbug_list transfers;
|
struct list_head transfers;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct rbug_screen *
|
static inline struct rbug_screen *
|
||||||
|
@ -69,7 +65,7 @@ rbug_screen(struct pipe_screen *screen)
|
||||||
#define rbug_screen_add_to_list(scr, name, obj) \
|
#define rbug_screen_add_to_list(scr, name, obj) \
|
||||||
do { \
|
do { \
|
||||||
mtx_lock(&scr->list_mutex); \
|
mtx_lock(&scr->list_mutex); \
|
||||||
insert_at_head(&scr->name, &obj->list); \
|
list_add(&scr->name, &obj->list); \
|
||||||
scr->num_##name++; \
|
scr->num_##name++; \
|
||||||
mtx_unlock(&scr->list_mutex); \
|
mtx_unlock(&scr->list_mutex); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -77,7 +73,7 @@ rbug_screen(struct pipe_screen *screen)
|
||||||
#define rbug_screen_remove_from_list(scr, name, obj) \
|
#define rbug_screen_remove_from_list(scr, name, obj) \
|
||||||
do { \
|
do { \
|
||||||
mtx_lock(&scr->list_mutex); \
|
mtx_lock(&scr->list_mutex); \
|
||||||
remove_from_list(&obj->list); \
|
list_del(&obj->list); \
|
||||||
scr->num_##name--; \
|
scr->num_##name--; \
|
||||||
mtx_unlock(&scr->list_mutex); \
|
mtx_unlock(&scr->list_mutex); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
Loading…
Reference in New Issue