c/main: Fill out all of the compositor info struct

This commit is contained in:
Jakob Bornecrantz 2020-08-06 12:09:15 +01:00 committed by Jakob Bornecrantz
parent ee48b44087
commit adc6ca8e8a
4 changed files with 46 additions and 8 deletions

View file

@ -984,6 +984,8 @@ xrt_gfx_provider_create_native(struct xrt_device *xdev)
COMP_DEBUG(c, "Done %p", (void *)c);
struct xrt_compositor_info *info = &c->base.base.info;
/*!
* @todo Support more like, depth/float formats etc,
* remember to update the GL client as well.
@ -997,14 +999,45 @@ 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.
*/
info->formats[0] = VK_FORMAT_R8G8B8A8_SRGB; // OGL VK
info->formats[1] = VK_FORMAT_A2B10G10R10_UNORM_PACK32; // OGL VK
info->formats[2] = VK_FORMAT_R16G16B16A16_SFLOAT; // OGL VK
info->formats[3] = VK_FORMAT_B8G8R8A8_SRGB; // VK
info->formats[4] = VK_FORMAT_R8G8B8A8_UNORM; // OGL VK
info->formats[5] = VK_FORMAT_B8G8R8A8_UNORM; // VK
info->num_formats = 6;
float scale = c->settings.viewport_scale;
if (scale > 2.0) {
scale = 2.0;
COMP_DEBUG(c, "Clamped scale to 200%%\n");
}
uint32_t w0 = (uint32_t)(xdev->hmd->views[0].display.w_pixels * scale);
uint32_t h0 = (uint32_t)(xdev->hmd->views[0].display.h_pixels * scale);
uint32_t w1 = (uint32_t)(xdev->hmd->views[1].display.w_pixels * scale);
uint32_t h1 = (uint32_t)(xdev->hmd->views[1].display.h_pixels * scale);
uint32_t w0_2 = xdev->hmd->views[0].display.w_pixels * 2;
uint32_t h0_2 = xdev->hmd->views[0].display.h_pixels * 2;
uint32_t w1_2 = xdev->hmd->views[1].display.w_pixels * 2;
uint32_t h1_2 = xdev->hmd->views[1].display.h_pixels * 2;
// 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;
info->views[0].recommended.width_pixels = w0;
info->views[0].recommended.height_pixels = h0;
info->views[0].recommended.sample_count = 1;
info->views[0].max.width_pixels = w0_2;
info->views[0].max.height_pixels = h0_2;
info->views[0].max.sample_count = 1;
info->views[1].recommended.width_pixels = w1;
info->views[1].recommended.height_pixels = h1;
info->views[1].recommended.sample_count = 1;
info->views[1].max.width_pixels = w1_2;
info->views[1].max.height_pixels = h1_2;
info->views[1].max.sample_count = 1;
// clang-format on
u_var_add_root(c, "Compositor", true);

View file

@ -21,6 +21,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(force_wayland, "XRT_COMPOSITOR_FORCE_WAYLAND", false)
DEBUG_GET_ONCE_BOOL_OPTION(wireframe, "XRT_COMPOSITOR_WIREFRAME", false)
DEBUG_GET_ONCE_NUM_OPTION(force_gpu_index, "XRT_COMPOSITOR_FORCE_GPU_INDEX", -1)
DEBUG_GET_ONCE_NUM_OPTION(desired_mode, "XRT_COMPOSITOR_DESIRED_MODE", -1)
DEBUG_GET_ONCE_NUM_OPTION(scale_percentage, "XRT_COMPOSITOR_SCALE_PERCENTAGE", 140)
// clang-format on
void
@ -48,6 +49,7 @@ comp_settings_init(struct comp_settings *s, struct xrt_device *xdev)
s->gpu_index = debug_get_num_option_force_gpu_index();
s->debug.wireframe = debug_get_bool_option_wireframe();
s->desired_mode = debug_get_num_option_desired_mode();
s->viewport_scale = debug_get_num_option_scale_percentage() / 100.0;
if (debug_get_bool_option_force_nvidia()) {
s->window_type = WINDOW_DIRECT_NVIDIA;

View file

@ -76,6 +76,9 @@ struct comp_settings
bool wireframe;
} debug;
//! Procentage to scale the viewport by.
double viewport_scale;
//! Not used with direct mode.
bool fullscreen;

View file

@ -21,7 +21,7 @@
#include "oxr_two_call.h"
// clang-format off
DEBUG_GET_ONCE_NUM_OPTION(scale_percentage, "OXR_VIEWPORT_SCALE_PERCENTAGE", 140)
DEBUG_GET_ONCE_NUM_OPTION(scale_percentage, "OXR_VIEWPORT_SCALE_PERCENTAGE", 100)
// clang-format on
static bool