[PATCH xf86-video-amdgpu] Require xserver >= 1.13

Deucher, Alexander Alexander.Deucher at amd.com
Thu Aug 31 13:45:53 UTC 2017


> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Michel Dänzer
> Sent: Thursday, August 31, 2017 5:57 AM
> To: amd-gfx at lists.freedesktop.org
> Subject: [PATCH xf86-video-amdgpu] Require xserver >= 1.13
> 
> From: Michel Dänzer <michel.daenzer at amd.com>
> 
> xserver 1.13.0 was released on September 6th, 2012, almost 5 years ago.
> 
> This allows cleaning up a bunch of backwards compatibility code.
> 
> (Ported from radeon commit
> 5cdd334b3402c2431deb3a87a8d04ef590da53ee)
> 
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  configure.ac                 |  8 +----
>  src/Makefile.am              |  1 -
>  src/amdgpu_bo_helper.c       | 12 ++------
>  src/amdgpu_dri2.c            | 52 +++++---------------------------
>  src/amdgpu_drm_queue.c       |  3 +-
>  src/amdgpu_drv.h             | 14 +--------
>  src/amdgpu_glamor.c          |  6 ----
>  src/amdgpu_glamor.h          |  4 ---
>  src/amdgpu_glamor_wrappers.c |  4 +--
>  src/amdgpu_kms.c             | 71 +++++++++++++-------------------------------
>  src/amdgpu_list.h            | 47 -----------------------------
>  src/amdgpu_probe.h           | 14 ++++-----
>  src/compat-api.h             | 70 +++----------------------------------------
>  src/drmmode_display.c        | 55 +++++++---------------------------
>  14 files changed, 58 insertions(+), 303 deletions(-)
>  delete mode 100644 src/amdgpu_list.h
> 
> diff --git a/configure.ac b/configure.ac
> index 6d7cee476..506c37236 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -75,7 +75,7 @@ PKG_CHECK_MODULES(LIBDRM_AMDGPU,
> [libdrm_amdgpu >= 2.4.72])
>  PKG_CHECK_MODULES(GBM, [gbm])
> 
>  # Obtain compiler/linker options for the driver dependencies
> -PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10 xproto fontsproto
> xf86driproto $REQUIRED_MODULES])
> +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.13 xproto fontsproto
> xf86driproto $REQUIRED_MODULES])
>  PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
>                    HAVE_XEXTPROTO_71="yes"; AC_DEFINE(HAVE_XEXTPROTO_71,
> 1, [xextproto 7.1 available]),
>                    HAVE_XEXTPROTO_71="no")
> @@ -180,12 +180,6 @@ AC_CHECK_DECL(xf86CursorResetCursor,
>  	      [#include <xorg-server.h>
>  	       #include <xf86Cursor.h>])
> 
> -AC_CHECK_DECL(xorg_list_init,
> -	      [AC_DEFINE(HAVE_XORG_LIST, 1, [Have xorg_list API])], [],
> -	      [#include <X11/Xdefs.h>
> -	      #include "xorg-server.h"
> -	      #include "list.h"])
> -
>  AC_CHECK_DECL(GBM_BO_USE_LINEAR,
>  	      [AC_DEFINE(HAVE_GBM_BO_USE_LINEAR, 1, [Have
> GBM_BO_USE_LINEAR])], [],
>  	      [#include <stdlib.h>
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 7468bba37..c23c87d7f 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -62,7 +62,6 @@ EXTRA_DIST = \
>  	amdgpu_drm_queue.h \
>  	amdgpu_glamor.h \
>  	amdgpu_drv.h \
> -	amdgpu_list.h \
>  	amdgpu_pixmap.h \
>  	amdgpu_probe.h \
>  	amdgpu_version.h \
> diff --git a/src/amdgpu_bo_helper.c b/src/amdgpu_bo_helper.c
> index ee52e0c24..ba2212228 100644
> --- a/src/amdgpu_bo_helper.c
> +++ b/src/amdgpu_bo_helper.c
> @@ -79,13 +79,8 @@ struct amdgpu_buffer
> *amdgpu_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width,
>  			bo_use |= GBM_BO_USE_SCANOUT;
> 
>  #ifdef HAVE_GBM_BO_USE_LINEAR
> -#ifdef CREATE_PIXMAP_USAGE_SHARED
> -		if (usage_hint == CREATE_PIXMAP_USAGE_SHARED) {
> -			bo_use |= GBM_BO_USE_LINEAR;
> -		}
> -#endif
> -
> -		if (usage_hint & AMDGPU_CREATE_PIXMAP_LINEAR) {
> +		if (usage_hint == CREATE_PIXMAP_USAGE_SHARED ||
> +		    (usage_hint & AMDGPU_CREATE_PIXMAP_LINEAR)) {
>  			bo_use |= GBM_BO_USE_LINEAR;
>  		}
>  #endif
> @@ -394,7 +389,6 @@ struct amdgpu_buffer
> *amdgpu_gem_bo_open_prime(amdgpu_device_handle pDev,
>  	return bo;
>  }
> 
> -#ifdef AMDGPU_PIXMAP_SHARING
> 
>  Bool amdgpu_set_shared_pixmap_backing(PixmapPtr ppix, void
> *fd_handle)
>  {
> @@ -467,5 +461,3 @@ Bool
> amdgpu_set_shared_pixmap_backing(PixmapPtr ppix, void *fd_handle)
> 
>  	return ret;
>  }
> -
> -#endif /* AMDGPU_PIXMAP_SHARING */
> diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
> index ccf5477cf..a8ccd22ba 100644
> --- a/src/amdgpu_dri2.c
> +++ b/src/amdgpu_dri2.c
> @@ -48,15 +48,10 @@
>  #include "amdgpu_bo_helper.h"
>  #include "amdgpu_version.h"
> 
> -#include "amdgpu_list.h"
> -
> +#include <list.h>
>  #include <xf86Priv.h>
>  #include <X11/extensions/dpmsconst.h>
> 
> -#if DRI2INFOREC_VERSION >= 9
> -#define USE_DRI2_PRIME
> -#endif
> -
>  #define FALLBACK_SWAP_DELAY 16
> 
>  typedef DRI2BufferPtr BufferPtr;
> @@ -204,14 +199,6 @@ error:
>  	return NULL;
>  }
> 
> -DRI2BufferPtr
> -amdgpu_dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment,
> -			  unsigned int format)
> -{
> -	return amdgpu_dri2_create_buffer2(pDraw->pScreen, pDraw,
> -					  attachment, format);
> -}
> -
>  static void
>  amdgpu_dri2_destroy_buffer2(ScreenPtr pScreen,
>  			    DrawablePtr drawable, BufferPtr buffers)
> @@ -240,11 +227,6 @@ amdgpu_dri2_destroy_buffer2(ScreenPtr pScreen,
>  	}
>  }
> 
> -void amdgpu_dri2_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buf)
> -{
> -	amdgpu_dri2_destroy_buffer2(pDraw->pScreen, pDraw, buf);
> -}
> -
>  static inline PixmapPtr GetDrawablePixmap(DrawablePtr drawable)
>  {
>  	if (drawable->type == DRAWABLE_PIXMAP)
> @@ -274,17 +256,14 @@ amdgpu_dri2_copy_region2(ScreenPtr pScreen,
>  	dst_drawable = &dst_private->pixmap->drawable;
> 
>  	if (src_private->attachment == DRI2BufferFrontLeft) {
> -#ifdef USE_DRI2_PRIME
>  		if (drawable->pScreen != pScreen) {
>  			src_drawable = DRI2UpdatePrime(drawable,
> src_buffer);
>  			if (!src_drawable)
>  				return;
>  		} else
> -#endif
>  			src_drawable = drawable;
>  	}
>  	if (dst_private->attachment == DRI2BufferFrontLeft) {
> -#ifdef USE_DRI2_PRIME
>  		if (drawable->pScreen != pScreen) {
>  			dst_drawable = DRI2UpdatePrime(drawable,
> dest_buffer);
>  			if (!dst_drawable)
> @@ -292,7 +271,6 @@ amdgpu_dri2_copy_region2(ScreenPtr pScreen,
>  			if (dst_drawable != drawable)
>  				translate = TRUE;
>  		} else
> -#endif
>  			dst_drawable = drawable;
>  	}
> 
> @@ -320,14 +298,6 @@ amdgpu_dri2_copy_region2(ScreenPtr pScreen,
>  	FreeScratchGC(gc);
>  }
> 
> -void
> -amdgpu_dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
> -			DRI2BufferPtr pDstBuffer, DRI2BufferPtr pSrcBuffer)
> -{
> -	return amdgpu_dri2_copy_region2(pDraw->pScreen, pDraw,
> pRegion,
> -					pDstBuffer, pSrcBuffer);
> -}
> -
>  enum DRI2FrameEventType {
>  	DRI2_SWAP,
>  	DRI2_FLIP,
> @@ -362,8 +332,9 @@ static void amdgpu_dri2_unref_buffer(BufferPtr
> buffer)
>  {
>  	if (buffer) {
>  		struct dri2_buffer_priv *private = buffer->driverPrivate;
> -		amdgpu_dri2_destroy_buffer(&(private->pixmap-
> >drawable),
> -					   buffer);
> +		DrawablePtr draw = &private->pixmap->drawable;
> +
> +		amdgpu_dri2_destroy_buffer2(draw->pScreen, draw,
> buffer);
>  	}
>  }
> 
> @@ -751,8 +722,8 @@ static void
> amdgpu_dri2_frame_event_handler(xf86CrtcPtr crtc, uint32_t seq,
>  			box.x2 = drawable->width;
>  			box.y2 = drawable->height;
>  			REGION_INIT(pScreen, &region, &box, 0);
> -			amdgpu_dri2_copy_region(drawable, &region,
> event->front,
> -						event->back);
> +			amdgpu_dri2_copy_region2(drawable->pScreen,
> drawable, &region,
> +						 event->front, event->back);
>  			swap_type = DRI2_BLIT_COMPLETE;
>  		}
> 
> @@ -1286,7 +1257,7 @@ blit_fallback:
>  		box.y2 = draw->height;
>  		REGION_INIT(pScreen, &region, &box, 0);
> 
> -		amdgpu_dri2_copy_region(draw, &region, front, back);
> +		amdgpu_dri2_copy_region2(draw->pScreen, draw, &region,
> front, back);
> 
>  		DRI2SwapComplete(client, draw, 0, 0, 0,
> DRI2_BLIT_COMPLETE, func, data);
> 
> @@ -1315,10 +1286,6 @@ Bool amdgpu_dri2_screen_init(ScreenPtr
> pScreen)
>  	dri2_info.driverName = SI_DRIVER_NAME;
>  	dri2_info.fd = pAMDGPUEnt->fd;
>  	dri2_info.deviceName = info->dri2.device_name;
> -	dri2_info.version = DRI2INFOREC_VERSION;
> -	dri2_info.CreateBuffer = amdgpu_dri2_create_buffer;
> -	dri2_info.DestroyBuffer = amdgpu_dri2_destroy_buffer;
> -	dri2_info.CopyRegion = amdgpu_dri2_copy_region;
> 
>  	if (info->drmmode.count_crtcs > 2) {
>  		uint64_t cap_value;
> @@ -1338,11 +1305,10 @@ Bool amdgpu_dri2_screen_init(ScreenPtr
> pScreen)
>  	}
> 
>  	if (scheduling_works) {
> -		dri2_info.version = 4;
>  		dri2_info.ScheduleSwap = amdgpu_dri2_schedule_swap;
>  		dri2_info.GetMSC = amdgpu_dri2_get_msc;
>  		dri2_info.ScheduleWaitMSC =
> amdgpu_dri2_schedule_wait_msc;
> -		dri2_info.numDrivers =
> AMDGPU_ARRAY_SIZE(driverNames);
> +		dri2_info.numDrivers = ARRAY_SIZE(driverNames);
>  		dri2_info.driverNames = driverNames;
>  		driverNames[0] = driverNames[1] = dri2_info.driverName;
> 
> @@ -1362,12 +1328,10 @@ Bool amdgpu_dri2_screen_init(ScreenPtr
> pScreen)
>  		DRI2InfoCnt++;
>  	}
> 
> -#if DRI2INFOREC_VERSION >= 9
>  	dri2_info.version = 9;
>  	dri2_info.CreateBuffer2 = amdgpu_dri2_create_buffer2;
>  	dri2_info.DestroyBuffer2 = amdgpu_dri2_destroy_buffer2;
>  	dri2_info.CopyRegion2 = amdgpu_dri2_copy_region2;
> -#endif
> 
>  	info->dri2.enabled = DRI2ScreenInit(pScreen, &dri2_info);
>  	return info->dri2.enabled;
> diff --git a/src/amdgpu_drm_queue.c b/src/amdgpu_drm_queue.c
> index eb3ca633d..2aa21e04d 100644
> --- a/src/amdgpu_drm_queue.c
> +++ b/src/amdgpu_drm_queue.c
> @@ -31,10 +31,11 @@
>  #endif
> 
>  #include <xorg-server.h>
> +#include <X11/Xdefs.h>
> +#include <list.h>
> 
>  #include "amdgpu_drv.h"
>  #include "amdgpu_drm_queue.h"
> -#include "amdgpu_list.h"
> 
> 
>  struct amdgpu_drm_queue_entry {
> diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
> index 8b378b18a..4ee13e12b 100644
> --- a/src/amdgpu_drv.h
> +++ b/src/amdgpu_drv.h
> @@ -166,11 +166,6 @@ typedef enum {
>  	OPTION_DELETE_DP12,
>  } AMDGPUOpts;
> 
> -#if XF86_CRTC_VERSION >= 5
> -#define AMDGPU_PIXMAP_SHARING 1
> -#define amdgpu_is_gpu_screen(screen) (screen)->isGPU
> -#define amdgpu_is_gpu_scrn(scrn) (scrn)->is_gpu
> -
>  static inline ScreenPtr
>  amdgpu_master_screen(ScreenPtr screen)
>  {
> @@ -202,10 +197,6 @@ amdgpu_dirty_src_equals(PixmapDirtyUpdatePtr
> dirty, PixmapPtr pixmap)
>  #endif
>  }
> 
> -#else
> -#define amdgpu_is_gpu_screen(screen) 0
> -#define amdgpu_is_gpu_scrn(scrn) 0
> -#endif
> 
>  #define AMDGPU_VSYNC_TIMEOUT	20000	/* Maximum wait for VSYNC
> (in usecs) */
> 
> @@ -218,7 +209,6 @@ amdgpu_dirty_src_equals(PixmapDirtyUpdatePtr
> dirty, PixmapPtr pixmap)
>  #define AMDGPU_LOGLEVEL_DEBUG 4
> 
>  /* Other macros */
> -#define AMDGPU_ARRAY_SIZE(x)  (sizeof(x)/sizeof(x[0]))
>  #define AMDGPU_ALIGN(x,bytes) (((x) + ((bytes) - 1)) & ~((bytes) - 1))
>  #define AMDGPUPTR(pScrn)      ((AMDGPUInfoPtr)(pScrn)->driverPrivate)
> 
> @@ -251,7 +241,7 @@ typedef struct {
>  	uint32_t family;
>  	struct gbm_device *gbm;
> 
> -	 Bool(*CloseScreen) (CLOSE_SCREEN_ARGS_DECL);
> +	Bool(*CloseScreen) (ScreenPtr pScreen);
> 
>  	void (*BlockHandler) (BLOCKHANDLER_ARGS_DECL);
> 
> @@ -333,10 +323,8 @@ typedef struct {
>  		AddTrapsProcPtr SavedAddTraps;
>  		UnrealizeGlyphProcPtr SavedUnrealizeGlyph;
>  #endif
> -#ifdef AMDGPU_PIXMAP_SHARING
>  		SharePixmapBackingProcPtr SavedSharePixmapBacking;
>  		SetSharedPixmapBackingProcPtr
> SavedSetSharedPixmapBacking;
> -#endif
>  	} glamor;
> 
>  } AMDGPUInfoRec, *AMDGPUInfoPtr;
> diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
> index 197592aa0..4d9788787 100644
> --- a/src/amdgpu_glamor.c
> +++ b/src/amdgpu_glamor.c
> @@ -317,7 +317,6 @@ amdgpu_glamor_set_pixmap_bo(DrawablePtr
> drawable, PixmapPtr pixmap)
>  	return old;
>  }
> 
> -#ifdef AMDGPU_PIXMAP_SHARING
> 
>  static Bool
>  amdgpu_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr
> slave,
> @@ -383,7 +382,6 @@
> amdgpu_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void
> *handle)
>  	return TRUE;
>  }
> 
> -#endif /* AMDGPU_PIXMAP_SHARING */
> 
>  Bool amdgpu_glamor_init(ScreenPtr screen)
>  {
> @@ -440,13 +438,11 @@ Bool amdgpu_glamor_init(ScreenPtr screen)
>  	screen->CreatePixmap = amdgpu_glamor_create_pixmap;
>  	info->glamor.SavedDestroyPixmap = screen->DestroyPixmap;
>  	screen->DestroyPixmap = amdgpu_glamor_destroy_pixmap;
> -#ifdef AMDGPU_PIXMAP_SHARING
>  	info->glamor.SavedSharePixmapBacking = screen-
> >SharePixmapBacking;
>  	screen->SharePixmapBacking =
> amdgpu_glamor_share_pixmap_backing;
>  	info->glamor.SavedSetSharedPixmapBacking = screen-
> >SetSharedPixmapBacking;
>  	screen->SetSharedPixmapBacking =
>  	    amdgpu_glamor_set_shared_pixmap_backing;
> -#endif
> 
>  	xf86DrvMsg(scrn->scrnIndex, X_INFO, "Use GLAMOR
> acceleration.\n");
>  	return TRUE;
> @@ -488,10 +484,8 @@ amdgpu_glamor_fini(ScreenPtr screen)
> 
>  	screen->CreatePixmap = info->glamor.SavedCreatePixmap;
>  	screen->DestroyPixmap = info->glamor.SavedDestroyPixmap;
> -#ifdef AMDGPU_PIXMAP_SHARING
>  	screen->SharePixmapBacking = info-
> >glamor.SavedSharePixmapBacking;
>  	screen->SetSharedPixmapBacking = info-
> >glamor.SavedSetSharedPixmapBacking;
> -#endif
>  }
> 
>  XF86VideoAdaptorPtr amdgpu_glamor_xv_init(ScreenPtr pScreen, int
> num_adapt)
> diff --git a/src/amdgpu_glamor.h b/src/amdgpu_glamor.h
> index 447349562..78fec0b01 100644
> --- a/src/amdgpu_glamor.h
> +++ b/src/amdgpu_glamor.h
> @@ -32,10 +32,6 @@
>  #define GLAMOR_FOR_XORG  1
>  #include <glamor.h>
> 
> -#ifndef CREATE_PIXMAP_USAGE_SHARED
> -#define CREATE_PIXMAP_USAGE_SHARED
> AMDGPU_CREATE_PIXMAP_DRI2
> -#endif
> -
>  #define AMDGPU_CREATE_PIXMAP_SHARED(usage) \
>  	((usage) == AMDGPU_CREATE_PIXMAP_DRI2 || \
>  	 (usage) == CREATE_PIXMAP_USAGE_SHARED)
> diff --git a/src/amdgpu_glamor_wrappers.c
> b/src/amdgpu_glamor_wrappers.c
> index 81b212d7b..fab8e5ab9 100644
> --- a/src/amdgpu_glamor_wrappers.c
> +++ b/src/amdgpu_glamor_wrappers.c
> @@ -896,7 +896,7 @@ amdgpu_glamor_triangles(CARD8 op, PicturePtr src,
> PicturePtr dst,
>   * down our screen private, before calling down to the next CloseScreen.
>   */
>  static Bool
> -amdgpu_glamor_close_screen(CLOSE_SCREEN_ARGS_DECL)
> +amdgpu_glamor_close_screen(ScreenPtr pScreen)
>  {
>  	AMDGPUInfoPtr info = AMDGPUPTR(xf86ScreenToScrn(pScreen));
>  #ifdef RENDER
> @@ -924,7 +924,7 @@
> amdgpu_glamor_close_screen(CLOSE_SCREEN_ARGS_DECL)
>  	}
>  #endif
> 
> -	return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
> +	return pScreen->CloseScreen(pScreen);
>  }
> 
>  /**
> diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
> index d82ead2ac..6fe43264c 100644
> --- a/src/amdgpu_kms.c
> +++ b/src/amdgpu_kms.c
> @@ -237,9 +237,7 @@ static Bool
> AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
>  	if (dixPrivateKeyRegistered(rrPrivKey)) {
>  		rrScrPrivPtr rrScrPriv = rrGetScrPriv(pScreen);
> 
> -		if (!amdgpu_is_gpu_screen(pScreen) &&
> -		    !rrScrPriv->primaryOutput)
> -		{
> +		if (!pScreen->isGPU && !rrScrPriv->primaryOutput) {
>  			xf86CrtcConfigPtr xf86_config =
> XF86_CRTC_CONFIG_PTR(pScrn);
> 
>  			rrScrPriv->primaryOutput = xf86_config->output[0]-
> >randr_output;
> @@ -248,8 +246,7 @@ static Bool
> AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
>  		}
>  	}
> 
> -	if (!drmmode_set_desired_modes(pScrn, &info->drmmode,
> -				       amdgpu_is_gpu_screen(pScreen)))
> +	if (!drmmode_set_desired_modes(pScrn, &info->drmmode,
> pScreen->isGPU))
>  		return FALSE;
> 
>  	drmmode_uevent_init(pScrn, &info->drmmode);
> @@ -275,8 +272,7 @@ static Bool
> AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
>  		amdgpu_glamor_create_screen_resources(pScreen);
> 
>  	info->callback_event_type = -1;
> -	if (!amdgpu_is_gpu_screen(pScreen) &&
> -		(damage_ext = CheckExtension("DAMAGE"))) {
> +	if (!pScreen->isGPU && (damage_ext =
> CheckExtension("DAMAGE"))) {
>  		info->callback_event_type = damage_ext->eventBase +
> XDamageNotify;
> 
>  		if (!AddCallback(&FlushCallback, amdgpu_flush_callback,
> pScrn))
> @@ -301,15 +297,12 @@ static Bool
> AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
>  static Bool
>  amdgpu_scanout_extents_intersect(xf86CrtcPtr xf86_crtc, BoxPtr extents)
>  {
> -#ifdef AMDGPU_PIXMAP_SHARING
>  	if (xf86_crtc->scrn->is_gpu) {
>  		extents->x1 -= xf86_crtc->x;
>  		extents->y1 -= xf86_crtc->y;
>  		extents->x2 -= xf86_crtc->x;
>  		extents->y2 -= xf86_crtc->y;
> -	} else
> -#endif
> -	{
> +	} else {
>  		extents->x1 -= xf86_crtc->filter_width >> 1;
>  		extents->x2 += xf86_crtc->filter_width >> 1;
>  		extents->y1 -= xf86_crtc->filter_height >> 1;
> @@ -325,8 +318,6 @@ amdgpu_scanout_extents_intersect(xf86CrtcPtr
> xf86_crtc, BoxPtr extents)
>  	return (extents->x1 < extents->x2 && extents->y1 < extents->y2);
>  }
> 
> -#if XF86_CRTC_VERSION >= 4
> -
>  static RegionPtr
>  transform_region(RegionPtr region, struct pict_f_transform *transform,
>  		 int w, int h)
> @@ -365,8 +356,6 @@ transform_region(RegionPtr region, struct
> pict_f_transform *transform,
>  	return transformed;
>  }
> 
> -#endif
> -
>  static void
>  amdgpu_sync_scanout_pixmaps(xf86CrtcPtr xf86_crtc, RegionPtr
> new_region,
>  							int scanout_id)
> @@ -394,14 +383,11 @@ amdgpu_sync_scanout_pixmaps(xf86CrtcPtr
> xf86_crtc, RegionPtr new_region,
>  	if (!amdgpu_scanout_extents_intersect(xf86_crtc, &extents))
>  		goto uninit;
> 
> -#if XF86_CRTC_VERSION >= 4
>  	if (xf86_crtc->driverIsPerformingTransform) {
>  		sync_region = transform_region(&remaining,
>  					       &xf86_crtc-
> >f_framebuffer_to_crtc,
>  					       dst->width, dst->height);
> -	} else
> -#endif /* XF86_CRTC_VERSION >= 4 */
> -	{
> +	} else {
>  		sync_region = RegionDuplicate(&remaining);
>  		RegionTranslate(sync_region, -xf86_crtc->x, -xf86_crtc->y);
>  	}
> @@ -453,7 +439,6 @@ amdgpu_scanout_flip_handler(xf86CrtcPtr crtc,
> uint32_t msc, uint64_t usec,
>  #endif
>  }
> 
> -#ifdef AMDGPU_PIXMAP_SHARING
> 
>  static RegionPtr
>  dirty_region(PixmapDirtyUpdatePtr dirty)
> @@ -803,7 +788,7 @@ amdgpu_dirty_update(ScrnInfoPtr scrn)
>  		}
>  	}
>  }
> -#endif
> +
> 
>  Bool
>  amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id,
> @@ -829,7 +814,6 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc,
> int scanout_id,
>  		RegionCopy(&drmmode_crtc->scanout_last_region,
> &region);
>  	}
> 
> -#if XF86_CRTC_VERSION >= 4
>  	if (xf86_crtc->driverIsPerformingTransform) {
>  		SourceValidateProcPtr SourceValidate = pScreen-
> >SourceValidate;
>  		PictFormatPtr format = PictureWindowFormat(pScreen-
> >root);
> @@ -875,7 +859,6 @@ amdgpu_scanout_do_update(xf86CrtcPtr xf86_crtc,
> int scanout_id,
>  		FreePicture(src, None);
>  	} else
>   out:
> -#endif /* XF86_CRTC_VERSION >= 4 */
>  	{
>  		GCPtr gc = GetScratchGC(pDraw->depth, pScreen);
> 
> @@ -1042,7 +1025,6 @@ amdgpu_scanout_flip(ScreenPtr pScreen,
> AMDGPUInfoPtr info,
> 
>  static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
>  {
> -	SCREEN_PTR(arg);
>  	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
>  	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
>  	xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
> @@ -1055,7 +1037,7 @@ static void
> AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
>  	if (!xf86ScreenToScrn(amdgpu_master_screen(pScreen))->vtSema)
>  		return;
> 
> -	if (!amdgpu_is_gpu_screen(pScreen))
> +	if (!pScreen->isGPU)
>  	{
>  		for (c = 0; c < xf86_config->num_crtc; c++) {
>  			xf86CrtcPtr crtc = xf86_config->crtc[c];
> @@ -1073,9 +1055,7 @@ static void
> AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
>  		amdgpu_glamor_flush(pScrn);
>  #endif
> 
> -#ifdef AMDGPU_PIXMAP_SHARING
>  	amdgpu_dirty_update(pScrn);
> -#endif
>  }
> 
>  /* This is called by AMDGPUPreInit to set up the default visual */
> @@ -1248,7 +1228,6 @@ static Bool
> amdgpu_get_tile_config(AMDGPUInfoPtr info,
> 
>  static void AMDGPUSetupCapabilities(ScrnInfoPtr pScrn)
>  {
> -#ifdef AMDGPU_PIXMAP_SHARING
>  	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
>  	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
>  	uint64_t value;
> @@ -1270,7 +1249,6 @@ static void AMDGPUSetupCapabilities(ScrnInfoPtr
> pScrn)
>  				pScrn->capabilities |=
> RR_Capability_SinkOutput;
>  		}
>  	}
> -#endif
>  }
> 
>  /* When the root window is created, initialize the screen contents from
> @@ -1438,7 +1416,7 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int
> flags)
>  			xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
> "ShadowPrimary enabled\n");
>  	}
> 
> -	if (!amdgpu_is_gpu_scrn(pScrn)) {
> +	if (!pScrn->is_gpu) {
>  		sw_cursor = xf86ReturnOptValBool(info->Options,
>  						 OPTION_SW_CURSOR,
> FALSE);
> 
> @@ -1665,7 +1643,7 @@ static Bool AMDGPUSaveScreen_KMS(ScreenPtr
> pScreen, int mode)
>   * text mode, unmap video memory, and unwrap and call the saved
>   * CloseScreen function.
>   */
> -static Bool AMDGPUCloseScreen_KMS(CLOSE_SCREEN_ARGS_DECL)
> +static Bool AMDGPUCloseScreen_KMS(ScreenPtr pScreen)
>  {
>  	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
>  	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
> @@ -1697,20 +1675,18 @@ static Bool
> AMDGPUCloseScreen_KMS(CLOSE_SCREEN_ARGS_DECL)
>  	xf86ClearPrimInitDone(info->pEnt->index);
>  	pScreen->BlockHandler = info->BlockHandler;
>  	pScreen->CloseScreen = info->CloseScreen;
> -	return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
> +	return pScreen->CloseScreen(pScreen);
>  }
> 
> -void AMDGPUFreeScreen_KMS(FREE_SCREEN_ARGS_DECL)
> +void AMDGPUFreeScreen_KMS(ScrnInfoPtr pScrn)
>  {
> -	SCRN_INFO_PTR(arg);
> -
>  	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,
> AMDGPU_LOGLEVEL_DEBUG,
>  		       "AMDGPUFreeScreen\n");
> 
>  	AMDGPUFreeRec(pScrn);
>  }
> 
> -Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
> +Bool AMDGPUScreenInit_KMS(ScreenPtr pScreen, int argc, char **argv)
>  {
>  	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
>  	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
> @@ -1804,7 +1780,7 @@ Bool
> AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>  	}
>  #endif
> 
> -	if (!amdgpu_is_gpu_screen(pScreen)) {
> +	if (!pScreen->isGPU) {
>  		if (xorgGetVersion() >=
> XORG_VERSION_NUMERIC(1,18,3,0,0))
>  			value = info->use_glamor;
>  		else
> @@ -1892,8 +1868,7 @@ Bool
> AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>  	 */
>  	/* xf86DiDGAInit(pScreen, info->LinearAddr + pScrn->fbOffset); */
>  #endif
> -	if (info->shadow_fb == FALSE &&
> -	    !amdgpu_is_gpu_screen(pScreen)) {
> +	if (info->shadow_fb == FALSE && !pScreen->isGPU) {
>  		/* Init Xv */
>  		xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,
> AMDGPU_LOGLEVEL_DEBUG,
>  			       "Initializing Xv\n");
> @@ -1909,7 +1884,7 @@ Bool
> AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>  	}
>  	pScrn->pScreen = pScreen;
> 
> -	if (!amdgpu_is_gpu_screen(pScreen)) {
> +	if (!pScreen->isGPU) {
>  		if (serverGeneration == 1 && bgNoneRoot && info-
> >use_glamor) {
>  			info->CreateWindow = pScreen->CreateWindow;
>  			pScreen->CreateWindow =
> AMDGPUCreateWindow_oneshot;
> @@ -1929,12 +1904,10 @@ Bool
> AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>  	info->CreateScreenResources = pScreen->CreateScreenResources;
>  	pScreen->CreateScreenResources =
> AMDGPUCreateScreenResources_KMS;
> 
> -#ifdef AMDGPU_PIXMAP_SHARING
>  	pScreen->StartPixmapTracking = PixmapStartDirtyTracking;
>  	pScreen->StopPixmapTracking = PixmapStopDirtyTracking;
>  #if HAS_SYNC_SHARED_PIXMAP
>  	pScreen->SyncSharedPixmap = amdgpu_sync_shared_pixmap;
> -#endif
>  #endif
> 
>  	if (!xf86CrtcScreenInit(pScreen))
> @@ -1959,9 +1932,8 @@ Bool
> AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>  	return TRUE;
>  }
> 
> -Bool AMDGPUEnterVT_KMS(VT_FUNC_ARGS_DECL)
> +Bool AMDGPUEnterVT_KMS(ScrnInfoPtr pScrn)
>  {
> -	SCRN_INFO_PTR(arg);
>  	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
> 
>  	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,
> AMDGPU_LOGLEVEL_DEBUG,
> @@ -1988,9 +1960,8 @@ pixmap_unref_fb(void *value, XID id, void *cdata)
>  		drmmode_fb_reference(pAMDGPUEnt->fd, fb_ptr, NULL);
>  }
> 
> -void AMDGPULeaveVT_KMS(VT_FUNC_ARGS_DECL)
> +void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn)
>  {
> -	SCRN_INFO_PTR(arg);
>  	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
>  	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
>  	ScreenPtr pScreen = pScrn->pScreen;
> @@ -2081,18 +2052,16 @@ void
> AMDGPULeaveVT_KMS(VT_FUNC_ARGS_DECL)
>  		       "Ok, leaving now...\n");
>  }
> 
> -Bool AMDGPUSwitchMode_KMS(SWITCH_MODE_ARGS_DECL)
> +Bool AMDGPUSwitchMode_KMS(ScrnInfoPtr pScrn, DisplayModePtr mode)
>  {
> -	SCRN_INFO_PTR(arg);
>  	Bool ret;
>  	ret = xf86SetSingleMode(pScrn, mode, RR_Rotate_0);
>  	return ret;
> 
>  }
> 
> -void AMDGPUAdjustFrame_KMS(ADJUST_FRAME_ARGS_DECL)
> +void AMDGPUAdjustFrame_KMS(ScrnInfoPtr pScrn, int x, int y)
>  {
> -	SCRN_INFO_PTR(arg);
>  	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
>  	drmmode_adjust_frame(pScrn, &info->drmmode, x, y);
>  	return;
> @@ -2187,7 +2156,7 @@ static Bool amdgpu_setup_kernel_mem(ScreenPtr
> pScreen)
>  }
> 
>  /* Used to disallow modes that are not supported by the hardware */
> -ModeStatus AMDGPUValidMode(SCRN_ARG_TYPE arg, DisplayModePtr
> mode,
> +ModeStatus AMDGPUValidMode(ScrnInfoPtr pScrn, DisplayModePtr
> mode,
>  			   Bool verbose, int flag)
>  {
>  	/* There are problems with double scan mode at high clocks
> diff --git a/src/amdgpu_list.h b/src/amdgpu_list.h
> deleted file mode 100644
> index eb28835e3..000000000
> --- a/src/amdgpu_list.h
> +++ /dev/null
> @@ -1,47 +0,0 @@
> -/*
> - * Copyright © 2015 Advanced Micro Devices, 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 (including the next
> - * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
> - */
> -
> -#ifndef _AMDGPU_LIST_H_
> -#define _AMDGPU_LIST_H_
> -
> -#include <xorg-server.h>
> -#include <list.h>
> -
> -#if !HAVE_XORG_LIST
> -#define xorg_list			list
> -#define xorg_list_init			list_init
> -#define xorg_list_is_empty		list_is_empty
> -#define xorg_list_add			list_add
> -#define xorg_list_del			list_del
> -#define xorg_list_for_each_entry	list_for_each_entry
> -#define xorg_list_for_each_entry_safe	list_for_each_entry_safe
> -
> -static inline void
> -xorg_list_append(struct list *entry, struct list *head)
> -{
> -	__list_add(entry, head->prev, head);
> -}
> -
> -#endif
> -
> -#endif /* _AMDGPU_LIST_H_ */
> diff --git a/src/amdgpu_probe.h b/src/amdgpu_probe.h
> index 9e4a9a451..5f61aab5a 100644
> --- a/src/amdgpu_probe.h
> +++ b/src/amdgpu_probe.h
> @@ -76,13 +76,13 @@ extern void
> amdgpu_kernel_close_fd(AMDGPUEntPtr pAMDGPUEnt);
>  extern const OptionInfoRec *AMDGPUOptionsWeak(void);
> 
>  extern Bool AMDGPUPreInit_KMS(ScrnInfoPtr, int);
> -extern Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL);
> -extern Bool AMDGPUSwitchMode_KMS(SWITCH_MODE_ARGS_DECL);
> -extern void AMDGPUAdjustFrame_KMS(ADJUST_FRAME_ARGS_DECL);
> -extern Bool AMDGPUEnterVT_KMS(VT_FUNC_ARGS_DECL);
> -extern void AMDGPULeaveVT_KMS(VT_FUNC_ARGS_DECL);
> -extern void AMDGPUFreeScreen_KMS(FREE_SCREEN_ARGS_DECL);
> +extern Bool AMDGPUScreenInit_KMS(ScreenPtr pScreen, int argc, char
> **argv);
> +extern Bool AMDGPUSwitchMode_KMS(ScrnInfoPtr pScrn, DisplayModePtr
> mode);
> +extern void AMDGPUAdjustFrame_KMS(ScrnInfoPtr pScrn, int x, int y);
> +extern Bool AMDGPUEnterVT_KMS(ScrnInfoPtr pScrn);
> +extern void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn);
> +extern void AMDGPUFreeScreen_KMS(ScrnInfoPtr pScrn);
> 
> -extern ModeStatus AMDGPUValidMode(SCRN_ARG_TYPE arg,
> DisplayModePtr mode,
> +extern ModeStatus AMDGPUValidMode(ScrnInfoPtr pScrn,
> DisplayModePtr mode,
>  				  Bool verbose, int flag);
>  #endif /* _AMDGPU_PROBE_H_ */
> diff --git a/src/compat-api.h b/src/compat-api.h
> index ebe9cf3e0..a703e5c8f 100644
> --- a/src/compat-api.h
> +++ b/src/compat-api.h
> @@ -23,81 +23,19 @@
>   * Author: Dave Airlie <airlied at redhat.com>
>   */
> 
> -/* this file provides API compat between server post 1.13 and pre it,
> -   it should be reused inside as many drivers as possible */
>  #ifndef COMPAT_API_H
>  #define COMPAT_API_H
> 
> -#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
> -#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
> -#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
> -#endif
> -
> -#ifndef XF86_HAS_SCRN_CONV
> -#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
> -#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
> -#endif
> -
> -#ifndef XF86_SCRN_INTERFACE
> -
> -#define SCRN_ARG_TYPE int
> -#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
> -
> -#define SCREEN_ARG_TYPE int
> -#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
> -
> -#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char
> **argv
> -
> -#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer
> pTimeout, pointer pReadmask
> -#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
> -
> -#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
> -#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
> -
> -#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
> -
> -#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
> -
> -#define FREE_SCREEN_ARGS_DECL int arg, int flags
> -
> -#define VT_FUNC_ARGS_DECL int arg, int flags
> -#define VT_FUNC_ARGS(flags) pScrn->scrnIndex, (flags)
> -
> -#define XF86_ENABLEDISABLEFB_ARG(x) ((x)->scrnIndex)
> -#else
> -#define SCRN_ARG_TYPE ScrnInfoPtr
> -#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
> -
> -#define SCREEN_ARG_TYPE ScreenPtr
> -#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
> -
> -#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
> -
>  #if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(22,0)
>  #define HAVE_NOTIFY_FD	1
>  #endif
> 
>  #if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0)
> -#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout
> -#define BLOCKHANDLER_ARGS arg, pTimeout
> +#define BLOCKHANDLER_ARGS_DECL ScreenPtr pScreen, pointer pTimeout
> +#define BLOCKHANDLER_ARGS pScreen, pTimeout
>  #else
> -#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout,
> pointer pReadmask
> -#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
> -#endif
> -
> -#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
> -#define CLOSE_SCREEN_ARGS pScreen
> -
> -#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
> -#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
> -
> -#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
> -
> -#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
> -#define VT_FUNC_ARGS(flags) pScrn
> -
> -#define XF86_ENABLEDISABLEFB_ARG(x) (x)
> -
> +#define BLOCKHANDLER_ARGS_DECL ScreenPtr pScreen, pointer
> pTimeout, pointer pReadmask
> +#define BLOCKHANDLER_ARGS pScreen, pTimeout, pReadmask
>  #endif
> 
>  #endif
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 9c838a8b9..3cbf2bd7d 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -34,6 +34,7 @@
>  #include <time.h>
>  #include "cursorstr.h"
>  #include "damagestr.h"
> +#include "list.h"
>  #include "micmap.h"
>  #include "xf86cmap.h"
>  #include "xf86Priv.h"
> @@ -42,12 +43,9 @@
>  #include "drmmode_display.h"
>  #include "amdgpu_bo_helper.h"
>  #include "amdgpu_glamor.h"
> -#include "amdgpu_list.h"
>  #include "amdgpu_pixmap.h"
> 
> -#ifdef AMDGPU_PIXMAP_SHARING
>  #include <dri.h>
> -#endif
> 
>  /* DPMS */
>  #ifdef HAVE_XEXTPROTO_71
> @@ -575,7 +573,7 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
>  	if (crtc->transformPresent)
>  		return FALSE;
> 
> -#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
> +#if XF86_CRTC_VERSION < 7
>  	/* Xorg doesn't correctly handle cursor position transform in the
>  	 * rotation case
>  	 */
> @@ -584,12 +582,10 @@ drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
>  		return FALSE;
>  #endif
> 
> -#if defined(AMDGPU_PIXMAP_SHARING)
>  	/* HW cursor not supported with RandR 1.4 multihead up to
> 1.18.99.901 */
>  	if (xorgGetVersion() <= XORG_VERSION_NUMERIC(1,18,99,901,0)
> &&
>  	    !xorg_list_is_empty(&crtc->scrn->pScreen->pixmap_dirty_list))
>  		return FALSE;
> -#endif
> 
>  	return TRUE;
>  }
> @@ -613,7 +609,7 @@ drmmode_crtc_update_tear_free(xf86CrtcPtr crtc)
> 
>  		if (drmmode_output->tear_free == 1 ||
>  		    (drmmode_output->tear_free == 2 &&
> -		     (amdgpu_is_gpu_screen(crtc->scrn->pScreen) ||
> +		     (crtc->scrn->pScreen->isGPU ||
>  		      info->shadow_primary ||
>  		      crtc->transformPresent || crtc->rotation !=
> RR_Rotate_0))) {
>  			drmmode_crtc->tear_free = TRUE;
> @@ -622,8 +618,6 @@ drmmode_crtc_update_tear_free(xf86CrtcPtr crtc)
>  	}
>  }
> 
> -#if XF86_CRTC_VERSION >= 4
> -
>  #if XF86_CRTC_VERSION < 7
>  #define XF86DriverTransformOutput TRUE
>  #define XF86DriverTransformNone FALSE
> @@ -652,17 +646,6 @@ drmmode_handle_transform(xf86CrtcPtr crtc)
>  	return ret;
>  }
> 
> -#else
> -
> -static Bool
> -drmmode_handle_transform(xf86CrtcPtr crtc)
> -{
> -	return xf86CrtcRotate(crtc);
> -}
> -
> -#endif
> -
> -#ifdef AMDGPU_PIXMAP_SHARING
> 
>  static void
>  drmmode_crtc_prime_scanout_update(xf86CrtcPtr crtc, DisplayModePtr
> mode,
> @@ -721,7 +704,6 @@ drmmode_crtc_prime_scanout_update(xf86CrtcPtr
> crtc, DisplayModePtr mode,
>  	drmmode_crtc->scanout_id = scanout_id;
>  }
> 
> -#endif /* AMDGPU_PIXMAP_SHARING */
> 
>  static void
>  drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
> @@ -878,21 +860,16 @@ drmmode_set_mode_major(xf86CrtcPtr crtc,
> DisplayModePtr mode,
>  		drmmode_crtc_gamma_do_set(crtc, crtc->gamma_red, crtc-
> >gamma_green,
>  					  crtc->gamma_blue, crtc-
> >gamma_size);
> 
> -#ifdef AMDGPU_PIXMAP_SHARING
>  		if (drmmode_crtc->prime_scanout_pixmap) {
>  			drmmode_crtc_prime_scanout_update(crtc, mode,
> scanout_id,
>  							  &fb, &x, &y);
> -		} else
> -#endif
> -		if (drmmode_crtc->rotate.pixmap) {
> +		} else if (drmmode_crtc->rotate.pixmap) {
>  			fb = amdgpu_pixmap_get_fb(drmmode_crtc-
> >rotate.pixmap);
>  			x = y = 0;
> 
> -		} else if (!amdgpu_is_gpu_screen(pScreen) &&
> +		} else if (!pScreen->isGPU &&
>  			   (drmmode_crtc->tear_free ||
> -#if XF86_CRTC_VERSION >= 4
>  			    crtc->driverIsPerformingTransform ||
> -#endif
>  			    info->shadow_primary)) {
>  			drmmode_crtc_scanout_update(crtc, mode,
> scanout_id,
>  						    &fb, &x, &y);
> @@ -992,7 +969,7 @@ static void drmmode_set_cursor_position(xf86CrtcPtr
> crtc, int x, int y)
>  	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
>  	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(crtc->scrn);
> 
> -#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
> +#if XF86_CRTC_VERSION < 7
>  	if (crtc->driverIsPerformingTransform) {
>  		x += crtc->x;
>  		y += crtc->y;
> @@ -1003,7 +980,7 @@ static void
> drmmode_set_cursor_position(xf86CrtcPtr crtc, int x, int y)
>  	drmModeMoveCursor(pAMDGPUEnt->fd, drmmode_crtc-
> >mode_crtc->crtc_id, x, y);
>  }
> 
> -#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
> +#if XF86_CRTC_VERSION < 7
> 
>  static int
>  drmmode_cursor_src_offset(Rotation rotation, int width, int height,
> @@ -1068,7 +1045,7 @@ static void
> drmmode_do_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image, uint32_
>  	ScrnInfoPtr pScrn = crtc->scrn;
>  	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
> 
> -#if XF86_CRTC_VERSION >= 4 && XF86_CRTC_VERSION < 7
> +#if XF86_CRTC_VERSION < 7
>  	if (crtc->driverIsPerformingTransform) {
>  		uint32_t cursor_w = info->cursor_w, cursor_h = info-
> >cursor_h;
>  		int dstx, dsty;
> @@ -1269,7 +1246,6 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc,
> uint16_t * red, uint16_t * green,
>  #endif
>  }
> 
> -#ifdef AMDGPU_PIXMAP_SHARING
>  static Bool drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
>  {
>  	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
> @@ -1320,7 +1296,6 @@ static Bool
> drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
>  #endif
>  	return TRUE;
>  }
> -#endif
> 
>  static xf86CrtcFuncsRec drmmode_crtc_funcs = {
>  	.dpms = drmmode_crtc_dpms,
> @@ -1339,9 +1314,7 @@ static xf86CrtcFuncsRec drmmode_crtc_funcs = {
>  	.shadow_allocate = drmmode_crtc_shadow_allocate,
>  	.shadow_destroy = drmmode_crtc_shadow_destroy,
>  	.destroy = NULL,	/* XXX */
> -#ifdef AMDGPU_PIXMAP_SHARING
>  	.set_scanout_pixmap = drmmode_set_scanout_pixmap,
> -#endif
>  };
> 
>  int drmmode_get_crtc_id(xf86CrtcPtr crtc)
> @@ -1852,14 +1825,12 @@ drmmode_create_name(ScrnInfoPtr pScrn,
> drmModeConnectorPtr koutput, char *name,
>  	if (output) {
>  		snprintf(name, 32, "%s-%s", output->name, extra_path);
>  	} else {
> -		if (koutput->connector_type >= NUM_OUTPUT_NAMES)
> +		if (koutput->connector_type >= NUM_OUTPUT_NAMES) {
>  			snprintf(name, 32, "Unknown%d-%d", koutput-
> >connector_type, koutput->connector_type_id - 1);
> -#ifdef AMDGPU_PIXMAP_SHARING
> -		else if (pScrn->is_gpu)
> +		} else if (pScrn->is_gpu) {
>  			snprintf(name, 32, "%s-%d-%d",
> output_names[koutput->connector_type],
>  				 pScrn->scrnIndex - GPU_SCREEN_OFFSET +
> 1, koutput->connector_type_id - 1);
> -#endif
> -		else {
> +		} else {
>  			/* need to do smart conversion here for compat with
> non-kms ATI driver */
>  			if (koutput->connector_type_id == 1) {
>  				switch(koutput->connector_type) {
> @@ -2355,9 +2326,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn,
> drmmode_ptr drmmode, int cpp)
>  	int i, num_dvi = 0, num_hdmi = 0;
>  	unsigned int crtcs_needed = 0;
>  	drmModeResPtr mode_res;
> -#ifdef AMDGPU_PIXMAP_SHARING
>  	char *bus_id_string, *provider_name;
> -#endif
> 
>  	xf86CrtcConfigInit(pScrn, &drmmode_xf86crtc_config_funcs);
> 
> @@ -2399,13 +2368,11 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn,
> drmmode_ptr drmmode, int cpp)
>  	/* workout clones */
>  	drmmode_clones_init(pScrn, drmmode, mode_res);
> 
> -#ifdef AMDGPU_PIXMAP_SHARING
>  	bus_id_string = DRICreatePCIBusID(info->PciInfo);
>  	XNFasprintf(&provider_name, "%s @ %s", pScrn->chipset,
> bus_id_string);
>  	free(bus_id_string);
>  	xf86ProviderSetup(pScrn, NULL, provider_name);
>  	free(provider_name);
> -#endif
> 
>  	xf86InitialConfiguration(pScrn, TRUE);
> 
> --
> 2.14.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list