Hi, the X drivers for ATI and AMD video cards are updated and released simultanemously, given that they share a lot of code.
The patch below updates the 2 drivers to versions 19.1.0 which where recently released by X.Org. Apply to /usr/xenocara (or $XSRCDIR) using 'patch -p0 -E' and rebuild xenocara as per release(8) Please test and report. Index: driver/xf86-video-amdgpu/ChangeLog =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-amdgpu/ChangeLog,v retrieving revision 1.1.1.1 diff -u -p -u -r1.1.1.1 ChangeLog --- driver/xf86-video-amdgpu/ChangeLog 16 Apr 2019 01:49:01 -0000 1.1.1.1 +++ driver/xf86-video-amdgpu/ChangeLog 19 Oct 2019 16:10:58 -0000 @@ -1,3 +1,156 @@ +commit b467d2569a003da05ad222b0dc095bee5eec450a +Author: Michel Dänzer <mdaen...@redhat.com> +Date: Fri Oct 11 17:10:10 2019 +0200 + + Bump version for the 19.1.0 release + +commit a1b7263277c033e109629829c370c0e95978e061 +Author: Michel Dänzer <mdaen...@redhat.com> +Date: Thu Sep 26 15:56:59 2019 +0200 + + Don't unreference FBs of pixmaps from different screens in LeaveVT + + FindClientResourcesByType finds pixmaps from all screens, but trying to + process ones from other screens here makes no sense and likely results + in a crash or memory corruption. + + Fixes: c16ff42f927d ("Make all active CRTCs scan out an all-black + framebuffer in LeaveVT") + (Ported from radeon commit 2faaecc69b127248718e759c6c98c84d56dd1b6b) + +commit 5b8bc9fc505c551dcd9b0ed5ab835a49fa4f9fda +Author: Michel Dänzer <mdaen...@redhat.com> +Date: Wed Sep 18 12:55:45 2019 +0200 + + Don't set up black scanout buffer if LeaveVT is called from CloseScreen + + Avoids a crash described in + https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/43#note_223718 + + Reviewed-by: Alex Deucher <alexander.deuc...@amd.com> + +commit e6fce59a071220967fcd4e2c9e4a262c72870761 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Wed Jul 24 16:05:05 2019 +0200 + + present: Don't check pixmap pitch in check_flip with non-DC >= 3.34 + + The current non-DC kernel driver also handles flipping between different + pitches correctly. + + Reviewed-by: Nicholas Kazlauskas <nicholas.kazlaus...@amd.com> + +commit 5bb2580b266468f87843b5585ae64e056b63bb88 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Wed Jul 24 15:55:19 2019 +0200 + + present: Don't check pixmap pitch in check_flip with current DC + + Current DC handles flipping between different pitches correctly. + + Reviewed-by: Nicholas Kazlauskas <nicholas.kazlaus...@amd.com> + +commit ac66086613cbd0974b421cd5eda872adc15242ed +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Wed Jul 24 15:45:21 2019 +0200 + + present: Also check pixmap pitch in check_flip with current xserver + + The corresponding check in the xserver Present code was removed again, + because flipping between different pitches can work in some cases. + + Reviewed-by: Nicholas Kazlauskas <nicholas.kazlaus...@amd.com> + +commit 98f172eb2d2353e19edd8167f22215ce596811f8 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Mon Jul 29 18:54:24 2019 +0200 + + gitlab-ci: Use templates from wayland/ci-templates + + These are already used by xserver, Mesa and some other projects. + + Current Debian testing brings e.g. GCC 8.3.0 and clang 7.0.1. + +commit 87f41ace4920fd2069794211683659eb25b025a6 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Fri Jul 5 12:43:53 2019 +0200 + + Don't disable page flipping completely with SW cursor + + Even with SW cursor, page flipping can be used while no X cursor is + visible. + + Occurred to me in the context of xorg/xserver#828. + +commit 7d3fef72e0c871e1677e9e544f4cae5e238b5c52 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Thu May 9 17:39:49 2019 +0200 + + present: Check that we can get a KMS FB for flipping + + This can legitimately fail if the pixmap's storage is shared from + another device, e.g. when using PRIME render offloading. + +commit ea19a5207054bb159fc7fb6d88e0ceb10c3da010 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Thu Jun 6 11:02:15 2019 +0200 + + Remove dri2_drawable_crtc parameter consider_disabled + + All callers were passing TRUE. + + Reviewed-and-tested-by: Flora Cui <flora....@amd.com> + +commit 3109f088fdbd89c2ee8078625d4f073852492656 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Thu Jun 6 11:22:09 2019 +0200 + + dri2: Re-use previous CRTC when possible if pick_best_crtc returns NULL + + This way, the MSC will continue ticking at the rate of (the last mode + which was enabled for) that CRTC, instead of the client running + unthrottled. + + Reviewed-and-tested-by: Flora Cui <flora....@amd.com> + +commit fb06fb814700a47464abd756e1111dcc76d0d776 +Author: Flora Cui <flora....@amd.com> +Date: Wed May 29 14:18:50 2019 +0800 + + dri2: reply to client for WaitMSC request in any case + + otherwise client would wait for reply forever and desktop appears hang. + + Signed-off-by: Flora Cui <flora....@amd.com> + Acked-by: Feifei Xu <feifei...@amd.com> + Reviewed-by: Michel Dänzer <michel.daen...@amd.com> + +commit 4b17533fcb30842caf0035ba593b7d986520cc85 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Tue Apr 30 17:50:15 2019 +0200 + + dri3: Always flush glamor before sharing pixmap storage with clients + + Even if glamor_gbm_bo_from_pixmap / glamor_fd_from_pixmap themselves + don't trigger any drawing, there could already be unflushed drawing to + the pixmap whose storage we share with a client. + +commit bf61e6d7ac1a5754b1026d7f80acf25ef622c491 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Thu Apr 18 19:21:40 2019 +0200 + + Retry get_fb_ptr in get_fb + + If get_fb_ptr returns NULL, try again after pixmap_get_handle, it should + work then. + + Fixes spurious Present page flipping failures using "normal" pixmaps + which aren't shared with direct rendering clients, e.g. with a + compositor using the RENDER extension. + + Bugzilla: https://bugs.freedesktop.org/110417 + Reviewed-by: Alex Deucher <alexander.deuc...@amd.com> + commit bd4ffd4ebbdf1c43ab9e1ef9ba8b812fd2dde4a4 Author: Michel Dänzer <michel.daen...@amd.com> Date: Tue Mar 19 18:44:31 2019 +0100 Index: driver/xf86-video-amdgpu/configure =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-amdgpu/configure,v retrieving revision 1.2 diff -u -p -u -r1.2 configure --- driver/xf86-video-amdgpu/configure 16 Apr 2019 01:59:34 -0000 1.2 +++ driver/xf86-video-amdgpu/configure 19 Oct 2019 16:13:34 -0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xf86-video-amdgpu 19.0.1. +# Generated by GNU Autoconf 2.69 for xf86-video-amdgpu 19.1.0. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/AMDgpu>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='xf86-video-amdgpu' PACKAGE_TARNAME='xf86-video-amdgpu' -PACKAGE_VERSION='19.0.1' -PACKAGE_STRING='xf86-video-amdgpu 19.0.1' +PACKAGE_VERSION='19.1.0' +PACKAGE_STRING='xf86-video-amdgpu 19.1.0' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/AMDgpu' PACKAGE_URL='' @@ -1394,7 +1394,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xf86-video-amdgpu 19.0.1 to adapt to many kinds of systems. +\`configure' configures xf86-video-amdgpu 19.1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1465,7 +1465,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xf86-video-amdgpu 19.0.1:";; + short | recursive ) echo "Configuration of xf86-video-amdgpu 19.1.0:";; esac cat <<\_ACEOF @@ -1622,7 +1622,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xf86-video-amdgpu configure 19.0.1 +xf86-video-amdgpu configure 19.1.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2037,7 +2037,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xf86-video-amdgpu $as_me 19.0.1, which was +It was created by xf86-video-amdgpu $as_me 19.1.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2869,7 +2869,7 @@ fi # Define the identity of the package. PACKAGE='xf86-video-amdgpu' - VERSION='19.0.1' + VERSION='19.1.0' cat >>confdefs.h <<_ACEOF @@ -20012,7 +20012,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xf86-video-amdgpu $as_me 19.0.1, which was +This file was extended by xf86-video-amdgpu $as_me 19.1.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20078,7 +20078,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -xf86-video-amdgpu config.status 19.0.1 +xf86-video-amdgpu config.status 19.1.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Index: driver/xf86-video-amdgpu/configure.ac =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-amdgpu/configure.ac,v retrieving revision 1.1.1.1 diff -u -p -u -r1.1.1.1 configure.ac --- driver/xf86-video-amdgpu/configure.ac 16 Apr 2019 01:49:10 -0000 1.1.1.1 +++ driver/xf86-video-amdgpu/configure.ac 19 Oct 2019 16:10:58 -0000 @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-video-amdgpu], - [19.0.1], + [19.1.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/AMDgpu], [xf86-video-amdgpu]) Index: driver/xf86-video-amdgpu/src/amdgpu_dri2.c =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-amdgpu/src/amdgpu_dri2.c,v retrieving revision 1.1.1.1 diff -u -p -u -r1.1.1.1 amdgpu_dri2.c --- driver/xf86-video-amdgpu/src/amdgpu_dri2.c 16 Apr 2019 01:49:40 -0000 1.1.1.1 +++ driver/xf86-video-amdgpu/src/amdgpu_dri2.c 19 Oct 2019 16:10:59 -0000 @@ -414,18 +414,20 @@ static Bool amdgpu_dri2_get_crtc_msc(xf8 } static -xf86CrtcPtr amdgpu_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled) +xf86CrtcPtr amdgpu_dri2_drawable_crtc(DrawablePtr pDraw) { ScreenPtr pScreen = pDraw->pScreen; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - xf86CrtcPtr crtc = amdgpu_pick_best_crtc(pScrn, consider_disabled, + xf86CrtcPtr crtc = amdgpu_pick_best_crtc(pScrn, TRUE, pDraw->x, pDraw->x + pDraw->width, pDraw->y, pDraw->y + pDraw->height); - if (crtc && pDraw->type == DRAWABLE_WINDOW) { + if (pDraw->type == DRAWABLE_WINDOW) { struct dri2_window_priv *priv = get_dri2_window_priv((WindowPtr)pDraw); - if (priv->crtc && priv->crtc != crtc) { + if (!crtc) { + crtc = priv->crtc; + } else if (priv->crtc && priv->crtc != crtc) { CARD64 ust, mscold, mscnew; if (amdgpu_dri2_get_crtc_msc(priv->crtc, &ust, &mscold) && @@ -831,7 +833,7 @@ CARD32 amdgpu_dri2_extrapolate_msc_delay */ static int amdgpu_dri2_get_msc(DrawablePtr draw, CARD64 * ust, CARD64 * msc) { - xf86CrtcPtr crtc = amdgpu_dri2_drawable_crtc(draw, TRUE); + xf86CrtcPtr crtc = amdgpu_dri2_drawable_crtc(draw); /* Drawable not displayed, make up a value */ if (!crtc) { @@ -946,7 +948,7 @@ static int amdgpu_dri2_schedule_wait_msc ScrnInfoPtr scrn = xf86ScreenToScrn(screen); DRI2FrameEventPtr wait_info = NULL; uintptr_t drm_queue_seq = 0; - xf86CrtcPtr crtc = amdgpu_dri2_drawable_crtc(draw, TRUE); + xf86CrtcPtr crtc = amdgpu_dri2_drawable_crtc(draw); uint32_t msc_delta; uint32_t seq; CARD64 current_msc; @@ -1062,6 +1064,9 @@ static int amdgpu_dri2_schedule_wait_msc out_complete: if (wait_info) amdgpu_dri2_deferred_event(NULL, 0, wait_info); + else + DRI2WaitMSCComplete(client, draw, 0, 0, 0); + return TRUE; } @@ -1093,7 +1098,7 @@ static int amdgpu_dri2_schedule_swap(Cli { ScreenPtr screen = draw->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - xf86CrtcPtr crtc = amdgpu_dri2_drawable_crtc(draw, TRUE); + xf86CrtcPtr crtc = amdgpu_dri2_drawable_crtc(draw); uint32_t msc_delta; drmVBlankSeqType type; uint32_t seq; Index: driver/xf86-video-amdgpu/src/amdgpu_dri3.c =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-amdgpu/src/amdgpu_dri3.c,v retrieving revision 1.1.1.1 diff -u -p -u -r1.1.1.1 amdgpu_dri3.c --- driver/xf86-video-amdgpu/src/amdgpu_dri3.c 16 Apr 2019 01:49:41 -0000 1.1.1.1 +++ driver/xf86-video-amdgpu/src/amdgpu_dri3.c 19 Oct 2019 16:10:59 -0000 @@ -221,29 +221,13 @@ static int amdgpu_dri3_fd_from_pixmap(Sc AMDGPUInfoPtr info = AMDGPUPTR(scrn); if (info->use_glamor) { - Bool need_flush = TRUE; - int ret = -1; -#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,19,99,904,0) - struct gbm_bo *gbm_bo = glamor_gbm_bo_from_pixmap(screen, pixmap); + int ret = glamor_fd_from_pixmap(screen, pixmap, stride, size); - if (gbm_bo) { - ret = gbm_bo_get_fd(gbm_bo); - gbm_bo_destroy(gbm_bo); - - if (ret >= 0) - need_flush = FALSE; - } -#endif - - if (ret < 0) - ret = glamor_fd_from_pixmap(screen, pixmap, stride, size); - - /* glamor might have needed to reallocate the pixmap storage and - * copy the pixmap contents to the new storage. The copy - * operation needs to be flushed to the kernel driver before the - * client starts using the pixmap storage for direct rendering. + /* Any pending drawing operations need to be flushed to the + * kernel driver before the client starts using the pixmap + * storage for direct rendering. */ - if (ret >= 0 && need_flush) + if (ret >= 0) amdgpu_glamor_flush(scrn); return ret; Index: driver/xf86-video-amdgpu/src/amdgpu_kms.c =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-amdgpu/src/amdgpu_kms.c,v retrieving revision 1.1.1.1 diff -u -p -u -r1.1.1.1 amdgpu_kms.c --- driver/xf86-video-amdgpu/src/amdgpu_kms.c 16 Apr 2019 01:49:38 -0000 1.1.1.1 +++ driver/xf86-video-amdgpu/src/amdgpu_kms.c 19 Oct 2019 16:10:59 -0000 @@ -1537,7 +1537,6 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn int cpp; uint64_t heap_size = 0; uint64_t max_allocation = 0; - Bool sw_cursor; if (flags & PROBE_DETECT) return TRUE; @@ -1645,19 +1644,15 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn } if (!pScrn->is_gpu) { - sw_cursor = xf86ReturnOptValBool(info->Options, - OPTION_SW_CURSOR, FALSE); - info->allowPageFlip = xf86ReturnOptValBool(info->Options, OPTION_PAGE_FLIP, TRUE); - if (sw_cursor || info->shadow_primary) { + if (info->shadow_primary) { xf86DrvMsg(pScrn->scrnIndex, info->allowPageFlip ? X_WARNING : X_DEFAULT, "KMS Pageflipping: disabled%s\n", info->allowPageFlip ? - (sw_cursor ? " because of SWcursor" : - " because of ShadowPrimary") : ""); + " because of ShadowPrimary" : ""); info->allowPageFlip = FALSE; } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -2245,16 +2240,25 @@ Bool AMDGPUEnterVT_KMS(ScrnInfoPtr pScrn } static void -pixmap_unref_fb(void *value, XID id, void *cdata) +pixmap_unref_fb(PixmapPtr pixmap) { - PixmapPtr pixmap = value; - AMDGPUEntPtr pAMDGPUEnt = cdata; + ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen); struct drmmode_fb **fb_ptr = amdgpu_pixmap_get_fb_ptr(pixmap); + AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn); if (fb_ptr) drmmode_fb_reference(pAMDGPUEnt->fd, fb_ptr, NULL); } +static void +client_pixmap_unref_fb(void *value, XID id, void *pScreen) +{ + PixmapPtr pixmap = value; + + if (pixmap->drawable.pScreen == pScreen) + pixmap_unref_fb(pixmap); +} + void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn) { AMDGPUInfoPtr info = AMDGPUPTR(pScrn); @@ -2272,6 +2276,12 @@ void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn unsigned w = 0, h = 0; int i; + /* If we're called from CloseScreen, trying to clear the black + * scanout BO will likely crash and burn + */ + if (!pScreen->GCperDepth[0]) + goto hide_cursors; + /* Compute maximum scanout dimensions of active CRTCs */ for (i = 0; i < xf86_config->num_crtc; i++) { crtc = xf86_config->crtc[i]; @@ -2310,11 +2320,9 @@ void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn if (pScrn->is_gpu) { if (drmmode_crtc->scanout[0].pixmap) - pixmap_unref_fb(drmmode_crtc->scanout[0].pixmap, - None, pAMDGPUEnt); + pixmap_unref_fb(drmmode_crtc->scanout[0].pixmap); if (drmmode_crtc->scanout[1].pixmap) - pixmap_unref_fb(drmmode_crtc->scanout[1].pixmap, - None, pAMDGPUEnt); + pixmap_unref_fb(drmmode_crtc->scanout[1].pixmap); } else { drmmode_crtc_scanout_free(crtc); } @@ -2334,18 +2342,20 @@ void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn (!clients[i] || clients[i]->clientState != ClientStateRunning)) continue; - FindClientResourcesByType(clients[i], RT_PIXMAP, pixmap_unref_fb, - pAMDGPUEnt); + FindClientResourcesByType(clients[i], RT_PIXMAP, + client_pixmap_unref_fb, pScreen); } - pixmap_unref_fb(pScreen->GetScreenPixmap(pScreen), None, pAMDGPUEnt); + pixmap_unref_fb(pScreen->GetScreenPixmap(pScreen)); } else { memset(info->front_buffer->cpu_ptr, 0, pScrn->virtualX * info->pixel_bytes * pScrn->virtualY); } - TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen); + if (pScreen->GCperDepth[0]) + TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen); + hide_cursors: xf86_hide_cursors(pScrn); amdgpu_drop_drm_master(pScrn); Index: driver/xf86-video-amdgpu/src/amdgpu_pixmap.h =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-amdgpu/src/amdgpu_pixmap.h,v retrieving revision 1.1.1.1 diff -u -p -u -r1.1.1.1 amdgpu_pixmap.h --- driver/xf86-video-amdgpu/src/amdgpu_pixmap.h 16 Apr 2019 01:49:42 -0000 1.1.1.1 +++ driver/xf86-video-amdgpu/src/amdgpu_pixmap.h 19 Oct 2019 16:10:59 -0000 @@ -36,6 +36,7 @@ struct amdgpu_pixmap { struct amdgpu_buffer *bo; struct drmmode_fb *fb; + Bool fb_failed; /* GEM handle for pixmaps shared via DRI2/3 */ Bool handle_valid; @@ -143,21 +144,22 @@ static inline struct drmmode_fb* amdgpu_pixmap_get_fb(PixmapPtr pix) { struct drmmode_fb **fb_ptr = amdgpu_pixmap_get_fb_ptr(pix); + uint32_t handle; - if (!fb_ptr) - return NULL; - - if (!*fb_ptr) { - uint32_t handle; - - if (amdgpu_pixmap_get_handle(pix, &handle)) { - ScrnInfoPtr scrn = xf86ScreenToScrn(pix->drawable.pScreen); - AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn); - - *fb_ptr = amdgpu_fb_create(scrn, pAMDGPUEnt->fd, pix->drawable.width, - pix->drawable.height, pix->devKind, - handle); - } + if (fb_ptr && *fb_ptr) + return *fb_ptr; + + if (amdgpu_pixmap_get_handle(pix, &handle)) { + ScrnInfoPtr scrn = xf86ScreenToScrn(pix->drawable.pScreen); + AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn); + + if (!fb_ptr) + fb_ptr = amdgpu_pixmap_get_fb_ptr(pix); + + *fb_ptr = amdgpu_fb_create(scrn, pAMDGPUEnt->fd, + pix->drawable.width, + pix->drawable.height, pix->devKind, + handle); } return *fb_ptr; Index: driver/xf86-video-amdgpu/src/amdgpu_present.c =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-amdgpu/src/amdgpu_present.c,v retrieving revision 1.1.1.1 diff -u -p -u -r1.1.1.1 amdgpu_present.c --- driver/xf86-video-amdgpu/src/amdgpu_present.c 16 Apr 2019 01:49:41 -0000 1.1.1.1 +++ driver/xf86-video-amdgpu/src/amdgpu_present.c 19 Oct 2019 16:10:59 -0000 @@ -255,10 +255,12 @@ amdgpu_present_check_flip(RRCrtcPtr crtc xf86CrtcPtr xf86_crtc = crtc->devPrivate; ScreenPtr screen = window->drawable.pScreen; ScrnInfoPtr scrn = xf86_crtc->scrn; + struct amdgpu_pixmap *priv = amdgpu_get_pixmap_private(pixmap); PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); AMDGPUInfoPtr info = AMDGPUPTR(scrn); int num_crtcs_on; + Bool dc_enabled; int i; if (!scrn->vtSema) @@ -273,16 +275,37 @@ amdgpu_present_check_flip(RRCrtcPtr crtc if (info->drmmode.dri2_flipping) return FALSE; -#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(1, 20, 99, 1, 0) - if (pixmap->devKind != screen_pixmap->devKind) + if (priv && priv->fb_failed) return FALSE; -#endif + + if (!amdgpu_pixmap_get_fb(pixmap)) { + if (!priv) + priv = amdgpu_get_pixmap_private(pixmap); + + if (priv && !priv->fb_failed) { + xf86DrvMsg(scrn->scrnIndex, X_WARNING, + "Cannot get FB for Present flip (may be " + "normal if using PRIME render offloading)\n"); + priv->fb_failed = TRUE; + } + + return FALSE; + } /* Only DC supports advanced color management features, so we can use * drmmode_cm_enabled as a proxy for "Is DC enabled?" */ - if (info->dri2.pKernelDRMVersion->version_minor < 31 || - !drmmode_cm_enabled(&info->drmmode)) { + dc_enabled = drmmode_cm_enabled(&info->drmmode); + + if (info->dri2.pKernelDRMVersion->version_minor < (dc_enabled ? 31 : 34)) { + /* The kernel driver doesn't handle flipping between BOs with + * different pitch correctly + */ + if (pixmap->devKind != screen_pixmap->devKind) + return FALSE; + } + + if (!dc_enabled || info->dri2.pKernelDRMVersion->version_minor < 31) { /* The kernel driver doesn't handle flipping between BOs with * different tiling parameters correctly */ Index: driver/xf86-video-ati/ChangeLog =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-ati/ChangeLog,v retrieving revision 1.18 diff -u -p -u -r1.18 ChangeLog --- driver/xf86-video-ati/ChangeLog 20 Mar 2019 07:33:17 -0000 1.18 +++ driver/xf86-video-ati/ChangeLog 19 Oct 2019 16:23:21 -0000 @@ -1,3 +1,123 @@ +commit b9bd8097e1d2c088b081f1b81799ea3892406214 +Author: Michel Dänzer <mdaen...@redhat.com> +Date: Tue Oct 15 17:54:12 2019 +0200 + + Bump version for 19.1.0 release + +commit 2faaecc69b127248718e759c6c98c84d56dd1b6b +Author: Michel Dänzer <mdaen...@redhat.com> +Date: Fri Sep 20 17:24:19 2019 +0200 + + Don't unreference FBs of pixmaps from different screens in LeaveVT + + FindClientResourcesByType finds pixmaps from all screens, but trying to + process ones from other screens here makes no sense and likely results + in a crash or memory corruption. + + Fixes: 06a465484101 ("Make all active CRTCs scan out an all-black + framebuffer in LeaveVT") + +commit 2cbbd8648cdd27db8076565943b932ef81337053 +Author: Michel Dänzer <mdaen...@redhat.com> +Date: Fri Sep 20 18:47:02 2019 +0200 + + Don't set up black scanout buffer if LeaveVT is called from CloseScreen + + Avoids a crash described in + https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/43#note_223718 + + (Ported from amdgpu commit 5b8bc9fc505c551dcd9b0ed5ab835a49fa4f9fda) + Reviewed-by: Alex Deucher <alexander.deuc...@amd.com> + +commit c7ed12cb2ea76999351d7cb87877224bdc0664f0 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Thu Jul 18 18:14:48 2019 +0200 + + Don't disable page flipping completely with SW cursor + + Even with SW cursor, page flipping can be used while no X cursor is + visible. + + Occurred to me in the context of xorg/xserver#828. + (Ported from amdgpu commit 87f41ace4920fd2069794211683659eb25b025a6) + +commit 33803c85f761d343aa7300311b8e9489b1a89495 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Tue Jun 25 17:46:23 2019 +0200 + + present: Check that we can get a KMS FB for flipping + + This can legitimately fail if the pixmap's storage is shared from + another device, e.g. when using PRIME render offloading. + + (Ported from amdgpu commit 7d3fef72e0c871e1677e9e544f4cae5e238b5c52) + +commit fee737e82837dc8282a832fc9391ed959c4c3737 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Fri Jun 14 11:23:34 2019 +0200 + + Remove dri2_drawable_crtc parameter consider_disabled + + All callers were passing TRUE. + + (Ported from amdgpu commit ea19a5207054bb159fc7fb6d88e0ceb10c3da010) + Reviewed-by: Alex Deucher <alexander.deuc...@amd.com> + +commit 2a3f2d2089f603c99be54c98d7033155e771ce7b +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Fri Jun 14 11:21:40 2019 +0200 + + dri2: Re-use previous CRTC when possible if pick_best_crtc returns NULL + + This way, the MSC will continue ticking at the rate of (the last mode + which was enabled for) that CRTC, instead of the client running + unthrottled. + + (Ported from amdgpu commit 3109f088fdbd89c2ee8078625d4f073852492656) + Reviewed-by: Alex Deucher <alexander.deuc...@amd.com> + +commit d5f5bc5846ef06c3ecf9e5acf1ca357574f06f5a +Author: Flora Cui <flora....@amd.com> +Date: Fri Jun 14 11:20:12 2019 +0200 + + dri2: reply to client for WaitMSC request in any case + + otherwise client would wait for reply forever and desktop appears hang. + + Signed-off-by: Flora Cui <flora....@amd.com> + (Ported from amdgpu commit fb06fb814700a47464abd756e1111dcc76d0d776) + Reviewed-by: Alex Deucher <alexander.deuc...@amd.com> + +commit f758908db4e71406e5d437d32e43aabd38a63504 +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Thu May 9 12:35:37 2019 +0200 + + dri3: Always flush glamor before sharing pixmap storage with clients + + Even if glamor_gbm_bo_from_pixmap / glamor_fd_from_pixmap themselves + don't trigger any drawing, there could already be unflushed drawing to + the pixmap whose storage we share with a client. + + (Ported from amdgpu commit 4b17533fcb30842caf0035ba593b7d986520cc85) + Acked-by: Alex Deucher <alexander.deuc...@amd.com> + +commit d1d8e3c8d0a0a0394d395eba171460501745209b +Author: Michel Dänzer <michel.daen...@amd.com> +Date: Wed Apr 24 12:25:39 2019 +0200 + + Retry get_fb_ptr in get_fb + + If get_fb_ptr returns NULL, try again after pixmap_get_handle, it should + work then. + + Fixes spurious Present page flipping failures using "normal" pixmaps + which aren't shared with direct rendering clients, e.g. with a + compositor using the RENDER extension. + + Bugzilla: https://bugs.freedesktop.org/110417 + (Ported from amdgpu commit bf61e6d7ac1a5754b1026d7f80acf25ef622c491) + Reviewed-by: Alex Deucher <alexander.deuc...@amd.com> + commit 36703f66c3b06875651606a6280d5dc9d9dad51e Author: Michel Dänzer <michel.daen...@amd.com> Date: Tue Mar 19 18:01:02 2019 +0100 Index: driver/xf86-video-ati/configure =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-ati/configure,v retrieving revision 1.27 diff -u -p -u -r1.27 configure --- driver/xf86-video-ati/configure 20 Mar 2019 07:33:17 -0000 1.27 +++ driver/xf86-video-ati/configure 19 Oct 2019 16:24:11 -0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xf86-video-ati 19.0.1. +# Generated by GNU Autoconf 2.69 for xf86-video-ati 19.1.0. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/Radeon>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='xf86-video-ati' PACKAGE_TARNAME='xf86-video-ati' -PACKAGE_VERSION='19.0.1' -PACKAGE_STRING='xf86-video-ati 19.0.1' +PACKAGE_VERSION='19.1.0' +PACKAGE_STRING='xf86-video-ati 19.1.0' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/Radeon' PACKAGE_URL='' @@ -1398,7 +1398,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xf86-video-ati 19.0.1 to adapt to many kinds of systems. +\`configure' configures xf86-video-ati 19.1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1468,7 +1468,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xf86-video-ati 19.0.1:";; + short | recursive ) echo "Configuration of xf86-video-ati 19.1.0:";; esac cat <<\_ACEOF @@ -1629,7 +1629,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xf86-video-ati configure 19.0.1 +xf86-video-ati configure 19.1.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2044,7 +2044,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xf86-video-ati $as_me 19.0.1, which was +It was created by xf86-video-ati $as_me 19.1.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2876,7 +2876,7 @@ fi # Define the identity of the package. PACKAGE='xf86-video-ati' - VERSION='19.0.1' + VERSION='19.1.0' cat >>confdefs.h <<_ACEOF @@ -20122,7 +20122,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xf86-video-ati $as_me 19.0.1, which was +This file was extended by xf86-video-ati $as_me 19.1.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20188,7 +20188,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -xf86-video-ati config.status 19.0.1 +xf86-video-ati config.status 19.1.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Index: driver/xf86-video-ati/configure.ac =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-ati/configure.ac,v retrieving revision 1.20 diff -u -p -u -r1.20 configure.ac --- driver/xf86-video-ati/configure.ac 20 Mar 2019 07:33:18 -0000 1.20 +++ driver/xf86-video-ati/configure.ac 19 Oct 2019 16:23:21 -0000 @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) AC_INIT([xf86-video-ati], - [19.0.1], + [19.1.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/Radeon], [xf86-video-ati]) Index: driver/xf86-video-ati/src/radeon.h =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-ati/src/radeon.h,v retrieving revision 1.21 diff -u -p -u -r1.21 radeon.h --- driver/xf86-video-ati/src/radeon.h 8 Mar 2019 21:59:56 -0000 1.21 +++ driver/xf86-video-ati/src/radeon.h 19 Oct 2019 16:23:21 -0000 @@ -309,6 +309,7 @@ struct radeon_pixmap { struct radeon_buffer *bo; struct drmmode_fb *fb; + Bool fb_failed; uint32_t tiling_flags; @@ -877,21 +878,22 @@ static inline struct drmmode_fb* radeon_pixmap_get_fb(PixmapPtr pix) { struct drmmode_fb **fb_ptr = radeon_pixmap_get_fb_ptr(pix); + uint32_t handle; - if (!fb_ptr) - return NULL; - - if (!*fb_ptr) { - uint32_t handle; - - if (radeon_get_pixmap_handle(pix, &handle)) { - ScrnInfoPtr scrn = xf86ScreenToScrn(pix->drawable.pScreen); - RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn); - - *fb_ptr = radeon_fb_create(scrn, pRADEONEnt->fd, pix->drawable.width, - pix->drawable.height, pix->devKind, - handle); - } + if (fb_ptr && *fb_ptr) + return *fb_ptr; + + if (radeon_get_pixmap_handle(pix, &handle)) { + ScrnInfoPtr scrn = xf86ScreenToScrn(pix->drawable.pScreen); + RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn); + + if (!fb_ptr) + fb_ptr = radeon_pixmap_get_fb_ptr(pix); + + *fb_ptr = radeon_fb_create(scrn, pRADEONEnt->fd, + pix->drawable.width, + pix->drawable.height, pix->devKind, + handle); } return *fb_ptr; Index: driver/xf86-video-ati/src/radeon_dri2.c =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-ati/src/radeon_dri2.c,v retrieving revision 1.14 diff -u -p -u -r1.14 radeon_dri2.c --- driver/xf86-video-ati/src/radeon_dri2.c 8 Mar 2019 21:59:56 -0000 1.14 +++ driver/xf86-video-ati/src/radeon_dri2.c 19 Oct 2019 16:23:21 -0000 @@ -509,18 +509,20 @@ static Bool radeon_dri2_get_crtc_msc(xf8 } static -xf86CrtcPtr radeon_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled) +xf86CrtcPtr radeon_dri2_drawable_crtc(DrawablePtr pDraw) { ScreenPtr pScreen = pDraw->pScreen; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); - xf86CrtcPtr crtc = radeon_pick_best_crtc(pScrn, consider_disabled, + xf86CrtcPtr crtc = radeon_pick_best_crtc(pScrn, TRUE, pDraw->x, pDraw->x + pDraw->width, pDraw->y, pDraw->y + pDraw->height); - if (crtc && pDraw->type == DRAWABLE_WINDOW) { + if (pDraw->type == DRAWABLE_WINDOW) { struct dri2_window_priv *priv = get_dri2_window_priv((WindowPtr)pDraw); - if (priv->crtc && priv->crtc != crtc) { + if (!crtc) { + crtc = priv->crtc; + } else if (priv->crtc && priv->crtc != crtc) { CARD64 ust, mscold, mscnew; if (radeon_dri2_get_crtc_msc(priv->crtc, &ust, &mscold) && @@ -926,7 +928,7 @@ CARD32 radeon_dri2_extrapolate_msc_delay */ static int radeon_dri2_get_msc(DrawablePtr draw, CARD64 *ust, CARD64 *msc) { - xf86CrtcPtr crtc = radeon_dri2_drawable_crtc(draw, TRUE); + xf86CrtcPtr crtc = radeon_dri2_drawable_crtc(draw); /* Drawable not displayed, make up a value */ if (!crtc) { @@ -1041,7 +1043,7 @@ static int radeon_dri2_schedule_wait_msc ScrnInfoPtr scrn = xf86ScreenToScrn(screen); DRI2FrameEventPtr wait_info = NULL; uintptr_t drm_queue_seq = 0; - xf86CrtcPtr crtc = radeon_dri2_drawable_crtc(draw, TRUE); + xf86CrtcPtr crtc = radeon_dri2_drawable_crtc(draw); uint32_t msc_delta; uint32_t seq; CARD64 current_msc; @@ -1156,6 +1158,9 @@ static int radeon_dri2_schedule_wait_msc out_complete: if (wait_info) radeon_dri2_deferred_event(NULL, 0, wait_info); + else + DRI2WaitMSCComplete(client, draw, 0, 0, 0); + return TRUE; } @@ -1187,7 +1192,7 @@ static int radeon_dri2_schedule_swap(Cli { ScreenPtr screen = draw->pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - xf86CrtcPtr crtc = radeon_dri2_drawable_crtc(draw, TRUE); + xf86CrtcPtr crtc = radeon_dri2_drawable_crtc(draw); uint32_t msc_delta; drmVBlankSeqType type; uint32_t seq; Index: driver/xf86-video-ati/src/radeon_dri3.c =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-ati/src/radeon_dri3.c,v retrieving revision 1.5 diff -u -p -u -r1.5 radeon_dri3.c --- driver/xf86-video-ati/src/radeon_dri3.c 8 Mar 2019 21:59:57 -0000 1.5 +++ driver/xf86-video-ati/src/radeon_dri3.c 19 Oct 2019 16:23:21 -0000 @@ -220,29 +220,13 @@ static int radeon_dri3_fd_from_pixmap(Sc RADEONInfoPtr info = RADEONPTR(scrn); if (info->use_glamor) { - Bool need_flush = TRUE; - int ret = -1; -#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,19,99,904,0) - struct gbm_bo *gbm_bo = glamor_gbm_bo_from_pixmap(screen, pixmap); + int ret = glamor_fd_from_pixmap(screen, pixmap, stride, size); - if (gbm_bo) { - ret = gbm_bo_get_fd(gbm_bo); - gbm_bo_destroy(gbm_bo); - - if (ret >= 0) - need_flush = FALSE; - } -#endif - - if (ret < 0) - ret = glamor_fd_from_pixmap(screen, pixmap, stride, size); - - /* glamor might have needed to reallocate the pixmap storage and - * copy the pixmap contents to the new storage. The copy - * operation needs to be flushed to the kernel driver before the - * client starts using the pixmap storage for direct rendering. + /* Any pending drawing operations need to be flushed to the + * kernel driver before the client starts using the pixmap + * storage for direct rendering. */ - if (ret >= 0 && need_flush) + if (ret >= 0) radeon_cs_flush_indirect(scrn); return ret; Index: driver/xf86-video-ati/src/radeon_kms.c =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-ati/src/radeon_kms.c,v retrieving revision 1.19 diff -u -p -u -r1.19 radeon_kms.c --- driver/xf86-video-ati/src/radeon_kms.c 8 Mar 2019 21:59:57 -0000 1.19 +++ driver/xf86-video-ati/src/radeon_kms.c 19 Oct 2019 16:23:21 -0000 @@ -1917,19 +1917,15 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn if (!pScrn->is_gpu) { if (info->dri2.pKernelDRMVersion->version_minor >= 8) { - Bool sw_cursor = xf86ReturnOptValBool(info->Options, - OPTION_SW_CURSOR, FALSE); - info->allowPageFlip = xf86ReturnOptValBool(info->Options, OPTION_PAGE_FLIP, TRUE); - if (sw_cursor || info->shadow_primary) { + if (info->shadow_primary) { xf86DrvMsg(pScrn->scrnIndex, info->allowPageFlip ? X_WARNING : X_DEFAULT, "KMS Pageflipping: disabled%s\n", info->allowPageFlip ? - (sw_cursor ? " because of SWcursor" : - " because of ShadowPrimary") : ""); + " because of ShadowPrimary" : ""); info->allowPageFlip = FALSE; } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -2606,16 +2602,25 @@ CARD32 cleanup_black_fb(OsTimerPtr timer } static void -pixmap_unref_fb(void *value, XID id, void *cdata) +pixmap_unref_fb(PixmapPtr pixmap) { - PixmapPtr pixmap = value; - RADEONEntPtr pRADEONEnt = cdata; + ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen); struct drmmode_fb **fb_ptr = radeon_pixmap_get_fb_ptr(pixmap); + RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn); if (fb_ptr) drmmode_fb_reference(pRADEONEnt->fd, fb_ptr, NULL); } +static void +client_pixmap_unref_fb(void *value, XID id, void *pScreen) +{ + PixmapPtr pixmap = value; + + if (pixmap->drawable.pScreen == pScreen) + pixmap_unref_fb(pixmap); +} + void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); @@ -2633,6 +2638,12 @@ void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn unsigned w = 0, h = 0; int i; + /* If we're called from CloseScreen, trying to clear the black + * scanout BO will likely crash and burn + */ + if (!pScreen->GCperDepth[0]) + goto hide_cursors; + /* Compute maximum scanout dimensions of active CRTCs */ for (i = 0; i < xf86_config->num_crtc; i++) { crtc = xf86_config->crtc[i]; @@ -2671,11 +2682,9 @@ void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn if (pScrn->is_gpu) { if (drmmode_crtc->scanout[0].pixmap) - pixmap_unref_fb(drmmode_crtc->scanout[0].pixmap, - None, pRADEONEnt); + pixmap_unref_fb(drmmode_crtc->scanout[0].pixmap); if (drmmode_crtc->scanout[1].pixmap) - pixmap_unref_fb(drmmode_crtc->scanout[1].pixmap, - None, pRADEONEnt); + pixmap_unref_fb(drmmode_crtc->scanout[1].pixmap); } else { drmmode_crtc_scanout_free(crtc); } @@ -2695,18 +2704,20 @@ void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn (!clients[i] || clients[i]->clientState != ClientStateRunning)) continue; - FindClientResourcesByType(clients[i], RT_PIXMAP, pixmap_unref_fb, - pRADEONEnt); + FindClientResourcesByType(clients[i], RT_PIXMAP, + client_pixmap_unref_fb, pScreen); } - pixmap_unref_fb(pScreen->GetScreenPixmap(pScreen), None, pRADEONEnt); + pixmap_unref_fb(pScreen->GetScreenPixmap(pScreen)); } else { memset(info->front_buffer->bo.radeon->ptr, 0, pScrn->displayWidth * info->pixel_bytes * pScrn->virtualY); } - TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen); + if (pScreen->GCperDepth[0]) + TimerSet(NULL, 0, 1000, cleanup_black_fb, pScreen); + hide_cursors: xf86_hide_cursors (pScrn); radeon_drop_drm_master(pScrn); Index: driver/xf86-video-ati/src/radeon_present.c =================================================================== RCS file: /cvs/OpenBSD/xenocara/driver/xf86-video-ati/src/radeon_present.c,v retrieving revision 1.6 diff -u -p -u -r1.6 radeon_present.c --- driver/xf86-video-ati/src/radeon_present.c 8 Mar 2019 21:59:57 -0000 1.6 +++ driver/xf86-video-ati/src/radeon_present.c 19 Oct 2019 16:23:21 -0000 @@ -254,6 +254,7 @@ radeon_present_check_flip(RRCrtcPtr crtc xf86CrtcPtr xf86_crtc = crtc->devPrivate; ScreenPtr screen = window->drawable.pScreen; ScrnInfoPtr scrn = xf86_crtc->scrn; + struct radeon_pixmap *priv = radeon_get_pixmap_private(pixmap); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); RADEONInfoPtr info = RADEONPTR(scrn); PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen); @@ -276,6 +277,23 @@ radeon_present_check_flip(RRCrtcPtr crtc if (pixmap->devKind != screen_pixmap->devKind) return FALSE; #endif + + if (priv && priv->fb_failed) + return FALSE; + + if (!radeon_pixmap_get_fb(pixmap)) { + if (!priv) + priv = radeon_get_pixmap_private(pixmap); + + if (priv && !priv->fb_failed) { + xf86DrvMsg(scrn->scrnIndex, X_WARNING, + "Cannot get FB for Present flip (may be " + "normal if using PRIME render offloading)\n"); + priv->fb_failed = TRUE; + } + + return FALSE; + } /* The kernel driver doesn't handle flipping between BOs with different * tiling parameters correctly yet -- Matthieu Herrb