Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/xf86-video-ati-kms merge xf86-video-ati 19.0.1.



details:   https://anonhg.NetBSD.org/xsrc/rev/ba6c1c5bfe01
branches:  trunk
changeset: 10295:ba6c1c5bfe01
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Jun 01 07:25:41 2019 +0000

description:
merge xf86-video-ati 19.0.1.

diffstat:

 external/mit/xf86-video-ati-kms/dist/README                 |   25 -
 external/mit/xf86-video-ati-kms/dist/src/radeon_bo_helper.c |    2 +
 external/mit/xf86-video-ati-kms/dist/src/radeon_kms.c       |  284 +++++++----
 external/mit/xf86-video-ati-kms/include/config.h            |   12 +-
 4 files changed, 183 insertions(+), 140 deletions(-)

diffs (truncated from 584 to 300 lines):

diff -r 13400d798181 -r ba6c1c5bfe01 external/mit/xf86-video-ati-kms/dist/README
--- a/external/mit/xf86-video-ati-kms/dist/README       Sat Jun 01 07:24:16 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-xf86-video-ati - ATI/AMD Radeon video driver for the Xorg X server
-
-Patches and questions regarding this software should be directed at the
-amd-gfx mailing list:
-
-        https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-
-Please submit bug reports to the Xorg bugzilla:
-
-        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/Radeon
-
-The master development code repository can be found at:
-
-        git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ati
-
-        https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
-
-For patch submission instructions, see:
-
-        https://www.x.org/wiki/Development/Documentation/SubmittingPatches
-
-For more information on the git code manager, see:
-
-        https://wiki.x.org/wiki/GitPage
-
diff -r 13400d798181 -r ba6c1c5bfe01 external/mit/xf86-video-ati-kms/dist/src/radeon_bo_helper.c
--- a/external/mit/xf86-video-ati-kms/dist/src/radeon_bo_helper.c       Sat Jun 01 07:24:16 2019 +0000
+++ b/external/mit/xf86-video-ati-kms/dist/src/radeon_bo_helper.c       Sat Jun 01 07:25:41 2019 +0000
@@ -39,6 +39,8 @@
     case 8:
        return GBM_FORMAT_R8;
 #endif
+    case 15:
+       return GBM_FORMAT_ARGB1555;
     case 16:
        return GBM_FORMAT_RGB565;
     case 32:
diff -r 13400d798181 -r ba6c1c5bfe01 external/mit/xf86-video-ati-kms/dist/src/radeon_kms.c
--- a/external/mit/xf86-video-ati-kms/dist/src/radeon_kms.c     Sat Jun 01 07:24:16 2019 +0000
+++ b/external/mit/xf86-video-ati-kms/dist/src/radeon_kms.c     Sat Jun 01 07:25:41 2019 +0000
@@ -202,6 +202,10 @@
     if (!pScrn)
        return;
 
+    pEnt = xf86GetEntityInfo(pScrn->entityList[pScrn->numEntities - 1]);
+    pPriv = xf86GetEntityPrivate(pEnt->index, gRADEONEntityIndex);
+    pRADEONEnt = pPriv->ptr;
+
     info = RADEONPTR(pScrn);
     if (info) {
        if (info->fbcon_pixmap)
@@ -217,15 +221,12 @@
            gbm_device_destroy(info->gbm);
 #endif
 
-       pEnt = info->pEnt;
+       pRADEONEnt->scrn[info->instance_id] = NULL;
+       pRADEONEnt->num_scrns--;
        free(pScrn->driverPrivate);
        pScrn->driverPrivate = NULL;
-    } else {
-       pEnt = xf86GetEntityInfo(pScrn->entityList[pScrn->numEntities - 1]);
     }
 
-    pPriv = xf86GetEntityPrivate(pEnt->index, gRADEONEntityIndex);
-    pRADEONEnt = pPriv->ptr;
     if (pRADEONEnt->fd > 0) {
         DevUnion *pPriv;
         RADEONEntPtr pRADEONEnt;
@@ -348,13 +349,13 @@
            RROutputChanged(rrScrPriv->primaryOutput, FALSE);
            rrScrPriv->layoutChanged = TRUE;
        }
+
+       drmmode_uevent_init(pScrn, &info->drmmode);
     }
 
     if (!drmmode_set_desired_modes(pScrn, &info->drmmode, pScreen->isGPU))
        return FALSE;
 
-    drmmode_uevent_init(pScrn, &info->drmmode);
-
     if (info->r600_shadow_fb) {
        pixmap = pScreen->GetScreenPixmap(pScreen);
 
@@ -525,10 +526,14 @@
 {
     RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
     drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+    struct drmmode_fb *fb = event_data;
 
     drmmode_crtc->scanout_update_pending = 0;
-    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
-                        NULL);
+
+    if (drmmode_crtc->flip_pending == fb) {
+       drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
+                            NULL);
+    }
 }
 
 static void
@@ -537,9 +542,9 @@
 {
     RADEONEntPtr pRADEONEnt = RADEONEntPriv(crtc->scrn);
     drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-
-    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb,
-                        drmmode_crtc->flip_pending);
+    struct drmmode_fb *fb = event_data;
+
+    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->fb, fb);
     radeon_scanout_flip_abort(crtc, event_data);
 }
 
@@ -751,6 +756,7 @@
 {
     ScreenPtr screen = dirty->slave_dst->drawable.pScreen;
     ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+    RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
     xf86CrtcPtr xf86_crtc = radeon_prime_dirty_to_crtc(dirty);
     drmmode_crtc_private_ptr drmmode_crtc;
     uintptr_t drm_queue_seq;
@@ -768,23 +774,45 @@
                                           RADEON_DRM_QUEUE_CLIENT_DEFAULT,
                                           RADEON_DRM_QUEUE_ID_DEFAULT, NULL,
                                           radeon_prime_scanout_update_handler,
-                                          radeon_prime_scanout_update_abort);
+                                          radeon_prime_scanout_update_abort,
+                                          FALSE);
     if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
        xf86DrvMsg(scrn->scrnIndex, X_WARNING,
                   "radeon_drm_queue_alloc failed for PRIME update\n");
-       return;
-    }
-
-    if (!drmmode_wait_vblank(xf86_crtc, DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,
-                            1, drm_queue_seq, NULL, NULL)) {
-       xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-                  "drmmode_wait_vblank failed for PRIME update: %s\n",
-                  strerror(errno));
-       radeon_drm_abort_entry(drm_queue_seq);
+       radeon_prime_scanout_update_handler(xf86_crtc, 0, 0, NULL);
        return;
     }
 
     drmmode_crtc->scanout_update_pending = drm_queue_seq;
+
+    if (!drmmode_wait_vblank(xf86_crtc, DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,
+                            1, drm_queue_seq, NULL, NULL)) {
+       if (!(drmmode_crtc->scanout_status & DRMMODE_SCANOUT_VBLANK_FAILED)) {
+           xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+                      "drmmode_wait_vblank failed for PRIME update: %s\n",
+                      strerror(errno));
+           drmmode_crtc->scanout_status |= DRMMODE_SCANOUT_VBLANK_FAILED;
+       }
+
+       drmmode_crtc->drmmode->event_context.vblank_handler(pRADEONEnt->fd,
+                                                           0, 0, 0,
+                                                           (void*)drm_queue_seq);
+       drmmode_crtc->wait_flip_nesting_level++;
+       radeon_drm_queue_handle_deferred(xf86_crtc);
+       return;
+    }
+
+    if (drmmode_crtc->scanout_status ==
+       (DRMMODE_SCANOUT_FLIP_FAILED | DRMMODE_SCANOUT_VBLANK_FAILED)) {
+       /* The page flip and vblank ioctls failed before, but the vblank
+        * ioctl is working again, so we can try re-enabling TearFree
+        */
+       xf86_crtc->funcs->set_mode_major(xf86_crtc, &xf86_crtc->mode,
+                                        xf86_crtc->rotation,
+                                        xf86_crtc->x, xf86_crtc->y);
+    }
+
+    drmmode_crtc->scanout_status &= ~DRMMODE_SCANOUT_VBLANK_FAILED;
 }
 
 static void
@@ -797,52 +825,61 @@
     drmmode_crtc_private_ptr drmmode_crtc;
     uintptr_t drm_queue_seq;
     unsigned scanout_id;
+    struct drmmode_fb *fb;
 
     if (!crtc || !crtc->enabled)
        return;
 
     drmmode_crtc = crtc->driver_private;
+    scanout_id = drmmode_crtc->scanout_id ^ 1;
     if (drmmode_crtc->scanout_update_pending ||
-       !drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap ||
+       !drmmode_crtc->scanout[scanout_id].pixmap ||
        drmmode_crtc->dpms_mode != DPMSModeOn)
        return;
 
-    scanout_id = drmmode_crtc->scanout_id ^ 1;
     if (!radeon_prime_scanout_do_update(crtc, scanout_id))
        return;
 
+    fb = radeon_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap);
+    if (!fb) {
+       xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+                  "Failed to get FB for PRIME flip.\n");
+       return;
+    }
+       
     drm_queue_seq = radeon_drm_queue_alloc(crtc,
                                           RADEON_DRM_QUEUE_CLIENT_DEFAULT,
-                                          RADEON_DRM_QUEUE_ID_DEFAULT,
-                                          NULL,
+                                          RADEON_DRM_QUEUE_ID_DEFAULT, fb,
                                           radeon_scanout_flip_handler,
-                                          radeon_scanout_flip_abort);
+                                          radeon_scanout_flip_abort, TRUE);
     if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
        xf86DrvMsg(scrn->scrnIndex, X_WARNING,
                   "Allocating DRM event queue entry failed for PRIME flip.\n");
        return;
     }
 
-    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending,
-                         radeon_pixmap_get_fb(drmmode_crtc->scanout[scanout_id].pixmap));
-    if (!drmmode_crtc->flip_pending) {
-       xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-                  "Failed to get FB for PRIME flip.\n");
+    if (drmmode_page_flip_target_relative(pRADEONEnt, drmmode_crtc,
+                                         fb->handle, 0, drm_queue_seq, 1)
+       != 0) {
+       if (!(drmmode_crtc->scanout_status & DRMMODE_SCANOUT_FLIP_FAILED)) {
+           xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+                      "flip queue failed in %s: %s, TearFree inactive\n",
+                      __func__, strerror(errno));
+           drmmode_crtc->scanout_status |= DRMMODE_SCANOUT_FLIP_FAILED;
+       }
+
        radeon_drm_abort_entry(drm_queue_seq);
        return;
     }
 
-    if (drmmode_page_flip_target_relative(pRADEONEnt, drmmode_crtc,
-                                         drmmode_crtc->flip_pending->handle,
-                                         0, drm_queue_seq, 0) != 0) {
-       xf86DrvMsg(scrn->scrnIndex, X_WARNING, "flip queue failed in %s: %s\n",
-                  __func__, strerror(errno));
-       radeon_drm_abort_entry(drm_queue_seq);
-       return;
+    if (drmmode_crtc->scanout_status & DRMMODE_SCANOUT_FLIP_FAILED) {
+       xf86DrvMsg(scrn->scrnIndex, X_INFO, "TearFree active again\n");
+       drmmode_crtc->scanout_status &= ~DRMMODE_SCANOUT_FLIP_FAILED;
     }
 
     drmmode_crtc->scanout_id = scanout_id;
     drmmode_crtc->scanout_update_pending = drm_queue_seq;
+    drmmode_fb_reference(pRADEONEnt->fd, &drmmode_crtc->flip_pending, fb);
 }
 
 static void
@@ -1020,8 +1057,9 @@
 radeon_scanout_update(xf86CrtcPtr xf86_crtc)
 {
     drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
+    ScrnInfoPtr scrn = xf86_crtc->scrn;
+    RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
     uintptr_t drm_queue_seq;
-    ScrnInfoPtr scrn;
     DamagePtr pDamage;
     RegionPtr pRegion;
     BoxRec extents;
@@ -1046,29 +1084,50 @@
        return;
     }
 
-    scrn = xf86_crtc->scrn;
     drm_queue_seq = radeon_drm_queue_alloc(xf86_crtc,
                                           RADEON_DRM_QUEUE_CLIENT_DEFAULT,
                                           RADEON_DRM_QUEUE_ID_DEFAULT,
                                           drmmode_crtc,
                                           radeon_scanout_update_handler,
-                                          radeon_scanout_update_abort);
+                                          radeon_scanout_update_abort,
+                                          FALSE);
     if (drm_queue_seq == RADEON_DRM_QUEUE_ERROR) {
        xf86DrvMsg(scrn->scrnIndex, X_WARNING,
                   "radeon_drm_queue_alloc failed for scanout update\n");
-       return;
-    }
-
-    if (!drmmode_wait_vblank(xf86_crtc, DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT,
-                            1, drm_queue_seq, NULL, NULL)) {
-       xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-                  "drmmode_wait_vblank failed for scanout update: %s\n",
-                  strerror(errno));
-       radeon_drm_abort_entry(drm_queue_seq);
+       radeon_scanout_update_handler(xf86_crtc, 0, 0, drmmode_crtc);
        return;



Home | Main Index | Thread Index | Old Index