From: Qiang Yu <Qiang.Yu-5C7GfCeVMHo@public.gmane.org>
To: xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org
Cc: Qiang Yu <Qiang.Yu-5C7GfCeVMHo@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH xserver 4/6] modesetting: exclude DRI2 and Present page flip
Date: Wed, 17 Aug 2016 18:29:09 +0800 [thread overview]
Message-ID: <1471429751-17269-5-git-send-email-Qiang.Yu@amd.com> (raw)
In-Reply-To: <1471429751-17269-1-git-send-email-Qiang.Yu-5C7GfCeVMHo@public.gmane.org>
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
---
hw/xfree86/drivers/modesetting/dri2.c | 13 +++++++++++--
hw/xfree86/drivers/modesetting/drmmode_display.h | 3 +++
hw/xfree86/drivers/modesetting/present.c | 15 +++++++++++++++
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c
index 11e0e6f..1abf98c 100644
--- a/hw/xfree86/drivers/modesetting/dri2.c
+++ b/hw/xfree86/drivers/modesetting/dri2.c
@@ -423,9 +423,14 @@ ms_dri2_flip_abort(void *data)
{
struct ms_crtc_pageflip *flip = data;
struct ms_flipdata *flipdata = flip->flipdata;
+ ScreenPtr screen = flipdata->screen;
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ modesettingPtr ms = modesettingPTR(scrn);
- if (flipdata->flip_count == 1)
- free(flipdata->event);
+ if (flipdata->flip_count == 1) {
+ ms->drmmode.dri2_flipping = FALSE;
+ free(flipdata->event);
+ }
ms_dri2_flip_free(flip);
}
@@ -469,6 +474,8 @@ ms_dri2_schedule_flip(ms_dri2_frame_event_ptr info)
{
DrawablePtr draw = info->drawable;
ScreenPtr screen = draw->pScreen;
+ ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ modesettingPtr ms = modesettingPTR(scrn);
ms_dri2_buffer_private_ptr back_priv = info->back->driverPrivate;
struct ms_dri2_vblank_event *event;
drmmode_crtc_private_ptr drmmode_crtc = info->crtc->driver_private;
@@ -486,6 +493,7 @@ ms_dri2_schedule_flip(ms_dri2_frame_event_ptr info)
drmmode_crtc->vblank_pipe, FALSE,
ms_dri2_flip_handler,
ms_dri2_flip_abort)) {
+ ms->drmmode.dri2_flipping = TRUE;
return TRUE;
}
return FALSE;
@@ -571,6 +579,7 @@ can_flip(ScrnInfoPtr scrn, DrawablePtr draw,
return draw->type == DRAWABLE_WINDOW &&
ms->drmmode.pageflip &&
+ !ms->drmmode.present_flipping &&
scrn->vtSema &&
DRI2CanFlip(draw) && can_exchange(scrn, draw, front, back);
}
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
index 5499c16..f774250 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -80,6 +80,9 @@ typedef struct {
Bool is_secondary;
PixmapPtr fbcon_pixmap;
+
+ Bool dri2_flipping;
+ Bool present_flipping;
} drmmode_rec, *drmmode_ptr;
typedef struct {
diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c
index f4318b4..d10c674 100644
--- a/hw/xfree86/drivers/modesetting/present.c
+++ b/hw/xfree86/drivers/modesetting/present.c
@@ -53,6 +53,7 @@
struct ms_present_vblank_event {
uint64_t event_id;
+ Bool unflip;
};
static RRCrtcPtr
@@ -221,6 +222,7 @@ ms_present_flip_handler(uint64_t msc, uint64_t ust, void *data)
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
modesettingPtr ms = modesettingPTR(scrn);
struct ms_flipdata *flipdata = flip->flipdata;
+ struct ms_present_vblank_event *event = flipdata->event;
DebugPresent(("\t\tms:fh %lld c %d msc %llu ust %llu\n",
(long long) flipdata->event->event_id,
@@ -238,6 +240,8 @@ ms_present_flip_handler(uint64_t msc, uint64_t ust, void *data)
flipdata->flip_count,
(long long) flipdata->fe_msc, (long long) flipdata->fe_usec));
+ if (event->unflip)
+ ms->drmmode.present_flipping = FALSE;
ms_present_vblank_handler(flipdata->fe_msc,
flipdata->fe_usec,
@@ -284,6 +288,9 @@ ms_present_check_flip(RRCrtcPtr crtc,
if (!ms->drmmode.pageflip)
return FALSE;
+ if (ms->drmmode.dri2_flipping)
+ return FALSE;
+
if (!scrn->vtSema)
return FALSE;
@@ -330,6 +337,7 @@ ms_present_flip(RRCrtcPtr crtc,
{
ScreenPtr screen = crtc->pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ modesettingPtr ms = modesettingPTR(scrn);
xf86CrtcPtr xf86_crtc = crtc->devPrivate;
drmmode_crtc_private_ptr drmmode_crtc = xf86_crtc->driver_private;
Bool ret;
@@ -343,10 +351,14 @@ ms_present_flip(RRCrtcPtr crtc,
return FALSE;
event->event_id = event_id;
+ event->unflip = FALSE;
+
ret = ms_do_pageflip(screen, pixmap, event, drmmode_crtc->vblank_pipe, !sync_flip,
ms_present_flip_handler, ms_present_flip_abort);
if (!ret)
xf86DrvMsg(scrn->scrnIndex, X_ERROR, "present flip failed\n");
+ else
+ ms->drmmode.present_flipping = TRUE;
return ret;
}
@@ -358,6 +370,7 @@ static void
ms_present_unflip(ScreenPtr screen, uint64_t event_id)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ modesettingPtr ms = modesettingPTR(scrn);
PixmapPtr pixmap = screen->GetScreenPixmap(screen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int i;
@@ -368,6 +381,7 @@ ms_present_unflip(ScreenPtr screen, uint64_t event_id)
return;
event->event_id = event_id;
+ event->unflip = TRUE;
if (ms_present_check_flip(NULL, screen->root, pixmap, TRUE) &&
ms_do_pageflip(screen, pixmap, event, -1, FALSE,
@@ -399,6 +413,7 @@ ms_present_unflip(ScreenPtr screen, uint64_t event_id)
}
present_event_notify(event_id, 0, 0);
+ ms->drmmode.present_flipping = FALSE;
}
#endif
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2016-08-17 10:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-17 10:29 [PATCH xserver 0/6] modesetting: add DRI2 page flip support Qiang Yu
[not found] ` <1471429751-17269-1-git-send-email-Qiang.Yu-5C7GfCeVMHo@public.gmane.org>
2016-08-17 10:29 ` [PATCH xserver 1/6] modesetting: make ms_do_pageflip generic for share with DRI2 Qiang Yu
[not found] ` <1471429751-17269-2-git-send-email-Qiang.Yu-5C7GfCeVMHo@public.gmane.org>
2016-08-18 7:48 ` Michel Dänzer
2016-08-17 10:29 ` [PATCH xserver 2/6] modesetting: move ms_do_pageflip to pageflip.c Qiang Yu
2016-08-17 10:29 ` [PATCH xserver 3/6] modesetting: add DRI2 page flip support Qiang Yu
[not found] ` <1471429751-17269-4-git-send-email-Qiang.Yu-5C7GfCeVMHo@public.gmane.org>
2016-08-18 8:12 ` Michel Dänzer
[not found] ` <7ae3a1a6-0e00-856b-885f-a8c39e7d5842-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-19 7:06 ` Yu, Qiang
[not found] ` <DM5PR12MB120959145EBDFF1847B5FF1A8F160-2J9CzHegvk/Xl62ebUdyqgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-19 7:25 ` Michel Dänzer
[not found] ` <1349a122-864e-2abd-9599-c7fa41e900c2-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-19 7:48 ` Yu, Qiang
[not found] ` <MWHPR12MB12152F00C2A18FC6149473F18F160-Gy0DoCVfaSXDoeKT4XqzagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-19 9:06 ` Michel Dänzer
2016-08-17 10:29 ` Qiang Yu [this message]
2016-08-17 10:29 ` [PATCH xserver 5/6] modesetting: merge common page flip code for present and dri2 Qiang Yu
2016-08-17 10:29 ` [PATCH xserver 6/6] modesetting: remove redundent pixmap destroy Qiang Yu
2016-08-17 15:54 ` [PATCH xserver 0/6] modesetting: add DRI2 page flip support Martin Peres
2016-08-18 8:18 ` Michel Dänzer
[not found] ` <1b121a8c-a201-396e-426c-838c4abed8f3-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-19 1:52 ` Yu, Qiang
2016-08-18 11:03 ` Emil Velikov
[not found] ` <CACvgo52vhzcyAS384uQdYy_XrA0LmKRdsRnLF0UB0OhV49A7uw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-19 2:02 ` Yu, Qiang
[not found] ` <MWHPR12MB121593BB7CA6C60D65B21E6B8F160-Gy0DoCVfaSXDoeKT4XqzagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-19 2:09 ` Michel Dänzer
[not found] ` <09c2176a-6a7e-b28d-d7e1-6a4bb76dab58-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-08-19 5:11 ` Keith Packard
2016-08-19 7:57 ` Emil Velikov
[not found] ` <CACvgo51CgrEqe+pE-0-FOrhk3NhLSygLA54RU2U3aoFfHEvXGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-19 9:09 ` Michel Dänzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1471429751-17269-5-git-send-email-Qiang.Yu@amd.com \
--to=qiang.yu-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.