Skip to content
Commits on Source (11)
......@@ -553,13 +553,19 @@ drm_output_pick_writeback_capture_task(struct drm_output *output)
int32_t height = output->base.current_mode->height;
uint32_t format = output->format->format;
assert(output->device->atomic_modeset);
ct = weston_output_pull_capture_task(&output->base,
WESTON_OUTPUT_CAPTURE_SOURCE_WRITEBACK,
width, height, pixel_format_get_info(format));
if (!ct)
return;
assert(output->device->atomic_modeset);
if (output->base.disable_planes > 0) {
msg = "drm: KMS planes usage is disabled for now, so " \
"writeback capture tasks are rejected";
goto err;
}
wb = drm_output_find_compatible_writeback(output);
if (!wb) {
......@@ -636,7 +642,8 @@ drm_output_repaint(struct weston_output *output_base, pixman_region32_t *damage)
if (drm_output_ensure_hdr_output_metadata_blob(output) < 0)
goto err;
drm_output_pick_writeback_capture_task(output);
if (device->atomic_modeset)
drm_output_pick_writeback_capture_task(output);
drm_output_render(state, damage);
scanout_state = drm_output_state_get_plane(state,
......@@ -948,7 +955,7 @@ drm_output_apply_mode(struct drm_output *output)
}
}
if (device->atomic_modeset && !output->base.disable_planes)
if (device->atomic_modeset)
weston_output_update_capture_info(&output->base,
WESTON_OUTPUT_CAPTURE_SOURCE_WRITEBACK,
output->base.current_mode->width,
......@@ -2138,7 +2145,7 @@ drm_output_enable(struct weston_output *base)
output->base.switch_mode = drm_output_switch_mode;
output->base.set_gamma = drm_output_set_gamma;
if (device->atomic_modeset && !base->disable_planes)
if (device->atomic_modeset)
weston_output_update_capture_info(base, WESTON_OUTPUT_CAPTURE_SOURCE_WRITEBACK,
base->current_mode->width,
base->current_mode->height,
......
......@@ -42,10 +42,6 @@
#include "pixel-formats.h"
#include "presentation-time-server-protocol.h"
#ifndef DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP
#define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15
#endif
struct drm_property_enum_info plane_type_enums[] = {
[WDRM_PLANE_TYPE_PRIMARY] = {
.name = "Primary",
......@@ -1851,10 +1847,19 @@ init_kms_caps(struct drm_device *device)
drmSetClientCap(device->drm.fd, DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1);
#if 0
/* FIXME: DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP isn't merged into mainline so
* we can't really use it at this point. Until then, make it so we
* don't support it. After it gets merged, we can flip this back such
* that we don't need to revert the entire tearing work, and we can
* still get it all back, when the capability is actually available in
* the kernel. */
ret = drmGetCap(device->drm.fd, DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP, &cap);
if (ret != 0)
cap = 0;
device->tearing_supported = cap;
#endif
device->tearing_supported = 0;
weston_log("DRM: does not support async page flipping\n");
/*
* KMS support for hardware planes cannot properly synchronize
......
......@@ -58,7 +58,7 @@ deps_drm = [
]
if get_option('renderer-gl')
dep_gbm = dependency('gbm', required: false)
dep_gbm = dependency('gbm', required: false, version: '>= 21.1.1')
if not dep_gbm.found()
error('drm-backend with GL renderer requires gbm which was not found. Or, you can use \'-Drenderer-gl=false\'.')
endif
......
......@@ -338,72 +338,19 @@ finish_frame_handler(void *data)
return 1;
}
static struct weston_mode *
rdp_insert_new_mode(struct weston_output *output, int width, int height, int rate)
{
struct weston_mode *ret;
ret = xzalloc(sizeof *ret);
ret->width = width;
ret->height = height;
ret->refresh = rate;
ret->flags = WL_OUTPUT_MODE_PREFERRED;
wl_list_insert(&output->mode_list, &ret->link);
return ret;
}
/* It doesn't make sense for RDP to have more than one mode, so
* we make sure that we have only one.
*/
static struct weston_mode *
ensure_single_mode(struct weston_output *output, struct weston_mode *target)
{
struct rdp_output *rdpOutput = to_rdp_output(output);
struct rdp_backend *b = rdpOutput->backend;
struct weston_mode *iter, *local = NULL, *new_mode;
wl_list_for_each(iter, &output->mode_list, link) {
assert(!local);
if ((iter->width == target->width) &&
(iter->height == target->height) &&
(iter->refresh == target->refresh)) {
return iter;
} else {
local = iter;
}
}
/* Make sure we create the new one before freeing the old one
* because some mode switch code uses pointer comparisons! If
* we freed the old mode first, malloc could theoretically give
* us back the same pointer.
*/
new_mode = rdp_insert_new_mode(output,
target->width, target->height,
b->rdp_monitor_refresh_rate);
if (local) {
wl_list_remove(&local->link);
free(local);
}
return new_mode;
}
static void
rdp_output_set_mode(struct weston_output *base, struct weston_mode *mode)
{
struct rdp_output *rdpOutput = container_of(base, struct rdp_output, base);
struct rdp_backend *b = rdpOutput->backend;
struct weston_mode *cur;
struct weston_output *output = base;
struct rdp_peers_item *rdpPeer;
rdpSettings *settings;
struct weston_renderbuffer *new_renderbuffer;
mode->refresh = b->rdp_monitor_refresh_rate;
cur = ensure_single_mode(base, mode);
weston_output_set_single_mode(base, mode);
base->current_mode = cur;
base->native_mode = cur;
if (base->enabled) {
const struct pixman_renderer_interface *pixman;
const struct pixel_format_info *pfmt;
......
......@@ -947,56 +947,15 @@ vnc_output_assign_planes(struct weston_output *base)
vnc_output_update_cursor(output);
}
static struct weston_mode *
vnc_insert_new_mode(struct weston_output *output, int width, int height,
int rate)
{
struct weston_mode *mode;
mode = xzalloc(sizeof *mode);
mode->width = width;
mode->height = height;
mode->refresh = rate;
wl_list_insert(&output->mode_list, &mode->link);
return mode;
}
static struct weston_mode *
vnc_ensure_matching_mode(struct vnc_output *output,
struct weston_mode *target)
{
struct vnc_backend *backend = output->backend;
struct weston_mode *local;
wl_list_for_each(local, &output->base.mode_list, link) {
if ((local->width == target->width) &&
(local->height == target->height))
return local;
}
return vnc_insert_new_mode(&output->base, target->width, target->height,
backend->vnc_monitor_refresh_rate);
}
static int
vnc_switch_mode(struct weston_output *base, struct weston_mode *target_mode)
{
struct vnc_output *output = to_vnc_output(base);
struct weston_mode *local_mode;
struct weston_size fb_size;
assert(output);
local_mode = vnc_ensure_matching_mode(output, target_mode);
if (local_mode == base->current_mode)
return 0;
base->current_mode->flags &= ~WL_OUTPUT_MODE_CURRENT;
base->current_mode = base->native_mode = local_mode;
base->current_mode->flags |= WL_OUTPUT_MODE_CURRENT;
weston_output_set_single_mode(base, target_mode);
fb_size.width = target_mode->width;
fb_size.height = target_mode->height;
......@@ -1015,7 +974,6 @@ vnc_output_set_size(struct weston_output *base, int width, int height)
{
struct vnc_output *output = to_vnc_output(base);
struct vnc_backend *backend = output->backend;
struct weston_mode *current_mode;
struct weston_mode init_mode;
/* We can only be called once. */
......@@ -1027,10 +985,7 @@ vnc_output_set_size(struct weston_output *base, int width, int height)
init_mode.height = height;
init_mode.refresh = backend->vnc_monitor_refresh_rate;
current_mode = vnc_ensure_matching_mode(output, &init_mode);
current_mode->flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
output->base.current_mode = output->base.native_mode = current_mode;
weston_output_set_single_mode(base, &init_mode);
output->base.start_repaint_loop = vnc_output_start_repaint_loop;
output->base.repaint = vnc_output_repaint;
......
......@@ -2897,6 +2897,8 @@ wayland_backend_create(struct weston_compositor *compositor,
create_cursor(b, new_config);
b->fullscreen = new_config->fullscreen;
b->formats_count = ARRAY_LENGTH(wayland_formats);
b->formats = pixel_format_get_array(wayland_formats, b->formats_count);
......
......@@ -7045,6 +7045,45 @@ weston_output_get_color_characteristics(struct weston_output *output)
return &output->color_characteristics;
}
WL_EXPORT void
weston_output_set_single_mode(struct weston_output *output,
struct weston_mode *target)
{
struct weston_mode *iter, *local = NULL, *mode;
wl_list_for_each(iter, &output->mode_list, link) {
assert(!local);
if ((iter->width == target->width) &&
(iter->height == target->height) &&
(iter->refresh == target->refresh)) {
mode = iter;
goto out;
} else {
local = iter;
}
}
/* Make sure we create the new one before freeing the old one
* because some mode switch code uses pointer comparisons! If
* we freed the old mode first, malloc could theoretically give
* us back the same pointer.
*/
mode = xzalloc(sizeof *mode);
mode->width = target->width;
mode->height = target->height;
mode->refresh = target->refresh;
mode->flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
wl_list_insert(&output->mode_list, &mode->link);
out:
output->current_mode = mode;
output->native_mode = mode;
if (local) {
wl_list_remove(&local->link);
free(local);
}
}
/** Initializes a weston_output object with enough data so
** an output can be configured.
*
......
......@@ -972,6 +972,7 @@ weston_pointer_start_drag(struct weston_pointer *pointer,
icon->committed_private = drag;
weston_surface_set_label_func(icon,
pointer_drag_surface_get_label);
drag->base.offset = weston_coord_surface(0, 0, icon);
} else {
drag->base.icon = NULL;
}
......@@ -990,7 +991,6 @@ weston_pointer_start_drag(struct weston_pointer *pointer,
if (keyboard)
weston_keyboard_start_grab(keyboard, &drag->base.keyboard_grab);
drag->base.offset = weston_coord_surface(0, 0, icon);
return 0;
}
......@@ -1036,6 +1036,7 @@ weston_touch_start_drag(struct weston_touch *touch,
icon->committed_private = drag;
weston_surface_set_label_func(icon,
touch_drag_surface_get_label);
drag->base.offset = weston_coord_surface(0, 0, icon);
} else {
drag->base.icon = NULL;
}
......@@ -1055,7 +1056,6 @@ weston_touch_start_drag(struct weston_touch *touch,
drag_grab_touch_focus(drag);
drag->base.offset = weston_coord_surface(0, 0, icon);
return 0;
}
......
......@@ -260,6 +260,10 @@ weston_output_disable_planes_incr(struct weston_output *output);
void
weston_output_disable_planes_decr(struct weston_output *output);
void
weston_output_set_single_mode(struct weston_output *output,
struct weston_mode *target);
/* weston_plane */
void
......
......@@ -207,6 +207,7 @@ with this value in the environment for all child processes to allow them to
connect to the right server automatically.
.BR \-\-version
Print the program version.
.TP
\fB\-\-wait-for-debugger\fR
Raises SIGSTOP before initializing the compositor. This allows the user to
attach with a debugger and continue execution by sending SIGCONT. This is
......
......@@ -1705,6 +1705,9 @@ client_capture_output(struct client *client,
client_roundtrip(client);
assert(capt.width != 0 && capt.height != 0 && capt.drm_format != 0 &&
"capture source not available");
buf = create_shm_buffer(client,
capt.width, capt.height, capt.drm_format);
......
......@@ -3272,7 +3272,9 @@ xserver_map_shell_surface(struct weston_wm_window *window,
} else if (window->override_redirect) {
xwayland_interface->set_xwayland(window->shsurf,
window->x, window->y);
} else if (window->transient_for && window->transient_for->surface) {
} else if (window->transient_for &&
!window->transient_for->override_redirect &&
window->transient_for->surface) {
parent = window->transient_for;
if (weston_wm_window_type_inactive(window)) {
xwayland_interface->set_transient(window->shsurf,
......