intel: implement all queue functions except intelQueueSubmit
intelQueueSubmit depends on XGL_CMD_BUFFER support which is still missing.
diff --git a/icd/intel/dev.c b/icd/intel/dev.c
index 759c2cf..ed79469 100644
--- a/icd/intel/dev.c
+++ b/icd/intel/dev.c
@@ -59,6 +59,14 @@
icd_free(queue);
}
+static XGL_RESULT queue_wait(struct intel_queue *queue, int64_t timeout)
+{
+ struct intel_bo *bo = queue->last_submitted_bo;
+
+ return (!bo || intel_bo_wait(bo, timeout) == 0) ?
+ XGL_SUCCESS : XGL_ERROR_UNKNOWN;
+}
+
static struct intel_dev_dbg *dev_dbg_create(const XGL_DEVICE_CREATE_INFO *info)
{
struct intel_dev_dbg *dbg;
@@ -339,3 +347,62 @@
return XGL_SUCCESS;
}
+
+XGL_RESULT XGLAPI intelGetDeviceQueue(
+ XGL_DEVICE device,
+ XGL_QUEUE_TYPE queueType,
+ XGL_UINT queueIndex,
+ XGL_QUEUE* pQueue)
+{
+ struct intel_dev *dev = intel_dev(device);
+
+ switch (queueType) {
+ case XGL_QUEUE_TYPE_GRAPHICS:
+ case XGL_QUEUE_TYPE_COMPUTE:
+ if (queueIndex > 0)
+ return XGL_ERROR_UNAVAILABLE;
+ *pQueue = dev->queues[INTEL_GPU_ENGINE_3D];
+ return XGL_SUCCESS;
+ case XGL_QUEUE_TYPE_DMA:
+ default:
+ return XGL_ERROR_UNAVAILABLE;
+ }
+}
+
+XGL_RESULT XGLAPI intelQueueSetGlobalMemReferences(
+ XGL_QUEUE queue,
+ XGL_UINT memRefCount,
+ const XGL_MEMORY_REF* pMemRefs)
+{
+ /*
+ * The winwys maintains the list of memory references. These are ignored
+ * until we move away from the winsys.
+ */
+ return XGL_SUCCESS;
+}
+
+XGL_RESULT XGLAPI intelQueueWaitIdle(
+ XGL_QUEUE queue_)
+{
+ struct intel_queue *queue = intel_queue(queue_);
+
+ return queue_wait(queue, -1);
+}
+
+XGL_RESULT XGLAPI intelDeviceWaitIdle(
+ XGL_DEVICE device)
+{
+ struct intel_dev *dev = intel_dev(device);
+ XGL_RESULT ret = XGL_SUCCESS;
+ XGL_UINT i;
+
+ for (i = 0; i < ARRAY_SIZE(dev->queues); i++) {
+ if (dev->queues[i]) {
+ const XGL_RESULT r = queue_wait(dev->queues[i], -1);
+ if (r != XGL_SUCCESS)
+ ret = r;
+ }
+ }
+
+ return ret;
+}
diff --git a/icd/intel/dev.h b/icd/intel/dev.h
index ee045c4..2c48303 100644
--- a/icd/intel/dev.h
+++ b/icd/intel/dev.h
@@ -29,6 +29,7 @@
#include "gpu.h"
#include "intel.h"
+struct intel_bo;
struct intel_gpu;
struct intel_queue;
struct intel_winsys;
@@ -59,6 +60,7 @@
struct intel_base base;
struct intel_dev *dev;
+ struct intel_bo *last_submitted_bo;
};
static inline struct intel_dev *intel_dev(XGL_DEVICE dev)
@@ -110,4 +112,21 @@
XGL_SIZE* pDataSize,
XGL_VOID* pData);
+XGL_RESULT XGLAPI intelGetDeviceQueue(
+ XGL_DEVICE device,
+ XGL_QUEUE_TYPE queueType,
+ XGL_UINT queueIndex,
+ XGL_QUEUE* pQueue);
+
+XGL_RESULT XGLAPI intelQueueSetGlobalMemReferences(
+ XGL_QUEUE queue,
+ XGL_UINT memRefCount,
+ const XGL_MEMORY_REF* pMemRefs);
+
+XGL_RESULT XGLAPI intelQueueWaitIdle(
+ XGL_QUEUE queue);
+
+XGL_RESULT XGLAPI intelDeviceWaitIdle(
+ XGL_DEVICE device);
+
#endif /* DEV_H */
diff --git a/icd/intel/dispatch_tables.c b/icd/intel/dispatch_tables.c
index 4f84abb..8566fab 100644
--- a/icd/intel/dispatch_tables.c
+++ b/icd/intel/dispatch_tables.c
@@ -27,15 +27,6 @@
#include "gpu.h"
#include "dispatch_tables.h"
-static XGL_RESULT XGLAPI intelGetDeviceQueue(
- XGL_DEVICE device,
- XGL_QUEUE_TYPE queueType,
- XGL_UINT queueIndex,
- XGL_QUEUE* pQueue)
-{
- return XGL_ERROR_UNAVAILABLE;
-}
-
static XGL_RESULT XGLAPI intelQueueSubmit(
XGL_QUEUE queue,
XGL_UINT cmdBufferCount,
@@ -47,26 +38,6 @@
return XGL_ERROR_UNAVAILABLE;
}
-static XGL_RESULT XGLAPI intelQueueSetGlobalMemReferences(
- XGL_QUEUE queue,
- XGL_UINT memRefCount,
- const XGL_MEMORY_REF* pMemRefs)
-{
- return XGL_ERROR_UNAVAILABLE;
-}
-
-static XGL_RESULT XGLAPI intelQueueWaitIdle(
- XGL_QUEUE queue)
-{
- return XGL_ERROR_UNAVAILABLE;
-}
-
-static XGL_RESULT XGLAPI intelDeviceWaitIdle(
- XGL_DEVICE device)
-{
- return XGL_ERROR_UNAVAILABLE;
-}
-
static XGL_RESULT XGLAPI intelAllocMemory(
XGL_DEVICE device,
const XGL_MEMORY_ALLOC_INFO* pAllocInfo,