aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2021-11-10 23:20:10 -0500
committerSimon Ser <contact@emersion.fr>2021-11-19 15:51:46 +0000
commite879d566bb5e0140036170b73757a613de51e4ca (patch)
treeda8afc54fa752a8082121a30a231a3dd19a7cb29 /include/wlr
parent3d7d6ec06ff519e4b28198fd514d511c6d670b0b (diff)
output: Add function to set preferred render format
This change introduces new double buffered state to the wlr_output, corresponding to the buffer format to render to. The format being rendered to does not control the bit depth of colors being sent to the display; it does generally determine the format with which screenshot data is provided. The DRM backend _may_ sent higher bit depths if the render format depth is increased, but hardware and other limitations may apply.
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/interfaces/wlr_output.h1
-rw-r--r--include/wlr/types/wlr_output.h19
2 files changed, 20 insertions, 0 deletions
diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h
index 100754f6..5ae1ab56 100644
--- a/include/wlr/interfaces/wlr_output.h
+++ b/include/wlr/interfaces/wlr_output.h
@@ -21,6 +21,7 @@
(WLR_OUTPUT_STATE_DAMAGE | \
WLR_OUTPUT_STATE_SCALE | \
WLR_OUTPUT_STATE_TRANSFORM | \
+ WLR_OUTPUT_STATE_RENDER_FORMAT | \
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED)
/**
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 9d3dc3cb..7d7fbaad 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -61,6 +61,7 @@ enum wlr_output_state_field {
WLR_OUTPUT_STATE_TRANSFORM = 1 << 5,
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED = 1 << 6,
WLR_OUTPUT_STATE_GAMMA_LUT = 1 << 7,
+ WLR_OUTPUT_STATE_RENDER_FORMAT = 1 << 8,
};
enum wlr_output_state_mode_type {
@@ -78,6 +79,7 @@ struct wlr_output_state {
float scale;
enum wl_output_transform transform;
bool adaptive_sync_enabled;
+ uint32_t render_format;
// only valid if WLR_OUTPUT_STATE_BUFFER
struct wlr_buffer *buffer;
@@ -134,6 +136,7 @@ struct wlr_output {
enum wl_output_subpixel subpixel;
enum wl_output_transform transform;
enum wlr_output_adaptive_sync_status adaptive_sync_status;
+ uint32_t render_format;
bool needs_frame;
// damage for cursors and fullscreen surface, in output-local coordinates
@@ -309,6 +312,22 @@ void wlr_output_set_transform(struct wlr_output *output,
*/
void wlr_output_enable_adaptive_sync(struct wlr_output *output, bool enabled);
/**
+ * Set the output buffer render format. Default value: DRM_FORMAT_XRGB8888
+ *
+ * While high bit depth render formats are necessary for a monitor to receive
+ * useful high bit data, they do not guarantee it; a DRM_FORMAT_XBGR2101010
+ * buffer will only lead to sending 10-bpc image data to the monitor if
+ * hardware and software permit this.
+ *
+ * This only affects the format of the output buffer used when rendering,
+ * as with `wlr_output_attach_render`. It has no impact on the cursor buffer
+ * format, or on the formats supported for direct scan-out (see also
+ * `wlr_output_attach_buffer`).
+ *
+ * This format is double-buffered state, see `wlr_output_commit`.
+ */
+void wlr_output_set_render_format(struct wlr_output *output, uint32_t format);
+/**
* Sets a scale for the output.
*
* Scale is double-buffered state, see `wlr_output_commit`.