diff --git a/libdrm-nouveau-immd-alloc.patch b/libdrm-nouveau-immd-alloc.patch new file mode 100644 index 0000000..1dc5bb2 --- /dev/null +++ b/libdrm-nouveau-immd-alloc.patch @@ -0,0 +1,105 @@ +From f1660c249198b5cc14ebbb75107da7bcb6972033 Mon Sep 17 00:00:00 2001 +From: Ben Skeggs +Date: Thu, 17 Dec 2009 13:07:18 +1000 +Subject: [PATCH] nouveau: remove delayed kernel bo creation + +Signed-off-by: Ben Skeggs +--- + 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 + diff --git a/libdrm.spec b/libdrm.spec index 4ddcd99..32baeb0 100644 --- a/libdrm.spec +++ b/libdrm.spec @@ -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-cs.patch 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 package %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 2.4.15-8 +- nouveau: fix bo allocation issues (rh#530169) + * Wed Dec 09 2009 Dave Airlie 2.4.15-7 - radeon API from kernel change