aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.sources3
-rw-r--r--freedreno/Makefile.sources3
-rw-r--r--freedreno/freedreno_priv.h2
-rw-r--r--tests/radeon/Makefile.am1
-rw-r--r--tests/radeon/list.h137
-rw-r--r--tests/radeon/rbo.h2
-rw-r--r--util_double_list.h (renamed from freedreno/list.h)0
7 files changed, 5 insertions, 143 deletions
diff --git a/Makefile.sources b/Makefile.sources
index 8b563292..38626be6 100644
--- a/Makefile.sources
+++ b/Makefile.sources
@@ -8,7 +8,8 @@ LIBDRM_FILES := \
8 xf86drmMode.c \ 8 xf86drmMode.c \
9 xf86atomic.h \ 9 xf86atomic.h \
10 libdrm_macros.h \ 10 libdrm_macros.h \
11 libdrm_lists.h 11 libdrm_lists.h \
12 util_double_list.h
12 13
13LIBDRM_H_FILES := \ 14LIBDRM_H_FILES := \
14 xf86drm.h \ 15 xf86drm.h \
diff --git a/freedreno/Makefile.sources b/freedreno/Makefile.sources
index c8c0244f..57a8bf1b 100644
--- a/freedreno/Makefile.sources
+++ b/freedreno/Makefile.sources
@@ -9,8 +9,7 @@ LIBDRM_FREEDRENO_FILES := \
9 msm/msm_drm.h \ 9 msm/msm_drm.h \
10 msm/msm_pipe.c \ 10 msm/msm_pipe.c \
11 msm/msm_priv.h \ 11 msm/msm_priv.h \
12 msm/msm_ringbuffer.c \ 12 msm/msm_ringbuffer.c
13 list.h
14 13
15LIBDRM_FREEDRENO_KGSL_FILES := \ 14LIBDRM_FREEDRENO_KGSL_FILES := \
16 kgsl/kgsl_bo.c \ 15 kgsl/kgsl_bo.c \
diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h
index 3c194fb3..cb24780d 100644
--- a/freedreno/freedreno_priv.h
+++ b/freedreno/freedreno_priv.h
@@ -48,7 +48,7 @@
48#include "xf86drm.h" 48#include "xf86drm.h"
49#include "xf86atomic.h" 49#include "xf86atomic.h"
50 50
51#include "list.h" 51#include "util_double_list.h"
52 52
53#include "freedreno_drmif.h" 53#include "freedreno_drmif.h"
54#include "freedreno_ringbuffer.h" 54#include "freedreno_ringbuffer.h"
diff --git a/tests/radeon/Makefile.am b/tests/radeon/Makefile.am
index d18620da..9da76259 100644
--- a/tests/radeon/Makefile.am
+++ b/tests/radeon/Makefile.am
@@ -11,5 +11,4 @@ noinst_PROGRAMS = \
11radeon_ttm_SOURCES = \ 11radeon_ttm_SOURCES = \
12 rbo.c \ 12 rbo.c \
13 rbo.h \ 13 rbo.h \
14 list.h \
15 radeon_ttm.c 14 radeon_ttm.c
diff --git a/tests/radeon/list.h b/tests/radeon/list.h
deleted file mode 100644
index 27e0761b..00000000
--- a/tests/radeon/list.h
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 *
3 * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND. USA.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 *
26 */
27
28/**
29 * \file
30 * List macros heavily inspired by the Linux kernel
31 * list handling. No list looping yet.
32 *
33 * Is not threadsafe, so common operations need to
34 * be protected using an external mutex.
35 */
36#ifndef _U_DOUBLE_LIST_H_
37#define _U_DOUBLE_LIST_H_
38
39#include <stddef.h>
40
41struct list_head
42{
43 struct list_head *prev;
44 struct list_head *next;
45};
46
47static inline void list_inithead(struct list_head *item)
48{
49 item->prev = item;
50 item->next = item;
51}
52
53static inline void list_add(struct list_head *item, struct list_head *list)
54{
55 item->prev = list;
56 item->next = list->next;
57 list->next->prev = item;
58 list->next = item;
59}
60
61static inline void list_addtail(struct list_head *item, struct list_head *list)
62{
63 item->next = list;
64 item->prev = list->prev;
65 list->prev->next = item;
66 list->prev = item;
67}
68
69static inline void list_replace(struct list_head *from, struct list_head *to)
70{
71 to->prev = from->prev;
72 to->next = from->next;
73 from->next->prev = to;
74 from->prev->next = to;
75}
76
77static inline void list_del(struct list_head *item)
78{
79 item->prev->next = item->next;
80 item->next->prev = item->prev;
81}
82
83static inline void list_delinit(struct list_head *item)
84{
85 item->prev->next = item->next;
86 item->next->prev = item->prev;
87 item->next = item;
88 item->prev = item;
89}
90
91#define LIST_INITHEAD(__item) list_inithead(__item)
92#define LIST_ADD(__item, __list) list_add(__item, __list)
93#define LIST_ADDTAIL(__item, __list) list_addtail(__item, __list)
94#define LIST_REPLACE(__from, __to) list_replace(__from, __to)
95#define LIST_DEL(__item) list_del(__item)
96#define LIST_DELINIT(__item) list_delinit(__item)
97
98#define LIST_ENTRY(__type, __item, __field) \
99 ((__type *)(((char *)(__item)) - offsetof(__type, __field)))
100
101#define LIST_IS_EMPTY(__list) \
102 ((__list)->next == (__list))
103
104#ifndef container_of
105#define container_of(ptr, sample, member) \
106 (void *)((char *)(ptr) \
107 - ((char *)&(sample)->member - (char *)(sample)))
108#endif
109
110#define LIST_FOR_EACH_ENTRY(pos, head, member) \
111 for (pos = container_of((head)->next, pos, member); \
112 &pos->member != (head); \
113 pos = container_of(pos->member.next, pos, member))
114
115#define LIST_FOR_EACH_ENTRY_SAFE(pos, storage, head, member) \
116 for (pos = container_of((head)->next, pos, member), \
117 storage = container_of(pos->member.next, pos, member); \
118 &pos->member != (head); \
119 pos = storage, storage = container_of(storage->member.next, storage, member))
120
121#define LIST_FOR_EACH_ENTRY_SAFE_REV(pos, storage, head, member) \
122 for (pos = container_of((head)->prev, pos, member), \
123 storage = container_of(pos->member.prev, pos, member); \
124 &pos->member != (head); \
125 pos = storage, storage = container_of(storage->member.prev, storage, member))
126
127#define LIST_FOR_EACH_ENTRY_FROM(pos, start, head, member) \
128 for (pos = container_of((start), pos, member); \
129 &pos->member != (head); \
130 pos = container_of(pos->member.next, pos, member))
131
132#define LIST_FOR_EACH_ENTRY_FROM_REV(pos, start, head, member) \
133 for (pos = container_of((start), pos, member); \
134 &pos->member != (head); \
135 pos = container_of(pos->member.prev, pos, member))
136
137#endif /*_U_DOUBLE_LIST_H_*/
diff --git a/tests/radeon/rbo.h b/tests/radeon/rbo.h
index c25c73a4..9164091d 100644
--- a/tests/radeon/rbo.h
+++ b/tests/radeon/rbo.h
@@ -26,7 +26,7 @@
26#ifndef RBO_H 26#ifndef RBO_H
27#define RBO_H 27#define RBO_H
28 28
29#include "list.h" 29#include "util_double_list.h"
30 30
31struct rbo { 31struct rbo {
32 struct list_head list; 32 struct list_head list;
diff --git a/freedreno/list.h b/util_double_list.h
index 27e0761b..27e0761b 100644
--- a/freedreno/list.h
+++ b/util_double_list.h