Commit cb6bff95 authored by Peter Wu's avatar Peter Wu Committed by Chris Wilson
Browse files

sn: fix PRIME output support since xserver 1.20

Since "Make PixmapDirtyUpdateRec::src a DrawablePtr" in xserver, the
"src" pointer might point to the root window (created by the server)
instead of a pixmap (as created by xf86-video-intel). Use
get_drawable_pixmap to handle both cases.

When built with -fsanitize=address, the following test on a hybrid
graphics laptop will trigger a heap-buffer-overflow error due to
to_sna_from_pixmap receiving a window instead of a pixmap:

    xrandr --setprovideroutputsource modesetting Intel
    xrandr --output DP-1-1 --mode 2560x1440  # should not crash
    glxgears  # should display gears on both screens

With nouveau instead of modesetting, it does not crash but the external
monitor remains blank aside from a mouse cursor. This patch fixes both.


Signed-off-by: Peter Wu's avatarPeter Wu <>
Reviewed-by: Ville Syrjälä's avatarVille Syrjälä <>
Signed-off-by: Chris Wilson's avatarChris Wilson <>
parent b5ac286c
......@@ -17686,10 +17686,10 @@ static void sna_accel_post_damage(struct sna *sna)
assert(dirty->src->type == DRAWABLE_PIXMAP);
src = get_drawable_pixmap(dirty->src);
src = dirty->src;
src = (PixmapPtr)dirty->src;
dst = dirty->slave_dst->master_pixmap;
region.extents.x1 = dirty->x;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment