pkgsrc-WIP-changes archive

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

xf86-video-ati-dfbsd: Update wip/xf86-video-ati-dfbsd to 18.1.0



Module Name:	pkgsrc-wip
Committed By:	David Shao <davshao%gmail.com@localhost>
Pushed By:	dshao
Date:		Sat Feb 23 20:41:49 2019 -0800
Changeset:	c0bf6ea461fdaa7cf0ad4c40e6f34b9cdfdb4909

Modified Files:
	xf86-video-ati-dfbsd/Makefile
	xf86-video-ati-dfbsd/distinfo
	xf86-video-ati-dfbsd/patches/patch-src_radeon__kms.c
Added Files:
	xf86-video-ati-dfbsd/patches/patch-configure
	xf86-video-ati-dfbsd/patches/patch-src_drmmode__display.c
	xf86-video-ati-dfbsd/patches/patch-src_radeon.h
	xf86-video-ati-dfbsd/patches/patch-src_radeon__bo__helper.c
	xf86-video-ati-dfbsd/patches/patch-src_radeon__bo__helper.h
	xf86-video-ati-dfbsd/patches/patch-src_radeon__dri2.c
	xf86-video-ati-dfbsd/patches/patch-src_radeon__dri3.c
	xf86-video-ati-dfbsd/patches/patch-src_radeon__glamor.c
	xf86-video-ati-dfbsd/patches/patch-src_radeon__glamor.h
	xf86-video-ati-dfbsd/patches/patch-src_radeon__probe.c

Log Message:
xf86-video-ati-dfbsd: Update wip/xf86-video-ati-dfbsd to 18.1.0

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=c0bf6ea461fdaa7cf0ad4c40e6f34b9cdfdb4909

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 xf86-video-ati-dfbsd/Makefile                      |  25 +++-
 xf86-video-ati-dfbsd/distinfo                      |  22 +++-
 xf86-video-ati-dfbsd/patches/patch-configure       |  27 ++++
 .../patches/patch-src_drmmode__display.c           |  79 +++++++++++
 xf86-video-ati-dfbsd/patches/patch-src_radeon.h    |  49 +++++++
 .../patches/patch-src_radeon__bo__helper.c         |  93 +++++++++++++
 .../patches/patch-src_radeon__bo__helper.h         |  57 ++++++++
 .../patches/patch-src_radeon__dri2.c               |  32 +++++
 .../patches/patch-src_radeon__dri3.c               |  41 ++++++
 .../patches/patch-src_radeon__glamor.c             | 145 +++++++++++++++++++++
 .../patches/patch-src_radeon__glamor.h             |  73 +++++++++++
 .../patches/patch-src_radeon__kms.c                | 111 +++++++++-------
 .../patches/patch-src_radeon__probe.c              |  29 +++++
 13 files changed, 721 insertions(+), 62 deletions(-)

diffs:
diff --git a/xf86-video-ati-dfbsd/Makefile b/xf86-video-ati-dfbsd/Makefile
index 6a7b0e0375..7954dd746f 100644
--- a/xf86-video-ati-dfbsd/Makefile
+++ b/xf86-video-ati-dfbsd/Makefile
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.42 2017/03/16 12:04:25 wiz Exp $
+# $NetBSD: Makefile,v 1.47 2018/09/16 20:28:51 triaxx Exp $
 
-DISTNAME=	xf86-video-ati-7.9.0
-PKGREVISION=	1
+DISTNAME=	xf86-video-ati-18.1.0
 CATEGORIES=	x11
 MASTER_SITES=	${MASTER_SITE_XORG:=driver/}
 EXTRACT_SUFX=	.tar.bz2
@@ -9,6 +8,9 @@ EXTRACT_SUFX=	.tar.bz2
 MAINTAINER=	joerg%NetBSD.org@localhost
 HOMEPAGE=	http://xorg.freedesktop.org/
 COMMENT=	Modular Xorg ATI Radeon video driver
+LICENSE=	mit AND x11
+
+CONFIGURE_ARGS+=	--enable-dri
 
 CONFLICTS+=	xf86-video-ati6-[0-9]*
 
@@ -19,7 +21,12 @@ USE_TOOLS+=	gmake pkg-config
 .include "../../mk/bsd.prefs.mk"
 
 PKG_OPTIONS_VAR=	PKG_OPTIONS.xf86-video-ati
-PKG_SUPPORTED_OPTIONS=	debug	
+PKG_SUPPORTED_OPTIONS=  debug
+PKG_SUPPORTED_OPTIONS+= revert_gbm_bo
+
+.if ${OPSYS} == "DragonFly"
+PKG_SUGGESTED_OPTIONS+= revert_gbm_bo
+.endif
 
 .include "../../mk/bsd.options.mk"
 
@@ -31,9 +38,15 @@ CONFIGURE_ARGS+=	--enable-glamor
 CFLAGS+=		-O0 -g3
 .endif
 
-CONFIGURE_ENV.SunOS+=	DRIVER_MAN_SUFFIX=4
+# Revert: Use gbm as much as possible for bo allocation
+# 2018-07-09 18:28:21 +0200
+# https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
+# commit	3c4c0213c11d623cba7adbc28dde652694f2f758
+.if !empty(PKG_OPTIONS:Mrevert_gbm_bo)
+CPPFLAGS+=	-DREVERT_GBM_BO
+.endif
 
-.include "../../devel/xorg-util-macros/buildlink3.mk"
+CONFIGURE_ENV.SunOS+=	DRIVER_MAN_SUFFIX=4
 
 BUILDLINK_API_DEPENDS.modular-xorg-server+=	modular-xorg-server>=1.18.1
 .include "../../x11/modular-xorg-server/buildlink3.mk"
diff --git a/xf86-video-ati-dfbsd/distinfo b/xf86-video-ati-dfbsd/distinfo
index ad2c161cf2..28b7441d8d 100644
--- a/xf86-video-ati-dfbsd/distinfo
+++ b/xf86-video-ati-dfbsd/distinfo
@@ -1,7 +1,17 @@
-$NetBSD: distinfo,v 1.30 2017/03/16 12:04:25 wiz Exp $
+$NetBSD: distinfo,v 1.35 2018/09/16 20:28:51 triaxx Exp $
 
-SHA1 (xf86-video-ati-7.9.0.tar.bz2) = 86ee6db1d7dcdeb1948aeb7965be8102c18be46b
-RMD160 (xf86-video-ati-7.9.0.tar.bz2) = b9e6650008e4c43e45f7a603b7431bc296dc1475
-SHA512 (xf86-video-ati-7.9.0.tar.bz2) = 125e035da6581520d677c56474653ed75aa6d168bf5450cc973248416b5ada3114ea14d0615b44c58029bb1702609453ab532a506273df2a5dd99dd2af4a9d43
-Size (xf86-video-ati-7.9.0.tar.bz2) = 848502 bytes
-SHA1 (patch-src_radeon__kms.c) = 2865ae6d8953f8e2f8eecf9d690b97498ebb313d
+SHA1 (xf86-video-ati-18.1.0.tar.bz2) = 87beb7d09f5b722570adda9a5a1822cbd19e7059
+RMD160 (xf86-video-ati-18.1.0.tar.bz2) = c9ab92004212306fd2347d9683d7c16ce9dc7085
+SHA512 (xf86-video-ati-18.1.0.tar.bz2) = 7a58c9a6cb4876bd2ff37d837372b4e360e81fec7de6a6c7a48d70a5338d62745f734f5d4207f30aa368ff2d9ef44f5f1ef36afd73802a618998c16fe395ed53
+Size (xf86-video-ati-18.1.0.tar.bz2) = 891953 bytes
+SHA1 (patch-configure) = bdd1014b215af69c2bb837d36829e12e86eb5764
+SHA1 (patch-src_drmmode__display.c) = e243e856507b4b3f1037838ee21c7258a5e83c07
+SHA1 (patch-src_radeon.h) = 938492aede478f071bdc22d907235c1fd9b27cbb
+SHA1 (patch-src_radeon__bo__helper.c) = e8d7e122b84ded2d7dec50262f48568cf59f27a2
+SHA1 (patch-src_radeon__bo__helper.h) = bf01afbec90e6a6a8eed0f2f604d4ac0dd616a65
+SHA1 (patch-src_radeon__dri2.c) = 0124a167886cca1f8c2734b9bc1acf77ec3ff112
+SHA1 (patch-src_radeon__dri3.c) = d47e68602b814d5ea469346451c5c91c46c66b21
+SHA1 (patch-src_radeon__glamor.c) = 8821396b6c38497cd38b79ea09fb22161c56d6df
+SHA1 (patch-src_radeon__glamor.h) = 0a1d28fae719cf709545f6064cd2cc5114418c93
+SHA1 (patch-src_radeon__kms.c) = 9b435022971c4c1f92f8fb26e64c3e406cb98a06
+SHA1 (patch-src_radeon__probe.c) = a29be4b9295295668e0725083145ec67f01df2cb
diff --git a/xf86-video-ati-dfbsd/patches/patch-configure b/xf86-video-ati-dfbsd/patches/patch-configure
new file mode 100644
index 0000000000..5285587a13
--- /dev/null
+++ b/xf86-video-ati-dfbsd/patches/patch-configure
@@ -0,0 +1,27 @@
+$NetBSD: patch-configure,v 1.1 2018/05/20 07:11:10 wiz Exp $
+
+Remove duplicate definitions - src/radeon.h defines these as well.
+
+--- configure.orig	2018-03-15 16:21:20.000000000 +0000
++++ configure
+@@ -19933,20 +19933,6 @@ $as_echo "$SYS_ENDIAN_BSWAP" >&6; }
+ $as_echo "#define USE_SYS_ENDIAN_H 1" >>confdefs.h
+ 
+ 
+-cat >>confdefs.h <<_ACEOF
+-#define bswap_16 ${BSWAP}16
+-_ACEOF
+-
+-
+-cat >>confdefs.h <<_ACEOF
+-#define bswap_32 ${BSWAP}32
+-_ACEOF
+-
+-
+-cat >>confdefs.h <<_ACEOF
+-#define bswap_64 ${BSWAP}64
+-_ACEOF
+-
+ 	fi
+ fi
+ 
diff --git a/xf86-video-ati-dfbsd/patches/patch-src_drmmode__display.c b/xf86-video-ati-dfbsd/patches/patch-src_drmmode__display.c
new file mode 100644
index 0000000000..a84bfcc068
--- /dev/null
+++ b/xf86-video-ati-dfbsd/patches/patch-src_drmmode__display.c
@@ -0,0 +1,79 @@
+$NetBSD$
+
+Revert:
+glamor: Use GBM for BO allocation when possible
+commit	3c4c0213c11d623cba7adbc28dde652694f2f758
+
+https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
+
+--- src/drmmode_display.c.orig	2018-09-14 15:56:09.000000000 +0000
++++ src/drmmode_display.c
+@@ -134,8 +134,14 @@ static PixmapPtr drmmode_create_bo_pixma
+ 			goto fail;
+ 	}
+ 
++#if defined(REVERT_GBM_BO)
++ 	if (!info->use_glamor ||
++	    radeon_glamor_create_textured_pixmap(pixmap,
++						 radeon_get_pixmap_private(pixmap)))
++#else
+ 	if (!info->use_glamor ||
+ 	    radeon_glamor_create_textured_pixmap(pixmap, bo))
++#endif
+ 		return pixmap;
+ 
+ fail:
+@@ -426,6 +432,13 @@ destroy_pixmap_for_fbcon(ScrnInfoPtr pSc
+ {
+ 	RADEONInfoPtr info = RADEONPTR(pScrn);
+ 
++#if defined(REVERT_GBM_BO)
++	/* XXX: The current GPUVM support in the kernel doesn't allow removing
++	 * the virtual address range for this BO, so we need to keep around
++	 * the pixmap to avoid breaking glamor with GPUVM
++	 */
++	if (info->use_glamor && info->ChipFamily >= CHIP_FAMILY_CAYMAN)
++#else
+ 	/* XXX: The current GPUVM support in the kernel doesn't allow removing
+ 	 * the virtual address range for this BO, so we need to keep around
+ 	 * the pixmap to avoid breaking glamor with GPUVM
+@@ -437,6 +450,7 @@ destroy_pixmap_for_fbcon(ScrnInfoPtr pSc
+ 	if (info->use_glamor &&
+ 	    (info->ChipFamily >= CHIP_FAMILY_CAYMAN ||
+ 	     xorgGetVersion() >= XORG_VERSION_NUMERIC(1,19,99,1,0)))
++#endif
+ 		return;
+ 
+ 	if (info->fbcon_pixmap)
+@@ -2311,6 +2325,23 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scr
+ 
+ 	scrn->displayWidth = pitch / cpp;
+ 
++#if defined(REVERT_GBM_BO)
++#if X_BYTE_ORDER == X_BIG_ENDIAN
++	switch (cpp) {
++	case 4:
++	    tiling_flags |= RADEON_TILING_SWAP_32BIT;
++	    break;
++	case 2:
++	    tiling_flags |= RADEON_TILING_SWAP_16BIT;
++	    break;
++	}
++	if (info->ChipFamily < CHIP_FAMILY_R600 &&
++	    info->r600_shadow_fb && tiling_flags)
++	    tiling_flags |= RADEON_TILING_SURFACE;
++#endif
++	if (tiling_flags)
++	    radeon_bo_set_tiling(info->front_buffer->bo.radeon, tiling_flags, pitch);
++#else
+ 	if (!info->use_glamor) {
+ #if X_BYTE_ORDER == X_BIG_ENDIAN
+ 		switch (cpp) {
+@@ -2328,6 +2359,7 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scr
+ 		if (tiling_flags)
+ 			radeon_bo_set_tiling(info->front_buffer->bo.radeon, tiling_flags, pitch);
+ 	}
++#endif
+ 
+ 	if (!info->r600_shadow_fb) {
+ 		if (info->surf_man && !info->use_glamor)
diff --git a/xf86-video-ati-dfbsd/patches/patch-src_radeon.h b/xf86-video-ati-dfbsd/patches/patch-src_radeon.h
new file mode 100644
index 0000000000..67d7cc675d
--- /dev/null
+++ b/xf86-video-ati-dfbsd/patches/patch-src_radeon.h
@@ -0,0 +1,49 @@
+$NetBSD$
+
+Revert:
+glamor: Use GBM for BO allocation when possible
+commit	3c4c0213c11d623cba7adbc28dde652694f2f758
+
+https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
+
+--- src/radeon.h.orig	2018-09-14 15:56:09.000000000 +0000
++++ src/radeon.h
+@@ -606,8 +606,10 @@ typedef struct {
+     unsigned hwcursor_disabled;
+ 
+ #ifdef USE_GLAMOR
++#if !defined(REVERT_GBM_BO)
+     struct gbm_device *gbm;
+ 
++#endif
+     struct {
+ 	CreateGCProcPtr SavedCreateGC;
+ 	RegionPtr (*SavedCopyArea)(DrawablePtr, DrawablePtr, GCPtr, int, int,
+@@ -747,6 +749,10 @@ static inline Bool radeon_set_pixmap_bo(
+ 	}
+ 
+ 	if (bo) {
++#if defined(REVERT_GBM_BO)
++	    uint32_t pitch;
++
++#endif
+ 	    if (!priv) {
+ 		priv = calloc(1, sizeof (struct radeon_pixmap));
+ 		if (!priv)
+@@ -755,10 +761,16 @@ static inline Bool radeon_set_pixmap_bo(
+ 
+ 	    radeon_buffer_ref(bo);
+ 	    priv->bo = bo;
++#if defined(REVERT_GBM_BO)
++
++	radeon_bo_get_tiling(bo->bo.radeon, &priv->tiling_flags, &pitch);
++#endif
+ 	}
+ 
+ 	radeon_set_pixmap_private(pPix, priv);
++#if !defined(REVERT_GBM_BO)
+ 	radeon_get_pixmap_tiling_flags(pPix);
++#endif
+ 	return TRUE;
+     } else
+ #endif /* USE_GLAMOR */
diff --git a/xf86-video-ati-dfbsd/patches/patch-src_radeon__bo__helper.c b/xf86-video-ati-dfbsd/patches/patch-src_radeon__bo__helper.c
new file mode 100644
index 0000000000..bd5e166a72
--- /dev/null
+++ b/xf86-video-ati-dfbsd/patches/patch-src_radeon__bo__helper.c
@@ -0,0 +1,93 @@
+$NetBSD$
+
+Revert:
+glamor: Use GBM for BO allocation when possible
+commit	3c4c0213c11d623cba7adbc28dde652694f2f758
+
+https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
+
+--- src/radeon_bo_helper.c.orig	2018-09-14 15:56:09.000000000 +0000
++++ src/radeon_bo_helper.c
+@@ -28,7 +28,7 @@
+ #include "radeon_glamor.h"
+ #include "radeon_bo_gem.h"
+ 
+-
++#if !defined(REVERT_GBM_BO)
+ #ifdef USE_GLAMOR
+ 
+ static uint32_t
+@@ -57,7 +57,7 @@ radeon_get_gbm_format(int depth, int bit
+ }
+ 
+ #endif /* USE_GLAMOR */
+-
++#endif /* !REVERT_GBM_BO */
+ 
+ static const unsigned MicroBlockTable[5][3][2] = {
+     /*linear  tiled   square-tiled */
+@@ -190,6 +190,7 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn
+     struct radeon_buffer *bo;
+     int domain = RADEON_GEM_DOMAIN_VRAM;
+ 
++#if !defined(REVERT_GBM_BO)
+ #ifdef USE_GLAMOR
+     if (info->use_glamor &&
+ 	!(usage_hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP &&
+@@ -228,6 +229,7 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn
+ 	return bo;
+     }
+ #endif
++#endif /* !REVERT_GBM_BO */
+ 
+     if (usage_hint) {
+ 	if (info->allowColorTiling) {
+@@ -316,12 +318,14 @@ radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn
+ void
+ radeon_finish(ScrnInfoPtr scrn, struct radeon_buffer *bo)
+ {
++#if !defined(REVERT_GBM_BO)
+     RADEONInfoPtr info = RADEONPTR(scrn);
+ 
+     if (info->use_glamor) {
+ 	radeon_glamor_finish(scrn);
+ 	return;
+     }
++#endif /* !REVERT_GBM_BO */
+ 
+     radeon_cs_flush_indirect(scrn);
+     radeon_bo_wait(bo->bo.radeon);
+@@ -360,10 +364,17 @@ Bool radeon_get_pixmap_handle(PixmapPtr
+     RADEONInfoPtr info = RADEONPTR(scrn);
+ #endif
+ 
++#if defined(REVERT_GBM_BO)
++    if (bo) {
++	*handle = bo->bo.radeon->handle;
++	return TRUE;
++    }
++#else
+     if (bo && !(bo->flags & RADEON_BO_FLAGS_GBM)) {
+ 	*handle = bo->bo.radeon->handle;
+ 	return TRUE;
+     }
++#endif
+ 
+ #ifdef USE_GLAMOR
+     if (info->use_glamor) {
+@@ -461,6 +472,7 @@ Bool radeon_set_shared_pixmap_backing(Pi
+     if (!bo)
+ 	goto error;
+ 
++#if !defined(REVERT_GBM_BO)
+ #ifdef USE_GLAMOR
+     if (info->use_glamor) {
+ 	struct gbm_import_fd_data data;
+@@ -498,6 +510,7 @@ Bool radeon_set_shared_pixmap_backing(Pi
+ 	return ret;
+     }
+ #endif
++#endif /* !REVERT_GBM_BO */
+ 
+     bo->bo.radeon = radeon_gem_bo_open_prime(info->bufmgr, ihandle, size);
+     if (!bo)
diff --git a/xf86-video-ati-dfbsd/patches/patch-src_radeon__bo__helper.h b/xf86-video-ati-dfbsd/patches/patch-src_radeon__bo__helper.h
new file mode 100644
index 0000000000..6734002d2f
--- /dev/null
+++ b/xf86-video-ati-dfbsd/patches/patch-src_radeon__bo__helper.h
@@ -0,0 +1,57 @@
+$NetBSD$
+
+Revert:
+glamor: Use GBM for BO allocation when possible
+commit	3c4c0213c11d623cba7adbc28dde652694f2f758
+
+https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
+
+--- src/radeon_bo_helper.h.orig	2018-09-14 15:56:09.000000000 +0000
++++ src/radeon_bo_helper.h
+@@ -23,21 +23,27 @@
+ #ifndef RADEON_BO_HELPER_H
+ #define RADEON_BO_HELPER_H 1
+ 
++#if !defined(REVERT_GBM_BO)
+ #ifdef USE_GLAMOR
+ #include <gbm.h>
+ #endif
++#endif /* !REVERT_GBM_BO */
+ 
+ #define RADEON_BO_FLAGS_GBM	0x1
+ 
+ struct radeon_buffer {
+ 	union {
++#if !defined(REVERT_GBM_BO)
+ #ifdef USE_GLAMOR
+ 		struct gbm_bo *gbm;
+ #endif
++#endif /* !REVERT_GBM_BO */
+ 		struct radeon_bo *radeon;
+ 	} bo;
+ 	uint32_t ref_count;
++#if !defined(REVERT_GBM_BO)
+     uint32_t flags;
++#endif /* !REVERT_GBM_BO */
+ };
+ 
+ extern struct radeon_buffer *
+@@ -96,6 +102,10 @@ radeon_buffer_unref(struct radeon_buffer
+ 	return;
+     }
+ 
++#if defined(REVERT_GBM_BO)
++    radeon_bo_unmap(buf->bo.radeon);
++    radeon_bo_unref(buf->bo.radeon);
++#else /* !REVERT_GBM_BO */
+ #ifdef USE_GLAMOR
+     if (buf->flags & RADEON_BO_FLAGS_GBM) {
+ 	gbm_bo_destroy(buf->bo.gbm);
+@@ -105,6 +115,7 @@ radeon_buffer_unref(struct radeon_buffer
+ 	radeon_bo_unmap(buf->bo.radeon);
+ 	radeon_bo_unref(buf->bo.radeon);
+     }
++#endif /* REVERT_GBM_BO */
+ 
+     free(buf);
+     *buffer = NULL;
diff --git a/xf86-video-ati-dfbsd/patches/patch-src_radeon__dri2.c b/xf86-video-ati-dfbsd/patches/patch-src_radeon__dri2.c
new file mode 100644
index 0000000000..abe17a89b9
--- /dev/null
+++ b/xf86-video-ati-dfbsd/patches/patch-src_radeon__dri2.c
@@ -0,0 +1,32 @@
+$NetBSD$
+
+Revert:
+glamor: Use GBM for BO allocation when possible
+commit	3c4c0213c11d623cba7adbc28dde652694f2f758
+
+https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
+
+--- src/radeon_dri2.c.orig	2018-09-14 15:56:09.000000000 +0000
++++ src/radeon_dri2.c
+@@ -79,12 +79,21 @@ static DevPrivateKeyRec dri2_window_priv
+ static Bool
+ radeon_get_flink_name(RADEONEntPtr pRADEONEnt, PixmapPtr pixmap, uint32_t *name)
+ {
++#if defined(REVERT_GBM_BO)
++    struct radeon_bo *bo = radeon_get_pixmap_bo(pixmap)->bo.radeon;
++#else
+     struct radeon_buffer *bo = radeon_get_pixmap_bo(pixmap);
++#endif
+     struct drm_gem_flink flink;
+ 
++#if defined(REVERT_GBM_BO)
++    if (bo)
++	return radeon_gem_get_kernel_name(bo, name) == 0;
++#else
+     if (bo && !(bo->flags & RADEON_BO_FLAGS_GBM) &&
+ 	radeon_gem_get_kernel_name(bo->bo.radeon, name) == 0)
+ 	return TRUE;
++#endif
+ 
+     if (radeon_get_pixmap_handle(pixmap, &flink.handle)) {
+ 	if (drmIoctl(pRADEONEnt->fd, DRM_IOCTL_GEM_FLINK, &flink) != 0)
diff --git a/xf86-video-ati-dfbsd/patches/patch-src_radeon__dri3.c b/xf86-video-ati-dfbsd/patches/patch-src_radeon__dri3.c
new file mode 100644
index 0000000000..f7570d55d5
--- /dev/null
+++ b/xf86-video-ati-dfbsd/patches/patch-src_radeon__dri3.c
@@ -0,0 +1,41 @@
+$NetBSD$
+
+Revert:
+glamor: Use GBM for BO allocation when possible
+commit	3c4c0213c11d623cba7adbc28dde652694f2f758
+
+https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
+
+--- src/radeon_dri3.c.orig	2018-09-14 15:56:09.000000000 +0000
++++ src/radeon_dri3.c
+@@ -214,6 +214,22 @@ static int radeon_dri3_fd_from_pixmap(Sc
+ {
+ 	struct radeon_bo *bo;
+ 	int fd;
++
++#if defined(REVERT_GBM_BO)
++	bo = radeon_get_pixmap_bo(pixmap)->bo.radeon;
++	if (!bo) {
++#ifdef USE_GLAMOR
++		ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
++		RADEONInfoPtr info = RADEONPTR(scrn);
++		if (info->use_glamor)
++			return glamor_fd_from_pixmap(screen, pixmap, stride, size);
++#endif
++		exaMoveInPixmap(pixmap);
++		bo = radeon_get_pixmap_bo(pixmap)->bo.radeon;
++		if (!bo)
++			return -1;
++	}
++#else /* !REVERT_GBM_BO */
+ #ifdef USE_GLAMOR
+ 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ 	RADEONInfoPtr info = RADEONPTR(scrn);
+@@ -229,6 +245,7 @@ static int radeon_dri3_fd_from_pixmap(Sc
+ 		if (!bo)
+ 			return -1;
+ 	}
++#endif /* REVERT_GBM_BO */
+ 
+ 	if (pixmap->devKind > UINT16_MAX)
+ 		return -1;
diff --git a/xf86-video-ati-dfbsd/patches/patch-src_radeon__glamor.c b/xf86-video-ati-dfbsd/patches/patch-src_radeon__glamor.c
new file mode 100644
index 0000000000..5a3795ed23
--- /dev/null
+++ b/xf86-video-ati-dfbsd/patches/patch-src_radeon__glamor.c
@@ -0,0 +1,145 @@
+$NetBSD$
+
+Revert:
+glamor: Use GBM for BO allocation when possible
+commit	3c4c0213c11d623cba7adbc28dde652694f2f758
+
+https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
+
+--- src/radeon_glamor.c.orig	2018-09-14 15:56:09.000000000 +0000
++++ src/radeon_glamor.c
+@@ -50,6 +50,29 @@ radeon_glamor_exchange_buffers(PixmapPtr
+ Bool
+ radeon_glamor_create_screen_resources(ScreenPtr screen)
+ {
++#if defined(REVERT_GBM_BO)
++
++	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
++	RADEONInfoPtr info = RADEONPTR(scrn);
++
++	if (!info->use_glamor)
++		return TRUE;
++
++#ifdef HAVE_GLAMOR_GLYPHS_INIT
++	if (!glamor_glyphs_init(screen))
++		return FALSE;
++#endif
++
++	if (!glamor_egl_create_textured_screen(screen,
++					       info->front_buffer->bo.radeon->handle,
++					       scrn->displayWidth *
++					       info->pixel_bytes))
++		return FALSE;
++
++	return TRUE;
++
++#else /* !REVERT_GBM_BO */
++
+ 	PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
+ 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ 	RADEONInfoPtr info = RADEONPTR(scrn);
+@@ -64,6 +87,7 @@ radeon_glamor_create_screen_resources(Sc
+ 
+ 	return radeon_glamor_create_textured_pixmap(screen_pixmap,
+ 						    info->front_buffer);
++#endif /* REVERT_GBM_BO */
+ }
+ 
+ 
+@@ -132,12 +156,14 @@ radeon_glamor_pre_init(ScrnInfoPtr scrn)
+ 	}
+ #endif
+ 
++#if !defined(REVERT_GBM_BO)
+ 	info->gbm = gbm_create_device(pRADEONEnt->fd);
+ 	if (!info->gbm) {
+ 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+ 			   "gbm_create_device returned NULL\n");
+ 		return FALSE;
+ 	}
++#endif
+ 
+ 	/* Load glamor module */
+ 	if ((glamor_module = xf86LoadSubModule(scrn, GLAMOR_EGL_MODULE_NAME))) {
+@@ -166,6 +192,13 @@ radeon_glamor_pre_init(ScrnInfoPtr scrn)
+ 	return TRUE;
+ }
+ 
++#if defined(REVERT_GBM_BO)
++radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_pixmap *priv)
++{
++	return glamor_egl_create_textured_pixmap(pixmap, priv->bo->bo.radeon->handle,
++						 pixmap->devKind);
++}
++#else /* !REVERT_GBM_BO */
+ Bool
+ radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_buffer *bo)
+ {
+@@ -188,6 +221,7 @@ radeon_glamor_create_textured_pixmap(Pix
+ 							 pixmap->devKind);
+ 	}
+ }
++#endif /* REVERT_GBM_BO */
+ 
+ static Bool radeon_glamor_destroy_pixmap(PixmapPtr pixmap)
+ {
+@@ -198,6 +232,15 @@ static Bool radeon_glamor_destroy_pixmap
+ #endif
+ 
+ 	if (pixmap->refcnt == 1) {
++#if defined(REVERT_GBM_BO)
++		if (pixmap->devPrivate.ptr) {
++			struct radeon_buffer *bo = radeon_get_pixmap_bo(pixmap);
++
++			if (bo)
++				radeon_bo_unmap(bo->bo.radeon);
++		}
++#endif /* REVERT_GBM_BO */
++
+ #ifdef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
+ 		glamor_egl_destroy_textured_pixmap(pixmap);
+ #endif
+@@ -271,7 +314,11 @@ radeon_glamor_create_pixmap(ScreenPtr sc
+ 
+ 		screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
+ 
++#if defined(REVERT_GBM_BO)
++		if (!radeon_glamor_create_textured_pixmap(pixmap, priv))
++#else
+ 		if (!radeon_glamor_create_textured_pixmap(pixmap, priv->bo))
++#endif
+ 			goto fallback_glamor;
+ 
+ 		pixmap->devPrivate.ptr = NULL;
+@@ -402,11 +449,23 @@ radeon_glamor_set_shared_pixmap_backing(
+ {
+ 	ScreenPtr screen = pixmap->drawable.pScreen;
+ 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
++#if defined(REVERT_GBM_BO)
++	struct radeon_pixmap *priv;
++#else /* !REVERT_GBM_BO */
+ 	int ihandle = (int)(long)handle;
++#endif /* REVERT_GBM_BO */
+ 
+ 	if (!radeon_set_shared_pixmap_backing(pixmap, handle, NULL))
+ 		return FALSE;
+ 
++#if defined(REVERT_GBM_BO)
++	priv = radeon_get_pixmap_private(pixmap);
++	if (!radeon_glamor_create_textured_pixmap(pixmap, priv)) {
++		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
++			   "Failed to get PRIME drawable for glamor pixmap.\n");
++		return FALSE;
++	}
++#else /* !REVERT_GBM_BO */
+ 	if (ihandle != -1 &&
+ 	    !radeon_glamor_create_textured_pixmap(pixmap,
+ 						  radeon_get_pixmap_bo(pixmap))) {
+@@ -414,6 +473,7 @@ radeon_glamor_set_shared_pixmap_backing(
+ 			   "Failed to get PRIME drawable for glamor pixmap.\n");
+ 		return FALSE;
+ 	}
++#endif /* REVERT_GBM_BO */
+ 
+ 	screen->ModifyPixmapHeader(pixmap,
+ 				   pixmap->drawable.width,
diff --git a/xf86-video-ati-dfbsd/patches/patch-src_radeon__glamor.h b/xf86-video-ati-dfbsd/patches/patch-src_radeon__glamor.h
new file mode 100644
index 0000000000..2e451574de
--- /dev/null
+++ b/xf86-video-ati-dfbsd/patches/patch-src_radeon__glamor.h
@@ -0,0 +1,73 @@
+$NetBSD$
+
+Revert:
+glamor: Use GBM for BO allocation when possible
+commit	3c4c0213c11d623cba7adbc28dde652694f2f758
+
+https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
+
+--- src/radeon_glamor.h.orig	2018-09-14 15:56:09.000000000 +0000
++++ src/radeon_glamor.h
+@@ -33,12 +33,14 @@ struct radeon_pixmap;
+ 
+ #ifdef USE_GLAMOR
+ 
++#if !defined(REVERT_GBM_BO)
+ #ifndef HAVE_GLAMOR_FINISH
+ #include <GL/gl.h>
+ #endif
+ 
+ #include <gbm.h>
+ 
++#endif /* !REVERT_GBM_BO */
+ #define GLAMOR_FOR_XORG  1
+ #include <glamor.h>
+ 
+@@ -71,12 +73,17 @@ void radeon_glamor_screen_init(ScreenPtr
+ Bool radeon_glamor_create_screen_resources(ScreenPtr screen);
+ void radeon_glamor_free_screen(int scrnIndex, int flags);
+ 
++#if defined(REVERT_GBM_BO)
++Bool radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_pixmap *priv);
++#else
+ Bool radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_buffer *bo);
++#endif
+ void radeon_glamor_exchange_buffers(PixmapPtr src, PixmapPtr dst);
+ PixmapPtr radeon_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap);
+ 
+ XF86VideoAdaptorPtr radeon_glamor_xv_init(ScreenPtr pScreen, int num_adapt);
+ 
++#if !defined(REVERT_GBM_BO)
+ static inline void
+ radeon_glamor_finish(ScrnInfoPtr scrn)
+ {
+@@ -91,6 +98,7 @@ radeon_glamor_finish(ScrnInfoPtr scrn)
+ 
+ 	info->gpu_flushed++;
+ }
++#endif /* !REVERT_GBM_BO */
+ 
+ #else
+ 
+@@ -100,7 +108,11 @@ static inline void radeon_glamor_fini(Sc
+ static inline Bool radeon_glamor_create_screen_resources(ScreenPtr screen) { return FALSE; }
+ static inline void radeon_glamor_free_screen(int scrnIndex, int flags) { }
+ 
++#if defined(REVERT_GBM_BO)
++static inline Bool radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_pixmap *priv) { return TRUE; }
++#else
+ static inline Bool radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_buffer *bo) { return TRUE; }
++#endif
+ 
+ static inline void radeon_glamor_exchange_buffers(PixmapPtr src, PixmapPtr dst) {}
+ static inline PixmapPtr radeon_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap) { return pixmap; }
+@@ -109,7 +121,9 @@ static inline struct radeon_pixmap *rade
+ 
+ static inline XF86VideoAdaptorPtr radeon_glamor_xv_init(ScreenPtr pScreen, int num_adapt) { return NULL; }
+ 
++#if !defined(REVERT_GBM_BO)
+ static inline void radeon_glamor_finish(ScrnInfoPtr pScrn) { }
++#endif /* !REVERT_GBM_BO */
+ 
+ #endif
+ 
diff --git a/xf86-video-ati-dfbsd/patches/patch-src_radeon__kms.c b/xf86-video-ati-dfbsd/patches/patch-src_radeon__kms.c
index bbe25bd83f..c7cf8b131e 100644
--- a/xf86-video-ati-dfbsd/patches/patch-src_radeon__kms.c
+++ b/xf86-video-ati-dfbsd/patches/patch-src_radeon__kms.c
@@ -1,59 +1,70 @@
 $NetBSD$
 
-From DragonFly dports since otherwise radeonkms.ko not loaded.
+Revert:
+glamor: Use GBM for BO allocation when possible
+commit	3c4c0213c11d623cba7adbc28dde652694f2f758
 
---- src/radeon_kms.c.orig	2017-03-16 07:43:58.000000000 +0000
+https://cgit.freedesktop.org/xorg/driver/xf86-video-ati
+
+--- src/radeon_kms.c.orig	2018-09-14 15:56:09.000000000 +0000
 +++ src/radeon_kms.c
-@@ -30,6 +30,10 @@
- 
- #include <errno.h>
- #include <sys/ioctl.h>
-+#if defined(__FreeBSD__) || defined(__DragonFly__)
-+#include <sys/param.h>
-+#include <sys/linker.h>
-+#endif
- /* Driver data structures */
- #include "radeon.h"
- #include "radeon_drm_queue.h"
-@@ -824,7 +828,11 @@ static void
- radeon_dirty_update(ScrnInfoPtr scrn)
- {
- 	ScreenPtr screen = scrn->pScreen;
-+#if defined(__FreeBSD__) || defined(__DragonFly__)
-+	PixmapDirtyUpdatePtr ent = NULL;
-+#else
- 	PixmapDirtyUpdatePtr ent;
-+#endif
- 	RegionPtr region;
+@@ -212,10 +212,12 @@ static void RADEONFreeRec(ScrnInfoPtr pS
+ 	    info->accel_state = NULL;
+ 	}
  
- 	xorg_list_for_each_entry(ent, &screen->pixmap_dirty_list, ent) {
-@@ -1401,7 +1409,11 @@ static int radeon_get_drm_master_fd(Scrn
++#if !defined(REVERT_GBM_BO)
+ #ifdef USE_GLAMOR
+ 	if (info->gbm)
+ 	    gbm_device_destroy(info->gbm);
  #endif
-     struct pci_device *dev = info->PciInfo;
-     char *busid;
-+#if defined(__FreeBSD__) || defined(__DragonFly__)
-+    int fd, err;
-+#else
-     int fd;
-+#endif
++#endif /* !REVERT_GBM_BO */
+ 
+ 	pEnt = info->pEnt;
+ 	free(pScrn->driverPrivate);
+@@ -2269,10 +2271,14 @@ Bool RADEONScreenInit_KMS(ScreenPtr pScr
+ 	return FALSE;
+     }
  
- #ifdef XF86_PDEV_SERVER_FD
-     if (pRADEONEnt->platform_dev) {
-@@ -1415,6 +1427,17 @@ static int radeon_get_drm_master_fd(Scrn
-     XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d",
-                 dev->domain, dev->bus, dev->dev, dev->func);
++#if defined(REVERT_GBM_BO)
++    front_ptr = info->front_buffer->bo.radeon->ptr;
++#else /* !REVERT_GBM_BO */
+     if (!(info->front_buffer->flags & RADEON_BO_FLAGS_GBM))
+ 	front_ptr = info->front_buffer->bo.radeon->ptr;
+     else
+ 	front_ptr = NULL;
++#endif /* REVERT_GBM_BO */
  
-+#if defined(__FreeBSD__) || defined(__DragonFly__)
-+    err = kldload("radeonkms");
-+    if (err == -1 && errno != EEXIST) {
-+       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-+                  "[drm] Failed to load kernel module for %s: %s\n",
-+                  busid, strerror(errno));
-+       free(busid);
-+       return -1;
-+    }
+     if (info->r600_shadow_fb) {
+ 	info->fb_shadow = calloc(1,
+@@ -2743,6 +2749,23 @@ static Bool radeon_setup_kernel_mem(Scre
+             }
+         }
+ 
++#if defined(REVERT_GBM_BO)
++#if X_BYTE_ORDER == X_BIG_ENDIAN
++	switch (cpp) {
++	case 4:
++	    tiling_flags |= RADEON_TILING_SWAP_32BIT;
++	    break;
++	case 2:
++	    tiling_flags |= RADEON_TILING_SWAP_16BIT;
++	    break;
++	}
++	if (info->ChipFamily < CHIP_FAMILY_R600 &&
++	    info->r600_shadow_fb && tiling_flags)
++	    tiling_flags |= RADEON_TILING_SURFACE;
 +#endif
-+
-     fd = drmOpen(NULL, busid);
-     if (fd == -1)
- 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
++	if (tiling_flags)
++            radeon_bo_set_tiling(info->front_buffer->bo.radeon, tiling_flags, pitch);
++#else /* !REVERT_GBM_BO */
+ 	if (!info->use_glamor) {
+ #if X_BYTE_ORDER == X_BIG_ENDIAN
+ 	    switch (cpp) {
+@@ -2760,6 +2783,7 @@ static Bool radeon_setup_kernel_mem(Scre
+ 	    if (tiling_flags)
+ 		radeon_bo_set_tiling(info->front_buffer->bo.radeon, tiling_flags, pitch);
+ 	}
++#endif /* REVERT_GBM_BO */
+ 
+ 	pScrn->displayWidth = pitch / cpp;
+     }
diff --git a/xf86-video-ati-dfbsd/patches/patch-src_radeon__probe.c b/xf86-video-ati-dfbsd/patches/patch-src_radeon__probe.c
new file mode 100644
index 0000000000..3647cce741
--- /dev/null
+++ b/xf86-video-ati-dfbsd/patches/patch-src_radeon__probe.c
@@ -0,0 +1,29 @@
+$NetBSD$
+
+From DragonFly dports
+
+Needed due to removed patches from graphics/libdrm.
+Sometimes fails to probe for given PCI:0:0:60 and leaves everything in funny
+state: no /dev/dri/card0 (devq-lsdri also) thou kms console works.
+It looks like reprobing should be done like this.
+
+--- src/radeon_probe.c.orig	2018-09-14 15:56:09.000000000 +0000
++++ src/radeon_probe.c
+@@ -55,7 +55,7 @@
+ #include "dri.h"
+ #endif
+ 
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+ #include <xf86_OSproc.h>
+ #endif
+ 
+@@ -101,7 +101,7 @@ static Bool radeon_kernel_mode_enabled(S
+ 
+     busIdString = DRICreatePCIBusID(pci_dev);
+     ret = drmCheckModesettingSupported(busIdString);
+-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+     if (ret) {
+       if (xf86LoadKernelModule("radeonkms"))
+         ret = drmCheckModesettingSupported(busIdString);


Home | Main Index | Thread Index | Old Index