*
* Copyright 2018-2019 Alyssa Rosenzweig
* Copyright 2018-2019 Collabora, Ltd.
+ * Copyright © 2015 Intel Corporation
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
#include "renderonly/renderonly.h"
#include "util/u_dynarray.h"
#include "util/bitset.h"
-#include "util/set.h"
+#include "util/list.h"
+#include "util/sparse_array.h"
-#include <panfrost-misc.h>
-#include "pan_allocate.h"
+#include <panfrost-job.h>
/* Driver limits */
#define PAN_MAX_CONST_BUFFERS 16
/* Fencepost problem, hence the off-by-one */
#define NR_BO_CACHE_BUCKETS (MAX_BO_CACHE_BUCKET - MIN_BO_CACHE_BUCKET + 1)
+/* Cache for blit shaders. Defined here so they can be cached with the device */
+
+enum pan_blit_type {
+ PAN_BLIT_FLOAT = 0,
+ PAN_BLIT_UINT,
+ PAN_BLIT_INT,
+ PAN_BLIT_NUM_TYPES,
+};
+
+#define PAN_BLIT_NUM_TARGETS (12)
+
+struct pan_blit_shaders {
+ struct panfrost_bo *bo;
+ mali_ptr loads[PAN_BLIT_NUM_TARGETS][PAN_BLIT_NUM_TYPES][2];
+};
+
struct panfrost_device {
/* For ralloc */
void *memctx;
unsigned thread_tls_alloc;
unsigned quirks;
+ /* Bitmask of supported compressed texture formats */
+ uint32_t compressed_formats;
+
+ /* debug flags, see pan_util.h how to interpret */
+ unsigned debug;
+
drmVersionPtr kernel_version;
struct renderonly *ro;
- pthread_mutex_t active_bos_lock;
- struct set *active_bos;
+ pthread_mutex_t bo_map_lock;
+ struct util_sparse_array bo_map;
struct {
pthread_mutex_t lock;
struct list_head buckets[NR_BO_CACHE_BUCKETS];
} bo_cache;
+
+ struct pan_blit_shaders blit_shaders;
};
+void
+panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev);
+
+void
+panfrost_close_device(struct panfrost_device *dev);
+
+bool
+panfrost_supports_compressed_format(struct panfrost_device *dev, unsigned fmt);
+
+static inline struct panfrost_bo *
+pan_lookup_bo(struct panfrost_device *dev, uint32_t gem_handle)
+{
+ return util_sparse_array_get(&dev->bo_map, gem_handle);
+}
+
#endif