rpms/libdrm/F-12 libdrm-nouveau-immd-alloc.patch, NONE, 1.1 libdrm.spec, 1.95, 1.96

Ben Skeggs bskeggs at fedoraproject.org
Mon Dec 21 06:02:15 UTC 2009


Author: bskeggs

Update of /cvs/pkgs/rpms/libdrm/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv18004

Modified Files:
	libdrm.spec 
Added Files:
	libdrm-nouveau-immd-alloc.patch 
Log Message:
* Mon Dec 21 2009 Ben Skeggs <bskeggs at redhat.com> 2.4.15-8
- nouveau: fix bo allocation issues (rh#530169)



libdrm-nouveau-immd-alloc.patch:
 nouveau_bo.c |   42 +++++++++++++++++-------------------------
 1 file changed, 17 insertions(+), 25 deletions(-)

--- NEW FILE libdrm-nouveau-immd-alloc.patch ---
>From f1660c249198b5cc14ebbb75107da7bcb6972033 Mon Sep 17 00:00:00 2001
From: Ben Skeggs <bskeggs at redhat.com>
Date: Thu, 17 Dec 2009 13:07:18 +1000
Subject: [PATCH] nouveau: remove delayed kernel bo creation

Signed-off-by: Ben Skeggs <bskeggs at redhat.com>
---
 libdrm/nouveau/nouveau_bo.c |   41 +++++++++++++++++------------------------
 1 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/libdrm/nouveau/nouveau_bo.c b/libdrm/nouveau/nouveau_bo.c
index ae11b68..10cc8a6 100644
--- a/libdrm/nouveau/nouveau_bo.c
+++ b/libdrm/nouveau/nouveau_bo.c
@@ -59,7 +59,7 @@ nouveau_bo_info(struct nouveau_bo_priv *nvbo, struct drm_nouveau_gem_info *arg)
 static int
 nouveau_bo_allocated(struct nouveau_bo_priv *nvbo)
 {
-	if (nvbo->sysmem || nvbo->handle || (nvbo->flags & NOUVEAU_BO_PIN))
+	if (nvbo->sysmem || nvbo->handle)
 		return 1;
 	return 0;
 }
@@ -116,7 +116,7 @@ nouveau_bo_kalloc(struct nouveau_bo_priv *nvbo, struct nouveau_channel *chan)
 	struct drm_nouveau_gem_info *info = &req.info;
 	int ret;
 
-	if (nvbo->handle || (nvbo->flags & NOUVEAU_BO_PIN))
+	if (nvbo->handle)
 		return 0;
 
 	req.channel_hint = chan ? chan->id : 0;
@@ -191,20 +191,24 @@ nouveau_bo_new_tile(struct nouveau_device *dev, uint32_t flags, int align,
 	nvbo->base.tile_flags = tile_flags;
 
 	nvbo->refcount = 1;
-	/* Don't set NOUVEAU_BO_PIN here, or nouveau_bo_allocated() will
-	 * decided the buffer's already allocated when it's not.  The
-	 * call to nouveau_bo_pin() later will set this flag.
-	 */
-	nvbo->flags = (flags & ~NOUVEAU_BO_PIN);
+	nvbo->flags = flags;
 	nvbo->size = size;
 	nvbo->align = align;
 
-	if (flags & NOUVEAU_BO_PIN) {
-		ret = nouveau_bo_pin((void *)nvbo, nvbo->flags);
+	if (flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)) {
+		ret = nouveau_bo_kalloc(nvbo, NULL);
 		if (ret) {
 			nouveau_bo_ref(NULL, (void *)nvbo);
 			return ret;
 		}
+
+		if (flags & NOUVEAU_BO_PIN) {
+			ret = nouveau_bo_pin((void *)nvbo, nvbo->flags);
+			if (ret) {
+				nouveau_bo_ref(NULL, (void *)nvbo);
+				return ret;
+			}
+		}
 	}
 
 	*bo = &nvbo->base;
@@ -489,25 +493,15 @@ nouveau_bo_pin(struct nouveau_bo *bo, uint32_t flags)
 	if (nvbo->pinned)
 		return 0;
 
-	/* Ensure we have a kernel object... */
-	if (!nvbo->flags) {
-		if (!(flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)))
-			return -EINVAL;
-		nvbo->flags = flags;
-	}
-
-	if (!nvbo->handle) {
-		ret = nouveau_bo_kalloc(nvbo, NULL);
-		if (ret)
-			return ret;
-	}
+	if (!nvbo->handle)
+		return -EINVAL;
 
 	/* Now force it to stay put :) */
 	req.handle = nvbo->handle;
 	req.domain = 0;
-	if (nvbo->flags & NOUVEAU_BO_VRAM)
+	if (flags & NOUVEAU_BO_VRAM)
 		req.domain |= NOUVEAU_GEM_DOMAIN_VRAM;
-	if (nvbo->flags & NOUVEAU_BO_GART)
+	if (flags & NOUVEAU_BO_GART)
 		req.domain |= NOUVEAU_GEM_DOMAIN_GART;
 
 	ret = drmCommandWriteRead(nvdev->fd, DRM_NOUVEAU_GEM_PIN, &req,
@@ -517,7 +511,6 @@ nouveau_bo_pin(struct nouveau_bo *bo, uint32_t flags)
 	nvbo->offset = req.offset;
 	nvbo->domain = req.domain;
 	nvbo->pinned = 1;
-	nvbo->flags |= NOUVEAU_BO_PIN;
 
 	/* Fill in public nouveau_bo members */
 	if (nvbo->domain & NOUVEAU_GEM_DOMAIN_VRAM)
-- 
1.6.5.2



Index: libdrm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libdrm/F-12/libdrm.spec,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -p -r1.95 -r1.96
--- libdrm.spec	9 Dec 2009 04:39:21 -0000	1.95
+++ libdrm.spec	21 Dec 2009 06:02:14 -0000	1.96
@@ -3,7 +3,7 @@
 Summary: Direct Rendering Manager runtime library
 Name: libdrm
 Version: 2.4.15
-Release: 7%{?dist}
+Release: 8%{?dist}
 License: MIT
 Group: System Environment/Libraries
 URL: http://dri.sourceforge.net
@@ -44,6 +44,9 @@ Patch10: libdrm-radeon-add-referenced-by
 Patch11: libdrm-add-drm-gdnff.patch
 Patch12: libdrm-radeon-eagain.patch
 
+# nouveau: fix bo allocation issues
+Patch13: libdrm-nouveau-immd-alloc.patch
+
 %description
 Direct Rendering Manager runtime library
 
@@ -70,6 +73,7 @@ Direct Rendering Manager development pac
 %patch10 -p1 -b .radeon-ref-by-cs
 %patch11 -p1 -b .drmapi
 %patch12 -p1 -b .rad-eagain
+%patch13 -p1 -b .nouveau-alloc
 
 %build
 autoreconf -v --install || exit 1
@@ -129,6 +133,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/pkgconfig/libdrm_nouveau.pc
 
 %changelog
+* Mon Dec 21 2009 Ben Skeggs <bskeggs at redhat.com> 2.4.15-8
+- nouveau: fix bo allocation issues (rh#530169)
+
 * Wed Dec 09 2009 Dave Airlie <airlied at redhat.com> 2.4.15-7
 - radeon API from kernel change
 




More information about the scm-commits mailing list