Compare commits

..

No commits in common. '02ee1efdb45924ee76dca5b689929bd99ea569dd' and '78852bd35045774ade6c2b7559efe9c2fc7398db' have entirely different histories.

  1. 6
      libweston/backend-drm/drm-internal.h
  2. 20
      libweston/backend-drm/drm.c
  3. 9
      libweston/backend-drm/kms.c
  4. 2
      libweston/backend-drm/meson.build
  5. 165
      libweston/backend-wayland/wayland.c
  6. 2
      meson.build
  7. 4
      xwayland/window-manager.c

@ -519,9 +519,6 @@ struct drm_head {
drmModeModeInfo inherited_mode; /**< Original mode on the connector */ drmModeModeInfo inherited_mode; /**< Original mode on the connector */
uint32_t inherited_max_bpc; /**< Original max_bpc on the connector */ uint32_t inherited_max_bpc; /**< Original max_bpc on the connector */
uint32_t inherited_crtc_id; /**< Original CRTC assignment */ uint32_t inherited_crtc_id; /**< Original CRTC assignment */
/* drm_output::disable_head */
struct wl_list disable_head_link;
}; };
struct drm_crtc { struct drm_crtc {
@ -544,9 +541,6 @@ struct drm_output {
struct drm_device *device; struct drm_device *device;
struct drm_crtc *crtc; struct drm_crtc *crtc;
/* drm_head::disable_head_link */
struct wl_list disable_head;
bool page_flip_pending; bool page_flip_pending;
bool atomic_complete_pending; bool atomic_complete_pending;
bool destroy_pending; bool destroy_pending;

@ -1299,14 +1299,10 @@ drm_output_attach_head(struct weston_output *output_base,
{ {
struct drm_backend *b = to_drm_backend(output_base->compositor); struct drm_backend *b = to_drm_backend(output_base->compositor);
struct drm_device *device = b->drm; struct drm_device *device = b->drm;
struct drm_head *head = to_drm_head(head_base);
if (wl_list_length(&output_base->head_list) >= MAX_CLONED_CONNECTORS) if (wl_list_length(&output_base->head_list) >= MAX_CLONED_CONNECTORS)
return -1; return -1;
wl_list_remove(&head->disable_head_link);
wl_list_init(&head->disable_head_link);
if (!output_base->enabled) if (!output_base->enabled)
return 0; return 0;
@ -1330,14 +1326,18 @@ static void
drm_output_detach_head(struct weston_output *output_base, drm_output_detach_head(struct weston_output *output_base,
struct weston_head *head_base) struct weston_head *head_base)
{ {
struct drm_output *output = to_drm_output(output_base); struct drm_backend *b = to_drm_backend(output_base->compositor);
struct drm_head *head = to_drm_head(head_base); struct drm_device *device = b->drm;
if (!output_base->enabled) if (!output_base->enabled)
return; return;
/* Drop connectors that should no longer be driven on next repaint. */ /* Need to go through modeset to drop connectors that should no longer
wl_list_insert(&output->disable_head, &head->disable_head_link); * be driven. */
/* XXX: Ideally we'd do this per-output, not globally. */
device->state_invalid = true;
weston_output_schedule_repaint(output_base);
} }
int int
@ -2249,8 +2249,6 @@ drm_head_create(struct drm_device *device, drmModeConnector *conn,
head->base.backend_id = drm_head_destroy; head->base.backend_id = drm_head_destroy;
wl_list_init(&head->disable_head_link);
ret = drm_head_update_info(head, conn); ret = drm_head_update_info(head, conn);
if (ret < 0) if (ret < 0)
goto err_update; goto err_update;
@ -2324,8 +2322,6 @@ drm_output_create(struct weston_compositor *compositor, const char *name)
output->device = device; output->device = device;
output->crtc = NULL; output->crtc = NULL;
wl_list_init(&output->disable_head);
output->max_bpc = 16; output->max_bpc = 16;
output->gbm_format = DRM_FORMAT_INVALID; output->gbm_format = DRM_FORMAT_INVALID;
#ifdef BUILD_DRM_GBM #ifdef BUILD_DRM_GBM

@ -951,7 +951,6 @@ drm_output_apply_state_atomic(struct drm_output_state *state,
struct drm_plane_state *plane_state; struct drm_plane_state *plane_state;
struct drm_mode *current_mode = to_drm_mode(output->base.current_mode); struct drm_mode *current_mode = to_drm_mode(output->base.current_mode);
struct drm_head *head; struct drm_head *head;
struct drm_head *tmp;
int ret = 0; int ret = 0;
drm_debug(b, "\t\t[atomic] %s output %lu (%s) state\n", drm_debug(b, "\t\t[atomic] %s output %lu (%s) state\n",
@ -988,14 +987,6 @@ drm_output_apply_state_atomic(struct drm_output_state *state,
wl_list_for_each(head, &output->base.head_list, base.output_link) wl_list_for_each(head, &output->base.head_list, base.output_link)
ret |= connector_add_prop(req, &head->connector, ret |= connector_add_prop(req, &head->connector,
WDRM_CONNECTOR_CRTC_ID, 0); WDRM_CONNECTOR_CRTC_ID, 0);
wl_list_for_each_safe(head, tmp, &output->disable_head,
disable_head_link) {
ret |= connector_add_prop(req, &head->connector,
WDRM_CONNECTOR_CRTC_ID, 0);
wl_list_remove(&head->disable_head_link);
wl_list_init(&head->disable_head_link);
}
} }
wl_list_for_each(head, &output->base.head_list, base.output_link) { wl_list_for_each(head, &output->base.head_list, base.output_link) {

@ -44,7 +44,7 @@ deps_drm = [
] ]
if get_option('renderer-gl') if get_option('renderer-gl')
dep_gbm = dependency('gbm', required: false, version: '>= 21.1.1') dep_gbm = dependency('gbm', required: false)
if not dep_gbm.found() if not dep_gbm.found()
error('drm-backend with GL renderer requires gbm which was not found. Or, you can use \'-Drenderer-gl=false\'.') error('drm-backend with GL renderer requires gbm which was not found. Or, you can use \'-Drenderer-gl=false\'.')
endif endif

@ -76,7 +76,6 @@ struct wayland_backend {
struct wl_display *wl_display; struct wl_display *wl_display;
struct wl_registry *registry; struct wl_registry *registry;
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct wl_shell *shell;
struct xdg_wm_base *xdg_wm_base; struct xdg_wm_base *xdg_wm_base;
struct zwp_fullscreen_shell_v1 *fshell; struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm; struct wl_shm *shm;
@ -112,7 +111,6 @@ struct wayland_output {
struct wl_output *output; struct wl_output *output;
uint32_t global_id; uint32_t global_id;
struct wl_shell_surface *shell_surface;
struct xdg_surface *xdg_surface; struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel; struct xdg_toplevel *xdg_toplevel;
int configure_width, configure_height; int configure_width, configure_height;
@ -252,7 +250,6 @@ to_wayland_output(struct weston_output *base)
{ {
if (base->destroy != wayland_output_destroy) if (base->destroy != wayland_output_destroy)
return NULL; return NULL;
return container_of(base, struct wayland_output, base); return container_of(base, struct wayland_output, base);
} }
@ -390,6 +387,7 @@ wayland_output_get_shm_buffer(struct wayland_output *output)
area.height = output->base.current_mode->height; area.height = output->base.current_mode->height;
} }
/* Address only the interior, excluding output decorations */
sb->pm_image = sb->pm_image =
pixman_image_create_bits(PIXMAN_a8r8g8b8, area.width, area.height, pixman_image_create_bits(PIXMAN_a8r8g8b8, area.width, area.height,
(uint32_t *)(data + area.y * stride) + area.x, (uint32_t *)(data + area.y * stride) + area.x,
@ -717,11 +715,6 @@ wayland_backend_destroy_output_surface(struct wayland_output *output)
output->parent.xdg_surface = NULL; output->parent.xdg_surface = NULL;
} }
if (output->parent.shell_surface) {
wl_shell_surface_destroy(output->parent.shell_surface);
output->parent.shell_surface = NULL;
}
wl_surface_destroy(output->parent.surface); wl_surface_destroy(output->parent.surface);
output->parent.surface = NULL; output->parent.surface = NULL;
} }
@ -743,7 +736,11 @@ static int
wayland_output_disable(struct weston_output *base) wayland_output_disable(struct weston_output *base)
{ {
struct wayland_output *output = to_wayland_output(base); struct wayland_output *output = to_wayland_output(base);
struct wayland_backend *b = to_wayland_backend(base->compositor); struct wayland_backend *b;
assert(output);
b = to_wayland_backend(base->compositor);
if (!output->base.enabled) if (!output->base.enabled)
return 0; return 0;
@ -777,6 +774,8 @@ wayland_output_destroy(struct weston_output *base)
{ {
struct wayland_output *output = to_wayland_output(base); struct wayland_output *output = to_wayland_output(base);
assert(output);
wayland_output_disable(&output->base); wayland_output_disable(&output->base);
weston_output_release(&output->base); weston_output_release(&output->base);
@ -788,8 +787,6 @@ wayland_output_destroy(struct weston_output *base)
free(output); free(output);
} }
static const struct wl_shell_surface_listener shell_surface_listener;
#ifdef ENABLE_EGL #ifdef ENABLE_EGL
static int static int
wayland_output_init_gl_renderer(struct wayland_output *output) wayland_output_init_gl_renderer(struct wayland_output *output)
@ -841,64 +838,54 @@ wayland_output_init_pixman_renderer(struct wayland_output *output)
static void static void
wayland_output_resize_surface(struct wayland_output *output) wayland_output_resize_surface(struct wayland_output *output)
{ {
struct wayland_backend *b = struct wayland_backend *b = to_wayland_backend(output->base.compositor);
to_wayland_backend(output->base.compositor); /* Defaults for without frame: */
int32_t ix, iy, iwidth, iheight; struct weston_size fb_size = {
int32_t width, height; .width = output->base.current_mode->width,
.height = output->base.current_mode->height
};
struct weston_geometry area = {
.x = 0,
.y = 0,
.width = fb_size.width,
.height = fb_size.height
};
struct weston_geometry inp = area;
struct weston_geometry opa = area;
struct wl_region *region; struct wl_region *region;
width = output->base.current_mode->width;
height = output->base.current_mode->height;
if (output->frame) { if (output->frame) {
frame_resize_inside(output->frame, width, height); frame_resize_inside(output->frame, area.width, area.height);
frame_interior(output->frame, &area.x, &area.y, NULL, NULL);
fb_size.width = frame_width(output->frame);
fb_size.height = frame_height(output->frame);
frame_input_rect(output->frame, &inp.x, &inp.y,
&inp.width, &inp.height);
frame_opaque_rect(output->frame, &opa.x, &opa.y,
&opa.width, &opa.height);
}
frame_input_rect(output->frame, &ix, &iy, &iwidth, &iheight);
region = wl_compositor_create_region(b->parent.compositor); region = wl_compositor_create_region(b->parent.compositor);
wl_region_add(region, ix, iy, iwidth, iheight); wl_region_add(region, inp.x, inp.y, inp.width, inp.height);
wl_surface_set_input_region(output->parent.surface, region); wl_surface_set_input_region(output->parent.surface, region);
wl_region_destroy(region); wl_region_destroy(region);
if (output->parent.xdg_surface) { if (output->parent.xdg_surface) {
xdg_surface_set_window_geometry(output->parent.xdg_surface, xdg_surface_set_window_geometry(output->parent.xdg_surface,
ix, inp.x, inp.y,
iy, inp.width, inp.height);
iwidth,
iheight);
} }
frame_opaque_rect(output->frame, &ix, &iy, &iwidth, &iheight);
region = wl_compositor_create_region(b->parent.compositor);
wl_region_add(region, ix, iy, iwidth, iheight);
wl_surface_set_opaque_region(output->parent.surface, region);
wl_region_destroy(region);
width = frame_width(output->frame);
height = frame_height(output->frame);
} else {
region = wl_compositor_create_region(b->parent.compositor);
wl_region_add(region, 0, 0, width, height);
wl_surface_set_input_region(output->parent.surface, region);
wl_region_destroy(region);
region = wl_compositor_create_region(b->parent.compositor); region = wl_compositor_create_region(b->parent.compositor);
wl_region_add(region, 0, 0, width, height); wl_region_add(region, opa.x, opa.y, opa.width, opa.height);
wl_surface_set_opaque_region(output->parent.surface, region); wl_surface_set_opaque_region(output->parent.surface, region);
wl_region_destroy(region); wl_region_destroy(region);
if (output->parent.xdg_surface) {
xdg_surface_set_window_geometry(output->parent.xdg_surface,
0,
0,
width,
height);
}
}
#ifdef ENABLE_EGL #ifdef ENABLE_EGL
if (output->gl.egl_window) { if (output->gl.egl_window) {
wl_egl_window_resize(output->gl.egl_window, wl_egl_window_resize(output->gl.egl_window,
width, height, 0, 0); fb_size.width, fb_size.height, 0, 0);
/* These will need to be re-created due to the resize */ /* These will need to be re-created due to the resize */
gl_renderer->output_set_border(&output->base, gl_renderer->output_set_border(&output->base,
@ -953,8 +940,6 @@ wayland_output_set_windowed(struct wayland_output *output)
if (output->parent.xdg_toplevel) { if (output->parent.xdg_toplevel) {
xdg_toplevel_unset_fullscreen(output->parent.xdg_toplevel); xdg_toplevel_unset_fullscreen(output->parent.xdg_toplevel);
} else if (output->parent.shell_surface) {
wl_shell_surface_set_toplevel(output->parent.shell_surface);
} else { } else {
abort(); abort();
} }
@ -964,7 +949,6 @@ wayland_output_set_windowed(struct wayland_output *output)
static void static void
wayland_output_set_fullscreen(struct wayland_output *output, wayland_output_set_fullscreen(struct wayland_output *output,
enum wl_shell_surface_fullscreen_method method,
uint32_t framerate, struct wl_output *target) uint32_t framerate, struct wl_output *target)
{ {
if (output->frame) { if (output->frame) {
@ -976,9 +960,6 @@ wayland_output_set_fullscreen(struct wayland_output *output,
if (output->parent.xdg_toplevel) { if (output->parent.xdg_toplevel) {
xdg_toplevel_set_fullscreen(output->parent.xdg_toplevel, target); xdg_toplevel_set_fullscreen(output->parent.xdg_toplevel, target);
} else if (output->parent.shell_surface) {
wl_shell_surface_set_fullscreen(output->parent.shell_surface,
method, framerate, target);
} else { } else {
abort(); abort();
} }
@ -1108,7 +1089,7 @@ wayland_output_switch_mode(struct weston_output *output_base,
b = to_wayland_backend(output_base->compositor); b = to_wayland_backend(output_base->compositor);
if (output->parent.xdg_surface || output->parent.shell_surface || !b->parent.fshell) if (output->parent.xdg_surface || !b->parent.fshell)
return -1; return -1;
mode = wayland_output_choose_mode(output, mode); mode = wayland_output_choose_mode(output, mode);
@ -1249,20 +1230,6 @@ wayland_backend_create_output_surface(struct wayland_output *output)
weston_log("wayland-backend: Using xdg_wm_base\n"); weston_log("wayland-backend: Using xdg_wm_base\n");
} }
else if (b->parent.shell) {
output->parent.shell_surface =
wl_shell_get_shell_surface(b->parent.shell,
output->parent.surface);
if (!output->parent.shell_surface) {
wl_surface_destroy(output->parent.surface);
return -1;
}
wl_shell_surface_add_listener(output->parent.shell_surface,
&shell_surface_listener, output);
weston_log("wayland-backend: Using wl_shell\n");
}
return 0; return 0;
} }
@ -1327,13 +1294,9 @@ wayland_output_enable(struct weston_output *base)
output->parent.draw_initial_frame = true; output->parent.draw_initial_frame = true;
} }
} else {
wayland_output_set_fullscreen(output,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER,
output->mode.refresh, output->parent.output);
} }
} else if (b->fullscreen) { } else if (b->fullscreen) {
wayland_output_set_fullscreen(output, 0, 0, NULL); wayland_output_set_fullscreen(output, 0, NULL);
} else { } else {
wayland_output_set_windowed(output); wayland_output_set_windowed(output);
} }
@ -1615,13 +1578,10 @@ wayland_output_setup_fullscreen(struct wayland_output *output,
return -1; return -1;
/* What should size be set if conditional is false? */ /* What should size be set if conditional is false? */
if (b->parent.xdg_wm_base || b->parent.shell) { if (b->parent.xdg_wm_base) {
if (output->parent.xdg_toplevel) if (output->parent.xdg_toplevel)
xdg_toplevel_set_fullscreen(output->parent.xdg_toplevel, xdg_toplevel_set_fullscreen(output->parent.xdg_toplevel,
output->parent.output); output->parent.output);
else if (output->parent.shell_surface)
wl_shell_surface_set_fullscreen(output->parent.shell_surface,
0, 0, NULL);
wl_display_roundtrip(b->parent.wl_display); wl_display_roundtrip(b->parent.wl_display);
@ -1645,36 +1605,6 @@ err_set_size:
return -1; return -1;
} }
static void
shell_surface_ping(void *data, struct wl_shell_surface *shell_surface,
uint32_t serial)
{
wl_shell_surface_pong(shell_surface, serial);
}
static void
shell_surface_configure(void *data, struct wl_shell_surface *shell_surface,
uint32_t edges, int32_t width, int32_t height)
{
struct wayland_output *output = data;
output->parent.configure_width = width;
output->parent.configure_height = height;
/* FIXME: implement resizing */
}
static void
shell_surface_popup_done(void *data, struct wl_shell_surface *shell_surface)
{
}
static const struct wl_shell_surface_listener shell_surface_listener = {
shell_surface_ping,
shell_surface_configure,
shell_surface_popup_done
};
/* Events received from the wayland-server this compositor is client of: */ /* Events received from the wayland-server this compositor is client of: */
/* parent input interface */ /* parent input interface */
@ -1852,9 +1782,6 @@ input_handle_button(void *data, struct wl_pointer *pointer,
if (input->output->parent.xdg_toplevel) if (input->output->parent.xdg_toplevel)
xdg_toplevel_move(input->output->parent.xdg_toplevel, xdg_toplevel_move(input->output->parent.xdg_toplevel,
input->parent.seat, serial); input->parent.seat, serial);
else if (input->output->parent.shell_surface)
wl_shell_surface_move(input->output->parent.shell_surface,
input->parent.seat, serial);
frame_status_clear(input->output->frame, frame_status_clear(input->output->frame,
FRAME_STATUS_MOVE); FRAME_STATUS_MOVE);
return; return;
@ -2208,9 +2135,6 @@ input_handle_touch_down(void *data, struct wl_touch *wl_touch,
if (output->parent.xdg_toplevel) if (output->parent.xdg_toplevel)
xdg_toplevel_move(output->parent.xdg_toplevel, xdg_toplevel_move(output->parent.xdg_toplevel,
input->parent.seat, serial); input->parent.seat, serial);
else if (output->parent.shell_surface)
wl_shell_surface_move(output->parent.shell_surface,
input->parent.seat, serial);
frame_status_clear(output->frame, frame_status_clear(output->frame,
FRAME_STATUS_MOVE); FRAME_STATUS_MOVE);
return; return;
@ -2723,10 +2647,6 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
&xdg_wm_base_interface, 1); &xdg_wm_base_interface, 1);
xdg_wm_base_add_listener(b->parent.xdg_wm_base, xdg_wm_base_add_listener(b->parent.xdg_wm_base,
&wm_base_listener, b); &wm_base_listener, b);
} else if (strcmp(interface, "wl_shell") == 0) {
b->parent.shell =
wl_registry_bind(registry, name,
&wl_shell_interface, 1);
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) { } else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
b->parent.fshell = b->parent.fshell =
wl_registry_bind(registry, name, wl_registry_bind(registry, name,
@ -2821,9 +2741,6 @@ wayland_destroy(struct weston_compositor *ec)
if (b->parent.xdg_wm_base) if (b->parent.xdg_wm_base)
xdg_wm_base_destroy(b->parent.xdg_wm_base); xdg_wm_base_destroy(b->parent.xdg_wm_base);
if (b->parent.shell)
wl_shell_destroy(b->parent.shell);
if (b->parent.fshell) if (b->parent.fshell)
zwp_fullscreen_shell_v1_release(b->parent.fshell); zwp_fullscreen_shell_v1_release(b->parent.fshell);
@ -2891,7 +2808,7 @@ fullscreen_binding(struct weston_keyboard *keyboard,
return; return;
if (input->output->frame) if (input->output->frame)
wayland_output_set_fullscreen(input->output, 0, 0, NULL); wayland_output_set_fullscreen(input->output, 0, NULL);
else else
wayland_output_set_windowed(input->output); wayland_output_set_windowed(input->output);

@ -1,6 +1,6 @@
project('weston', project('weston',
'c', 'c',
version: '11.0.3', version: '11.0.2',
default_options: [ default_options: [
'warning_level=3', 'warning_level=3',
'c_std=gnu99', 'c_std=gnu99',

@ -3048,9 +3048,7 @@ xserver_map_shell_surface(struct weston_wm_window *window,
} else if (window->override_redirect) { } else if (window->override_redirect) {
xwayland_interface->set_xwayland(window->shsurf, xwayland_interface->set_xwayland(window->shsurf,
window->x, window->y); window->x, window->y);
} else if (window->transient_for && } else if (window->transient_for && window->transient_for->surface) {
!window->transient_for->override_redirect &&
window->transient_for->surface) {
parent = window->transient_for; parent = window->transient_for;
if (weston_wm_window_type_inactive(window)) { if (weston_wm_window_type_inactive(window)) {
xwayland_interface->set_transient(window->shsurf, xwayland_interface->set_transient(window->shsurf,

Loading…
Cancel
Save