···150150 uint32_t preferred_width,
151151 uint32_t preferred_height)
152152{
153153+ /*
154154+ * A sub-class wants us to use these extents over the ones the
155155+ * compositor preferred, this is probably due to the target only
156156+ * upporting this size so we better respect those wishes.
157157+ */
158158+ if (cts->override.compositor_extent) {
159159+ preferred_width = cts->override.extent.width;
160160+ preferred_height = cts->override.extent.height;
161161+ }
162162+153163 // If width (and height) equals the special value 0xFFFFFFFF,
154164 // the size of the surface will be set by the swapchain
155165 if (caps.currentExtent.width == (uint32_t)-1) {
···10311041 * 'Exported' functions.
10321042 *
10331043 */
10441044+10451045+void
10461046+comp_target_swapchain_override_extents(struct comp_target_swapchain *cts, VkExtent2D extent)
10471047+{
10481048+ VkExtent2D old = cts->override.extent;
10491049+10501050+ COMP_INFO( //
10511051+ cts->base.c, //
10521052+ "Target '%s' overrides compositor extents with (%ux%u) was (%ux%u %s)", //
10531053+ cts->base.name, //
10541054+ extent.width, //
10551055+ extent.height, //
10561056+ old.width, //
10571057+ old.height, //
10581058+ cts->override.compositor_extent ? "true" : "false"); //
10591059+10601060+ cts->override.compositor_extent = true;
10611061+ cts->override.extent = extent;
10621062+}
1034106310351064void
10361065comp_target_swapchain_cleanup(struct comp_target_swapchain *cts)
+27
src/xrt/compositor/main/comp_target_swapchain.h
···49495050 struct
5151 {
5252+ /*!
5353+ * Should we ignore the compositor's preferred extents. Some
5454+ * targets, like the direct mode ones, requires a particular
5555+ * set of dimensions.
5656+ */
5757+ bool compositor_extent;
5858+5959+ /*!
6060+ * The extents that a sub-class wants us to use,
6161+ * see @p ignore_compositor_extent above.
6262+ */
6363+ VkExtent2D extent;
6464+ } override;
6565+6666+ struct
6767+ {
5268 VkSwapchainKHR handle;
5369 } swapchain;
5470···128144void
129145comp_target_swapchain_init_and_set_fnptrs(struct comp_target_swapchain *cts,
130146 enum comp_target_display_timing_usage timing_usage);
147147+148148+/*!
149149+ * Set that any size from the compositor should be ignored and that given size
150150+ * must be used for the @p VkSwapchain the helper code creates.
151151+ *
152152+ * @protected @memberof comp_target_swapchain
153153+ *
154154+ * @ingroup comp_main
155155+ */
156156+void
157157+comp_target_swapchain_override_extents(struct comp_target_swapchain *cts, VkExtent2D extent);
131158132159/*!
133160 * Free all managed resources on the given @ref comp_target_swapchain,
···160160 */
161161162162 // Make the compositor use this size.
163163- w->base.base.c->settings.preferred.width = disp->physicalResolution.width;
164164- w->base.base.c->settings.preferred.height = disp->physicalResolution.height;
163163+ comp_target_swapchain_override_extents(&w->base, disp->physicalResolution);
165164166165 // Create the entry.
167166 struct comp_window_direct_nvidia_display d = {