#ifndef FREEDRENO_PRIV_H_
#define FREEDRENO_PRIV_H_
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
+#include "libdrm.h"
#include "xf86drm.h"
#include "xf86atomic.h"
#include "freedreno_drmif.h"
#include "freedreno_ringbuffer.h"
-#include "drm/drm.h"
+#include "drm.h"
struct fd_device_funcs {
int (*bo_new_handle)(struct fd_device *dev, uint32_t size,
void (*destroy)(struct fd_device *dev);
};
+struct fd_bo_bucket {
+ uint32_t size;
+ struct list_head list;
+};
+
struct fd_device {
int fd;
atomic_t refcnt;
void *handle_table, *name_table;
struct fd_device_funcs *funcs;
+
+ struct fd_bo_bucket cache_bucket[14 * 4];
+ int num_buckets;
+ time_t time;
+
+ int closefd; /* call close(fd) upon destruction */
};
+void fd_cleanup_bo_cache(struct fd_device *dev, time_t time);
+
+/* for where @table_lock is already held: */
+void fd_device_del_locked(struct fd_device *dev);
+
struct fd_pipe_funcs {
struct fd_ringbuffer * (*ringbuffer_new)(struct fd_pipe *pipe, uint32_t size);
int (*get_param)(struct fd_pipe *pipe, enum fd_param_id param, uint64_t *value);
struct fd_ringbuffer_funcs {
void * (*hostptr)(struct fd_ringbuffer *ring);
int (*flush)(struct fd_ringbuffer *ring, uint32_t *last_start);
+ void (*reset)(struct fd_ringbuffer *ring);
void (*emit_reloc)(struct fd_ringbuffer *ring,
const struct fd_reloc *reloc);
void (*emit_reloc_ring)(struct fd_ringbuffer *ring,
uint32_t size;
uint32_t handle;
uint32_t name;
+ int fd; /* dmabuf handle */
void *map;
atomic_t refcnt;
struct fd_bo_funcs *funcs;
-};
-struct fd_bo *fd_bo_from_handle(struct fd_device *dev,
- uint32_t handle, uint32_t size);
+ int bo_reuse;
+ struct list_head list; /* bucket-list entry */
+ time_t free_time; /* time when added to bucket-list */
+};
#define ALIGN(v,a) (((v) + (a) - 1) & ~((a) - 1))
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))