xgl: Impossible to expose multi-function queues
Bug: 13363
header version: r29597 (0.51.0)
included review feedback.
diff --git a/demos/cube.c b/demos/cube.c
index 6553962..601d1de 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -204,6 +204,8 @@
XGL_PHYSICAL_GPU gpu;
XGL_DEVICE device;
XGL_QUEUE queue;
+ uint32_t graphics_queue_node_index;
+ XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *queue_props;
int width, height;
XGL_FORMAT format;
@@ -892,7 +894,7 @@
XGL_CMD_BUFFER_CREATE_INFO cmd_buf_create_info = {
.sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO,
.pNext = NULL,
- .queueType = XGL_QUEUE_TYPE_GRAPHICS,
+ .queueNodeIndex = demo->graphics_queue_node_index,
.flags = 0
};
@@ -1517,7 +1519,7 @@
const XGL_CMD_BUFFER_CREATE_INFO cmd = {
.sType = XGL_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO,
.pNext = NULL,
- .queueType = XGL_QUEUE_TYPE_GRAPHICS,
+ .queueNodeIndex = demo->graphics_queue_node_index,
.flags = 0,
};
XGL_RESULT err;
@@ -1687,6 +1689,8 @@
XGL_RESULT err;
uint32_t gpu_count;
uint32_t i;
+ size_t data_size;
+ uint32_t queue_count;
err = xglCreateInstance(&app, NULL, &demo->inst);
if (err == XGL_ERROR_INCOMPATIBLE_DRIVER) {
@@ -1711,7 +1715,25 @@
err = xglCreateDevice(demo->gpu, &device, &demo->device);
assert(!err);
- err = xglGetDeviceQueue(demo->device, XGL_QUEUE_TYPE_GRAPHICS,
+ err = xglGetGpuInfo(demo->gpu, XGL_INFO_TYPE_PHYSICAL_GPU_QUEUE_PROPERTIES,
+ &data_size, NULL);
+ assert(!err);
+
+ demo->queue_props = (XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *) malloc(data_size);
+ err = xglGetGpuInfo(demo->gpu, XGL_INFO_TYPE_PHYSICAL_GPU_QUEUE_PROPERTIES,
+ &data_size, demo->queue_props);
+ assert(!err);
+ queue_count = data_size / sizeof(XGL_PHYSICAL_GPU_QUEUE_PROPERTIES);
+ assert(queue_count >= 1);
+
+ for (i = 0; i < queue_count; i++) {
+ if (demo->queue_props[i].queueFlags & XGL_QUEUE_GRAPHICS_BIT)
+ break;
+ }
+ assert(i < queue_count);
+ demo->graphics_queue_node_index = i;
+
+ err = xglGetDeviceQueue(demo->device, demo->graphics_queue_node_index,
0, &demo->queue);
assert(!err);
}