xf86-video-ati: Branch 'master' - 6 commits
Michel Dänzer
daenzer at kemper.freedesktop.org
Wed Mar 1 08:03:06 UTC 2017
src/drmmode_display.c | 101 +++++++++++++++++++-------------------------------
src/radeon_present.c | 12 ++++-
2 files changed, 49 insertions(+), 64 deletions(-)
New commits:
commit 9035b6abea557828e672ee455f0c84e43da0906f
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Tue Feb 28 18:13:42 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.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/radeon_present.c b/src/radeon_present.c
index 01409ff..af55e46 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -347,6 +347,8 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
event->event_id = event_id;
+ radeon_cs_flush_indirect(scrn);
+
ret = radeon_do_pageflip(scrn, RADEON_DRM_QUEUE_CLIENT_DEFAULT, handle,
event_id, event, crtc_id,
radeon_present_flip_event,
commit 0a4eb0e12f0c9c653cf4cea6fd62e1a507eb261c
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Fri Feb 10 12:52:02 2017 +0900
present: Use async flip for unflip if possible
In that case, unflip operations should finish faster in general.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/radeon_present.c b/src/radeon_present.c
index 6409fe3..01409ff 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -48,6 +48,8 @@
#include "present.h"
+static present_screen_info_rec radeon_present_screen_info;
+
struct radeon_present_vblank_event {
uint64_t event_id;
Bool unflip;
@@ -370,6 +372,9 @@ radeon_present_unflip(ScreenPtr screen, uint64_t event_id)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
struct radeon_present_vblank_event *event;
PixmapPtr pixmap = screen->GetScreenPixmap(screen);
+ enum drmmode_flip_sync flip_sync =
+ (radeon_present_screen_info.capabilities & PresentCapabilityAsync) ?
+ FLIP_ASYNC : FLIP_VSYNC;
uint32_t handle;
int old_fb_id;
int i;
@@ -396,7 +401,7 @@ radeon_present_unflip(ScreenPtr screen, uint64_t event_id)
if (radeon_do_pageflip(scrn, RADEON_DRM_QUEUE_CLIENT_DEFAULT, handle,
event_id, event, -1, radeon_present_flip_event,
- radeon_present_flip_abort, FLIP_VSYNC, 0))
+ radeon_present_flip_abort, flip_sync, 0))
return;
modeset:
commit 9a951a3e551db58ba50e7a594521ceac54d90615
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Tue Feb 28 18:06:55 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.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/radeon_present.c b/src/radeon_present.c
index 1b0ddcb..6409fe3 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -374,6 +374,8 @@ radeon_present_unflip(ScreenPtr screen, uint64_t event_id)
int old_fb_id;
int i;
+ radeon_cs_flush_indirect(scrn);
+
if (!radeon_present_check_unflip(scrn))
goto modeset;
@@ -404,7 +406,6 @@ modeset:
old_fb_id = info->drmmode.fb_id;
info->drmmode.fb_id = 0;
- radeon_cs_flush_indirect(scrn);
radeon_bo_wait(info->front_bo);
for (i = 0; i < config->num_crtc; i++) {
xf86CrtcPtr crtc = config->crtc[i];
commit f2bc882f1c1082bed9f496cfab6c8f07a76bc122
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Tue Feb 28 17:31:14 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.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 38b36b2..9c69b55 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -673,23 +673,20 @@ drmmode_crtc_update_tear_free(xf86CrtcPtr crtc)
#if XF86_CRTC_VERSION >= 4
+#if XF86_CRTC_VERSION < 7
+#define XF86DriverTransformOutput TRUE
+#define XF86DriverTransformNone FALSE
+#endif
+
static Bool
drmmode_handle_transform(xf86CrtcPtr crtc)
{
Bool ret;
-#if XF86_CRTC_VERSION >= 7
if (crtc->transformPresent || crtc->rotation != RR_Rotate_0)
crtc->driverIsPerformingTransform = XF86DriverTransformOutput;
else
crtc->driverIsPerformingTransform = XF86DriverTransformNone;
-#else
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- RADEONInfoPtr info = RADEONPTR(crtc->scrn);
-
- crtc->driverIsPerformingTransform = crtc->transformPresent ||
- (drmmode_crtc->tear_free && crtc->rotation != RR_Rotate_0);
-#endif
ret = xf86CrtcRotate(crtc);
commit ae921a3150f69c38b5b3c88a9e37d54fdf0d5093
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Tue Feb 28 17:47:09 2017 +0900
Fold drmmode_crtc_scanout_allocate into drmmode_crtc_scanout_create
Not used anywhere else anymore.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 560bfae..38b36b2 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -550,10 +550,9 @@ drmmode_scanout_free(ScrnInfoPtr scrn)
drmmode_crtc_scanout_free(xf86_config->crtc[c]->driver_private);
}
-static void *
-drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
- struct drmmode_scanout *scanout,
- int width, int height, int *pitch)
+static PixmapPtr
+drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout,
+ int width, int height)
{
ScrnInfoPtr pScrn = crtc->scrn;
RADEONInfoPtr info = RADEONPTR(pScrn);
@@ -561,11 +560,11 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
drmmode_ptr drmmode = drmmode_crtc->drmmode;
struct radeon_surface surface;
uint32_t tiling = RADEON_CREATE_PIXMAP_TILING_MACRO;
- int ret;
+ int pitch;
- if (scanout->bo) {
+ if (scanout->pixmap) {
if (scanout->width == width && scanout->height == height)
- return scanout->bo->ptr;
+ return scanout->pixmap;
drmmode_crtc_scanout_destroy(drmmode, scanout);
}
@@ -574,48 +573,16 @@ drmmode_crtc_scanout_allocate(xf86CrtcPtr crtc,
tiling |= RADEON_CREATE_PIXMAP_TILING_MICRO;
scanout->bo = radeon_alloc_pixmap_bo(pScrn, width, height, pScrn->depth,
tiling, pScrn->bitsPerPixel,
- pitch, &surface, &tiling);
+ &pitch, &surface, &tiling);
if (scanout->bo == NULL)
- return NULL;
-
- radeon_bo_map(scanout->bo, 1);
+ goto error;
- ret = drmModeAddFB(drmmode->fd, width, height, pScrn->depth,
- pScrn->bitsPerPixel, *pitch,
+ if (drmModeAddFB(drmmode->fd, width, height, pScrn->depth,
+ pScrn->bitsPerPixel, pitch,
scanout->bo->handle,
- &scanout->fb_id);
- if (ret) {
+ &scanout->fb_id) != 0) {
ErrorF("failed to add scanout fb\n");
- radeon_bo_unref(scanout->bo);
- scanout->bo = NULL;
- return NULL;
- }
-
- scanout->width = width;
- scanout->height = height;
- return scanout->bo->ptr;
-}
-
-static PixmapPtr
-drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout,
- int width, int height)
-{
- ScrnInfoPtr pScrn = crtc->scrn;
- drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- drmmode_ptr drmmode = drmmode_crtc->drmmode;
- int pitch;
-
- if (scanout->pixmap) {
- if (scanout->width == width && scanout->height == height)
- return scanout->pixmap;
-
- drmmode_crtc_scanout_destroy(drmmode, scanout);
- }
-
- if (!scanout->bo) {
- if (!drmmode_crtc_scanout_allocate(crtc, scanout, width, height,
- &pitch))
- return NULL;
+ goto error;
}
scanout->pixmap = drmmode_create_bo_pixmap(pScrn,
@@ -623,9 +590,15 @@ drmmode_crtc_scanout_create(xf86CrtcPtr crtc, struct drmmode_scanout *scanout,
pScrn->depth,
pScrn->bitsPerPixel,
pitch, scanout->bo, NULL);
- if (scanout->pixmap == NULL)
+ if (scanout->pixmap) {
+ scanout->width = width;
+ scanout->height = height;
+ } else {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Couldn't allocate scanout pixmap for CRTC\n");
+error:
+ drmmode_crtc_scanout_destroy(drmmode, scanout);
+ }
return scanout->pixmap;
}
commit 987a34adb319923ad36e2b47a26837248f187c3e
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Tue Feb 28 17:17:20 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
Fixes: ea30d856ba5e ("Pass pitch from drmmode_crtc_scanout_allocate to drmmode_create_bo_pixmap")
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index fd22a19..560bfae 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1194,14 +1194,20 @@ drmmode_show_cursor (xf86CrtcPtr crtc)
info->cursor_w, info->cursor_h);
}
+/* Xorg expects a non-NULL return value from drmmode_crtc_shadow_allocate, and
+ * passes that back to drmmode_crtc_scanout_create; it doesn't use it for
+ * anything else.
+ */
static void *
drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- int pitch;
- return drmmode_crtc_scanout_allocate(crtc, &drmmode_crtc->rotate,
- width, height, &pitch);
+ if (!drmmode_crtc_scanout_create(crtc, &drmmode_crtc->rotate, width,
+ height))
+ return NULL;
+
+ return (void*)~0UL;
}
static PixmapPtr
@@ -1209,11 +1215,12 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
- /* Xorg passes in the return value of drmmode_crtc_shadow_allocate
- * for data, but that's redundant for drmmode_crtc_scanout_create.
- */
- return drmmode_crtc_scanout_create(crtc, &drmmode_crtc->rotate, width,
- height);
+ if (!data) {
+ drmmode_crtc_scanout_create(crtc, &drmmode_crtc->rotate, width,
+ height);
+ }
+
+ return drmmode_crtc->rotate.pixmap;
}
static void
More information about the xorg-commit
mailing list