-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'output render_bit_depth [8|10]' command
This makes it possible to hint to the renderer and backends how many bits per channel the buffers that the compositor draws windows onto should have. Renderers and backends may deviate from this if they do not support the formats with higher bit depth.
- Loading branch information
Showing
7 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include <drm_fourcc.h> | ||
#include <strings.h> | ||
#include "sway/commands.h" | ||
#include "sway/config.h" | ||
|
||
static const uint32_t format_order_8bpc[] = { | ||
DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888, 0 | ||
}; | ||
|
||
static const uint32_t format_order_10bpc[] = { | ||
DRM_FORMAT_ABGR2101010, DRM_FORMAT_ARGB2101010, | ||
DRM_FORMAT_XBGR2101010, DRM_FORMAT_XRGB2101010, | ||
DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888, | ||
0, | ||
}; | ||
|
||
struct cmd_results *output_cmd_render_bit_depth(int argc, char **argv) { | ||
if (!config->handler_context.output_config) { | ||
return cmd_results_new(CMD_FAILURE, "Missing output config"); | ||
} | ||
if (!argc) { | ||
return cmd_results_new(CMD_INVALID, "Missing bit depth argument."); | ||
} | ||
|
||
if (strcmp(*argv, "8") == 0) { | ||
config->handler_context.output_config->render_format_order = | ||
format_order_8bpc; | ||
} else if (strcmp(*argv, "10") == 0) { | ||
config->handler_context.output_config->render_format_order = | ||
format_order_10bpc; | ||
} else { | ||
return cmd_results_new(CMD_INVALID, | ||
"Invalid bit depth. Must be either 8 or 10 ."); | ||
} | ||
|
||
config->handler_context.leftovers.argc = argc - 1; | ||
config->handler_context.leftovers.argv = argv + 1; | ||
return NULL; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters