xf86-video-amdgpu: Branch 'master' - 3 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Mon Jul 23 16:46:37 UTC 2018


 src/amdgpu_drv.h      |    1 
 src/amdgpu_kms.c      |    4 --
 src/drmmode_display.c |   70 ++++++++------------------------------------------
 src/drmmode_display.h |    2 -
 4 files changed, 12 insertions(+), 65 deletions(-)

New commits:
commit 5f06d6b8ba570b500956ad26fee711d5ac427818
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Jul 17 19:00:51 2018 +0200

    Remove drmmode_terminate_leases
    
    The RandR screen private is already freed when our CloseScreen runs, so
    this can't do anything useful. This cleanup has to be done by the X
    server itself.

diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index c22b797..7b13d77 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1702,7 +1702,6 @@ static Bool AMDGPUCloseScreen_KMS(ScreenPtr pScreen)
 	/* Clear mask of assigned crtc's in this generation */
 	pAMDGPUEnt->assigned_crtcs = 0;
 
-	drmmode_terminate_leases(pScrn);
 	drmmode_uevent_fini(pScrn, &info->drmmode);
 	amdgpu_drm_queue_close(pScrn);
 
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 7117b42..b3e7540 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -3037,26 +3037,6 @@ drmmode_terminate_lease(RRLeasePtr lease)
 
 #endif // XF86_LEASE_VERSION
 
-void
-drmmode_terminate_leases(ScrnInfoPtr pScrn)
-{
-#ifdef XF86_LEASE_VERSION
-	ScreenPtr screen = xf86ScrnToScreen(pScrn);
-	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
-	rrScrPrivPtr scr_priv = rrGetScrPriv(screen);
-	RRLeasePtr lease, next;
-
-	xorg_list_for_each_entry_safe(lease, next, &scr_priv->leases, list) {
-		drmmode_lease_private_ptr lease_private = lease->devPrivate;
-		drmModeRevokeLease(pAMDGPUEnt->fd, lease_private->lessee_id);
-		free(lease_private);
-		lease->devPrivate = NULL;
-		RRLeaseTerminated(lease);
-		RRLeaseFree(lease);
-	}
-#endif
-}
-
 static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = {
 	.resize = drmmode_xf86crtc_resize,
 #ifdef XF86_LEASE_VERSION
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 0646752..8b949f7 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -245,8 +245,6 @@ PixmapPtr drmmode_crtc_scanout_create(xf86CrtcPtr crtc,
 extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
 extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
 
-extern void drmmode_terminate_leases(ScrnInfoPtr scrn);
-
 Bool drmmode_set_mode(xf86CrtcPtr crtc, struct drmmode_fb *fb,
 		      DisplayModePtr mode, int x, int y);
 
commit 7cc2d4515a63845a027214daf4d391cf56e35bb3
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Jul 19 16:59:22 2018 +0200

    Remove AMDGPUInfoRec::fbcon_pixmap
    
    We always destroy the fbcon pixmap in drmmode_copy_fb anyway.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 8a77b05..45bc394 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -264,7 +264,6 @@ typedef struct {
 	struct amdgpu_dri2 dri2;
 
 	/* accel */
-	PixmapPtr fbcon_pixmap;
 	int callback_event_type;
 	uint_fast32_t gpu_flushed;
 	uint_fast32_t gpu_synced;
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 39e047e..c22b797 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -125,9 +125,6 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn)
 
 	info = AMDGPUPTR(pScrn);
 	if (info) {
-		if (info->fbcon_pixmap)
-			pScrn->pScreen->DestroyPixmap(info->fbcon_pixmap);
-
 		pEnt = info->pEnt;
 		free(pScrn->driverPrivate);
 		pScrn->driverPrivate = NULL;
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b300866..7117b42 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -357,13 +357,9 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
 {
 	ScreenPtr pScreen = pScrn->pScreen;
 	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
-	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
-	PixmapPtr pixmap = info->fbcon_pixmap;
+	PixmapPtr pixmap = NULL;
 	drmModeFBPtr fbcon;
 
-	if (pixmap)
-		return pixmap;
-
 	fbcon = drmModeGetFB(pAMDGPUEnt->fd, fbcon_id);
 	if (!fbcon)
 		return NULL;
@@ -387,7 +383,6 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
 		pixmap = NULL;
 	}
 
-	info->fbcon_pixmap = pixmap;
 out_free_fb:
 	drmModeFreeFB(fbcon);
 	return pixmap;
@@ -396,7 +391,6 @@ out_free_fb:
 void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 {
 	xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
 	ScreenPtr pScreen = pScrn->pScreen;
 	PixmapPtr src, dst = pScreen->GetScreenPixmap(pScreen);
 	struct drmmode_fb *fb = amdgpu_pixmap_get_fb(dst);
@@ -436,10 +430,7 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 	FreeScratchGC(gc);
 
 	pScreen->canDoBGNoneRoot = TRUE;
-
-	if (info->fbcon_pixmap)
-		pScrn->pScreen->DestroyPixmap(info->fbcon_pixmap);
-	info->fbcon_pixmap = NULL;
+	pScreen->DestroyPixmap(src);
 
 	return;
 }
commit 46d87187c6a0b8f941cc6f30af1f53a98ff2e635
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Jul 19 12:37:42 2018 +0200

    Don't use DRM_IOCTL_GEM_FLINK in create_pixmap_for_fbcon
    
    We don't need it.

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e127593..b300866 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -355,13 +355,11 @@ static PixmapPtr
 create_pixmap_for_fbcon(drmmode_ptr drmmode,
 			ScrnInfoPtr pScrn, int fbcon_id)
 {
+	ScreenPtr pScreen = pScrn->pScreen;
 	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(pScrn);
 	AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
 	PixmapPtr pixmap = info->fbcon_pixmap;
-	struct amdgpu_buffer *bo;
 	drmModeFBPtr fbcon;
-	struct drm_gem_flink flink;
-	struct amdgpu_bo_import_result import = {0};
 
 	if (pixmap)
 		return pixmap;
@@ -375,36 +373,21 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
 	    fbcon->height != pScrn->virtualY)
 		goto out_free_fb;
 
-	flink.handle = fbcon->handle;
-	if (ioctl(pAMDGPUEnt->fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) {
-		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-			   "Couldn't flink fbcon handle\n");
+	pixmap = fbCreatePixmap(pScreen, 0, 0, fbcon->depth, 0);
+	if (!pixmap)
 		goto out_free_fb;
-	}
 
-	bo = calloc(1, sizeof(struct amdgpu_buffer));
-	if (!bo) {
-		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-			   "Couldn't allocate bo for fbcon handle\n");
-		goto out_free_fb;
-	}
-	bo->ref_count = 1;
+	pScreen->ModifyPixmapHeader(pixmap, fbcon->width, fbcon->height, 0, 0,
+				    fbcon->pitch, NULL);
+	pixmap->devPrivate.ptr = NULL;
 
-	if (amdgpu_bo_import(pAMDGPUEnt->pDev,
-			     amdgpu_bo_handle_type_gem_flink_name, flink.name,
-			     &import) != 0) {
-		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-			   "Couldn't import BO for fbcon handle\n");
-		goto out_free_bo;
+	if (!glamor_egl_create_textured_pixmap(pixmap, fbcon->handle,
+					       pixmap->devKind)) {
+		pScreen->DestroyPixmap(pixmap);
+		pixmap = NULL;
 	}
-	bo->bo.amdgpu = import.buf_handle;
 
-	pixmap = drmmode_create_bo_pixmap(pScrn, fbcon->width, fbcon->height,
-					  fbcon->depth, fbcon->bpp,
-					  fbcon->pitch, bo);
 	info->fbcon_pixmap = pixmap;
-out_free_bo:
-	amdgpu_bo_unref(&bo);
 out_free_fb:
 	drmModeFreeFB(fbcon);
 	return pixmap;


More information about the xorg-commit mailing list