commit cf1767a9a58a3ec95622a7b8ca661113e2148da9
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Sep 8 16:19:48 2017 +0900

    Bump version for 1.4.0 release

commit 114de91e3548cd30b709b19f1447f597e71175e0
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Aug 31 17:59:08 2017 +0900

    Require xserver >= 1.13
    
    xserver 1.13.0 was released on September 6th, 2012, almost 5 years ago.
    
    This allows cleaning up a bunch of backwards compatibility code.
    
    (Ported from radeon commit 5cdd334b3402c2431deb3a87a8d04ef590da53ee)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 456e5841233a8a79c23ad13649bbdaf8428b50f3
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Aug 30 17:17:49 2017 +0900

    Use a timer for unreferencing the all-black FB
    
    The timer fires 1 second after LeaveVT. This gives the next DRM master
    enough time to set up scanout of its own buffers.
    
    Fixes prolonged intermittent black screen when switching from Xorg to
    e.g. the GDM Wayland mode login VT.
    
    Fixes: c16ff42f927d ("Make all active CRTCs scan out an all-black
                          framebuffer in LeaveVT")
    (Ported from radeon commit 9d9c565c84601f4c6c73ad769f86491088683f7a)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 639076efb06cdf13a211a8df1acb00c3908992b9
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Aug 29 17:24:18 2017 +0900

    Remove drmmode_scanout_free
    
    Not used anymore.
    
    (Cherry picked from radeon commit e4a3df19d588a4310fcb889ef34e205d0e92e4d7)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit c16ff42f927df805619a5255bc383841474daff8
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Aug 29 17:06:58 2017 +0900

    Make all active CRTCs scan out an all-black framebuffer in LeaveVT
    
    And destroy all other FBs. This is so that other DRM masters can only
    get access to this all-black FB, not to any other FB we created, while
    we're switched away and not DRM master.
    
    Fixes: b09fde0d81e0 ("Use reference counting for tracking KMS
                          framebuffer lifetimes")
    (Ported from radeon commit 06a465484101f21e99d3a0a62fb03440bcaff93e)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 19672625df0531c12acc05999ea09ea763e5db59
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Aug 29 17:05:19 2017 +0900

    Create amdgpu_master_screen helper
    
    Preparatory, no functional change intended yet.
    
    (Ported from radeon commit 7f0cd68d1b0c132e32ae736371bce3e12ed33c7a)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 6b376c8d73b20c92755527edb0527a233886e4eb
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Aug 29 16:56:56 2017 +0900

    Create amdgpu_pixmap_get_fb_ptr helper
    
    Preparatory, no functional change intended yet.
    
    Also inline amdgpu_pixmap_create_fb into amdgpu_pixmap_get_fb, since
    there's only one call-site.
    
    (Ported from radeon commit 20f6b56fdb74d88086e8e094013fedbb14e50a24)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 5af396253f6a03fa3f8f92e81da231dd581b50c9
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Aug 29 16:54:10 2017 +0900

    Create drmmode_set_mode helper
    
    Preparatory, no functional change intended yet.
    
    (Ported from radeon commit 4bc992c31059eb50e22df4ebf5b92d08411f41ef)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 1afd4a526c97e77ec882988e35d4977880b9d16c
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Aug 29 16:46:33 2017 +0900

    Create amdgpu_pixmap_clear helper
    
    Preparatory, no functional change intended yet.
    
    (Ported from radeon commit 3f6210ca2c8ef60d59efc8139151d3b9838bb875)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 0de05767adb79d417284dae83e9a77857633fd80
Author: Martin Peres <martin.peres@linux.intel.com>
Date:   Tue Aug 22 18:43:24 2017 +0900

    modesetting: re-set the crtc's mode when link-status goes BAD
    
    Despite all the careful planning of the kernel, a link may become
    insufficient to handle the currently-set mode. At this point, the
    kernel should mark this particular configuration as being broken
    and potentially prune the mode before setting the offending connector's
    link-status to BAD and send the userspace a hotplug event. This may
    happen right after a modeset or later on.
    
    Upon receiving a hot-plug event, we iterate through the connectors to
    re-apply the currently-set mode on all the connectors that have a
    link-status property set to BAD. The kernel may be able to get the
    link to work by dropping to using a lower link bpp (with the same
    display bpp). However, the modeset may fail if the kernel has pruned
    the mode, so to make users aware of this problem a warning is outputed
    in the logs to warn about having a potentially-black display.
    
    This patch does not modify the current behaviour of always propagating
    the events to the randr clients. This allows desktop environments to
    re-probe the connectors and select a new resolution based on the new
    (currated) mode list if a mode disapeared. This behaviour is expected in
    order to pass the Display Port compliance tests.
    
    (Ported from xserver commit bcee1b76aa0db8525b491485e90b8740763d7de6)
    
    [ Michel: Bump libdrm dependency to >= 2.4.78 for
      DRM_MODE_LINK_STATUS_BAD ]
    (Ported from radeon commit 0472a605e0ec8fec1892bbc3a84698b7ef9c5296)
    Acked-by: Harry Wentland <harry.wentland@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit a2ee5c36c7d4fdcd067fdc1ef424be474f1ad2cb
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 17:24:45 2017 +0900

    Make amdgpu_scanout_do_update take a PixmapPtr instead of a DrawablePtr
    
    All callers were already passing in a pixmap.
    
    This allows simplifying the rotated scanout case slightly.
    
    (Ported from radeon commit d822a0f47070374ad0c1a97b559bae27724dc52a)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 828fb44cf953f78bd65d8f391bdabe2b1b3d53ae
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 17:22:12 2017 +0900

    Use xorg_list_append for the DRM event list
    
    We were adding entries at the start of the list, i.e. the list was
    ordered from most recently added to least recently added. However, the
    corresponding DRM events are generally expected to arrive in the same
    order as they are queued, which means that amdgpu_drm_queue_alloc would
    generally have to traverse the whole list to find the entry
    corresponding to an arrived event. Fix this by adding entries at the end
    of the list.
    
    (Ported from radeon commit 3e24770b1b472fc15df56d06f5f04778c9db63dd)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 22740f86d028cdd0f556543df7444516a86f923b
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 17:15:54 2017 +0900

    Consolidate amdgpu_scanout_flip_abort/handler helpers
    
    While at it, make them use crtc->driver_private.
    
    (Ported from radeon commit 36ce7920136c0d723c9397a84e7dd5926a9c7943)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 2692508ae8920ce62f488a9384444c1645964913
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 17:12:15 2017 +0900

    Always allow DRI2 page flipping with TearFree
    
    Even if TearFree is enabled for the CRTC we're synchronizing to.
    
    (Ported from radeon commit d314cbfb228bb4b8762714f98d0c114a8ee3f061)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 8c82878c6ef1b984ba289383dc17152192c916ee
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 16:57:13 2017 +0900

    Always allow Present page flipping with TearFree
    
    Even if TearFree is active for the the CRTC we're synchronizing to. In
    that case, for Present flips synchronized to vertical blank, the other
    scanout buffer is immediately synchronized and flipped to during the
    target vertical blank period. For Present flips not synchronized to
    vertical blank, we simply use the MSC and timestamp values of the last
    vertical blank period for timing purposes, and let the normal TearFree
    mechanism handle display updates.
    
    (Ported from radeon commit 4445765af5b97d0cfd10889fe6d6f58f2ce85659)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit d8e8f0107bb3e83a787917f4db16a7a54ce4768b
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 16:46:18 2017 +0900

    Pass extents to amdgpu_scanout_do_update
    
    Preparation for following change, no functional change intended yet.
    
    (Ported from radeon commit 65e0c5ea1b4adff21d673dbf54af99704c429627)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit cc1dfb88eb6714fcdcb9b576a70f400a5d0d58ca
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 16:34:50 2017 +0900

    Add source drawable parameter to amdgpu_scanout_do_update
    
    Preparation for following changes, no functional change intended yet.
    
    (Ported from radeon commit 1443270e52e8562bd8dc3603f301963bd4027cef)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit b82d1b6063a36facc9cdd0e0189fdb6932be94e2
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 16:23:39 2017 +0900

    Handle multiple "pending" Present flips
    
    The xserver Present code can submit a flip in response to notifying it
    that a vblank event arrived. This can happen before the completion event
    of the previous flip is processed. In that case, we were clearing the
    drmmode_crtc->flip_pending field prematurely.
    
    Prevent this by only clearing drmmode_crtc->flip_pending when it matches
    the framebuffer being scanned out since the flip whose completion event
    we're processing.
    
    (Ported from radeon commit 7c10ee9c88378d773c0bcf651fdc5d9f2c6dc5e5)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 2cbe7f2dff5eef159486f875b3ec67516c85862d
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 16:13:17 2017 +0900

    Wait for pending flips synchronously before turning off a CRTC
    
    Allows removing drmmode_clear_pending_flip and the pending_dpms_mode
    field and cleaning up the code considerably.
    
    (Ported from radeon commit e6d7dc2070f4d21a6900916bb70a31839112882c)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit e8d0bfab276d47338c337955b9d2fcbff3af225f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 16:11:41 2017 +0900

    Create drmmode_crtc_wait_pending_event helper macro
    
    Preparation for following change, no functional change intended yet.
    
    (Ported from radeon commit f87acdbfb1b0b6d2769764772a52ea8b81675e20)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit fd5b78b7edff2021111bca37642b8b508f0c3328
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 15:12:35 2017 +0900

    Create drmmode_wait_vblank helper
    
    Allows cleaning up the code considerably.
    
    (Ported from radeon commit 99f1d7a474af3683fe1a66f50c0bb8935478ff0a)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 24b2718992e4bbc859c07e5b29b571f53314045d
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 15:03:52 2017 +0900

    Pass reference CRTC to amdgpu_do_pageflip directly
    
    Simplifies the code slightly.
    
    (Ported from radeon commit 49cc61ab970ee28d4509b4e2dd0a57165136889f)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 87a1f577f1de62f6b628bbe221cd8d551531e708
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Aug 18 14:56:10 2017 +0900

    Remove drmmode_crtc->scanout_destroy[] array
    
    No longer necessary since we're reference counting framebuffers.
    
    (Ported from radeon commit 3f120fa1d5d921656a367751bc079e020e9ab105)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit e15b23663cd1a6f85394253b3fb566b55828b1c5
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Apr 18 18:21:24 2017 +0900

    Adapt to PixmapDirtyUpdateRec::src being a DrawablePtr

commit 9caa9dd9cc5eb9882c4bb85275bc318948dab71f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Aug 2 19:07:40 2017 +0900

    Allow DRI page flipping when some CRTCs use separate scanout buffers
    
    As long as the CRTC we're synchronizing to doesn't.
    
    (Ported from radeon commit 5309bde0c4e28adf2b167191c6d7011a19e31eed)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 4441c7c6dde2d71bd44c3031c5679ee3186ea8f9
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Aug 1 17:29:16 2017 +0900

    Add drmmode_crtc_can_flip helper
    
    To reduce code duplication between DRI2 and Present. No functional
    change intended yet.
    
    (Ported from radeon commit 9bc3eef74452d924f9101c024f66ad9b14c404c8)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 3e08409344a2fd504429522507592f98555bec05
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Aug 2 19:03:40 2017 +0900

    Use root window (pixmap) instead of screen pixmap for scanout updates
    
    Preparation for following changes, no functional change intended yet.
    
    (Ported from radeon commit c2d26890691ec105858f086b63170ad94c6f7f05)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 35106fc0a948957cbb7e1e9649c89993a3d5c95c
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Jul 27 15:22:02 2017 +0900

    Only handle reflection in the driver with Xorg < 1.16
    
    Xorg doesn't handle the hardware cursor correctly in that case for
    rotation and general transforms, and we can't force the SW cursor.
    
    Fixes: ba2aa0a8c12a ("Handle rotation in the driver also with Xorg
                          1.12-1.18")
    (Cherry picked from radeon commit 7d7abf99b5441ddb04dbee99bc8fa7abc30d4c46)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit a47c0093338d80d84e7033ad15d051925d542ca0
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Jul 26 16:46:14 2017 +0900

    autogen.sh: Pass -f to autoreconf
    
    To ensure that any existing copies of autotools files will be replaced
    with the current versions.
    
    Acked-by: Alex Deucher <alexander.deucher@amd.com>

commit 842bad4b951296ca25f47b50cb358e502bf30ebb
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Jul 26 16:44:00 2017 +0900

    Makefile.am: Set ACLOCAL_AMFLAGS = -I m4
    
    Suggested by one of the tools called by autoreconf.
    
    Acked-by: Alex Deucher <alexander.deucher@amd.com>

commit 227b399badaad9bbef0be5a776ce008d0d243449
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Jul 26 16:42:58 2017 +0900

    Add AC_CONFIG_MACRO_DIRS([m4]) to configure.ac
    
    Suggested by one of the tools called by autoreconf.
    
    Acked-by: Alex Deucher <alexander.deucher@amd.com>

commit 4d36306bcebb8548455a21eae6a7216a9439d9e4
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Jul 13 17:40:58 2017 +0900

    If a TearFree flip fails, fall back to non-TearFree operation
    
    In order to avoid possible freeze / log file spam in that case.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99769
    (Ported from radeon commit 94dc2b80f3ef0b2c17c20501d824fb0447d52e7a)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 88147c1a532a9275eb57e14d8c11be41bf4c1fe1
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Jul 13 17:35:55 2017 +0900

    Use drmmode_crtc->scanout_id instead of 0 to check for scanout buffer
    
    Preparation for following change, no functional change intended.
    
    (Ported from radeon commit aff267ee36cc6a703a532f91f82adc1ba1425ff3)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit e90721ba654d70db5eeb1cf552308c73151530ee
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Jun 27 18:13:05 2017 +0900

    Only call drmmode_scanout_free for non-GPU screens in LeaveVT
    
    Destroying the scanout buffers of GPU screens resulted in a crash when
    switching back to the Xorg VT.
    
    Fixes: b10ecdbd89b0 ("Use drmmode_crtc_scanout_* helpers for RandR 1.4
                          scanout pixmaps")
    (Ported from radeon commit c9dd28cb0c9c3de676eadac61e727732510f6b9b)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 1b6ff5fd9933c00ec1ec90dfc62e0b531927749b
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Jun 22 16:27:32 2017 +0900

    Improve drmmode_fb_reference debugging code
    
    If a reference count is <= 0, call FatalError with the call location
    (in case it doesn't get resolved in the backtrace printed by
    FatalError).
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit af7221e1c4d2dbdfd488eb0976a835584ea8441c
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Jun 21 19:01:54 2017 +0900

    Increase reference count of FB assigned to drmmode_crtc->flip_pending
    
    Otherwise, it could happen that we destroy the FB before the flip
    completes, resulting in use-after-free and most likely a crash.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 184d50e008b9b31f4dda1425e255af068b6ab068
Author: Adam Jackson <ajax@redhat.com>
Date:   Tue Jun 13 09:36:21 2017 -0400

    modesetting: Validate the atom for enum properties
    
    The client could have said anything here, and if what they said doesn't
    actually name an atom NameForAtom() will return NULL, and strcmp() will
    be unhappy about that.
    
    [copied from xserver d4995a3936ae283b9080fdaa0905daa669ebacfc]
    
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>

commit bbdac40e2af472d37aa0f4f26df77a0b1b12a830
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Jun 8 10:46:26 2017 +0900

    Improve AMDGPUPreInitAccel_KMS log messages
    
    Now it should always be clear in the log file why acceleration isn't
    enabled.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit b09fde0d81e07fbe96139289098b4d4b9f5e3c35
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu May 11 19:04:11 2017 +0900

    Use reference counting for tracking KMS framebuffer lifetimes
    
    References are held by the pixmaps corresponding to the FBs (so
    the same KMS FB can be reused as long as the pixmap exists) and by the
    CRTCs scanning out from them (so a KMS FB is only destroyed once it's
    not being scanned out anymore, preventing intermittent black screens and
    worse issues due to a CRTC turning off when it should be on).
    
    v2:
    * Only increase reference count in drmmode_fb_reference if it was sane
      before
    * Make drmmode_fb_reference's indentation match the rest of
      drmmode_display.h
    
    (Ported from radeon commit 55e513b978b2afc52b7cafc5bfcb0d1dc78d75f6)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 000e5eaeb20607508c5c5371654615a30a8a1b0b
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed May 24 10:12:55 2017 +0900

    Update URLs
    
    * Point to the amd-gfx mailing list
    * Specify the component in all bugzilla URLs
    * Use https:// for all HTML URLs
    
    (Ported from radeon commit d80d01a73c2eaba2e3649b7bc0a3541b3ff782f6)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 2ea2d4d827f086098be198f110ca822ed2c290cd
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri May 12 19:01:18 2017 +0900

    Simplify tracking of PRIME scanout pixmap
    
    Remember the shared pixmap passed to drmmode_set_scanout_pixmap for each
    CRTC, and just compare against that.
    
    Fixes leaving stale entries in ScreenRec::pixmap_dirty_list under some
    circumstances, which would usually result in use-after-free and a crash
    down the line.
    
    (Ported from radeon commit 7dc68e26755466f9056f8c72195ab8690660693d)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 8cb41b962eb06b9cb1b3a573a4087e4d89f733fb
Author: Eric Anholt <eric@anholt.net>
Date:   Wed May 17 16:11:52 2017 +0900

    Use plain glamor_egl_create_textured_screen().
    
    Since 5064ffab631 (2014), glamor's implementation of _ext just drops the
    back_pixmap arg, which we were passing NULL (the default) to anyway.
    
    Signed-off-by: Eric Anholt <eric@anholt.net>
    Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
    (Ported from radeon commit 2b7d77b90108911777a11ecaa63435552000c958)

commit e900e48a11a93cde7d8d2d7bdb4a15ec705c56b1
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed May 10 18:37:56 2017 +0900

    Don't enable DRI3 without glamor
    
    Can't work currently. Fixes crash when trying to run a DRI3 client when
    glamor isn't enabled.
    
    Bugzilla: https://bugs.freedesktop.org/100968
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 462ac3341e5bfbded9086d3d9043821d19352b3e
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue May 2 17:58:55 2017 +0900

    Remove unused struct members from drmmode_display.h
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 82fa615f38137add75f9cd4bb49c48dd88de916f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue May 2 11:53:25 2017 +0900

    Apply gamma correction to HW cursor
    
    The display hardware CLUT we're currently using for gamma correction
    doesn't affect the HW cursor, so we have to apply it manually when
    uploading the HW cursor data.
    
    This currently only works in depth 24/32.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 981bac185cfd74ae50dffc28f57cf34623a9595f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 23 18:51:38 2017 +0900

    Don't set modes before AMDGPUWindowExposures_oneshot is called
    
    The root window contents may be undefined before that, so we don't want
    to show anything yet.
    
    Fixes a crash on startup with rotation and virtual resolution set in
    xorg.conf.
    
    Bugzilla: https://bugs.freedesktop.org/100276
    Fixes: ad53635af150 ("Move DPMS check from amdgpu_scanout_do_update to
                          amdgpu_scanout_flip")
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 51e17041cb89806c934c5cf795207940a6aaccfe
Author: Daniel Stone <daniels@collabora.com>
Date:   Mon Apr 10 17:36:01 2017 +0900

    Set correct DRM event context version
    
    DRM_EVENT_CONTEXT_VERSION is the latest context version supported by
    whatever version of libdrm is present. We were blindly asserting we
    supported whatever version that may be, even if we actually didn't.
    
    Set the version as 2, which should be bumped only with the appropriate
    version checks.
    
    Signed-off-by: Daniel Stone <daniels@collabora.com>
    (Ported from xserver commit 0c8e6ed85810e96d84173a52d628863802a78d82)
    v2: Remove second paragraph of commit log, we always initialize
            page_flip_handler2 = NULL (Emil Velikov)
    Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com> # v1

commit 67d155e62f5e09af242b0181527c162576dae02e
Author: Nicholas Molloy <nick.a.molloy@gmail.com>
Date:   Sun Mar 26 02:38:40 2017 +1300

    Fix a misspelling of 'acceleration' in amdgpu_kms.c
    
    Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

commit 165b51447643ce37f391f25ca6aecb8d76fabaa3
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Mar 22 18:58:32 2017 +0900

    manpage: Don't put "'" at the beginning of a line
    
    It caused the whole line to be dropped.
    
    Fixes: af0b24c1aca4 ("Allow toggling TearFree at runtime via output
                          property")
    Reported-by: Andy Furniss <adf.lists@gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 1b476d417f85fd1b97e813adbbf4970db07adf5c
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 23 18:03:56 2017 +0900

    Post-release version bump

commit 804e30e14e51f94403a0721ef2aae28f1fa9e9f2
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 16 17:28:11 2017 +0900

    Bump version for 1.3.0 release

commit 3a8582944ed3fef1b75f8871489e6e19963e2ea6
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 9 15:56:59 2017 +0900

    Pass TRUE to drmmode_set_desired_modes the first time for GPU screens
    
    This is the only place we call drmmode_set_desired_modes for GPU screens
    during server startup. Without this change, the display outputs of
    secondary GPUs may stay on even while Xorg isn't using them.
    
    (Ported from radeon commit 9a71445094b728f3d78db8f6808b4782ee19a453)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 82b15a4da156e18da4c8fc0093500c32b549e487
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 9 15:47:24 2017 +0900

    Skip some initialization steps for GPU screens
    
    Xorg doesn't use the following functionality of GPU screens, so don't
    bother initializing it:
    
    * DRI page flipping
    * DRI3 / Present / SYNC fences
    * XVideo / XvMC
    * Root window with background None
    
    (Ported from radeon commit 67ae5e00a748ad52cf92738d401afff2947b1891)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit fa85331f0ce27e16a9338516518433955133840e
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Mar 7 18:02:29 2017 +0900

    glamor: Use glamor_finish when available
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 7884e38e94c2cbd6c205f556f2b31ad59b4089b4
Author: Hans De Goede <hdegoede@redhat.com>
Date:   Tue Oct 18 16:48:40 2016 +0200

    amdgpu_probe: Do not close server managed drm fds
    
    This fixes the xserver only seeing AMD/ATI devices supported by the amdgpu
    driver, as by the time xf86-video-ati gets a chance to probe them, the
    fd has been closed.
    
    This fixes e.g. Xorg not seeing the dGPU on a Lenovo Thinkpad E465 laptop
    with a CARRIZO iGPU and a HAINAN dGPU.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    
    v2: Rebased on top of new patch 1.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit a2c360fa1d33d6a5aa64c396197e119ff77d1379
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Mon Mar 6 18:59:23 2017 +0900

    Refactor amdgpu_kernel_close_fd helper
    
    Preparation for the following change.
    
    Assign pAMDGPUEnt->fd = -1 instead of 0 when we're not using the file
    descriptor anymore.
    
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 947017194d07e32876a43ee0efc45fdc71385748
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Mar 3 17:59:19 2017 +0900

    glamor: Don't flush in BlockHandler with Xorg >= 1.19
    
    This was only necessary with older versions for driving the FBO cache
    expiry mechanism.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 86907a5e4ce33154167b330570491f88218725d3
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Mon Mar 6 18:23:41 2017 +0900

    Only define transform_region for XF86_CRTC_VERSION >= 4
    
    Not used with older versions of Xorg. Fixes warning in that case:
    
    ../../src/amdgpu_kms.c:328:1: warning: ‘transform_region’ defined but not used [-Wunused-function]
     transform_region(RegionPtr region, struct pict_f_transform *transform,
     ^~~~~~~~~~~~~~~~
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 8d2b7d1758e3fcac520a18a0684c073f0ac62389
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Mon Mar 6 18:09:58 2017 +0900

    Use local implementation of RegionDuplicate for older xserver
    
    It was only added in xserver 1.15. Fixes build against older xserver.
    
    Reported-by: Pali Rohár <pali.rohar@gmail.com>
    (Ported from radeon commit 80cc892ee1ce54fad3cb7dd11bd9df18c359136f)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit cd73100114a18642d9c40f1df33cef8311e96a8b
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Mon Mar 6 18:07:19 2017 +0900

    Don't use pScrn->is_gpu in AMDGPUCreateScreenResources_KMS
    
    Looks like this snuck in accidentally.
    
    Brings us back in line with the radeon driver, and fixes the build
    against older versions of xserver which didn't have the is_gpu field
    yet.
    
    Fixes: 6bab8fabb37e ("Remove info->dri2.drm_fd and info->drmmode->fd")
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 351baa89b9b0ecfb6c666af3a2d10c559a9224a9
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Mar 3 16:44:15 2017 +0900

    Don't call amdgpu_glamor_flush in drmmode_copy_fb
    
    AMDGPUWindowExposures_oneshot takes care of it.
    
    (Ported from radeon commit d63881623f0686a66a2e3e3c1f84e496aa52ec6b)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit ad53635af150cda9b8da413be5a011d74f972ac7
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Mar 3 16:41:49 2017 +0900

    Move DPMS check from amdgpu_scanout_do_update to amdgpu_scanout_flip
    
    When amdgpu_scanout_do_update is called from
    drmmode_crtc_scanout_update, drmmode_crtc->pending_dpms_mode may still
    be != DPMSModeOn, e.g. during server startup.
    
    Fixes intermittently showing garbage with TearFree enabled.
    
    (Ported from radeon commit cc9d6b7db9c2078be1e530a64af6d517c6a42024)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 378bd05c849ad3092f138bdc8917d35d0b967389
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Mar 3 16:36:24 2017 +0900

    Call drmmode_set_desired_modes from a WindowExposures hook
    
    This is the earliest opportunity where the root window contents are
    guaranteed to be initialized, and prevents drmmode_set_mode_major from
    getting called before drmmode_set_desired_modes via AMDGPUUnblank ->
    drmmode_crtc_dpms. Also, in contrast to the BlockHandler hook, this is
    called when running Xorg with -pogo.
    
    Fixes intermittently showing garbage on server startup or after server
    reset.
    
    As a bonus, this avoids trouble due to higher layers (e.g. the tigervnc
    Xorg module) calling AMDGPUBlockHandler_oneshot repeatedly even after
    we set pScreen->BlockHandler = AMDGPUBlockHandler_KMS.
    
    Bugzilla: https://bugs.freedesktop.org/99457
    (Ported from radeon commits 0a12bf1085505017068dfdfd31d23133e51b45b9 and
    f0e7948e1c0e984fc27f235f365639e9cf628291)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 8d4d73e05ce34eb353daec7b2c0e7c844113c7de
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Mar 3 16:34:16 2017 +0900

    present: Flush before flipping
    
    This isn't necessary for DRI clients, but the Present extension can also
    be used for presenting normal pixmaps rendered to via the X11 protocol.
    
    (Ported from radeon commit 9035b6abea557828e672ee455f0c84e43da0906f)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 88725b68cad92418c9bb03cb7f20526ce238d64e
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Mar 3 16:30:27 2017 +0900

    present: Use async flip for unflip if possible
    
    In that case, unflip operations should finish faster in general.
    
    (Ported from radeon commit 0a4eb0e12f0c9c653cf4cea6fd62e1a507eb261c)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit b31489c086b4bc50c824e85fa26d97c0f43afb20
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Mar 3 16:28:41 2017 +0900

    present: Also flush before using a flip to unflip
    
    Not doing so might result in intermittently scanning out stale contents
    of the screen pixmap.
    
    (Ported from radeon commit 9a951a3e551db58ba50e7a594521ceac54d90615)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit f6a3c87c3097e8d5c1d2159bc90d6541a46ed8be
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Mar 3 16:26:26 2017 +0900

    present: Wait for GPU idle before setting modes for unflip
    
    To make sure the screen pixmap contents are up to date when it starts
    being scanned out.
    
    (Ported from radeon commit 244d4bc7f8c8f6bc90f49556c0b9344c8aa40295)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 012ffffb45119059f3610fb8fd6ae103186b3e3c
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Mar 3 16:22:39 2017 +0900

    present: Only call drmModeRmFB after setting modes for unflip
    
    Fixes display intermittently blanking when a modeset is used for unflip.
    
    (Ported from radeon commit 3ff29e5a14451916bc66b4e0028e9a317f0723f8)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit f4719bb473df897012f8830f46e99cb781d67b6f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Mar 3 16:19:11 2017 +0900

    Use drmmode_crtc_scanout_free in drmmode_fini
    
    We were leaking drmmode_crtc->scanout_damage, which caused trouble on
    server reset. Fixes server reset with active separate scanout pixmaps.
    
    (Cherry picked from radeon commit 0c29deb5a97d9a57e994cc0053c49ddf7aca6ecb)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit af0b24c1aca4cba2692d5aa410e63cb536478dbe
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 2 17:24:03 2017 +0900

    Allow toggling TearFree at runtime via output property
    
    Option "TearFree" now sets the default value of the output property.
    See the manpage update for details.
    
    TearFree is now enabled by default for outputs using rotation or other
    RandR transforms, and for RandR 1.4 slave outputs.
    
    (Ported from radeon commit 58cd1600057e41aade0106d4acf78e23eac6e44f)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 77853f02e5b879e7042f55c672cf2d8e6955309f
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 2 17:19:59 2017 +0900

    Factor out drmmode_crtc_scanout_update helper
    
    Cleanup in preparation for following change, no functional change
    intended.
    
    (Ported from radeon commit 305e2cbf335837a2ab6a24e9ff65815afe038296)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit d25cc3b2b3b2d257aea247b85fea405d7e84e5b1
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 2 17:15:03 2017 +0900

    Factor out amdgpu_prime_dirty_to_crtc helper
    
    Cleanup in preparation for the following change, no functional change
    intended.
    
    (Ported from radeon commit 649644a88347a6d03de68f8c41db03a82deeb23b)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit a6d363008e2b55f0aa6151be1a99f01b97870e91
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 2 17:13:06 2017 +0900

    Don't destroy current FB if drmModeAddFB fails
    
    It would probably result in a black screen.
    
    (Ported from radeon commit 1351e48efe7a2c28eab447e16f36a00fbd02ae48)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 53926db2355de0a324c205703a0377b498136f65
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 2 17:08:19 2017 +0900

    Fix flip event data leak if calloc or drmModeAddFB fails
    
    (Ported from radeon commit 481394e3c9f9f7d88bb66fe9ae8834c87952a8ab)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 45a8ec6257c370eecf43b6b8010863e37b704872
Author: Mihail Konev <k.mvc@ya.ru>
Date:   Thu Mar 2 17:04:36 2017 +0900

    autogen: add default patch prefix
    
    (Ported from radeon commit 8e6a4e96b7b27559e186f71b5547abb0a80b96dd)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit ba2aa0a8c12a2bea1e8be01ca3134b518d4cb0f2
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 2 16:55:38 2017 +0900

    Handle rotation in the driver also with Xorg 1.12-1.18
    
    We cannot use the HW cursor in that case, but in turn we get more
    efficient and less teary updates of rotated outputs.
    
    (Ported from radeon commit f2bc882f1c1082bed9f496cfab6c8f07a76bc122)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 7f3abf35a2e1225ffd6a777b23f6a7a6355c1691
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 2 16:47:06 2017 +0900

    Fold drmmode_crtc_scanout_allocate into drmmode_crtc_scanout_create
    
    Not used anywhere else anymore.
    
    (Ported from radeon commit ae921a3150f69c38b5b3c88a9e37d54fdf0d5093)
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

commit 03c2db3c67bf5ad3c0744add9e0bb611b6cd3df7
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Mar 2 16:42:04 2017 +0900

    Call drmmode_crtc_scanout_create in drmmode_crtc_shadow_allocate as well
    
    Calling drmmode_crtc_scanout_allocate in drmmode_crtc_shadow_allocate
    resulted in drmmode_crtc_scanout_create called from
    drmmode_crtc_shadow_create passing an uninitialized pitch value to
    drmmode_create_bo_pixmap.
    
    Fixes issues such as failure to allocate the scanout pixmap or visual
    corruption and GPUVM faults when attempting to use rotation with Xorg
    <1.19.
    
    Bugzilla: https://bugs.freedesktop.org/99916
