Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RandR backports (X.org commits 2016+17) #391

Open
wants to merge 33 commits into
base: 3.6.x
Choose a base branch
from

Conversation

sunweaver
Copy link
Member

@sunweaver sunweaver commented Mar 11, 2017

... plus (planned) NXAGENT_SERVER unif(n)def'ing of the rrProvider slave output code...

This PR requires #331 to be merged...

keith-packard and others added 30 commits March 11, 2017 01:44
 Backported from X.org:

 commit db1089eafc1c5371fa0030202de588d2e2b4f8e5
 Author: Keith Packard <keithp@keithp.com>
 Date:   Mon Sep 21 07:16:17 2015 +0100

    os/xdmcp: Just send XDMCP keepalive packets once every three minutes

    There was a complicated scheme to increase the time between keepalives
    from 3 minutes up to as much as 24 hours in an attempt to reduce
    network traffic from idle X terminals. X terminals receiving X
    traffic, or receiving user input would use the 3 minute value; X
    terminals without any network traffic would use a longer value.

    However, this was actually broken -- any activity in the X server,
    either client requests or user input, would end up resetting the
    keepalive timeout, so a user mashing on the keyboard would never
    discover that the XDMCP master had disappeared and have the session
    terminated, which was precisely the design goal of the XDMCP keepalive
    mechanism.

    Instead of attempting to fix this, accept the cost of a pair of XDMCP
    packets once every three minutes and just perform keepalives
    regularly.

    This will also make reworking the block and wakeup handler APIs to
    eliminate select masks easier.

    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backported from X.org:

 commit 0c41b7af4ab0c8d22b88f201293f59524d1e7317
 Author: Keith Packard <keithp@keithp.com>
 Date:   Wed Nov 11 22:02:02 2015 -0800

    os: Add NotifyFd interfaces

    This provides a callback-based interface to monitor file
    descriptors beyond the usual client and device interfaces.

    Modules within the server using file descriptors for reading and/or
    writing can call

        Bool SetNotifyFd(int fd, NotifyFdProcPtr notify_fd, int mask, void *data);

    mask can be any combination of X_NOTIFY_READ and X_NOTIFY_WRITE.

    When 'fd' becomes readable or writable, the notify_fd function will be
    called with the 'fd', the ready conditions and 'data' values as arguments,

    When the module no longer needs to monitor the fd, it will call

        void RemoveNotifyFd(int fd);

    RemoveNotifyFd may be called from the notify function.

    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

    Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
…, from WaitForSomething to mieqProcessInputEvents.

 Backported from X.org:

 commit 3b5b7ef5c2ab1d196806f6359e0972fd78d204dd
 Author: Fredrik Höglund <fredrik@kde.org>
 Date:   Wed Jan 3 21:05:35 2007 +0100

    Move the code for resetting the DPMS mode in response to input events,
    from WaitForSomething to mieqProcessInputEvents.

    mieqProcessInputEvents already handles resetting the screen saver.

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
…nabledDevices/RemoveEnabledDevices

 Backported from X.org:

 commit be5a513fee6cbf29ef7570e57eb0436d70fbd88c
 Author: Keith Packard <keithp@keithp.com>
 Date:   Mon Dec 7 15:12:14 2015 -0800

    Remove AddEnabledDevice and AddGeneralSocket APIs

    All uses of these interfaces should instead be using the NotifyFd API
    instead.

    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>

 commit 4020aacd1fc5b9c63369f011aeb9120af9c55218
 Author: Keith Packard <keithp@keithp.com>
 Date:   Wed Nov 11 22:02:03 2015 -0800

    os: Implement support for NotifyFd X_NOTIFY_WRITE

    This adds the ability to be notified when a file descriptor is
    available for writing.

    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Keith Packard <keithp@keithp.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Inspired by X.org commit:

 commit 55c2e1a3aa587c58a74066724e11e30b3df267b8
 Author: Keith Packard <keithp@keithp.com>
 Date:   Mon Dec 7 15:11:33 2015 -0800

    xnest: Use SetNotifyFd to receive events

    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
 Backported from X.org:

 commit ce6546337487c052b5dd3c04d3d8d4b09d691c3d
 Author: Keith Packard <keithp@keithp.com>
 Date:   Tue May 31 09:38:17 2016 -0700

    os: Initialize NotifyFds earlier in startup

    If the server calls AbortServer during the first-time initialization
    (which can happen if you start the server on an already using
    DISPLAY), then the dbus code will shut down and call the notify fd
    interface. If the notify fd list hasn't been initialized, the server
    will crash.

    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 commit 941aeb3b92e644923bd112eef8023f033a140ee6
 Author: Olivier Fourdan <ofourdan@redhat.com>
 Date:   Fri May 13 08:58:58 2016 +0200

    randr: Do not update ConnectionInfo if NULL

    RRScreenSizeNotify() will update the connection information block, but
    if this occurs during initialization before ConnectionInfo is even
    initialized, this will lead to a crash.

    Simply check for ConnectionInfo prior to update it to avoid the crash.

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95337
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
…oad slaves

 Backported from X.org and not-yet-enabled ABI-wise in NXAGENT_SERVER:

 commit 5c7af02b103790ac1fb6a71822788892c70290b6
 Author: Hans de Goede <hdegoede@redhat.com>
 Date:   Fri May 13 15:58:10 2016 +0200

    xrandrprovider: Do not use separate lists for unbound / source / offload slaves

    A single provider can be both a offload and source slave at the same time,
    the use of seperate lists breaks in this case e.g. :

    xrandr --listproviders
    Providers: number : 2
    Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 0 name:modesetting
    Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 0 name:modesetting

    xrandr --setprovideroutputsource 1 0x7b
    xrandr --listproviders
    Providers: number : 2
    Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 1 name:modesetting
    Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 1 name:modesetting

    xrandr --setprovideroffloadsink 1 0x7b
    xrandr --listproviders
    Providers: number : 3
    Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 2 name:modesetting
    Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 2 name:modesetting
    Provider 2: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 2 name:modesetting

    Not good. The problem is that the provider with id 0x46 now is on both
    the output_slave_list and the offload_slave_list of the master screen.

    This commit fixes this by unifying all 3 lists into a single slaves list.

    Note that this does change the struct _Screen definition, so this is an ABI
    break. I do not expect any of the drivers to actually use the removed / changed
    fields so a recompile should suffice.

    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Dave Airlie <airlied@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 commit 15595d29c2c3992f260a3314f26fa691f1e5cec8
 Author: Nikhil Mahale <nmahale@nvidia.com>
 Date:   Thu May 26 21:50:16 2016 +0530

    randr: Adjust master's last set time with slaves

    In prime configurations master's last set time may not be latest
    and greatest, adjust it with slaves last set time, pick up greatest
    one. Otherwise xserver may end with events which has
    lastSetTime < lastConfigTime even if that's not
    the case and confuse xrandr client.

    [hdegoede: rebase on "xrandrprovider: Do not use separate lists for unbound /
     source / offload slaves"]
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backported from X.org:

 commit 35c4e96ed1d372dd161480be8cddcd2d4549e449
 Author: Hans de Goede <hdegoede@redhat.com>
 Date:   Mon Sep 12 12:47:59 2016 +0200

    randr: Fix crtc_bounds when using rotation combined with reflection

    Before this commit crtc_bounds() did not take reflection into account,
    when using reflection with 0 / 180 degree rotation this was not an
    issue because of the default in the switch-case doing the right thing.

    But when using 90 / 270 degree rotation we would also end up in the
    default which is wrong in this case. This would lead to the cursor
    being constrained to a height x height area of the monitor.

    This commit masks out the reflection bits for the switch-case,
    making crtc_bounds return the correct bounds and fixing the
    problematic cursor constraining.

    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
…reen size

 Backported from X.org (and not-yet-enabled in NXAGENT_SERVER):

 commit 3b624aa9a9df86dc7d48149e0f18ca223b4355f1
 Author: Hans de Goede <hdegoede@redhat.com>
 Date:   Tue Nov 22 14:48:14 2016 +0100

    randr: rrCheckPixmapBounding: Do not substract crtc non 0 x,y from screen size

    The purpose of rrCheckPixmapBounding is to make sure that the
    screen_pixmap is large enough for the slave-output which crtc is
    being configured.

    This should include crtc->x and crtc->y, otherwise the crtc might
    still end up scanning out an area outside of the screen-pixmap.

    For example: Take a laptop with an external monitor on a slave-output at
    1920x1080+0+0 and its internal-screen at 3840x2160+1920+0 and in
    gnome-settings-daemon move the external monitor to be on the ri ght of
    the internal screen rather then on the left. First g-s-d will do a
    RRSetScreenSize to 5760*2160 (which is a nop), then it calls RRSetCrtc
    to move the slave output to 1920x1080+3840+0, since this is a slave
    output, rrCheckPixmapBounding gets called, since the 2 crtcs now overlap
    the code before this commit would shrinks the screen_pixmap to 3180*2160.
    randr: rrCheckPixmapBounding: Do not substract crtc non 0 x,y from screen size
    randr: rrCheckPixmapBounding: Do not substract crtc non 0 x,y from screen size

    The purpose of rrCheckPixmapBounding is to make sure that the
    screen_pixmap is large enough for the slave-output which crtc is
    being configured.

    This should include crtc->x and crtc->y, otherwise the crtc might
    still end up scanning out an area outside of the screen-pixmap.

    For example: Take a laptop with an external monitor on a slave-output at
    1920x1080+0+0 and its internal-screen at 3840x2160+1920+0 and in
    gnome-settings-daemon move the external monitor to be on the ri ght of
    the internal screen rather then on the left. First g-s-d will do a
    RRSetScreenSize to 5760*2160 (which is a nop), then it calls RRSetCrtc
    to move the slave output to 1920x1080+3840+0, since this is a slave
    output, rrCheckPixmapBounding gets called, since the 2 crtcs now overlap
    the code before this commit would shrinks the screen_pixmap to 3180*2160.
    Then g-s-d calls RRSetCrtc to move the internal screen to 3180*2160+0+0.

    And we end up with the slave-output configured to scan-out an area
    which completely falls outside of the screen-pixmap (and end up with
    a black display on the external monitor).

    This commit fixes this by not substracting the x1 and y1 coordinates
    of the union-ed region when determining the new screen_pixmap size.

    Cc: Nikhil Mahale <nmahale@nvidia.com>
    Cc: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Dave Airlie <airlied@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backported from X.org (and not-yet-enabled in NXAGENT_SERVER):

 commit a46afee84d45fbff4e4dad9376afc95bbcc31d7c
 Author: Hans de Goede <hdegoede@redhat.com>
 Date:   Tue Nov 22 14:53:20 2016 +0100

    randr: rrCheckPixmapBounding: do not shrink the screen_pixmap

    The purpose of rrCheckPixmapBounding is to make sure that the
    screen_pixmap is *large* enough for the slave-output which crtc is
    being configured.

    However until now rrCheckPixmapBounding would also shrink the
    screen_pixmap in certain scenarios leading to various problems.

    For example: Take a laptop with its internalscreen on a slave-output and
    currently disabled and an external monitor at 1920x1080+0+0.
    Now lets say that we want to drive the external monitor at its native
    resolution of 2560x1440 and have the internal screen mirror the top left
    part of the external monitor, so we run:

      $ xrandr --output eDP --mode 1920x1080 --pos 0x0 --output HDMI \
      --mode 2560x1440 --pos 0x0

    Here xrandr utility first calls RRSetScreenSize to 2560x1440, then it
    calls RRSetCrtc 1920x1080+0+0 on the eDP, since this is a slave output,
    rrCheckPixmapBounding gets called and resizes the screen_pixmap to
    1920x1080, undoing the RRSetScreenSize. Then RRSetCrtc 2560x1440+0+0
    gets called on the HDMI, depending on crtc->transforms this will
    either result in a BadValue error from ProcRRSetCrtcConfig; or
    it will succeed, but the monitor ends up running at 2560x1440
    while showing a 1920x1080 screen_pixmap + black borders on the right
    and bottom. Neither of which is what we want.

    This commit removes the troublesome shrinking behavior, fixing this.

    Note:

    1) One could argue that this will leave us with a too large screen_pixmap
    in some cases, but rrCheckPixmapBounding only gets called for slave
    outputs, so xrandr clients already must manually shrink the screen_pixmap
    after disabling crtcs in normal setups.

    2) An alternative approach would be to also call rrCheckPixmapBounding
    on RRSetCrtc on normal (non-slave) outputs, but that would result in
    2 unnecessary resizes of the screen_pixmap in the above example, which
    seems undesirable.

    Cc: Nikhil Mahale <nmahale@nvidia.com>
    Cc: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Dave Airlie <airlied@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backported from X.org:

 commit c96c860b6420adf0d004707a323af30491a1d7d3
 Author: Michal Srb <msrb@suse.com>
 Date:   Mon Dec 12 17:45:22 2016 +0200

    xinerama: Swap the response in RRXineramaWriteMonitor

    Reviewed-by: Adam Jackson <ajax@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backported from X.org (and not-yet-enabled in NXAGENT_SERVER):

 commit 555e0a42d138ac8d83af62638752a1bebad602d6
 Author: Qiang Yu <Qiang.Yu@amd.com>
 Date:   Tue Jan 10 18:51:55 2017 +0800

    randr: fix xserver crash when xrandr setprovideroutputsource

    xrandr --setprovideroutputsource <screen> <gpu screen>
    Xorg: ../../../xserver/dix/dispatch.c:4018: AttachOutputGPU:
    Assertion `new->isGPU' failed.

    GPUScreen is not allowed to be sink output.

    Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backported from X.org:

 commit f2e310132fbe1520c1b5f3da4faa2d2d47835e72
 Author: Aaron Plattner <aplattner@nvidia.com>
 Date:   Wed Oct 31 14:15:35 2007 -0700

    Add CreatePixmap allocation hints.

    These hints allow an acceleration architecture to optimize allocation of certain
    types of pixmaps, such as pixmaps that will serve as backing pixmaps for
    redirected windows.

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backported from X.org:

 commit f797c96845a3fab37cda6839ebecf9ac5401fd6e
 Author: Aaron Plattner <aplattner@nvidia.com>
 Date:   Thu Nov 15 12:12:02 2007 -0800

    Save pixmap allocation hints into the PixmapRec.

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backport from X.org:

 commit fd6c1bf0a3efced3ad4623dbd4716230a5f2419e
 Author: Dave Airlie <airlied@redhat.com>
 Date:   Thu May 24 16:03:19 2012 +0100

    dix: pixmap sharing infrastructure (v3)

    This is a hooks for pixmap sharing and tracking.

    The pixmap sharing ones get an integer handle for the pixmap
    and use a handle to be the backing for a pixmap.

    The tracker interface is to be used when a GPU needs to
    track pixmaps to be updated for another GPU.

    v2: pass slave to sharing so it can use it to work out driver.

    v3: use void * as per keithp's suggestion.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Partially pruned out of X.org commits:

 commit 987579c930bda803427a28cb82773c389f5110d6
 Author: Peter Hutterer <peter.hutterer@who-t.net>
 Date:   Wed Apr 22 13:26:40 2009 +1000

    dix: remove all but main() from main.c

    All other functions are pushed into where they seemed to fit.
    main.c is now linked separately into libmain.a and linked in by the various
    DDXs.

    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

 commit 3478af3374abffa0c226ee077fda1fcfc0751e74
 Author: Dave Airlie <airlied@redhat.com>
 Date:   Tue Jun 5 17:01:21 2012 +0100

    screen: split out screen init code. (v2)

    This is a precursor for reusing this code to init gpu screens.

    v2: fixup int check as per Keith's review.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 commit 6b5206e7cb8e5279816b48f014d47d3f03f16972
 Author: Daniel Stone <daniel@fooishbar.org>
 Date:   Fri Jul 18 15:38:10 2008 +0300

    dix: Remove insane BC hacks

    If your DDX needs a 1bpp mode and doesn't set it up, your DDX is
    incompetent.

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Extracted from X.org bulk commit:

 commit 1f0e8bd5eb1a5539689cfc4f5a6b86b530907ec5
 Author: Dave Airlie <airlied@redhat.com>
 Date:   Tue Jun 5 13:22:18 2012 +0100

    api: rework the X server driver API to avoid global arrays.

    This is a squash merge containing all the API changes, as
    well as the video ABI bump.

    Its been squashed to make bisection easier.

    Full patch log below:

    [...]

    commit 06729dbbc804a20242e6499f446acb5d94023c3c
    Author: Dave Airlie <airlied@gmail.com>
    Date:   Tue Apr 10 14:04:59 2012 +0100

        xserver: remove index from CloseScreen (API/ABI breakage)

        This drops the index from the CloseScreen callback,
        its always been useless really, since the pScreen contains it.

        Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
        Acked-by: Aaron Plattner <aplattner@nvidia.com>
        Reviewed-by: Adam Jackson <ajax@redhat.com>
        Signed-off-by: Dave Airlie <airlied@redhat.com>
 commit 1f0e8bd5eb1a5539689cfc4f5a6b86b530907ec5
 Author: Dave Airlie <airlied@redhat.com>
 Date:   Tue Jun 5 13:22:18 2012 +0100

    api: rework the X server driver API to avoid global arrays.

    This is a squash merge containing all the API changes, as
    well as the video ABI bump.

    Its been squashed to make bisection easier.

    Full patch log below:

    [...]

    commit 37c3ae3e6cd4f3dedc72f371096d6743f8f99df3
    Author: Dave Airlie <airlied@redhat.com>
    Date:   Wed May 23 15:09:12 2012 +0100

        dix: make Create/Free scratch pixmaps take a ScreenPtr

        While technically an API/ABI change I doubt anyone uses it,
        but it helps in splitting screens up.

        Reviewed-by: Keith Packard <keithp@keithp.com>
        Signed-off-by: Dave Airlie <airlied@redhat.com>

    [...]

    Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backports from X.org:

 commit 9d179818293b466ec6f1777f0b792e1fbbeb318c
 Author: Dave Airlie <airlied@redhat.com>
 Date:   Tue Jun 5 17:09:38 2012 +0100

    dix: introduce gpu screens. (v5)

    This patch introduces gpu screens into screenInfo. It adds interfaces
    for adding and removing gpu screens, along with adding private fixup,
    block handler support, and scratch pixmap init.

    GPU screens have a myNum that is offset by GPU_SCREEN_OFFSET (256),
    this is used for logging etc.

    RemoveGPUScreen isn't used until "xfree86: add platform bus hotplug support".

    v2: no glyph pictures for GPU screens for now.
    v3: introduce MAXGPUSCREENS, fix return value check
    v4: fixup myNum when renumbering screens (ajax)
    v5: drop cursor privates for now.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

 commit 288b87e42cbb5db34cda848143655e84af8455da
 Author: Keith Packard <keithp@keithp.com>
 Date:   Tue Aug 7 17:49:47 2012 -0700

    Close GPU screens before core screens

    This should make cleaning up the GPU screens easier as the core
    screens they are associated with will still be around.

    Signed-off-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Dave Airlie <airlied@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 commit 4caad34c932115dc0a9fd9c2995ebb2d38b9359c
 Author: Dave Airlie <airlied@redhat.com>
 Date:   Wed Jun 13 14:27:42 2012 +0100

    dix: add unattached list for attaching screens to initially. (v1.1)

    This list is meant for attaching unbound gpu screens to initially,
    before the client side rebinds them.

    v1.1: add another assert in the add path.

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Done by partially backporting the below X.org commit and unifdef'ing
 the scanout pixmap support in the already plainly copied in RandR 1.5 code:

 commit f2da2c12042d3447b1c954e7301632d174a08b4f
 Author: Dave Airlie <airlied@redhat.com>
 Date:   Wed Jun 20 12:37:12 2012 +0100

    randr: add initial scanout pixmap support (v3)

    When randr notices a crtc configuration request for a slave device,
    it checks if the slave allocated pixmap exists and is suitable,
    if not it allocates a new shared pixmap from the master, shares
    it to the slave, and starts the master tracking damage to it,
    to keep it updated from the current front pixmap.

    If the resize means the crtc is no longer used it will destroy
    the slave pixmap.

    This adds the concept of a scanout_pixmap to the randr_crtc object,
    and also adds a master pixmap pointer to the pixmap object, along
    with defining some pixmap helper functions for getting pixmap box/regions.

    v2: split out pixmap sharing to a separate function.

    v3: update for void *

    Reviewed-by: Keith Packard <keithp@keithp.com>
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backport from X.org:

 commit 1bdbc7e764ed7bf7c1ae46287dec368aa7c7e80d
 Author: Alex Goins <agoins@nvidia.com>
 Date:   Thu Jun 16 20:06:47 2016 -0700

    randr/xf86: Add PRIME Synchronization / Double Buffer

    Changes PRIME to use double buffering and synchronization if all required
    driver functions are available.

    rrcrtc.c:
        Changes rrSetupPixmapSharing() to use double buffering and
        synchronization in the case that all required driver functions are
        available. Otherwise, falls back to unsynchronized single buffer.

        Changes RRCrtcDetachScanoutPixmap() to properly clean up in the case of
        double buffering.

        Moves StopPixmapTracking() from rrDestroySharedPixmap() to
        RRCrtcDetachScanoutPixmap().

        Changes RRReplaceScanoutPixmap() to fail if we are using double buffering,
        as it would need a second ppix parameter to function with double buffering,
        and AFAICT no driver I've implemented double buffered source support in uses
        RRReplaceScanoutPixmap().

    randrstr.h:
        Adds scanout_pixmap_back to struct _rrCrtc to facilitate PRIME
        double buffering.

    xf86Crtc.h:
        Adds current_scanout_back to _xf86Crtc to facilitate detection
        of changes to it in xf86RandR12CrtcSet().

    xf86RandR12.c:
        Changes xf86RandR12CrtcSet() to detect changes in
        scanout_pixmap_back.

        Adds scanout_pixmap_back to struct _rrCrtc to facilitate PRIME double
        buffering.

    v1: Initial commit
    v2: Rename PresentTrackedFlippingPixmap to PresentSharedPixmap
    v3: Refactor to accomodate moving (rr)StartFlippingPixmapTracking and
        (rr)(Enable/Disable)SharedPixmapFlipping to rrScrPrivRec from ScreenRec
        Add fallback if flipping funcs fail
    v4: Detach scanout pixmap when destroying scanout_pixmap_back, to avoid
        dangling pointers in some drivers
    v5: Disable RRReplaceScanoutPixmap for double-buffered PRIME, it would need an
        ABI change with support for 2 pixmaps if it were to be supported, but AFAICT
        no driver that actually supports double-buffered PRIME uses it.
        Refactor to use rrEnableSharedPixmapFlipping() as a substitute for
        rrCrtcSetScanoutPixmap() in the flipping case.
        Remove extraneous pSlaveScrPriv from DetachScanoutPixmap()
        Remove extraneous protopix and pScrPriv from rrSetupPixmapSharing()
    v6: Rebase onto ToT
    v7: Unchanged

    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Alex Goins <agoins@nvidia.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
AlexGoinsNV and others added 3 commits March 11, 2017 01:44
 commit b601f96a5915a2c486b389483b291797e6fdf617
 Author: Alex Goins <agoins@nvidia.com>
 Date:   Thu Jun 16 20:06:46 2016 -0700

    xf86: Add PRIME flipping functions to Screen

    Adds typedefs for (*RRStartFlippingPixmapTrackingProcPtr),
    (*RREnableSharedPixmapFlippingProcPtr),
    and (*RRDisableSharedPixmapFlippingProcPtr) in randrstr.h.

    Adds typedefs for (*PresentSharedPixmapProcPtr),
    (*SharedPixmapNotifyDamageProcPtr),
    (*RequestSharedPixmapNotifyDamageProcPtr), and
    (*StopFlippingPixmapTrackingProcPtr) in scrnintstr.h.

    Adds RR(Enable/Disable)SharedPixmapFlipping, and
    RRStartFlippingPixmapTracking to rrScrnPrivRec.

    Adds StopFlippingPixmapTracking, PresentSharedPixmap,
    SharedPixmapNotifyDamage, and RequestSharedPixmapNotifyDamage to ScreenRec.

    rrScrnPrivRec used for functions that use RandR-private data types, and
    ScreenRec used for the rest.

    RREnableSharedPixmapFlipping will allow the sink driver to setup for
    flipping between two shared pixmaps.

    RRDisableSharedPixmapFlipping will allow the sink driver to do teardown
    associated with flipping between two shared pixmaps.

    (RRStart/Stop)FlippingPixmapTracking are merely the double-buffered
    equivalents of (Start/Stop)PixmapTracking, allowing the source driver to do
    whatever setup and teardown necessary for presenting on the two shared
    pixmaps.

    PresentSharedPixmap is a function exposed by the source driver for the X
    server or sink driver to call to request a present on a given shared
    pixmap.  This way, presents can be driven by the sink's vblank instead of a
    timer or similar mechanism.

    SharedPixmapNotifyDamage and RequestSharedPixmapNotifyDamage are OPTIONAL
    (even for double-buffered PRIME) functions exposed by the sink driver and
    the source driver, respectively. By calling
    master->RequestSharedPixmapNotifyDamage(ppix), the sink driver can request
    for the source driver to call slave->SharedPixmapNotifyDamage(ppix) in
    response to damage on the master screen pixmap tracked by ppix.

    v1: Initial commit
    v2: Rename PresentTrackedFlippingPixmap to PresentSharedPixmap
        Add SharedPixmapNotifyDamage / RequestSharedPixmapNotifyDamage
    v3: Add RRCrtcPtr as a parameter to StartFlippingPixmapTracking
        Move functions that use RandR-private data types to rrScrnPrivRec.
    v4: Unchanged
    v5: Add front and back parameters to RREnableSharedPixmapFlippingProcPtr
    v6: Rebase onto ToT
    v7: Unchanged

    Reviewed-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Alex Goins <agoins@nvidia.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backport from X.org

 commit df8e86931eb19c196ed2afc85d89525ef8cb711b
 Author: agoins <agoins@nvidia.com>
 Date:   Thu Jun 16 20:06:48 2016 -0700

    randr: Add ability to turn PRIME sync off

    Adds an output parameter to disable PRIME synchronization.

    Output parameter is created when the user calls 'xrandr
    --setprovideroutputsource <sink> <source>' to prevent polluting output
    parameters of non-PRIME configurations.

    Defaults to on, so if the user wants PRIME synchronization they don't need
    to do anything.

    If the user wishes to disable PRIME synchronization when they first set up
    PRIME, they can run 'xrandr --output <output> --set "PRIME Synchronization"
    0' after running 'xrandr --setprovideroutputsource <sink> <source>', but
    before 'xrandr --auto'.

    If the user wishes to enable or disable PRIME synchronization after PRIME has
    already been set up, they can run 'xrandr --output <output> --set "PRIME
    Synchronization" <0 or 1>' at any time, xrandr will trigger a modeset, which
    will tear down and setup PRIME in the configuration they requested on CRTCs
    associated with that output.

    randrstr.h:
        Add central definition of the output property name.

    rrcrtc.c:
        Add function rrGetPixmapSharingSyncProp() to query the status of the
        output property.

        Add function rrSetPixmapSharingSyncProp() to set the output property.

        Add 'sync' parameter to rrSetupPixmapSharing(), which when false will
        use single buffering even if the required ABI functions are supported.
        Changes rrSetupPixmapSharing() to only report an error if falling back
        to single buffering when the user requested synchronization.

        Change RRCrtcSet() to use rrPixmapSharingSyncProp() to query the status
        of the output property and feed it into rrSetupPixmapSharing() using
        the 'sync' parameter.

    rrprovider.c:
        Add RR(Init/Fini)PrimeSyncProps(), functions to create and destroy the
        PRIME synchronization output property.

        Add a call to RRInitPrimeSyncProps() in
        ProcRRSetProviderOutputSource(), such that the output property is
        created when the user requests PRIME.

        Add a call to RRFiniPrimeSyncProps() in RRProviderDestroy().

    v1: Initial commit
    v2: Unchanged
    v3: Add /* TODO */ for handling different sources with different outputs
        Make rrSetupPixmapSharing() set the output property to 0 if it has to fall
        back, to avoid user confusion.
        Make rr(Get)PixmapSharingSyncProp() check the current value if there isn't a
        pending value
    v4: Unchanged
    v5: Unchanged
    v6: Rebase onto ToT
    v7: Unchanged

    Signed-off-by: Alex Goins <agoins@nvidia.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
 Backport from X.org:

 commit 2eefb53f58854ef9d34859583207ec37d3c3047a
 Author: Hans de Goede <hdegoede@redhat.com>
 Date:   Tue Sep 6 13:15:36 2016 +0200

    randr: Add RRHasScanoutPixmap helper function

    This is a preparation patch for adding prime hw-cursor support.

    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

 Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
@sunweaver sunweaver added this to the 3.6.1.0 milestone Mar 11, 2017
@sunweaver sunweaver self-assigned this Mar 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants