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

xserver-xorg-video-nouveau: Changes to 'upstream-unstable'



 configure.ac             |   15 --
 man/nouveau.man          |    9 +
 src/Makefile.am          |    2 
 src/drmmode_display.c    |   60 ++++++-----
 src/nouveau_copy.c       |    6 -
 src/nouveau_dri2.c       |  144 ++++++++++++++++++++++++++-
 src/nouveau_glamor.c     |  246 -----------------------------------------------
 src/nouveau_glamor.h     |   33 ------
 src/nouveau_present.c    |   34 ------
 src/nouveau_present.h    |    2 
 src/nouveau_wfb.c        |    8 -
 src/nouveau_xv.c         |   15 +-
 src/nv04_exa.c           |    3 
 src/nv10_exa.c           |    8 -
 src/nv30_exa.c           |   20 +--
 src/nv40_exa.c           |    8 -
 src/nv50_accel.c         |  227 +++++++++++++++++++++----------------------
 src/nv50_accel.h         |    1 
 src/nv50_exa.c           |    8 -
 src/nv50_xv.c            |    3 
 src/nv_accel_common.c    |   27 +----
 src/nv_const.h           |    2 
 src/nv_driver.c          |  106 ++++++++++++--------
 src/nv_proto.h           |    1 
 src/nv_type.h            |    5 
 src/nvc0_accel.c         |   12 +-
 src/nvc0_exa.c           |    2 
 src/shader/Makefile      |   13 +-
 src/shader/exac8nvf0.fp  |    4 
 src/shader/exac8nvf0.fpc |    4 
 src/shader/exacanve0.fp  |    1 
 src/shader/exacanve0.fpc |    2 
 src/shader/exacanvf0.fp  |    5 
 src/shader/exacanvf0.fpc |    6 -
 src/shader/exacmnve0.fp  |    1 
 src/shader/exacmnve0.fpc |    2 
 src/shader/exacmnvf0.fp  |    5 
 src/shader/exacmnvf0.fpc |    6 -
 src/shader/exas8nvf0.fp  |    2 
 src/shader/exas8nvf0.fpc |    2 
 src/shader/exasanve0.fp  |    1 
 src/shader/exasanve0.fpc |    2 
 src/shader/exasanvf0.fp  |    5 
 src/shader/exasanvf0.fpc |    6 -
 src/shader/exascnvf0.fp  |    2 
 src/shader/exascnvf0.fpc |    2 
 src/shader/videonvf0.fp  |    4 
 src/shader/videonvf0.fpc |    4 
 48 files changed, 461 insertions(+), 625 deletions(-)

New commits:
commit b18bc036bf9997ea65f5cbd824fd057931e604fe
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Tue Dec 8 15:52:25 2015 +1000

    Bump version to 1.0.12
    
    Various random fixes have been pending for a long while now...
    
    Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

diff --git a/configure.ac b/configure.ac
index 9c77f94..8da54f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-nouveau],
-        [1.0.11],
+        [1.0.12],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-nouveau])
 

commit 6e6d8ac1c7b4ee047a7b40b95dea1e65a7c3211a
Author: Mario Kleiner <mario.kleiner.de@gmail.com>
Date:   Sun Jun 28 02:33:49 2015 +0200

    Take shift in crtc positions for ZaphodHeads configs into account.
    
    In multi-x-screen ZaphodHeads configurations, there isn't a
    one-to-one mapping of kernel provided drmmode crtc index
    to the index of the corresponding xf86Crtc inside the
    xf86CrtcConfig crtc array anymore, ie. for kernel provided
    drmmode->mode_res->crtcs[i], the i'th crtc won't correspond
    to the xf86Crtc in the i'th slot of the x-screens xf86CrtcConfig
    anymore, once ZaphodHeads has only selected a subset of all crtcs
    of a graphics card for a given x-screen, instead of all crtcs.
    
    This breaks the mapping of bit positions in the bit masks returned
    in kencoder->possible_crtcs and kencoder->possible_clones. A 1 bit
    in position i of those masks allows use of the kernels i'th crtc for
    the given kencoder. The X-Servers dix code checks those bit masks
    for valid xf86Output -> xf86Crtc assignments, assuming that the i'th
    slot xf86CrtcConfigPtr config->crtc[i] corresponds to bit i in the
    xf86Output->possibe_crtcs bitmask, and bails if the bitmask doesn't
    allow the specified assignment of crtc to output. If ZaphodHeads
    breaks the assumption of bit i <-> crtc slot i this ends in failure.
    
    Take this shift of crtc index positions wrt. encoder bitmask bit
    positions into account by bit-shifting positions accordingly when
    assigning encoder->possible_crtcs to output->possible_crtcs, so
    the proper indices match up again for validation by the dix.
    
    This problem wasn't apparent last year when testing the ZaphodHeads
    support on some Kepler cards, as apparently the encoder->possible_crtcs
    bitmasks returned for those cards by the kernel just had all 4
    lsb bits set for all tested encoders/output, so each of the cards 4
    crtcs could go with each output and things worked by chance.
    
    The current code breaks, e.g., on 2010 MacBookPro with nv50, where
    one crtc is hardwired to the internal lvds panel, and one crtc
    is hardwired to the external DP connector, resulting in a failure
    where dual-display on single-x-screen works fine, but assigning
    each output to a separate x-screen via ZaphodHeads fails due to
    the mismatched encoder->possible_crtcs bitmasks.
    
    This patch fixes the problem.
    
    Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
    Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index dc2e0ac..1dc48c5 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1211,7 +1211,7 @@ drmmode_zaphod_match(ScrnInfoPtr pScrn, const char *s, char *output_name)
 }
 
 static unsigned int
-drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
+drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num, int crtcshift)
 {
 	NVPtr pNv = NVPTR(pScrn);
 	xf86OutputPtr output;
@@ -1293,8 +1293,8 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
 	output->subpixel_order = subpixel_conv_table[koutput->subpixel];
 	output->driver_private = drmmode_output;
 
-	output->possible_crtcs = kencoder->possible_crtcs;
-	output->possible_clones = kencoder->possible_clones;
+	output->possible_crtcs = kencoder->possible_crtcs >> crtcshift;
+	output->possible_clones = kencoder->possible_clones >> crtcshift;
 
 	output->interlaceAllowed = true;
 	output->doubleScanAllowed = true;
@@ -1415,6 +1415,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
 	NVEntPtr pNVEnt = NVEntPriv(pScrn);
 	int i;
 	unsigned int crtcs_needed = 0;
+	int crtcshift;
 
 	drmmode = xnfalloc(sizeof *drmmode);
 	drmmode->fd = fd;
@@ -1438,8 +1439,9 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
 	}
 
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing outputs ...\n");
+	crtcshift = ffs(pNVEnt->assigned_crtcs ^ 0xffffffff) - 1;
 	for (i = 0; i < drmmode->mode_res->count_connectors; i++)
-		crtcs_needed += drmmode_output_init(pScrn, drmmode, i);
+		crtcs_needed += drmmode_output_init(pScrn, drmmode, i, crtcshift);
 
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		   "%d crtcs needed for screen.\n", crtcs_needed);

commit 1ff13a922535924681b91452235b017e43a4c6f6
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Sun Sep 13 15:29:15 2015 -0400

    fix build after glamor removal
    
    Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 6495961..dc2e0ac 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -104,7 +104,6 @@ drmmode_from_scrn(ScrnInfoPtr scrn)
 static inline struct nouveau_pixmap *
 drmmode_pixmap(PixmapPtr ppix)
 {
-	NVPtr pNv = NVPTR(xf86ScreenToScrn(ppix->drawable.pScreen));
 	return nouveau_pixmap(ppix);
 }
 
diff --git a/src/nv_driver.c b/src/nv_driver.c
index c3bd41b..4dde8e0 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -1051,12 +1051,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 	}
 
 	if (pNv->AccelMethod == UNKNOWN) {
-#ifdef HAVE_GLAMOR
-		if (pNv->Architecture >= NV_MAXWELL)
-			pNv->AccelMethod = GLAMOR;
-		else
-#endif
-			pNv->AccelMethod = EXA;
+		pNv->AccelMethod = EXA;
 	}
 
 	if (xf86ReturnOptValBool(pNv->Options, OPTION_NOACCEL, FALSE)) {
@@ -1084,10 +1079,9 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 
 	/* Define maximum allowed level of DRI implementation to use.
 	 * We default to DRI2 on EXA for now, as DRI3 still has some
-	 * problems. However, the max_dri_level can be only honored
-	 * by EXA, as GLAMOR only supports DRI3 at the moment.
+	 * problems.
 	 */
-	pNv->max_dri_level = (pNv->AccelMethod == GLAMOR) ? 3 : 2;
+	pNv->max_dri_level = 2;
 	from = X_DEFAULT;
 
 	if (xf86GetOptValInteger(pNv->Options, OPTION_DRI,

commit 3bb943b33bbe8e593afc00d13fe867dd7a708c3c
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Thu Aug 21 20:36:41 2014 -0400

    xv: use correct max width/height settings
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70931
    Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>

diff --git a/src/nouveau_xv.c b/src/nouveau_xv.c
index a82ef2c..d514dbf 100644
--- a/src/nouveau_xv.c
+++ b/src/nouveau_xv.c
@@ -1068,6 +1068,8 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x,
 	if (pPriv->grabbedByV4L)
 		return Success;
 
+	if (width > pPriv->max_image_dim || height > pPriv->max_image_dim)
+		return BadMatch;
 
 	NV_set_action_flags(pScrn, pDraw, pPriv, id, drw_x, drw_y, drw_w,
 			    drw_h, &action_flags);
@@ -1441,11 +1443,6 @@ NVQueryImageAttributes(ScrnInfoPtr pScrn, int id,
 {
 	int size, tmp;
 
-	if (*w > IMAGE_MAX_W)
-		*w = IMAGE_MAX_W;
-	if (*h > IMAGE_MAX_H)
-		*h = IMAGE_MAX_H;
-
 	*w = (*w + 1) & ~1; // width rounded up to an even number
 	if (offsets)
 		offsets[0] = 0;
@@ -1706,6 +1703,7 @@ NVSetupBlitVideo (ScreenPtr pScreen)
 	pPriv->bicubic			= FALSE;
 	pPriv->doubleBuffer		= FALSE;
 	pPriv->SyncToVBlank		= (pNv->dev->chipset >= 0x11);
+	pPriv->max_image_dim            = 2048;
 
 	pNv->blitAdaptor		= adapt;
 
@@ -1766,6 +1764,7 @@ NVSetupOverlayVideoAdapter(ScreenPtr pScreen)
 	pPriv->blitter			= FALSE;
 	pPriv->texture			= FALSE;
 	pPriv->bicubic			= FALSE;
+	pPriv->max_image_dim            = 2048;
 
 	NVSetPortDefaults (pScrn, pPriv);
 
@@ -1967,6 +1966,7 @@ NV30SetupTexturedVideo (ScreenPtr pScreen, Bool bicubic)
 	pPriv->bicubic			= bicubic;
 	pPriv->doubleBuffer		= FALSE;
 	pPriv->SyncToVBlank		= TRUE;
+	pPriv->max_image_dim            = 4096;
 
 	if (bicubic)
 		pNv->textureAdaptor[1]	= adapt;
@@ -2048,6 +2048,7 @@ NV40SetupTexturedVideo (ScreenPtr pScreen, Bool bicubic)
 	pPriv->bicubic			= bicubic;
 	pPriv->doubleBuffer		= FALSE;
 	pPriv->SyncToVBlank		= TRUE;
+	pPriv->max_image_dim            = 4096;
 
 	if (bicubic)
 		pNv->textureAdaptor[1]	= adapt;
diff --git a/src/nv50_xv.c b/src/nv50_xv.c
index 1c467f4..b2541b9 100644
--- a/src/nv50_xv.c
+++ b/src/nv50_xv.c
@@ -364,6 +364,7 @@ nv50_xv_set_port_defaults(ScrnInfoPtr pScrn, NVPortPrivPtr pPriv)
 	pPriv->saturation	= 0;
 	pPriv->hue		= 0;
 	pPriv->iturbt_709	= 0;
+	pPriv->max_image_dim    = 8192;
 }
 
 int
diff --git a/src/nv_type.h b/src/nv_type.h
index d903e75..d7bb4f4 100644
--- a/src/nv_type.h
+++ b/src/nv_type.h
@@ -165,6 +165,7 @@ typedef struct _NVPortPrivRec {
 	Bool		texture;
 	Bool		bicubic; /* only for texture adapter */
 	Bool		SyncToVBlank;
+	int             max_image_dim;
 	struct nouveau_bo *video_mem;
 	int		pitch;
 	int		offset;

commit 3e2e0faa2ee1cce9c1bb5c7ad80d0592460f3edc
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Sat Jul 11 17:16:27 2015 -0400

    remove maxwell GM10x support for now
    
    There is no EXA acceleration, and now no GLAMOR either.
    User is better off with modesetting until EXA makes an appearance.
    
    Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>

diff --git a/src/nv_driver.c b/src/nv_driver.c
index ab7e127..c3bd41b 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -389,10 +389,9 @@ NVHasKMS(struct pci_device *pci_dev, struct xf86_platform_device *platform_dev)
 	case 0xe0:
 	case 0xf0:
 	case 0x100:
-	case 0x110:
 		break;
 	default:
-		xf86DrvMsg(-1, X_ERROR, "Unknown chipset: NV%02x\n", chipset);
+		xf86DrvMsg(-1, X_ERROR, "Unknown chipset: NV%02X\n", chipset);
 		return FALSE;
 	}
 	return TRUE;

commit 1f8b2b348526d94e9bde4a285f331a4934c11078
Author: Ilia Mirkin <imirkin@alum.mit.edu>
Date:   Sat Jul 11 17:08:52 2015 -0400

    glamor: remove
    
    If you want glamor, just use modesetting instead. It's hooked up
    incorrectly in nouveau, and there doesn't seem to be any point in fixing
    it when the modesetting driver does it all properly.
    
    Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>

diff --git a/configure.ac b/configure.ac
index 03563c1..9c77f94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,17 +140,6 @@ if test "x$have_list_h" = xyes; then
                    #include "list.h"])
 fi
 
-AC_CHECK_HEADERS([glamor.h],[found_glamor_header=yes],[found_glamor_header=no],
-		 [#include "xorg-server.h"])
-AC_MSG_CHECKING([whether to include GLAMOR support])
-if test "x$found_glamor_header" = xyes && pkg-config --exists "xorg-server >= 1.15.99.901"
-then
-	AC_DEFINE(HAVE_GLAMOR, 1, [Build support for glamor acceleration])
-	AC_MSG_RESULT([yes])
-else
-	AC_MSG_RESULT([no])
-fi
-
 AC_CONFIG_FILES([
 	Makefile
 	src/Makefile
diff --git a/man/nouveau.man b/man/nouveau.man
index 3d5a428..64e4144 100644
--- a/man/nouveau.man
+++ b/man/nouveau.man
@@ -81,8 +81,7 @@ are supported:
 Enable or disable the HW cursor.  Default: on.
 .TP
 .BI "Option \*qAccelMethod\*q \*q" string \*q
-Specify the acceleration method. One of \*qnone\*q, \*qexa\*q, or
-\*qglamor\*q. Default: exa, except for GMxxx which default to glamor.
+Specify the acceleration method. One of \*qnone\*q, or \*qexa\*q. Default: exa.
 .TP
 .BI "Option \*qNoAccel\*q \*q" boolean \*q
 Disable or enable acceleration.  Default: acceleration is enabled.
diff --git a/src/Makefile.am b/src/Makefile.am
index 9d39a00..1e04ddf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,7 +35,6 @@ nouveau_drv_la_SOURCES = \
 			 nouveau_copy90b5.c \
 			 nouveau_copya0b5.c \
 			 nouveau_exa.c nouveau_xv.c nouveau_dri2.c \
-			 nouveau_glamor.c \
 			 nouveau_present.c \
 			 nouveau_sync.c \
 			 nouveau_wfb.c \
@@ -123,7 +122,6 @@ EXTRA_DIST = hwdefs/nv_3ddefs.xml.h \
 	     shader/Makefile \
 	     nouveau_local.h \
 	     nouveau_copy.h \
-	     nouveau_glamor.h \
 	     nouveau_present.h \
 	     nouveau_sync.h \
 	     nv_const.h \
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index cd13820..6495961 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -42,8 +42,6 @@
 #include "libudev.h"
 #endif
 
-#include "nouveau_glamor.h"
-
 static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height);
 typedef struct {
     int fd;
@@ -107,8 +105,6 @@ static inline struct nouveau_pixmap *
 drmmode_pixmap(PixmapPtr ppix)
 {
 	NVPtr pNv = NVPTR(xf86ScreenToScrn(ppix->drawable.pScreen));
-	if (pNv->AccelMethod == GLAMOR)
-		return nouveau_glamor_pixmap_get(ppix);
 	return nouveau_pixmap(ppix);
 }
 
@@ -1393,9 +1389,6 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 				       crtc->rotation, crtc->x, crtc->y);
 	}
 
-	if (pNv->AccelMethod == GLAMOR)
-		nouveau_glamor_create_screen_resources(scrn->pScreen);
-
 	if (old_fb_id)
 		drmModeRmFB(drmmode->fd, old_fb_id);
 	nouveau_bo_ref(NULL, &old_bo);
diff --git a/src/nouveau_glamor.c b/src/nouveau_glamor.c
deleted file mode 100644
index a8e9206..0000000
--- a/src/nouveau_glamor.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright 2014 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: Ben Skeggs <bskeggs@redhat.com>
- */
-
-#include "nouveau_glamor.h"
-#ifdef HAVE_GLAMOR
-
-static DevPrivateKeyRec glamor_private;
-
-void
-nouveau_glamor_pixmap_set(PixmapPtr pixmap, struct nouveau_pixmap *priv)
-{
-	dixSetPrivate(&pixmap->devPrivates, &glamor_private, priv);
-}
-
-struct nouveau_pixmap *
-nouveau_glamor_pixmap_get(PixmapPtr pixmap)
-{
-	return dixGetPrivate(&pixmap->devPrivates, &glamor_private);
-}
-
-static Bool
-nouveau_glamor_destroy_pixmap(PixmapPtr pixmap)
-{
-	struct nouveau_pixmap *priv = nouveau_glamor_pixmap_get(pixmap);
-	if (pixmap->refcnt == 1) {
-		glamor_egl_destroy_textured_pixmap(pixmap);
-		if (priv)
-			nouveau_bo_ref(NULL, &priv->bo);
-	}
-	fbDestroyPixmap(pixmap);
-	return TRUE;
-}
-
-static PixmapPtr
-nouveau_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
-			     unsigned usage)
-{
-	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
-	struct nouveau_pixmap *priv;
-	PixmapPtr pixmap;
-	int pitch;
-
-	if (usage != CREATE_PIXMAP_USAGE_SHARED)
-		return glamor_create_pixmap(screen, w, h, depth, usage);
-	if (depth == 1)
-		return fbCreatePixmap(screen, w, h, depth, usage);
-	if (w > 32767 || h > 32767)
-		return NullPixmap;
-
-	pixmap = fbCreatePixmap(screen, 0, 0, depth, usage);
-	if (pixmap == NullPixmap || !w || !h)
-		return pixmap;
-
-	priv = calloc(1, sizeof(*priv));
-	if (!priv)
-		goto fail_priv;
-
-	if (!nouveau_allocate_surface(scrn, w, h,
-				     pixmap->drawable.bitsPerPixel,
-				     usage, &pitch, &priv->bo))
-		goto fail_bo;
-
-	nouveau_glamor_pixmap_set(pixmap, priv);
-	screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL);
-
-	if (!glamor_egl_create_textured_pixmap(pixmap, priv->bo->handle,
-					       pixmap->devKind)) {
-		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-			   "[GLAMOR] failed to create textured PRIME pixmap.");
-		return pixmap;
-	}
-
-	return pixmap;
-fail_bo:
-	free(priv);
-fail_priv:
-	fbDestroyPixmap(pixmap);
-	return fbCreatePixmap(screen, w, h, depth, usage);
-}
-
-static Bool
-nouveau_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave,
-				    void **phandle)
-{
-	struct nouveau_pixmap *priv = nouveau_glamor_pixmap_get(pixmap);
-	int ret, handle;
-
-	ret = nouveau_bo_set_prime(priv->bo, &handle);
-	if (ret)
-		return FALSE;
-
-	priv->shared = TRUE;
-	*phandle = (void *)(long)handle;
-	return TRUE;
-}
-
-static Bool
-nouveau_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void *_handle)
-{
-	struct nouveau_pixmap *priv = nouveau_glamor_pixmap_get(pixmap);
-	ScreenPtr screen = pixmap->drawable.pScreen;
-	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
-	NVPtr pNv = NVPTR(scrn);
-	struct nouveau_bo *bo;
-	int ret, handle = (int)(long)_handle;
-
-	ret = nouveau_bo_prime_handle_ref(pNv->dev, handle, &bo);
-	if (ret)
-		return FALSE;
-
-	if (!priv) {
-		priv = calloc(1, sizeof(*priv));
-		if (!priv)
-			return FALSE;
-		nouveau_glamor_pixmap_set(pixmap, priv);
-	}
-
-	priv->bo = bo;
-	priv->shared = TRUE;
-	close(handle);
-
-	if (!glamor_egl_create_textured_pixmap(pixmap, priv->bo->handle,
-					       pixmap->devKind)) {
-		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-			   "[GLAMOR] failed to get PRIME drawable\n");
-		return FALSE;
-	}
-
-	return TRUE;
-}
-
-static void
-nouveau_glamor_flush(ScrnInfoPtr pScrn)
-{
-	glamor_block_handler(pScrn->pScreen);
-}
-
-Bool
-nouveau_glamor_create_screen_resources(ScreenPtr screen)
-{
-	PixmapPtr ppix = screen->GetScreenPixmap(screen);
-	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
-	NVPtr pNv = NVPTR(scrn);
-
-	if (!glamor_glyphs_init(screen))
-		return FALSE;
-
-	if (!glamor_egl_create_textured_screen_ext(screen,
-						   pNv->scanout->handle,
-						   scrn->displayWidth *
-						   scrn->bitsPerPixel / 8,
-						   NULL))
-		return FALSE;
-
-	if (!nouveau_glamor_pixmap_get(ppix)) {
-		struct nouveau_pixmap *priv = calloc(1, sizeof(*priv));
-		if (priv) {
-			nouveau_bo_ref(pNv->scanout, &priv->bo);
-			nouveau_glamor_pixmap_set(ppix, priv);
-		}
-	}
-
-	return TRUE;
-}
-
-Bool
-nouveau_glamor_pre_init(ScrnInfoPtr scrn)
-{
-	NVPtr pNv = NVPTR(scrn);
-	pointer glamor_module;
-
-	if (scrn->depth < 24) {
-		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-			   "[GLAMOR] requires depth >= 24\n");
-		return FALSE;
-	}
-
-	if ((glamor_module = xf86LoadSubModule(scrn, GLAMOR_EGL_MODULE_NAME))) {
-		if (!glamor_egl_init(scrn, pNv->dev->fd)) {
-			xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-				   "[GLAMOR] failed to initialise EGL\n");
-			return FALSE;
-		}
-	} else {
-		xf86DrvMsg(scrn->scrnIndex, X_ERROR, "[GLAMOR] unavailable\n");
-		return FALSE;
-	}
-
-	xf86DrvMsg(scrn->scrnIndex, X_INFO, "[GLAMOR] EGL initialised\n");
-	return TRUE;
-}
-
-Bool
-nouveau_glamor_init(ScreenPtr screen)
-{
-	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
-	NVPtr pNv = NVPTR(scrn);
-
-	if (!glamor_init(screen, GLAMOR_INVERTED_Y_AXIS |
-				 GLAMOR_USE_EGL_SCREEN |
-				 GLAMOR_USE_SCREEN |
-				 GLAMOR_USE_PICTURE_SCREEN)) {
-		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-			   "[GLAMOR] failed to initialise\n");
-		return FALSE;
-	}
-
-	if (!glamor_egl_init_textured_pixmap(screen)) {
-		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-			   "[GLAMOR] failed to initialize screen pixmap\n");
-		return FALSE;
-	}
-
-	if (!dixRegisterPrivateKey(&glamor_private, PRIVATE_PIXMAP, 0))
-		return FALSE;
-
-	screen->CreatePixmap = nouveau_glamor_create_pixmap;
-	screen->DestroyPixmap = nouveau_glamor_destroy_pixmap;
-	screen->SharePixmapBacking = nouveau_glamor_share_pixmap_backing;
-	screen->SetSharedPixmapBacking = nouveau_glamor_set_shared_pixmap_backing;
-
-	xf86DrvMsg(scrn->scrnIndex, X_INFO, "[GLAMOR] initialised with DRI3\n");
-	pNv->Flush = nouveau_glamor_flush;
-	return TRUE;
-}
-
-XF86VideoAdaptorPtr
-nouveau_glamor_xv_init(ScreenPtr pScreen, int num_adapt)
-{
-	return glamor_xv_init(pScreen, num_adapt);
-}
-#endif
diff --git a/src/nouveau_glamor.h b/src/nouveau_glamor.h
deleted file mode 100644
index fb6565d..0000000
--- a/src/nouveau_glamor.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef __NOUVEAU_GLAMOR_H__
-#define __NOUVEAU_GLAMOR_H__
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "xf86xv.h"
-
-#ifdef HAVE_GLAMOR
-#include "nv_include.h"
-#define GLAMOR_FOR_XORG 1
-#include "glamor.h"
-
-Bool nouveau_glamor_pre_init(ScrnInfoPtr scrn);
-Bool nouveau_glamor_init(ScreenPtr screen);
-Bool nouveau_glamor_create_screen_resources(ScreenPtr screen);
-XF86VideoAdaptorPtr nouveau_glamor_xv_init(ScreenPtr pScreen, int num_adapt);
-void nouveau_glamor_pixmap_set(PixmapPtr pixmap, struct nouveau_pixmap *priv);
-struct nouveau_pixmap *nouveau_glamor_pixmap_get(PixmapPtr pixmap);
-#else
-static inline Bool nouveau_glamor_pre_init(ScrnInfoPtr scrn) { return FALSE; }
-static inline Bool nouveau_glamor_init(ScreenPtr screen) { return FALSE; }
-static inline Bool
-nouveau_glamor_create_screen_resources(ScreenPtr screen) { return FALSE; }
-static inline void
-nouveau_glamor_pixmap_set(PixmapPtr pixmap, void *priv) { }
-static inline struct nouveau_pixmap *
-nouveau_glamor_pixmap_get(PixmapPtr pixmap) { return NULL; }
-static inline XF86VideoAdaptorPtr
-nouveau_glamor_xv_init(ScreenPtr pScreen, int num_adapt) { return NULL; }
-#endif
-
-#endif
diff --git a/src/nouveau_present.c b/src/nouveau_present.c
index 699a58d..482ac6e 100644
--- a/src/nouveau_present.c
+++ b/src/nouveau_present.c
@@ -25,7 +25,6 @@
 #include "nouveau_present.h"
 #if defined(DRI3)
 #include "nv_include.h"
-#include "nouveau_glamor.h"
 #include "xf86drmMode.h"
 
 struct nouveau_present {
@@ -177,38 +176,12 @@ static Bool
 nouveau_present_flip_exec(ScrnInfoPtr scrn, uint64_t event_id, int sync,
 			  uint64_t target_msc, PixmapPtr pixmap, Bool vsync)
 {
-	ScreenPtr screen = scrn->pScreen;
-	struct nouveau_pixmap *priv = NULL;
+	struct nouveau_pixmap *priv = nouveau_pixmap(pixmap);
 	NVPtr pNv = NVPTR(scrn);
 	uint32_t next_fb;
-	CARD16 stride;
-	CARD32 size;
 	void *token;
 	int ret;
 
-#ifdef HAVE_GLAMOR
-	if (pNv->AccelMethod == GLAMOR &&
-	    !(priv = nouveau_glamor_pixmap_get(pixmap))) {
-		int fd = glamor_fd_from_pixmap(screen, pixmap, &stride, &size);
-		if (fd < 0)
-			return FALSE;
-
-		priv = calloc(1, sizeof(*priv));
-		if (!priv)
-			return FALSE;
-
-		ret = nouveau_bo_prime_handle_ref(pNv->dev, fd, &priv->bo);
-		if (ret) {
-			free(priv);
-			return FALSE;
-		}
-
-		nouveau_glamor_pixmap_set(pixmap, priv);
-	} else
-#endif
-	if (!priv)
-		priv = nouveau_pixmap(pixmap);
-
 	ret = drmModeAddFB(pNv->dev->fd, pixmap->drawable.width,
 			   pixmap->drawable.height, pixmap->drawable.depth,
 			   pixmap->drawable.bitsPerPixel, pixmap->devKind,
diff --git a/src/nouveau_wfb.c b/src/nouveau_wfb.c
index 10f0f27..a52f2fd 100644
--- a/src/nouveau_wfb.c
+++ b/src/nouveau_wfb.c
@@ -26,7 +26,6 @@
  */
 
 #include "nv_include.h"
-#include "nouveau_glamor.h"
 
 struct wfb_pixmap {
 	PixmapPtr ppix;
@@ -136,12 +135,7 @@ nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite,
 
 	ppix = NVGetDrawablePixmap(pDraw);
 	if (ppix) {
-		NVPtr pNv = NVPTR(xf86ScreenToScrn(pDraw->pScreen));
-		struct nouveau_pixmap *priv;
-		if (pNv->AccelMethod == GLAMOR)
-			priv = nouveau_glamor_pixmap_get(ppix);
-		else
-			priv = nouveau_pixmap(ppix);
+		struct nouveau_pixmap *priv = nouveau_pixmap(ppix);
 		bo = priv ? priv->bo : NULL;
 	}
 
diff --git a/src/nouveau_xv.c b/src/nouveau_xv.c
index a479d38..a82ef2c 100644
--- a/src/nouveau_xv.c
+++ b/src/nouveau_xv.c
@@ -38,7 +38,6 @@
 
 #include "nv_include.h"
 #include "nv_dma.h"
-#include "nouveau_glamor.h"
 
 #include "vl_hwmc.h"
 
@@ -2182,9 +2181,6 @@ NVInitVideo(ScreenPtr pScreen)
 		}
 
 		NVSetupTexturedVideo(pScreen, textureAdaptor);
-	} else
-	if (pNv->AccelMethod == GLAMOR) {
-		blitAdaptor = nouveau_glamor_xv_init(pScreen, 16);
 	}
 
 	num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
diff --git a/src/nv_driver.c b/src/nv_driver.c
index 514a8bc..ab7e127 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -34,7 +34,6 @@
 #endif
 
 #include "nouveau_copy.h"
-#include "nouveau_glamor.h"
 #include "nouveau_present.h"
 #include "nouveau_sync.h"
 
@@ -625,9 +624,6 @@ NVCreateScreenResources(ScreenPtr pScreen)
 	if (pNv->AccelMethod == EXA) {
 		PixmapPtr ppix = pScreen->GetScreenPixmap(pScreen);
 		nouveau_bo_ref(pNv->scanout, &nouveau_pixmap(ppix)->bo);
-	} else
-	if (pNv->AccelMethod == GLAMOR) {
-		nouveau_glamor_create_screen_resources(pScreen);
 	}
 
 	return TRUE;
@@ -1049,9 +1045,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 	if (string) {
 		if      (!strcmp(string,   "none")) pNv->AccelMethod = NONE;
 		else if (!strcmp(string,    "exa")) pNv->AccelMethod = EXA;
-#ifdef HAVE_GLAMOR
-		else if (!strcmp(string, "glamor")) pNv->AccelMethod = GLAMOR;
-#endif
 		else {
 			xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 				   "Invalid AccelMethod specified\n");
@@ -1087,11 +1080,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 		pNv->tiled_scanout = TRUE;
 	}
 
-	if (pNv->AccelMethod == GLAMOR) {
-		if (!nouveau_glamor_pre_init(pScrn))
-			pNv->AccelMethod = EXA;
-	}
-
 	pNv->ce_enabled =
 		xf86ReturnOptValBool(pNv->Options, OPTION_ASYNC_COPY, FALSE);
 
@@ -1502,10 +1490,6 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
 
 	nouveau_sync_init(pScreen);
 	nouveau_dri2_init(pScreen);
-	if (pNv->AccelMethod == GLAMOR) {
-		if (!nouveau_glamor_init(pScreen))
-			return FALSE;
-	} else
 	if (pNv->AccelMethod == EXA) {
 		if (pNv->max_dri_level >= 3 &&
 		    !nouveau_dri3_screen_init(pScreen))
diff --git a/src/nv_type.h b/src/nv_type.h
index 510a30c..d903e75 100644
--- a/src/nv_type.h
+++ b/src/nv_type.h
@@ -53,7 +53,6 @@ typedef struct _NVRec {
 	    UNKNOWN = 0,
 	    NONE,
 	    EXA,
-	    GLAMOR,
     } AccelMethod;
     void (*Flush)(ScrnInfoPtr);
 

commit 6296145654b78518f3299bb5887f224f0d3810fd
Author: Mario Kleiner <mario.kleiner.de@gmail.com>
Date:   Wed Jul 29 14:39:02 2015 +0200

    Add Option "DRI" to allow selection of maximum DRI level. (v2)
    
    Allow user to select the maximum level of DRI implementation
    to use, DRI2 or DRI3.
    
    exa accel supports both DRI2 and, if the kernel supports
    rendernodes, also DRI3. However, DRI3 still seems to have
    some bugs on current implementations, and additionally it
    doesn't work well at all for X-Servers older than 1.16.3
    due to X-Server bugs. Therefore we default to DRI2 on exa,
    but allow the user to enable DRI3 with this new option.
    
    nouveau's glamor accel backend currently doesn't work under
    DRI2 at all, so we continue to use DRI3 whenever it is
    supported and ignore this new option for now.
    
    Also add a bit more output about status of Present and
    DRI3 to aid debugging.
    
    Note: This was originally meant to be a boolean parameter,
          to just select between DRI3 on and off, but changed
          here to a DRI level to make it consistent with the
          same option in the released Intel-ddx.
    
    v2: Use fixed up Bool return type of nouveau_present_init().
    
    Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
    Cc: Ilia Mirkin <imirkin@alum.mit.edu>
    Cc: Emil Velikov <emil.l.velikov@gmail.com>
    Cc: Martin Peres <martin.peres@free.fr>
    Cc: Ben Skeggs <bskeggs@redhat.com>
    Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>

diff --git a/man/nouveau.man b/man/nouveau.man
index 129bb7f..3d5a428 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 \*qDRI\*q \*q" integer \*q
+Define the maximum level of DRI to enable. Valid values are 2 or 3.
+exa acceleration will honor the maximum level if it is supported.
+Under glamor acceleration DRI3 is always enabled if supported,
+as glamor currently does not support DRI2. Default: 2 on exa, 3 on glamor.
 .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 ce6f53e..81ee9be 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -1134,7 +1134,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/nouveau_glamor.c b/src/nouveau_glamor.c
index b8bca17..a8e9206 100644
--- a/src/nouveau_glamor.c
+++ b/src/nouveau_glamor.c
@@ -240,7 +240,7 @@ nouveau_glamor_init(ScreenPtr screen)
 	screen->SharePixmapBacking = nouveau_glamor_share_pixmap_backing;
 	screen->SetSharedPixmapBacking = nouveau_glamor_set_shared_pixmap_backing;
 
-	xf86DrvMsg(scrn->scrnIndex, X_INFO, "[GLAMOR] initialised\n");
+	xf86DrvMsg(scrn->scrnIndex, X_INFO, "[GLAMOR] initialised with DRI3\n");
 	pNv->Flush = nouveau_glamor_flush;
 	return TRUE;
 }
diff --git a/src/nv_const.h b/src/nv_const.h
index f1b4e9b..3f18d23 100644
--- a/src/nv_const.h
+++ b/src/nv_const.h
@@ -18,6 +18,7 @@ typedef enum {
     OPTION_SWAP_LIMIT,
     OPTION_ASYNC_COPY,


Reply to: