aboutsummaryrefslogtreecommitdiff
path: root/src/wld/intel/batch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wld/intel/batch.c')
-rw-r--r--src/wld/intel/batch.c126
1 files changed, 77 insertions, 49 deletions
diff --git a/src/wld/intel/batch.c b/src/wld/intel/batch.c
index ce15ef1..2618a4a 100644
--- a/src/wld/intel/batch.c
+++ b/src/wld/intel/batch.c
@@ -27,69 +27,97 @@
#include <i915_drm.h>
#include <stdlib.h>
-static const struct intel_device_info device_info_i965 = {.gen = 4};
-static const struct intel_device_info device_info_g4x = {.gen = 4};
-static const struct intel_device_info device_info_ilk = {.gen = 5};
-static const struct intel_device_info device_info_snb_gt1 = {.gen = 6};
-static const struct intel_device_info device_info_snb_gt2 = {.gen = 6};
-static const struct intel_device_info device_info_ivb_gt1 = {.gen = 7};
-static const struct intel_device_info device_info_ivb_gt2 = {.gen = 7};
-static const struct intel_device_info device_info_byt = {.gen = 7};
-static const struct intel_device_info device_info_hsw_gt1 = {.gen = 7};
-static const struct intel_device_info device_info_hsw_gt2 = {.gen = 7};
-static const struct intel_device_info device_info_hsw_gt3 = {.gen = 7};
-
-static const struct intel_device_info *device_info(int device_id) {
- switch (device_id) {
-#define CHIPSET(device_id, type, name) \
- case device_id: \
- return &device_info_##type;
+static const struct intel_device_info device_info_i965 = { .gen = 4 };
+static const struct intel_device_info device_info_g4x = { .gen = 4 };
+static const struct intel_device_info device_info_ilk = { .gen = 5 };
+static const struct intel_device_info device_info_snb_gt1 = { .gen = 6 };
+static const struct intel_device_info device_info_snb_gt2 = { .gen = 6 };
+static const struct intel_device_info device_info_ivb_gt1 = { .gen = 7 };
+static const struct intel_device_info device_info_ivb_gt2 = { .gen = 7 };
+static const struct intel_device_info device_info_byt = { .gen = 7 };
+static const struct intel_device_info device_info_hsw_gt1 = { .gen = 7 };
+static const struct intel_device_info device_info_hsw_gt2 = { .gen = 7 };
+static const struct intel_device_info device_info_hsw_gt3 = { .gen = 7 };
+static const struct intel_device_info device_info_bdw_gt1 = { .gen = 8 };
+static const struct intel_device_info device_info_bdw_gt2 = { .gen = 8 };
+static const struct intel_device_info device_info_bdw_gt3 = { .gen = 8 };
+static const struct intel_device_info device_info_chv = { .gen = 8 };
+static const struct intel_device_info device_info_skl_gt1 = { .gen = 9 };
+static const struct intel_device_info device_info_skl_gt2 = { .gen = 9 };
+static const struct intel_device_info device_info_skl_gt3 = { .gen = 9 };
+static const struct intel_device_info device_info_skl_gt4 = { .gen = 9 };
+static const struct intel_device_info device_info_bxt = { .gen = 9 };
+static const struct intel_device_info device_info_bxt_2x6 = { .gen = 9 };
+static const struct intel_device_info device_info_kbl_gt1 = { .gen = 9 };
+static const struct intel_device_info device_info_kbl_gt1_5 = { .gen = 9 };
+static const struct intel_device_info device_info_kbl_gt2 = { .gen = 9 };
+static const struct intel_device_info device_info_kbl_gt3 = { .gen = 9 };
+static const struct intel_device_info device_info_kbl_gt4 = { .gen = 9 };
+static const struct intel_device_info device_info_glk = { .gen = 9 };
+static const struct intel_device_info device_info_glk_2x6 = { .gen = 9 };
+static const struct intel_device_info device_info_cfl_gt1 = { .gen = 9 };
+static const struct intel_device_info device_info_cfl_gt2 = { .gen = 9 };
+static const struct intel_device_info device_info_cfl_gt3 = { .gen = 9 };
+static const struct intel_device_info device_info_cnl_2x8 = { .gen = 10 };
+static const struct intel_device_info device_info_cnl_3x8 = { .gen = 10 };
+static const struct intel_device_info device_info_cnl_4x8 = { .gen = 10 };
+static const struct intel_device_info device_info_cnl_5x8 = { .gen = 10 };
+
+static const struct intel_device_info * device_info(int device_id)
+{
+ switch (device_id)
+ {
+#define CHIPSET(device_id, type, name) \
+ case device_id: return &device_info_ ## type;
#include "i965_pci_ids.h"
#undef CHIPSET
- default:
- return NULL;
- }
+ default: return NULL;
+ }
}
-bool intel_batch_initialize(struct intel_batch *batch,
- drm_intel_bufmgr *bufmgr) {
- int device_id = drm_intel_bufmgr_gem_get_devid(bufmgr);
+bool intel_batch_initialize(struct intel_batch * batch,
+ drm_intel_bufmgr * bufmgr)
+{
+ int device_id = drm_intel_bufmgr_gem_get_devid(bufmgr);
- batch->command_count = 0;
- batch->device_info = device_info(device_id);
+ batch->command_count = 0;
+ batch->device_info = device_info(device_id);
- if (!batch->device_info)
- return false;
+ if (!batch->device_info)
+ return false;
- /* Alignment argument (4096) is not used */
- batch->bo =
- drm_intel_bo_alloc(bufmgr, "batchbuffer", sizeof batch->commands, 4096);
+ /* Alignment argument (4096) is not used */
+ batch->bo = drm_intel_bo_alloc(bufmgr, "batchbuffer",
+ sizeof batch->commands, 4096);
- if (!batch->bo)
- return false;
+ if (!batch->bo)
+ return false;
- return true;
+ return true;
}
-void intel_batch_finalize(struct intel_batch *batch) {
- drm_intel_bo_unreference(batch->bo);
+void intel_batch_finalize(struct intel_batch * batch)
+{
+ drm_intel_bo_unreference(batch->bo);
}
-void intel_batch_flush(struct intel_batch *batch) {
- if (batch->command_count == 0)
- return;
+void intel_batch_flush(struct intel_batch * batch)
+{
+ if (batch->command_count == 0)
+ return;
- intel_batch_add_dword(batch, MI_BATCH_BUFFER_END);
+ intel_batch_add_dword(batch, MI_BATCH_BUFFER_END);
- /* Pad the batch buffer to the next quad-word. */
- if (batch->command_count & 1)
- intel_batch_add_dword(batch, MI_NOOP);
+ /* Pad the batch buffer to the next quad-word. */
+ if (batch->command_count & 1)
+ intel_batch_add_dword(batch, MI_NOOP);
- drm_intel_bo_subdata(batch->bo, 0, batch->command_count << 2,
- batch->commands);
- drm_intel_bo_mrb_exec(batch->bo, batch->command_count << 2, NULL, 0, 0,
- batch->device_info->gen >= 6 ? I915_EXEC_BLT
- : I915_EXEC_DEFAULT);
- drm_intel_gem_bo_clear_relocs(batch->bo, 0);
- batch->command_count = 0;
+ drm_intel_bo_subdata(batch->bo, 0, batch->command_count << 2,
+ batch->commands);
+ drm_intel_bo_mrb_exec(batch->bo, batch->command_count << 2, NULL, 0, 0,
+ GEN(batch, 6) ? I915_EXEC_BLT
+ : I915_EXEC_DEFAULT);
+ drm_intel_gem_bo_clear_relocs(batch->bo, 0);
+ batch->command_count = 0;
}
+