mirror of
https://github.com/swaywm/sway.git
synced 2024-11-24 08:51:27 +00:00
Add 16f option to render_bit_depth command
This change adds an option to let sway render onto XBGR16161616F buffers, assuming hardware and drivers support this. Such half-float formats may be used in the future for applications (including nested Sway) to submit high-dynamic-range buffers. Using this option is even more likely to reveal bugs in graphics drivers, monitors, and screenshot tools than 'render_bit_depth 10'.
This commit is contained in:
parent
6b97c4fa71
commit
1351c4e505
|
@ -258,6 +258,7 @@ enum render_bit_depth {
|
||||||
RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8
|
RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8
|
||||||
RENDER_BIT_DEPTH_8,
|
RENDER_BIT_DEPTH_8,
|
||||||
RENDER_BIT_DEPTH_10,
|
RENDER_BIT_DEPTH_10,
|
||||||
|
RENDER_BIT_DEPTH_16F,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,9 +17,12 @@ struct cmd_results *output_cmd_render_bit_depth(int argc, char **argv) {
|
||||||
} else if (strcmp(*argv, "10") == 0) {
|
} else if (strcmp(*argv, "10") == 0) {
|
||||||
config->handler_context.output_config->render_bit_depth =
|
config->handler_context.output_config->render_bit_depth =
|
||||||
RENDER_BIT_DEPTH_10;
|
RENDER_BIT_DEPTH_10;
|
||||||
|
} else if (strcmp(*argv, "16f") == 0 || strcmp(*argv, "16F") == 0) {
|
||||||
|
config->handler_context.output_config->render_bit_depth =
|
||||||
|
RENDER_BIT_DEPTH_16F;
|
||||||
} else {
|
} else {
|
||||||
return cmd_results_new(CMD_INVALID,
|
return cmd_results_new(CMD_INVALID,
|
||||||
"Invalid bit depth. Must be a value in (8|10).");
|
"Invalid bit depth. Must be a value in (8|10|16f).");
|
||||||
}
|
}
|
||||||
|
|
||||||
config->handler_context.leftovers.argc = argc - 1;
|
config->handler_context.leftovers.argc = argc - 1;
|
||||||
|
|
|
@ -376,6 +376,11 @@ static const uint32_t *bit_depth_preferences[] = {
|
||||||
DRM_FORMAT_XRGB8888,
|
DRM_FORMAT_XRGB8888,
|
||||||
DRM_FORMAT_INVALID,
|
DRM_FORMAT_INVALID,
|
||||||
},
|
},
|
||||||
|
[RENDER_BIT_DEPTH_16F] = (const uint32_t []){
|
||||||
|
DRM_FORMAT_XBGR16161616F,
|
||||||
|
DRM_FORMAT_XRGB8888,
|
||||||
|
DRM_FORMAT_INVALID,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void queue_output_config(struct output_config *oc,
|
static void queue_output_config(struct output_config *oc,
|
||||||
|
|
|
@ -165,9 +165,10 @@ must be separated by one space. For example:
|
||||||
adaptive sync can improve latency, but can cause flickering on some
|
adaptive sync can improve latency, but can cause flickering on some
|
||||||
hardware.
|
hardware.
|
||||||
|
|
||||||
*output* <name> render_bit_depth 8|10
|
*output* <name> render_bit_depth 8|10|16f
|
||||||
Controls the color channel bit depth at which frames are rendered; the
|
Controls the color channel bit depth at which frames are rendered; the
|
||||||
default is currently 8 bits per channel.
|
default is currently 8 bits per channel. The "16f" option requests
|
||||||
|
color channels encoded in half-precision floating point format.
|
||||||
|
|
||||||
Setting higher values will not have an effect if hardware and software lack
|
Setting higher values will not have an effect if hardware and software lack
|
||||||
support for such bit depths. Successfully increasing the render bit depth
|
support for such bit depths. Successfully increasing the render bit depth
|
||||||
|
|
Loading…
Reference in a new issue