mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-04 06:06:17 +00:00
xrt: Use new info struct for compositor formats
This commit is contained in:
parent
0adfeb77a1
commit
d1d841e7c3
|
@ -380,15 +380,15 @@ client_gl_compositor_init(struct client_gl_compositor *c,
|
|||
|
||||
// Passthrough our formats from the native compositor to the client.
|
||||
size_t count = 0;
|
||||
for (uint32_t i = 0; i < xcn->base.num_formats; i++) {
|
||||
int64_t f = vk_format_to_gl(xcn->base.formats[i]);
|
||||
for (uint32_t i = 0; i < xcn->base.info.num_formats; i++) {
|
||||
int64_t f = vk_format_to_gl(xcn->base.info.formats[i]);
|
||||
if (f == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
c->base.base.formats[count++] = f;
|
||||
c->base.base.info.formats[count++] = f;
|
||||
}
|
||||
c->base.base.num_formats = count;
|
||||
c->base.base.info.num_formats = count;
|
||||
|
||||
#if defined(XRT_HAVE_OPENGL)
|
||||
gladLoadGL(get_gl_procaddr);
|
||||
|
|
|
@ -474,11 +474,11 @@ client_vk_compositor_create(struct xrt_compositor_native *xcn,
|
|||
|
||||
c->xcn = xcn;
|
||||
// passthrough our formats from the native compositor to the client
|
||||
for (uint32_t i = 0; i < xcn->base.num_formats; i++) {
|
||||
c->base.base.formats[i] = xcn->base.formats[i];
|
||||
for (uint32_t i = 0; i < xcn->base.info.num_formats; i++) {
|
||||
c->base.base.info.formats[i] = xcn->base.info.formats[i];
|
||||
}
|
||||
|
||||
c->base.base.num_formats = xcn->base.num_formats;
|
||||
c->base.base.info.num_formats = xcn->base.info.num_formats;
|
||||
|
||||
ret = vk_init_from_given(&c->vk, getProc, instance, physicalDevice,
|
||||
device, queueFamilyIndex, queueIndex);
|
||||
|
|
|
@ -998,13 +998,15 @@ xrt_gfx_provider_create_native(struct xrt_device *xdev)
|
|||
* two formats should not be used as they are linear but doesn't have
|
||||
* enough bits to express it without resulting in banding.
|
||||
*/
|
||||
c->base.base.formats[0] = VK_FORMAT_R8G8B8A8_SRGB; // OGL VK
|
||||
c->base.base.formats[1] = VK_FORMAT_A2B10G10R10_UNORM_PACK32; // OGL VK
|
||||
c->base.base.formats[2] = VK_FORMAT_R16G16B16A16_SFLOAT; // OGL VK
|
||||
c->base.base.formats[3] = VK_FORMAT_B8G8R8A8_SRGB; // VK
|
||||
c->base.base.formats[4] = VK_FORMAT_R8G8B8A8_UNORM; // OGL VK
|
||||
c->base.base.formats[5] = VK_FORMAT_B8G8R8A8_UNORM; // VK
|
||||
c->base.base.num_formats = 6;
|
||||
// clang-format off
|
||||
c->base.base.info.formats[0] = VK_FORMAT_R8G8B8A8_SRGB; // OGL VK
|
||||
c->base.base.info.formats[1] = VK_FORMAT_A2B10G10R10_UNORM_PACK32; // OGL VK
|
||||
c->base.base.info.formats[2] = VK_FORMAT_R16G16B16A16_SFLOAT; // OGL VK
|
||||
c->base.base.info.formats[3] = VK_FORMAT_B8G8R8A8_SRGB; // VK
|
||||
c->base.base.info.formats[4] = VK_FORMAT_R8G8B8A8_UNORM; // OGL VK
|
||||
c->base.base.info.formats[5] = VK_FORMAT_B8G8R8A8_UNORM; // VK
|
||||
c->base.base.info.num_formats = 6;
|
||||
// clang-format on
|
||||
|
||||
u_var_add_root(c, "Compositor", true);
|
||||
u_var_add_ro_f32(c, &c->compositor_frame_times.fps, "FPS (Compositor)");
|
||||
|
|
|
@ -453,14 +453,9 @@ struct xrt_compositor_info
|
|||
struct xrt_compositor
|
||||
{
|
||||
/*!
|
||||
* Number of formats.
|
||||
* Capabilities and recommended values information.
|
||||
*/
|
||||
uint32_t num_formats;
|
||||
|
||||
/*!
|
||||
* Supported formats.
|
||||
*/
|
||||
int64_t formats[XRT_MAX_SWAPCHAIN_FORMATS];
|
||||
struct xrt_compositor_info info;
|
||||
|
||||
/*!
|
||||
* Create a swapchain with a set of images.
|
||||
|
|
|
@ -535,11 +535,11 @@ ipc_client_compositor_create(struct ipc_connection *ipc_c,
|
|||
uint32_t num_formats = 0;
|
||||
ipc_compositor_get_formats(&(c->base.base), &num_formats, formats);
|
||||
// TODO: client compositor format count is hardcoded
|
||||
c->base.base.num_formats = 0;
|
||||
c->base.base.info.num_formats = 0;
|
||||
for (uint32_t i = 0; i < 8; i++) {
|
||||
if (i < num_formats) {
|
||||
c->base.base.formats[i] = formats[i];
|
||||
c->base.base.num_formats++;
|
||||
c->base.base.info.formats[i] = formats[i];
|
||||
c->base.base.info.num_formats++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,9 +127,9 @@ xrt_result_t
|
|||
ipc_handle_compositor_get_formats(volatile struct ipc_client_state *ics,
|
||||
struct ipc_formats_info *out_info)
|
||||
{
|
||||
out_info->num_formats = ics->xc->num_formats;
|
||||
for (size_t i = 0; i < ics->xc->num_formats; i++) {
|
||||
out_info->formats[i] = ics->xc->formats[i];
|
||||
out_info->num_formats = ics->xc->info.num_formats;
|
||||
for (size_t i = 0; i < ics->xc->info.num_formats; i++) {
|
||||
out_info->formats[i] = ics->xc->info.formats[i];
|
||||
}
|
||||
|
||||
return XRT_SUCCESS;
|
||||
|
|
|
@ -112,7 +112,7 @@ oxr_session_enumerate_formats(struct oxr_logger *log,
|
|||
}
|
||||
|
||||
OXR_TWO_CALL_HELPER(log, formatCapacityInput, formatCountOutput,
|
||||
formats, xc->num_formats, xc->formats,
|
||||
formats, xc->info.num_formats, xc->info.formats,
|
||||
oxr_session_success_result(sess));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue