xf86-video-amdgpu: Branch 'master' - 7 commits
Michel Dänzer
daenzer at kemper.freedesktop.org
Thu Jun 23 07:22:52 UTC 2016
src/amdgpu_dri2.c | 5 ++-
src/amdgpu_present.c | 47 ++++++++++++++++++++-----------
src/drmmode_display.c | 74 +++++++++++++++++++-------------------------------
3 files changed, 63 insertions(+), 63 deletions(-)
New commits:
commit 4d506c23c9a628204fa23607931557b07ada3e31
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Wed Jun 22 17:16:24 2016 +0900
present: Separate checks for flips vs unflips v2
All unflip checks apply to flips as well, but not vice versa.
v2: Add comment above amdgpu_present_check_unflip (Alex)
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index c0b2f17..edfccb1 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -211,15 +211,13 @@ amdgpu_present_flush(WindowPtr window)
}
/*
- * Test to see if page flipping is possible on the target crtc
+ * Test to see if unflipping is possible
+ *
+ * These tests have to pass for flips as well
*/
static Bool
-amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
- Bool sync_flip)
+amdgpu_present_check_unflip(ScrnInfoPtr scrn)
{
- ScreenPtr screen = window->drawable.pScreen;
- ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
- AMDGPUInfoPtr info = AMDGPUPTR(scrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int num_crtcs_on;
int i;
@@ -227,15 +225,6 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
if (!scrn->vtSema)
return FALSE;
- if (!info->allowPageFlip)
- return FALSE;
-
- if (info->hwcursor_disabled)
- return FALSE;
-
- if (info->drmmode.dri2_flipping)
- return FALSE;
-
for (i = 0, num_crtcs_on = 0; i < config->num_crtc; i++) {
drmmode_crtc_private_ptr drmmode_crtc = config->crtc[i]->driver_private;
@@ -254,6 +243,29 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
}
/*
+ * Test to see if page flipping is possible on the target crtc
+ */
+static Bool
+amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
+ Bool sync_flip)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ AMDGPUInfoPtr info = AMDGPUPTR(scrn);
+
+ if (!info->allowPageFlip)
+ return FALSE;
+
+ if (info->hwcursor_disabled)
+ return FALSE;
+
+ if (info->drmmode.dri2_flipping)
+ return FALSE;
+
+ return amdgpu_present_check_unflip(scrn);
+}
+
+/*
* Once the flip has been completed on all CRTCs, notify the
* extension code telling it when that happened
*/
@@ -333,7 +345,7 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
PixmapPtr pixmap = screen->GetScreenPixmap(screen);
int i;
- if (!amdgpu_present_check_flip(NULL, screen->root, pixmap, TRUE))
+ if (!amdgpu_present_check_unflip(scrn))
goto modeset;
event = calloc(1, sizeof(struct amdgpu_present_vblank_event));
commit decabd574f90d3df397c80ec931b3fde8a4afb49
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Wed Jun 22 17:43:41 2016 +0900
dri2: Don't allow flipping when using a dedicated scanout buffer
Fixes issues when mixing rotation and page flipping with current xserver
Git master.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 9cdcf28..dd18e72 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -600,7 +600,10 @@ can_exchange(ScrnInfoPtr pScrn, DrawablePtr draw,
for (i = 0; i < xf86_config->num_crtc; i++) {
xf86CrtcPtr crtc = xf86_config->crtc[i];
- if (crtc->enabled && crtc->rotatedData)
+ drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+ if (crtc->enabled &&
+ (crtc->rotatedData || drmmode_crtc->scanout[0].bo))
return FALSE;
}
commit 3ed28ce7cd26f89969617ba901ff253091d0d469
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Wed Jun 22 16:54:01 2016 +0900
present: Don't allow flipping when using a dedicated scanout buffer
Fixes issues when mixing rotation and page flipping with current xserver
Git master.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 63ba812..c0b2f17 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -242,7 +242,8 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
if (!config->crtc[i]->enabled)
continue;
- if (!drmmode_crtc || drmmode_crtc->rotate.bo != NULL)
+ if (!drmmode_crtc || drmmode_crtc->rotate.bo ||
+ drmmode_crtc->scanout[0].bo)
return FALSE;
if (drmmode_crtc->dpms_mode == DPMSModeOn)
commit 9c3324715fd395fd486ea341654d78f4f298b97f
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Wed Jun 22 16:12:32 2016 +0900
Make sure drmmode_crtc->scanout[] are destroyed when not needed
We failed to do this when going back to scanning out directly from the
screen pixmap.
As a bonus, since we now destroy drmmode_crtc->scanout[] after setting
the new scanout buffer, we may avoid the CRTC turning off intermittently
in this case.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 50e541e..2cd99cb 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -697,17 +697,11 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
if (crtc->randr_crtc && crtc->randr_crtc->scanout_pixmap) {
x = drmmode_crtc->prime_pixmap_x;
y = 0;
-
- drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[0]);
- drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[1]);
} else
#endif
if (drmmode_crtc->rotate.fb_id) {
fb_id = drmmode_crtc->rotate.fb_id;
x = y = 0;
-
- drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[0]);
- drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[1]);
} else if (info->tear_free ||
#if XF86_CRTC_VERSION >= 4
crtc->driverIsPerformingTransform ||
@@ -838,9 +832,15 @@ done:
crtc->y = saved_y;
crtc->rotation = saved_rotation;
crtc->mode = saved_mode;
- } else
+ } else {
crtc->active = TRUE;
+ if (fb_id != drmmode_crtc->scanout[0].fb_id) {
+ drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[0]);
+ drmmode_crtc_scanout_destroy(drmmode, &drmmode_crtc->scanout[1]);
+ }
+ }
+
return ret;
}
commit 3bce0519a4008cf87c0e31a7a579e10f5dcdd2f3
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Wed Jun 22 16:19:07 2016 +0900
Simplify drmmode_set_mode_major error handling
Initialize ret = FALSE and only set it to TRUE when we've succeeded.
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 8d8eeb1..50e541e 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -650,7 +650,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
DisplayModeRec saved_mode;
uint32_t *output_ids = NULL;
int output_count = 0;
- Bool ret = TRUE;
+ Bool ret = FALSE;
int i;
int fb_id;
drmModeModeInfo kmode;
@@ -668,10 +668,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
crtc->rotation = rotation;
output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
- if (!output_ids) {
- ret = FALSE;
+ if (!output_ids)
goto done;
- }
for (i = 0; i < xf86_config->num_output; i++) {
xf86OutputPtr output = xf86_config->output[i];
@@ -768,7 +766,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
if (fb_id == 0) {
if (!amdgpu_bo_get_handle(info->front_buffer, &bo_handle)) {
ErrorF("failed to get BO handle for FB\n");
- ret = FALSE;
goto done;
}
@@ -779,7 +776,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
pScrn->displayWidth * info->pixel_bytes,
bo_handle, &drmmode->fb_id) < 0) {
ErrorF("failed to add fb\n");
- ret = FALSE;
goto done;
}
@@ -797,7 +793,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
output_count, &kmode) != 0) {
xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR,
"failed to set mode: %s\n", strerror(errno));
- ret = FALSE;
goto done;
} else
ret = TRUE;
commit a3ca1500703837cbb8d49c554199a25dea7d5e1e
Author: Hans de Goede <hdegoede at redhat.com>
Date: Wed Jun 1 15:14:32 2016 +0200
Only add main fb if necessary
If we're doing reverse-prime; or doing rotation the main fb is not used,
and there is no reason to add it in this case.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
(Ported from xserver commit 4313122dea0df9affc280ee698e929489061ccc6)
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 6a918e6..8d8eeb1 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -656,24 +656,6 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drmModeModeInfo kmode;
uint32_t bo_handle;
- if (drmmode->fb_id == 0) {
- if (!amdgpu_bo_get_handle(info->front_buffer, &bo_handle)) {
- ErrorF("failed to get BO handle for FB\n");
- return FALSE;
- }
-
- ret = drmModeAddFB(pAMDGPUEnt->fd,
- pScrn->virtualX,
- pScrn->virtualY,
- pScrn->depth, pScrn->bitsPerPixel,
- pScrn->displayWidth * info->pixel_bytes,
- bo_handle, &drmmode->fb_id);
- if (ret < 0) {
- ErrorF("failed to add fb\n");
- return FALSE;
- }
- }
-
saved_mode = crtc->mode;
saved_x = crtc->x;
saved_y = crtc->y;
@@ -783,6 +765,27 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
}
}
+ if (fb_id == 0) {
+ if (!amdgpu_bo_get_handle(info->front_buffer, &bo_handle)) {
+ ErrorF("failed to get BO handle for FB\n");
+ ret = FALSE;
+ goto done;
+ }
+
+ if (drmModeAddFB(pAMDGPUEnt->fd,
+ pScrn->virtualX,
+ pScrn->virtualY,
+ pScrn->depth, pScrn->bitsPerPixel,
+ pScrn->displayWidth * info->pixel_bytes,
+ bo_handle, &drmmode->fb_id) < 0) {
+ ErrorF("failed to add fb\n");
+ ret = FALSE;
+ goto done;
+ }
+
+ fb_id = drmmode->fb_id;
+ }
+
/* Wait for any pending flip to finish */
do {} while (drmmode_crtc->flip_pending &&
drmHandleEvent(pAMDGPUEnt->fd,
commit 9ca1c24235ff5ab2e028333fc326e2eff008c574
Author: Hans de Goede <hdegoede at redhat.com>
Date: Wed Jun 1 15:11:05 2016 +0200
Remove unnecessary fb addition from drmmode_xf86crtc_resize
drmmode_set_mode_major() is the only user of drmmode->fb_id and will
create it if necessary.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
(Ported from xserver commit 877453212166fdc912e0d687cdecee11aba563b5)
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 5d08b49..6a918e6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1893,7 +1893,6 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
int i, pitch, old_width, old_height, old_pitch;
int cpp = info->pixel_bytes;
PixmapPtr ppix = screen->GetScreenPixmap(screen);
- uint32_t bo_handle;
void *fb_shadow;
int hint = 0;
xRectangle rect;
@@ -1914,6 +1913,7 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
old_height = scrn->virtualY;
old_pitch = scrn->displayWidth;
old_fb_id = drmmode->fb_id;
+ drmmode->fb_id = 0;
old_front = info->front_buffer;
scrn->virtualX = width;
@@ -1938,20 +1938,6 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
xf86DrvMsg(scrn->scrnIndex, X_INFO, " => pitch %d bytes\n", pitch);
scrn->displayWidth = pitch / cpp;
- if (!amdgpu_bo_get_handle(info->front_buffer, &bo_handle)) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "Failed to get front buffer handle\n");
- goto fail;
- }
-
- if (drmModeAddFB(pAMDGPUEnt->fd, width, height, scrn->depth,
- scrn->bitsPerPixel, pitch,
- bo_handle, &drmmode->fb_id) != 0) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "drmModeAddFB failed for front buffer\n");
- goto fail;
- }
-
if (info->use_glamor ||
(info->front_buffer->flags & AMDGPU_BO_FLAGS_GBM)) {
screen->ModifyPixmapHeader(ppix,
More information about the xorg-commit
mailing list