Skip to content
Commits on Source (4)
  • José María Casanova Crespo's avatar
    modesetting: Fix front_bo leak at drmmode_xf86crtc_resize on XRandR rotation · 73480f17
    José María Casanova Crespo authored and José María Casanova Crespo's avatar José María Casanova Crespo committed
    Since the introduction of "modesetting: Remove unnecessary fb addition from
    drmmode_xf86crtc_resize" the fb_id isn't initialited at
    drmmode_xf86crtc_resize.
    
    Rotate operation of XRandR uses rotate_bo. So in this case the fb_id
    associated to the front_bo is not initialized at drmmode_set_mode_major.
    So fd_id remains 0.
    
    As every call to drmmode_xf86crtc_resize allocates a new front_bo we should
    destroy unconditionally the old_front_bo if operation success. So we free
    the allocated GBM handles.
    
    This avoids crashing xserver with a OOM in the RPI4 1Gb at 4k resolution
    after 3 series xrandr rotations from normal to left and vice versa reported at
    https://github.com/raspberrypi/firmware/issues/1345
    
    
    
    Signed-off-by: default avatarJose Maria Casanova Crespo <jmcasanova@igalia.com>
    Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
    Closes: xorg/xserver#1024
    Fixes: 87745321 "modesetting: Remove unnecessary fb addition from
           drmmode_xf86crtc_resize"
    73480f17
  • Sjoerd Simons's avatar
    xwayland: Fix crashes when there is no pointer · d35f6833
    Sjoerd Simons authored and Peter Hutterer's avatar Peter Hutterer committed
    
    
    When running with a weston session without a pointer device (thus with
    the wl_seat not having a pointer) xwayland pointer warping and pointer
    confining should simply be ignored to avoid crashes.
    
    Signed-off-by: default avatarSjoerd Simons <sjoerd@collabora.com>
    d35f6833
  • SimonPilkington's avatar
    xwayland: Initialise values in xwlVidModeGetGamma() · 6748a409
    SimonPilkington authored and Michel Dänzer's avatar Michel Dänzer committed
    ProcVidModeGetGamma() relies on GetGamma() to initialise values if it
    returns TRUE. Without this, we're sending uninitialised values to
    clients.
    
    Fixes: xorg/xserver#1040
    6748a409
  • Olivier Fourdan's avatar
    xwayland: Use a fixed DPI value for core protocol · b0413b6e
    Olivier Fourdan authored and Michel Dänzer's avatar Michel Dänzer committed
    
    
    The way Xwayland works (like all Wayland clients), it first queries the
    Wayland registry, set up all relevant protocols and then initializes its
    own structures.
    
    That means Xwayland will get the Wayland outputs from the Wayland
    compositor, compute the physical size of the combined outputs and set
    the corresponding Xwayland screen properties accordingly.
    
    Then it creates the X11 screen using fbScreenInit() but does so by using
    a default DPI value of 96. That value is used to set the physical size
    of the X11 screen, hence overriding the value computed from the actual
    physical size provided by the Wayland compositor.
    
    As a result, the DPI computed by tools such as xdpyinfo will always be
    96 regardless of the actual screen size and resolution.
    
    However, if the Wayland outputs get reconfigured, or new outputs added,
    or existing outputs removed, Xwayland will recompute and update the
    physical size of the screen, leading to an unexpected change of DPI.
    
    To avoid that discrepancy, use a fixed size DPI (defaults to 96, and can
    be set using the standard command lime option "-dpi") and compute a
    physical screen size to match that DPI setting.
    
    Note that only affects legacy core protocols, X11 clients can still get
    the actual physical output size as reported by the Wayland compositor
    using the RandR protocol, which also allows for the size to be 0 if the
    size is unknown or meaningless.
    
    Signed-off-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
    Reviewed-by: Simon Ser's avatarSimon Ser <contact@emersion.fr>
    Closes: xorg/xserver#731
    b0413b6e
......@@ -3233,10 +3233,10 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
crtc->rotation, crtc->x, crtc->y);
}
if (old_fb_id) {
if (old_fb_id)
drmModeRmFB(drmmode->fd, old_fb_id);
drmmode_bo_destroy(drmmode, &old_front);
}
drmmode_bo_destroy(drmmode, &old_front);
return TRUE;
......
......@@ -2806,6 +2806,9 @@ xwl_seat_can_emulate_pointer_warp(struct xwl_seat *xwl_seat)
{
struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
if (!xwl_seat->pointer)
return FALSE;
if (!xwl_screen->relative_pointer_manager)
return FALSE;
......@@ -2900,6 +2903,9 @@ xwl_seat_confine_pointer(struct xwl_seat *xwl_seat,
if (!pointer_constraints)
return;
if (!xwl_seat->wl_pointer)
return;
if (xwl_seat->cursor_confinement_window == xwl_window &&
xwl_seat->confined_pointer)
return;
......
......@@ -35,7 +35,6 @@
#include "xdg-output-unstable-v1-client-protocol.h"
#define DEFAULT_DPI 96
#define ALL_ROTATIONS (RR_Rotate_0 | \
RR_Rotate_90 | \
RR_Rotate_180 | \
......@@ -148,34 +147,6 @@ output_get_new_size(struct xwl_output *xwl_output,
*height = xwl_output->y + output_height;
}
/* Approximate some kind of mmpd (m.m. per dot) of the screen given the outputs
* associated with it.
*
* It either calculates the mean mmpd of all the outputs or, if no reasonable
* value could be calculated, defaults to the mmpd of a screen with a DPI value
* of DEFAULT_DPI.
*/
static double
approximate_mmpd(struct xwl_screen *xwl_screen)
{
struct xwl_output *it;
int total_width_mm = 0;
int total_width = 0;
xorg_list_for_each_entry(it, &xwl_screen->output_list, link) {
if (it->randr_output->mmWidth == 0)
continue;
total_width_mm += it->randr_output->mmWidth;
total_width += it->width;
}
if (total_width_mm != 0)
return (double)total_width_mm / total_width;
else
return 25.4 / DEFAULT_DPI;
}
static int
xwl_set_pixmap_visit_window(WindowPtr window, void *data)
{
......@@ -214,7 +185,6 @@ static void
update_screen_size(struct xwl_output *xwl_output, int width, int height)
{
struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
double mmpd;
if (xwl_screen->root_clip_mode == ROOT_CLIP_FULL)
SetRootClip(xwl_screen->screen, ROOT_CLIP_NONE);
......@@ -226,15 +196,8 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height)
xwl_screen->height = height;
xwl_screen->screen->width = width;
xwl_screen->screen->height = height;
if (xwl_output->width == width && xwl_output->height == height) {
xwl_screen->screen->mmWidth = xwl_output->randr_output->mmWidth;
xwl_screen->screen->mmHeight = xwl_output->randr_output->mmHeight;
} else {
mmpd = approximate_mmpd(xwl_screen);
xwl_screen->screen->mmWidth = width * mmpd;
xwl_screen->screen->mmHeight = height * mmpd;
}
xwl_screen->screen->mmWidth = (width * 25.4) / monitorResolution;
xwl_screen->screen->mmHeight = (height * 25.4) / monitorResolution;
SetRootClip(xwl_screen->screen, xwl_screen->root_clip_mode);
......
......@@ -59,6 +59,8 @@
static DevPrivateKeyRec xwl_screen_private_key;
static DevPrivateKeyRec xwl_client_private_key;
#define DEFAULT_DPI 96
_X_NORETURN
static void _X_ATTRIBUTE_PRINTF(1, 2)
xwl_give_up(const char *f, ...)
......@@ -594,6 +596,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xorg_list_init(&xwl_screen->window_list);
xwl_screen->depth = 24;
if (!monitorResolution)
monitorResolution = DEFAULT_DPI;
xwl_screen->display = wl_display_connect(NULL);
if (xwl_screen->display == NULL) {
ErrorF("could not connect to wayland server\n");
......@@ -624,7 +629,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
ret = fbScreenInit(pScreen, NULL,
xwl_screen->width, xwl_screen->height,
96, 96, 0,
monitorResolution, monitorResolution, 0,
BitsPerPixel(xwl_screen->depth));
if (!ret)
return FALSE;
......
......@@ -404,6 +404,7 @@ static Bool
xwlVidModeGetGamma(ScreenPtr pScreen, float *red, float *green, float *blue)
{
/* Unsupported for now, but pretend it works */
*red = *green = *blue = 1.0f;
return TRUE;
}
......