All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add Option "DRI3" to allow to disable DRI3 under EXA.
@ 2015-06-30  3:30 Mario Kleiner
       [not found] ` <1435635043-3738-1-git-send-email-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Mario Kleiner @ 2015-06-30  3:30 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w,
	bskeggs-H+wXaHxf7aLQT0dZR+AlfA

X-Server versions older than 1.16.3 have bugs in their
DRI3/Present implementation which impair nouveau, so
it is better to stick to good old DRI2 by default on
such servers. E.g., page flipping doesn't work at all
under DRI3/Present with older servers, and use of
extensions like OML_sync_control, SGI_video_sync or
INTEL_swap_events also causes failure of Present.

nouveau's glamor accel backend currently doesn't work under
DRI2, so continue to use DRI3 whenever it is supported.

Under the exa accel backend, DRI2 works just fine, so
disable DRI3 and choose DRI2 by default when nouveau
is built for X-Server < 1.16.3, and enable DRI3 if
building on later X-Servers which work reasonably well
under DRI3/Present.

A new boolean xorg.conf Option "DRI3" allows to enforce or
prevent use of DRI3/Present under EXA acceleration for
testing.

Also add a bit more output about status of Present and
DRI3 to aid debugging.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
---
 man/nouveau.man    |  6 ++++++
 src/nouveau_dri2.c | 11 ++++++++++-
 src/nv_const.h     |  2 ++
 src/nv_driver.c    | 17 +++++++++++++++--
 4 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/man/nouveau.man b/man/nouveau.man
index 129bb7f..12cfbc0 100644
--- a/man/nouveau.man
+++ b/man/nouveau.man
@@ -125,6 +125,12 @@ that relies on correct presentation timing behaviour as defined in that
 specification.
 .br
 Default: 1.
+.TP
+.BI "Option \*qDRI3\*q \*q" boolean \*q
+Enable the DRI3 extension under exa acceleration if supported by server.
+A setting of "off" will only use DRI2 instead. Under glamor acceleration,
+DRI3 is always enabled if supported. Default: on for XOrg >= 1.16.3, off for
+earlier versions.
 .SH "SEE ALSO"
 __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
 .SH AUTHORS
diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index f22e319..d818976 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -1130,7 +1130,16 @@ nouveau_dri3_screen_init(ScreenPtr screen)
 	if (buf && stat(buf, &render) == 0 &&
 	    master.st_mode == render.st_mode) {
 		pNv->render_node = buf;
-		return dri3_screen_init(screen, &nouveau_dri3_screen_info);
+		if (dri3_screen_init(screen, &nouveau_dri3_screen_info)) {
+			xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+				   "DRI3 on EXA enabled\n");
+			return TRUE;
+		}
+		else {
+			xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+				   "DRI3 on EXA initialization failed\n");
+			return FALSE;
+		}
 	} else
 		free(buf);
 #endif
diff --git a/src/nv_const.h b/src/nv_const.h
index f1b4e9b..df1e398 100644
--- a/src/nv_const.h
+++ b/src/nv_const.h
@@ -18,6 +18,7 @@ typedef enum {
     OPTION_SWAP_LIMIT,
     OPTION_ASYNC_COPY,
     OPTION_ACCELMETHOD,
+    OPTION_DRI3,
 } NVOpts;
 
 
@@ -34,6 +35,7 @@ static const OptionInfoRec NVOptions[] = {
     { OPTION_SWAP_LIMIT,	"SwapLimit",	OPTV_INTEGER,	{0}, FALSE },
     { OPTION_ASYNC_COPY,	"AsyncUTSDFS",	OPTV_BOOLEAN,	{0}, FALSE },
     { OPTION_ACCELMETHOD,	"AccelMethod",	OPTV_STRING,	{0}, FALSE },
+    { OPTION_DRI3,		"DRI3",		OPTV_BOOLEAN,	{0}, FALSE },
     { -1,                       NULL,           OPTV_NONE,      {0}, FALSE }
 };
 
diff --git a/src/nv_driver.c b/src/nv_driver.c
index 8e2ae03..32f04d8 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -1470,7 +1470,13 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
 
 	xf86SetBlackWhitePixels(pScreen);
 
-	nouveau_present_init(pScreen);
+	if (nouveau_present_init(pScreen) <= 0)
+		xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+			   "Hardware support for Present disabled\n");
+	else
+		xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+			   "Hardware support for Present enabled\n");
+
 	nouveau_sync_init(pScreen);
 	nouveau_dri2_init(pScreen);
 	if (pNv->AccelMethod == GLAMOR) {
@@ -1478,7 +1484,14 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
 			return FALSE;
 	} else
 	if (pNv->AccelMethod == EXA) {
-		if (!nouveau_dri3_screen_init(pScreen))
+		/* Default to DRI3/Present on XOrg >= 1.16.3, DRI2 on older
+		 * servers, as older servers have DRI3/Present bugs affecting
+		 * nouveau.
+		 */
+		ret = xf86ReturnOptValBool(pNv->Options, OPTION_DRI3,
+					   XORG_VERSION_CURRENT >=
+					   XORG_VERSION_NUMERIC(1,16,3,0,0));
+		if (ret && !nouveau_dri3_screen_init(pScreen))
 			return FALSE;
 
 		if (!nouveau_exa_init(pScreen))
-- 
1.9.1

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-07-26 13:11 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-30  3:30 [PATCH] Add Option "DRI3" to allow to disable DRI3 under EXA Mario Kleiner
     [not found] ` <1435635043-3738-1-git-send-email-mario.kleiner.de-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-30  7:00   ` Martin Peres
2015-07-04 17:17   ` Ilia Mirkin
     [not found]     ` <CAKb7UvhOcQ1-y2q3_8RZzvLewhsZ3A1OHC=vo3uBSwX3XTR0Eg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-04 18:23       ` Emil Velikov
     [not found]         ` <CACvgo53NaCJ6r+1LdJEG78Zyi+SBfMu2y1Mkm2HCKUo7Co5zQw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-04 18:28           ` Ilia Mirkin
     [not found]             ` <CAKb7Uvj-7AeG8EQ58cZZhF1O7HU=E_VkKO8wi7LpitoNBmCjGg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-04 19:03               ` Emil Velikov
     [not found]                 ` <CACvgo50R5kPGVAwDYTUSCkY-Cfh=HENFDT8OdT=nNKLG85=S9Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-07 19:51                   ` Ilia Mirkin
     [not found]                     ` <CAKb7UvhuYJxLk1zPQbdTgG_HQcbo0Zt_TnpHf7gD2apk+RYCdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-14  3:43                       ` Mario Kleiner
     [not found]                         ` <55A48575.5060100-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-07-14 15:26                           ` Ilia Mirkin
     [not found]                             ` <CAKb7Uvi7pCT-rkFxfpsmw-P0UhF86ZrEdtmJDc3kU+REz7oZ3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-14 19:00                               ` Mario Kleiner
     [not found]                                 ` <55A55C40.4000207-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-07-14 19:12                                   ` Ilia Mirkin
2015-07-18 11:09                                   ` Dave Airlie
     [not found]                                     ` <CAPM=9ty34G39nceFnarvs0qOoJiyqjcsgXD0FdB4Ye_O1D+EhQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-19  8:34                                       ` Mario Kleiner
     [not found]                                         ` <55AB6116.4000004-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-07-22  4:39                                           ` Dave Airlie
     [not found]                                             ` <CAPM=9twESbxOf+r4cy=-B+FNpKQwm8dvgbA9b-6XNbo275KLKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-26  8:12                                               ` Mario Kleiner
2015-07-26 13:11                                       ` Pekka Paalanen
2015-07-24 15:40                           ` Ilia Mirkin

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.