1
1
Fork 0
mirror of https://github.com/swaywm/sway synced 2024-05-09 03:26:02 +02:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Ian Hattendorf 6003f65b65
Merge ee75c1ec1c into 646019cad9 2024-04-25 18:54:04 -07:00
Kenny Levinsen 646019cad9 desktop/output: Fix check if config should be stored
We want to check if a config_head existed for the current
matched_output_config, so we should check cfg->output. sway_output is a
temporary variable from a previous wl_list_for_each, and does not
contain anything useful to us.

Fixes: https://github.com/swaywm/sway/issues/8128
2024-04-23 13:31:30 +02:00
Kenny Levinsen ffcde7a70c server: Use wlr_renderer_get_texture_formats
wlr_renderer_get_{dmabuf|shm}_texture_formats have been replaced by a
unified wlr_renderer_get_texture_formats interface using buffer caps.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4644
2024-04-21 17:19:33 +02:00
Ian Hattendorf ee75c1ec1c
swaymsg: display render bit depth instead of format 2023-08-21 13:09:26 -07:00
Ian Hattendorf 1929112b23
Add render_format to get_outputs IPC command
Addresses https://github.com/swaywm/sway/issues/6681
2023-08-15 13:31:49 -07:00
7 changed files with 55 additions and 8 deletions

View File

@ -146,4 +146,8 @@ void handle_output_power_manager_set_mode(struct wl_listener *listener,
struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output);
const char *sway_render_format_to_string(uint32_t render_format);
int sway_render_format_to_bit_depth(uint32_t render_format);
#endif

View File

@ -403,6 +403,33 @@ static const uint32_t *bit_depth_preferences[] = {
},
};
int sway_render_format_to_bit_depth(uint32_t render_format) {
switch (render_format) {
case DRM_FORMAT_XRGB2101010:
case DRM_FORMAT_XBGR2101010:
return 10;
case DRM_FORMAT_XRGB8888:
return 8;
default:
return -1;
}
}
const char *sway_render_format_to_string(uint32_t render_format) {
switch (render_format) {
case DRM_FORMAT_XRGB2101010:
return "XRGB2101010";
case DRM_FORMAT_XBGR2101010:
return "XBGR2101010";
case DRM_FORMAT_XRGB8888:
return "XRGB8888";
case DRM_FORMAT_INVALID:
return "INVALID";
default:
return "UNKNOWN";
}
}
static void queue_output_config(struct output_config *oc,
struct sway_output *output, struct wlr_output_state *pending) {
if (output == root->fallback_output) {

View File

@ -619,7 +619,7 @@ static void output_manager_apply(struct sway_server *server,
if (!test_only && ok) {
struct wlr_output_configuration_head_v1 *config_head;
wl_list_for_each(config_head, &config->heads, link) {
if (config_head->state.output == sway_output->wlr_output) {
if (config_head->state.output == cfg->output->wlr_output) {
store_config = true;
break;
}

View File

@ -688,6 +688,13 @@ void ipc_client_handle_command(struct ipc_client *client, uint32_t payload_lengt
const char *subpixel = sway_wl_output_subpixel_to_string(output->wlr_output->subpixel);
json_object_object_add(output_json, "subpixel_hinting", json_object_new_string(subpixel));
const char *render_format = sway_render_format_to_string(output->wlr_output->render_format);
json_object_object_add(output_json, "render_format", json_object_new_string(render_format));
const int bit_depth = sway_render_format_to_bit_depth(output->wlr_output->render_format);
json_object_object_add(output_json, "render_bit_depth", json_object_new_int(bit_depth));
json_object_array_add(outputs, output_json);
}
struct sway_output *output;

View File

@ -240,13 +240,12 @@ bool server_init(struct sway_server *server) {
wlr_renderer_init_wl_shm(server->renderer, server->wl_display);
if (wlr_renderer_get_dmabuf_texture_formats(server->renderer) != NULL) {
if (wlr_renderer_get_texture_formats(server->renderer, WLR_BUFFER_CAP_DMABUF) != NULL) {
server->linux_dmabuf_v1 = wlr_linux_dmabuf_v1_create_with_renderer(
server->wl_display, 4, server->renderer);
}
if (wlr_renderer_get_dmabuf_texture_formats(server->renderer) != NULL &&
debug.legacy_wl_drm) {
wlr_drm_create(server->wl_display, server->renderer);
if (debug.legacy_wl_drm) {
wlr_drm_create(server->wl_display, server->renderer);
}
}
server->allocator = wlr_allocator_autocreate(server->backend,

View File

@ -225,7 +225,13 @@ following properties:
: The scale currently in use on the output or _-1_ for disabled outputs
|- subpixel_hinting
: string
: The subpixel hinting current in use on the output. This can be _rgb_, _bgr_, _vrgb_, _vbgr_, or _none_
: The subpixel hinting currently in use on the output. This can be _rgb_, _bgr_, _vrgb_, _vbgr_, or _none_
|- render_bit_depth
: integer
: The render bit depth currently in use on the output.
|- render_format
: string
: The render format currently in use on the output.
|- transform
: string
: The transform currently in use for the output. This can be _normal_, _90_,
@ -258,6 +264,7 @@ following properties:
"primary": false,
"scale": 1.0,
"subpixel_hinting": "rgb",
"render_format": "XRGB8888",
"transform": "normal",
"current_workspace": "1",
"modes": [

View File

@ -193,13 +193,14 @@ static void pretty_print_output(json_object *o) {
json_object_object_get_ex(o, "current_workspace", &ws);
json_object_object_get_ex(o, "non_desktop", &non_desktop);
json_object *make, *model, *serial, *scale, *scale_filter, *subpixel,
*transform, *max_render_time, *adaptive_sync_status;
*bit_depth, *transform, *max_render_time, *adaptive_sync_status;
json_object_object_get_ex(o, "make", &make);
json_object_object_get_ex(o, "model", &model);
json_object_object_get_ex(o, "serial", &serial);
json_object_object_get_ex(o, "scale", &scale);
json_object_object_get_ex(o, "scale_filter", &scale_filter);
json_object_object_get_ex(o, "subpixel_hinting", &subpixel);
json_object_object_get_ex(o, "render_bit_depth", &bit_depth);
json_object_object_get_ex(o, "transform", &transform);
json_object_object_get_ex(o, "max_render_time", &max_render_time);
json_object_object_get_ex(o, "adaptive_sync_status", &adaptive_sync_status);
@ -231,6 +232,7 @@ static void pretty_print_output(json_object *o) {
" Scale factor: %f\n"
" Scale filter: %s\n"
" Subpixel hinting: %s\n"
" Render bit depth: %d\n"
" Transform: %s\n"
" Workspace: %s\n",
json_object_get_string(name),
@ -246,6 +248,7 @@ static void pretty_print_output(json_object *o) {
json_object_get_double(scale),
json_object_get_string(scale_filter),
json_object_get_string(subpixel),
json_object_get_int(bit_depth),
json_object_get_string(transform),
json_object_get_string(ws)
);