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 "util/u_memory.h"
|
||||
#include "util/u_inlines.h"
|
||||
#include "util/simple_list.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);
|
||||
(void) mtx_init(&rb_pipe->call_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.priv = pipe->priv; /* expose wrapped data */
|
||||
|
|
|
@ -39,7 +39,7 @@ struct rbug_context {
|
|||
|
||||
struct pipe_context *pipe;
|
||||
|
||||
struct rbug_list list;
|
||||
struct list_head list;
|
||||
|
||||
/* call locking */
|
||||
mtx_t call_mutex;
|
||||
|
@ -76,7 +76,7 @@ struct rbug_context {
|
|||
/* list of state objects */
|
||||
mtx_t list_mutex;
|
||||
unsigned num_shaders;
|
||||
struct rbug_list shaders;
|
||||
struct list_head shaders;
|
||||
};
|
||||
|
||||
static inline struct rbug_context *
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "util/u_string.h"
|
||||
#include "util/u_inlines.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/simple_list.h"
|
||||
#include "util/u_network.h"
|
||||
#include "util/os_time.h"
|
||||
|
||||
|
@ -67,11 +66,9 @@ rbug_thread(void *void_rbug);
|
|||
static struct rbug_context *
|
||||
rbug_get_context_locked(struct rbug_screen *rb_screen, rbug_context_t ctx)
|
||||
{
|
||||
struct rbug_context *rb_context = NULL;
|
||||
struct rbug_list *ptr;
|
||||
struct rbug_context *rb_context;
|
||||
|
||||
foreach(ptr, &rb_screen->contexts) {
|
||||
rb_context = container_of(ptr, struct rbug_context, list);
|
||||
LIST_FOR_EACH_ENTRY(rb_context, &rb_screen->contexts, list) {
|
||||
if (ctx == VOID2U64(rb_context))
|
||||
break;
|
||||
rb_context = NULL;
|
||||
|
@ -83,11 +80,9 @@ rbug_get_context_locked(struct rbug_screen *rb_screen, rbug_context_t ctx)
|
|||
static struct rbug_shader *
|
||||
rbug_get_shader_locked(struct rbug_context *rb_context, rbug_shader_t shdr)
|
||||
{
|
||||
struct rbug_shader *tr_shdr = NULL;
|
||||
struct rbug_list *ptr;
|
||||
struct rbug_shader *tr_shdr;
|
||||
|
||||
foreach(ptr, &rb_context->shaders) {
|
||||
tr_shdr = container_of(ptr, struct rbug_shader, list);
|
||||
LIST_FOR_EACH_ENTRY(tr_shdr, &rb_context->shaders, list) {
|
||||
if (shdr == VOID2U64(tr_shdr))
|
||||
break;
|
||||
tr_shdr = NULL;
|
||||
|
@ -175,15 +170,13 @@ static int
|
|||
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_resource *tr_tex = NULL;
|
||||
struct rbug_list *ptr;
|
||||
struct rbug_resource *tr_tex;
|
||||
rbug_texture_t *texs;
|
||||
int i = 0;
|
||||
|
||||
mtx_lock(&rb_screen->list_mutex);
|
||||
texs = MALLOC(rb_screen->num_resources * sizeof(rbug_texture_t));
|
||||
foreach(ptr, &rb_screen->resources) {
|
||||
tr_tex = container_of(ptr, struct rbug_resource, list);
|
||||
LIST_FOR_EACH_ENTRY(tr_tex, &rb_screen->resources, list) {
|
||||
texs[i++] = VOID2U64(tr_tex);
|
||||
}
|
||||
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)
|
||||
{
|
||||
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_list *ptr;
|
||||
struct pipe_resource *t;
|
||||
uint16_t num_layers;
|
||||
|
||||
mtx_lock(&rb_screen->list_mutex);
|
||||
foreach(ptr, &rb_screen->resources) {
|
||||
tr_tex = container_of(ptr, struct rbug_resource, list);
|
||||
LIST_FOR_EACH_ENTRY(tr_tex, &rb_screen->resources, list) {
|
||||
if (gpti->texture == VOID2U64(tr_tex))
|
||||
break;
|
||||
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_screen *rb_screen = tr_rbug->rb_screen;
|
||||
struct rbug_resource *tr_tex = NULL;
|
||||
struct rbug_list *ptr;
|
||||
struct rbug_resource *tr_tex;
|
||||
|
||||
struct pipe_context *context = rb_screen->private_context;
|
||||
struct pipe_resource *tex;
|
||||
|
@ -254,8 +244,7 @@ rbug_texture_read(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_
|
|||
void *map;
|
||||
|
||||
mtx_lock(&rb_screen->list_mutex);
|
||||
foreach(ptr, &rb_screen->resources) {
|
||||
tr_tex = container_of(ptr, struct rbug_resource, list);
|
||||
LIST_FOR_EACH_ENTRY(tr_tex, &rb_screen->resources, list) {
|
||||
if (gptr->texture == VOID2U64(tr_tex))
|
||||
break;
|
||||
tr_tex = NULL;
|
||||
|
@ -294,15 +283,13 @@ static int
|
|||
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_list *ptr;
|
||||
struct rbug_context *rb_context = NULL;
|
||||
struct rbug_context *rb_context, *next;
|
||||
rbug_context_t *ctxs;
|
||||
int i = 0;
|
||||
|
||||
mtx_lock(&rb_screen->list_mutex);
|
||||
ctxs = MALLOC(rb_screen->num_contexts * sizeof(rbug_context_t));
|
||||
foreach(ptr, &rb_screen->contexts) {
|
||||
rb_context = container_of(ptr, struct rbug_context, list);
|
||||
LIST_FOR_EACH_ENTRY_SAFE(rb_context, next, &rb_screen->contexts, list) {
|
||||
ctxs[i++] = VOID2U64(rb_context);
|
||||
}
|
||||
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_context *rb_context = NULL;
|
||||
struct rbug_shader *tr_shdr = NULL;
|
||||
struct rbug_list *ptr;
|
||||
struct rbug_shader *tr_shdr, *next;
|
||||
rbug_shader_t *shdrs;
|
||||
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);
|
||||
shdrs = MALLOC(rb_context->num_shaders * sizeof(rbug_shader_t));
|
||||
foreach(ptr, &rb_context->shaders) {
|
||||
tr_shdr = container_of(ptr, struct rbug_shader, list);
|
||||
LIST_FOR_EACH_ENTRY_SAFE(tr_shdr, next, &rb_context->shaders, list) {
|
||||
shdrs[i++] = VOID2U64(tr_shdr);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include "util/u_inlines.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/simple_list.h"
|
||||
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ struct rbug_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_list list;
|
||||
struct list_head list;
|
||||
|
||||
void *shader;
|
||||
void *tokens;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "pipe/p_state.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/simple_list.h"
|
||||
|
||||
#include "rbug_public.h"
|
||||
#include "rbug_screen.h"
|
||||
|
@ -452,10 +451,10 @@ rbug_screen_create(struct pipe_screen *screen)
|
|||
return screen;
|
||||
|
||||
(void) mtx_init(&rb_screen->list_mutex, mtx_plain);
|
||||
make_empty_list(&rb_screen->contexts);
|
||||
make_empty_list(&rb_screen->resources);
|
||||
make_empty_list(&rb_screen->surfaces);
|
||||
make_empty_list(&rb_screen->transfers);
|
||||
list_inithead(&rb_screen->contexts);
|
||||
list_inithead(&rb_screen->resources);
|
||||
list_inithead(&rb_screen->surfaces);
|
||||
list_inithead(&rb_screen->transfers);
|
||||
|
||||
#define SCR_INIT(_member) \
|
||||
rb_screen->base._member = screen->_member ? rbug_screen_##_member : NULL
|
||||
|
|
|
@ -30,14 +30,10 @@
|
|||
|
||||
#include "pipe/p_screen.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "util/list.h"
|
||||
|
||||
#include "os/os_thread.h"
|
||||
|
||||
struct rbug_list {
|
||||
struct rbug_list *next;
|
||||
struct rbug_list *prev;
|
||||
};
|
||||
|
||||
|
||||
struct rbug_screen
|
||||
{
|
||||
|
@ -54,10 +50,10 @@ struct rbug_screen
|
|||
int num_resources;
|
||||
int num_surfaces;
|
||||
int num_transfers;
|
||||
struct rbug_list contexts;
|
||||
struct rbug_list resources;
|
||||
struct rbug_list surfaces;
|
||||
struct rbug_list transfers;
|
||||
struct list_head contexts;
|
||||
struct list_head resources;
|
||||
struct list_head surfaces;
|
||||
struct list_head transfers;
|
||||
};
|
||||
|
||||
static inline struct rbug_screen *
|
||||
|
@ -69,7 +65,7 @@ rbug_screen(struct pipe_screen *screen)
|
|||
#define rbug_screen_add_to_list(scr, name, obj) \
|
||||
do { \
|
||||
mtx_lock(&scr->list_mutex); \
|
||||
insert_at_head(&scr->name, &obj->list); \
|
||||
list_add(&scr->name, &obj->list); \
|
||||
scr->num_##name++; \
|
||||
mtx_unlock(&scr->list_mutex); \
|
||||
} while (0)
|
||||
|
@ -77,7 +73,7 @@ rbug_screen(struct pipe_screen *screen)
|
|||
#define rbug_screen_remove_from_list(scr, name, obj) \
|
||||
do { \
|
||||
mtx_lock(&scr->list_mutex); \
|
||||
remove_from_list(&obj->list); \
|
||||
list_del(&obj->list); \
|
||||
scr->num_##name--; \
|
||||
mtx_unlock(&scr->list_mutex); \
|
||||
} while (0)
|
||||
|
|
Loading…
Reference in New Issue