[PATCH xf86-video-amdgpu 1/7] Remove unnecessary fb addition from drmmode_xf86crtc_resize

Michel Dänzer michel at daenzer.net
Wed Jun 22 08:50:25 UTC 2016


From: Hans de Goede <hdegoede at redhat.com>

drmmode_set_mode_major() is the only user of drmmode->fb_id and will
create it if necessary.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
(Ported from xserver commit 877453212166fdc912e0d687cdecee11aba563b5)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 7a41294..379bbea 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1893,7 +1893,6 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	int i, pitch, old_width, old_height, old_pitch;
 	int cpp = info->pixel_bytes;
 	PixmapPtr ppix = screen->GetScreenPixmap(screen);
-	uint32_t bo_handle;
 	void *fb_shadow;
 	int hint = 0;
 	xRectangle rect;
@@ -1914,6 +1913,7 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	old_height = scrn->virtualY;
 	old_pitch = scrn->displayWidth;
 	old_fb_id = drmmode->fb_id;
+	drmmode->fb_id = 0;
 	old_front = info->front_buffer;
 
 	scrn->virtualX = width;
@@ -1938,20 +1938,6 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	xf86DrvMsg(scrn->scrnIndex, X_INFO, " => pitch %d bytes\n", pitch);
 	scrn->displayWidth = pitch / cpp;
 
-	if (!amdgpu_bo_get_handle(info->front_buffer, &bo_handle)) {
-		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-			   "Failed to get front buffer handle\n");
-		goto fail;
-	}
-
-	if (drmModeAddFB(pAMDGPUEnt->fd, width, height, scrn->depth,
-			 scrn->bitsPerPixel, pitch,
-			 bo_handle, &drmmode->fb_id) != 0) {
-		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-			   "drmModeAddFB failed for front buffer\n");
-		goto fail;
-	}
-
 	if (!amdgpu_glamor_create_screen_resources(scrn->pScreen))
 		goto fail;
 
-- 
2.8.1



More information about the amd-gfx mailing list