ipc: Use xrt limits for number of swapchain handles max

This commit is contained in:
Jakob Bornecrantz 2022-11-03 09:51:09 +00:00 committed by Jakob Bornecrantz
parent 589a898c74
commit cf2dbb9334
3 changed files with 15 additions and 14 deletions

View file

@ -279,21 +279,21 @@ swapchain_server_create(struct ipc_client_compositor *icc,
const struct xrt_swapchain_create_info *info,
struct xrt_swapchain **out_xsc)
{
xrt_graphics_buffer_handle_t remote_handles[IPC_MAX_SWAPCHAIN_HANDLES] = {0};
xrt_graphics_buffer_handle_t remote_handles[XRT_MAX_SWAPCHAIN_IMAGES] = {0};
xrt_result_t r = XRT_SUCCESS;
uint32_t handle;
uint32_t image_count;
uint64_t size;
bool use_dedicated_allocation;
r = ipc_call_swapchain_create(icc->ipc_c, // connection
info, // in
&handle, // out
&image_count, // out
&size, // out
&use_dedicated_allocation, // out
remote_handles, // handles
IPC_MAX_SWAPCHAIN_HANDLES); // handles
r = ipc_call_swapchain_create(icc->ipc_c, // connection
info, // in
&handle, // out
&image_count, // out
&size, // out
&use_dedicated_allocation, // out
remote_handles, // handles
XRT_MAX_SWAPCHAIN_IMAGES); // handles
if (r != XRT_SUCCESS) {
return r;
}
@ -327,7 +327,7 @@ swapchain_server_import(struct ipc_client_compositor *icc,
struct xrt_swapchain **out_xsc)
{
struct ipc_arg_swapchain_from_native args = {0};
xrt_graphics_buffer_handle_t handles[IPC_MAX_SWAPCHAIN_HANDLES] = {0};
xrt_graphics_buffer_handle_t handles[XRT_MAX_SWAPCHAIN_IMAGES] = {0};
xrt_result_t r = XRT_SUCCESS;
uint32_t id = 0;

View file

@ -789,7 +789,7 @@ ipc_handle_swapchain_create(volatile struct ipc_client_state *ics,
struct xrt_swapchain_native *xscn = (struct xrt_swapchain_native *)xsc;
// Limit checking
assert(xsc->image_count <= IPC_MAX_SWAPCHAIN_HANDLES);
assert(xsc->image_count <= XRT_MAX_SWAPCHAIN_IMAGES);
assert(xsc->image_count <= max_handle_capacity);
for (size_t i = 1; i < xsc->image_count; i++) {
@ -830,7 +830,7 @@ ipc_handle_swapchain_import(volatile struct ipc_client_state *ics,
return xret;
}
struct xrt_image_native xins[IPC_MAX_SWAPCHAIN_HANDLES] = {0};
struct xrt_image_native xins[XRT_MAX_SWAPCHAIN_IMAGES] = {0};
for (uint32_t i = 0; i < handle_count; i++) {
xins[i].handle = handles[i];
xins[i].size = args->sizes[i];

View file

@ -10,6 +10,7 @@
#pragma once
#include "xrt/xrt_limits.h"
#include "xrt/xrt_compiler.h"
#include "xrt/xrt_compositor.h"
#include "xrt/xrt_results.h"
@ -23,7 +24,7 @@
#include <sys/types.h>
#define IPC_MAX_SWAPCHAIN_HANDLES 8
#define IPC_CRED_SIZE 1 // auth not implemented
#define IPC_BUF_SIZE 512 // must be >= largest message length in bytes
#define IPC_MAX_VIEWS 8 // max views we will return configs for
@ -297,7 +298,7 @@ struct ipc_app_state
*/
struct ipc_arg_swapchain_from_native
{
uint32_t sizes[IPC_MAX_SWAPCHAIN_HANDLES];
uint32_t sizes[XRT_MAX_SWAPCHAIN_IMAGES];
};
/*!