summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-02-23 17:21:36 +0000
committerJosé Fonseca <[email protected]>2009-02-23 17:21:36 +0000
commit37f21fce3bd323c361291215edeb7d8cf5f4335b (patch)
tree2909c90da7bff47ba359d50bde242b79a632210b /src/gallium/auxiliary
parent7399d56ec6019e00297eef57f802a53698baa8ad (diff)
parent60e35ebf1476c31eb5d7c207ab8e9db77fcad896 (diff)
Merge commit 'origin/gallium-0.1'
Conflicts: src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c src/gallium/auxiliary/util/u_tile.c
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c98
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h7
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c4
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c10
-rw-r--r--src/gallium/auxiliary/util/u_tile.c26
5 files changed, 127 insertions, 18 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index 0cddc95aa67..272e2205e34 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -66,8 +66,12 @@ struct fenced_buffer_list
struct pb_fence_ops *ops;
size_t numDelayed;
-
struct list_head delayed;
+
+#ifdef DEBUG
+ size_t numUnfenced;
+ struct list_head unfenced;
+#endif
};
@@ -115,8 +119,11 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf)
assert(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
assert(fenced_buf->fence);
- assert(!fenced_buf->head.prev);
- assert(!fenced_buf->head.next);
+#ifdef DEBUG
+ LIST_DEL(&fenced_buf->head);
+ assert(fenced_list->numUnfenced);
+ --fenced_list->numUnfenced;
+#endif
LIST_ADDTAIL(&fenced_buf->head, &fenced_list->delayed);
++fenced_list->numDelayed;
}
@@ -128,8 +135,19 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf)
static INLINE void
_fenced_buffer_destroy(struct fenced_buffer *fenced_buf)
{
+ struct fenced_buffer_list *fenced_list = fenced_buf->list;
+
assert(!fenced_buf->base.base.refcount);
assert(!fenced_buf->fence);
+#ifdef DEBUG
+ assert(fenced_buf->head.prev);
+ assert(fenced_buf->head.next);
+ LIST_DEL(&fenced_buf->head);
+ assert(fenced_list->numUnfenced);
+ --fenced_list->numUnfenced;
+#else
+ (void)fenced_list;
+#endif
pb_reference(&fenced_buf->buffer, NULL);
FREE(fenced_buf);
}
@@ -149,15 +167,16 @@ _fenced_buffer_remove(struct fenced_buffer_list *fenced_list,
assert(fenced_buf->head.prev);
assert(fenced_buf->head.next);
- LIST_DEL(&fenced_buf->head);
-#ifdef DEBUG
- fenced_buf->head.prev = NULL;
- fenced_buf->head.next = NULL;
-#endif
+ LIST_DEL(&fenced_buf->head);
assert(fenced_list->numDelayed);
--fenced_list->numDelayed;
+#ifdef DEBUG
+ LIST_ADDTAIL(&fenced_buf->head, &fenced_list->unfenced);
+ ++fenced_list->numUnfenced;
+#endif
+
if(!fenced_buf->base.base.refcount)
_fenced_buffer_destroy(fenced_buf);
}
@@ -441,6 +460,13 @@ fenced_buffer_create(struct fenced_buffer_list *fenced_list,
buf->buffer = buffer;
buf->list = fenced_list;
+#ifdef DEBUG
+ pipe_mutex_lock(fenced_list->mutex);
+ LIST_ADDTAIL(&buf->head, &fenced_list->unfenced);
+ ++fenced_list->numUnfenced;
+ pipe_mutex_unlock(fenced_list->mutex);
+#endif
+
return &buf->base;
}
@@ -457,9 +483,13 @@ fenced_buffer_list_create(struct pb_fence_ops *ops)
fenced_list->ops = ops;
LIST_INITHEAD(&fenced_list->delayed);
-
fenced_list->numDelayed = 0;
+#ifdef DEBUG
+ LIST_INITHEAD(&fenced_list->unfenced);
+ fenced_list->numUnfenced = 0;
+#endif
+
pipe_mutex_init(fenced_list->mutex);
return fenced_list;
@@ -476,6 +506,52 @@ fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
}
+#ifdef DEBUG
+void
+fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list)
+{
+ struct pb_fence_ops *ops = fenced_list->ops;
+ struct list_head *curr, *next;
+ struct fenced_buffer *fenced_buf;
+ struct pipe_fence_handle *prev_fence = NULL;
+
+ pipe_mutex_lock(fenced_list->mutex);
+
+ debug_printf("%10s %7s %10s %s\n",
+ "buffer", "refcount", "fence", "signalled");
+
+ curr = fenced_list->unfenced.next;
+ next = curr->next;
+ while(curr != &fenced_list->unfenced) {
+ fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
+ assert(!fenced_buf->fence);
+ debug_printf("%10p %7u\n",
+ fenced_buf,
+ fenced_buf->base.base.refcount);
+ curr = next;
+ next = curr->next;
+ }
+
+ curr = fenced_list->delayed.next;
+ next = curr->next;
+ while(curr != &fenced_list->delayed) {
+ int signaled;
+ fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
+ signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
+ debug_printf("%10p %7u %10p %s\n",
+ fenced_buf,
+ fenced_buf->base.base.refcount,
+ fenced_buf->fence,
+ signaled == 0 ? "y" : "n");
+ curr = next;
+ next = curr->next;
+ }
+
+ pipe_mutex_unlock(fenced_list->mutex);
+}
+#endif
+
+
void
fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
{
@@ -491,6 +567,10 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
pipe_mutex_lock(fenced_list->mutex);
}
+#ifdef DEBUG
+ //assert(!fenced_list->numUnfenced);
+#endif
+
pipe_mutex_unlock(fenced_list->mutex);
fenced_list->ops->destroy(fenced_list->ops);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
index c2b29e974b1..034ca1e024a 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
@@ -114,6 +114,13 @@ void
fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
int wait);
+
+#ifdef DEBUG
+void
+fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list);
+#endif
+
+
void
fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
index e352f5357b5..144db5669b6 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
@@ -79,6 +79,10 @@ fenced_bufmgr_create_buffer(struct pb_manager *mgr,
buf = fenced_mgr->provider->create_buffer(fenced_mgr->provider, size, desc);
if(!buf) {
+#if 0
+ fenced_buffer_list_dump(fenced_mgr->fenced_list);
+#endif
+
/* give up */
return NULL;
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index f3b1ca73b0c..85ff3a09de4 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
@@ -204,13 +204,9 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
#if 0
mmDumpMemInfo(mm->heap);
#endif
-
- mm_buf->block = u_mmAllocMem(mm->heap, size, mm->align2, 0);
- if(!mm_buf->block) {
- FREE(mm_buf);
- pipe_mutex_unlock(mm->mutex);
- return NULL;
- }
+ FREE(mm_buf);
+ pipe_mutex_unlock(mm->mutex);
+ return NULL;
}
/* Some sanity checks */
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 56f2f577ccf..d31ca9c029e 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -882,6 +882,27 @@ ycbcr_get_tile_rgba(const ushort *src,
}
+static void
+fake_get_tile_rgba(const ushort *src,
+ unsigned w, unsigned h,
+ float *p,
+ unsigned dst_stride)
+{
+ unsigned i, j;
+
+ for (i = 0; i < h; i++) {
+ float *pRow = p;
+ for (j = 0; j < w; j++, pRow += 4) {
+ pRow[0] =
+ pRow[1] =
+ pRow[2] =
+ pRow[3] = (i ^ j) & 1 ? 1.0f : 0.0f;
+ }
+ p += dst_stride;
+ }
+}
+
+
void
pipe_tile_raw_to_rgba(enum pipe_format format,
void *src,
@@ -948,7 +969,8 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
ycbcr_get_tile_rgba((ushort *) src, w, h, dst, dst_stride, TRUE);
break;
default:
- assert(0);
+ debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(format));
+ fake_get_tile_rgba(src, w, h, dst, dst_stride);
}
}
@@ -1050,7 +1072,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
/*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
default:
- assert(0);
+ debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(pt->format));
}
pipe_put_tile_raw(pt, x, y, w, h, packed, 0);