All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xf86-video-amdgpu] Don't use DRM_IOCTL_GEM_FLINK in create_pixmap_for_fbcon
@ 2018-07-19 10:43 Michel Dänzer
  0 siblings, 0 replies; only message in thread
From: Michel Dänzer @ 2018-07-19 10:43 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Michel Dänzer <michel.daenzer@amd.com>

We don't need it.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 39 +++++++++++----------------------------
 1 file changed, 11 insertions(+), 28 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e947ca979..bf8b1a8b6 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;
-- 
2.18.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-19 10:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 10:43 [PATCH xf86-video-amdgpu] Don't use DRM_IOCTL_GEM_FLINK in create_pixmap_for_fbcon Michel Dänzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.