aboutsummaryrefslogtreecommitdiff
path: root/src/wld/intel/batch.h
diff options
context:
space:
mode:
authorJeff <jeff@i2p.rocks>2019-06-16 15:56:40 -0400
committerGitHub <noreply@github.com>2019-06-16 15:56:40 -0400
commit8015dab11ec76d5b6f18e23b4686d1e2dc233a42 (patch)
tree6529655e38f149e52a5b651803020c699292d557 /src/wld/intel/batch.h
parentc5c548536c62f5b7281f43ab896c8daf927fcaee (diff)
parentba56eac2ab8869c9720d4ee252fb8618a1f535f3 (diff)
downloadwterm-8015dab11ec76d5b6f18e23b4686d1e2dc233a42.zip
wterm-8015dab11ec76d5b6f18e23b4686d1e2dc233a42.tar.gz
wterm-8015dab11ec76d5b6f18e23b4686d1e2dc233a42.tar.bz2
Merge pull request #13 from MichaelMackus/update-wld
Update wld
Diffstat (limited to 'src/wld/intel/batch.h')
-rw-r--r--src/wld/intel/batch.h88
1 files changed, 51 insertions, 37 deletions
diff --git a/src/wld/intel/batch.h b/src/wld/intel/batch.h
index 682b41c..cc9d1d9 100644
--- a/src/wld/intel/batch.h
+++ b/src/wld/intel/batch.h
@@ -24,69 +24,83 @@
#ifndef WLD_INTEL_BATCH_H
#define WLD_INTEL_BATCH_H
-#include <intel_bufmgr.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
+#include <intel_bufmgr.h>
#define INTEL_BATCH_MAX_COMMANDS (1 << 13)
#define INTEL_BATCH_RESERVED_COMMANDS 2
#define INTEL_BATCH_SIZE (INTEL_BATCH_MAX_COMMANDS << 2)
-enum intel_batch_result { INTEL_BATCH_SUCCESS, INTEL_BATCH_NO_SPACE };
+enum intel_batch_result
+{
+ INTEL_BATCH_SUCCESS,
+ INTEL_BATCH_NO_SPACE
+};
-struct intel_device_info {
- int gen;
+struct intel_device_info
+{
+ int gen;
};
-struct intel_batch {
- const struct intel_device_info *device_info;
- drm_intel_bo *bo;
- uint32_t commands[INTEL_BATCH_MAX_COMMANDS];
- uint32_t command_count;
+#define GEN(b, m) ((b)->device_info->gen >= (m))
+
+struct intel_batch
+{
+ const struct intel_device_info * device_info;
+ drm_intel_bo * bo;
+ uint32_t commands[INTEL_BATCH_MAX_COMMANDS];
+ uint32_t command_count;
};
-bool intel_batch_initialize(struct intel_batch *batch,
- drm_intel_bufmgr *bufmgr);
+bool intel_batch_initialize(struct intel_batch * batch,
+ drm_intel_bufmgr * bufmgr);
-void intel_batch_finalize(struct intel_batch *batch);
+void intel_batch_finalize(struct intel_batch * batch);
-void intel_batch_flush(struct intel_batch *batch);
+void intel_batch_flush(struct intel_batch * batch);
-static inline uint32_t intel_batch_check_space(struct intel_batch *batch,
- uint32_t size) {
- return (INTEL_BATCH_MAX_COMMANDS - INTEL_BATCH_RESERVED_COMMANDS -
- batch->command_count) >= size;
+static inline uint32_t intel_batch_check_space(struct intel_batch * batch,
+ uint32_t size)
+{
+ return (INTEL_BATCH_MAX_COMMANDS - INTEL_BATCH_RESERVED_COMMANDS
+ - batch->command_count) >= size;
}
-static inline void intel_batch_ensure_space(struct intel_batch *batch,
- uint32_t size) {
- if (!intel_batch_check_space(batch, size))
- intel_batch_flush(batch);
+static inline void intel_batch_ensure_space(struct intel_batch * batch, uint32_t size)
+{
+ if (!intel_batch_check_space(batch, size))
+ intel_batch_flush(batch);
}
-static inline void intel_batch_add_dword(struct intel_batch *batch,
- uint32_t dword) {
- batch->commands[batch->command_count++] = dword;
+static inline void intel_batch_add_dword(struct intel_batch * batch,
+ uint32_t dword)
+{
+ batch->commands[batch->command_count++] = dword;
}
-static inline void intel_batch_add_dwords_va(struct intel_batch *batch,
- uint32_t count, va_list dwords) {
- while (count--)
- intel_batch_add_dword(batch, va_arg(dwords, uint32_t));
+static inline void intel_batch_add_dwords_va(struct intel_batch * batch,
+ uint32_t count, va_list dwords)
+{
+ while (count--)
+ intel_batch_add_dword(batch, va_arg(dwords, uint32_t));
}
-static inline void intel_batch_add_dwords(struct intel_batch *batch,
- uint32_t count, ...) {
- va_list dwords;
- va_start(dwords, count);
- intel_batch_add_dwords_va(batch, count, dwords);
- va_end(dwords);
+static inline void intel_batch_add_dwords(struct intel_batch * batch,
+ uint32_t count, ...)
+{
+ va_list dwords;
+ va_start(dwords, count);
+ intel_batch_add_dwords_va(batch, count, dwords);
+ va_end(dwords);
}
-static inline uint32_t intel_batch_offset(struct intel_batch *batch,
- uint32_t command_index) {
- return (batch->command_count + command_index) << 2;
+static inline uint32_t intel_batch_offset(struct intel_batch * batch,
+ uint32_t command_index)
+{
+ return (batch->command_count + command_index) << 2;
}
#endif
+