From e8ee4282880331bf9b417d918ab082205077c63c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 3 May 2012 13:35:41 +0100 Subject: nouveau: do better at shared pixmap --- src/nv50_exa.c | 3 ++- src/nv_accel_common.c | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/nv50_exa.c b/src/nv50_exa.c index 81244d3..30605de 100644 --- a/src/nv50_exa.c +++ b/src/nv50_exa.c @@ -94,10 +94,11 @@ NV50EXAAcquireSurface2D(PixmapPtr ppix, int is_src, uint32_t fmt) { NV50EXA_LOCALS(ppix); struct nouveau_bo *bo = nouveau_pixmap_bo(ppix); + struct nouveau_pixmap *nvpix = nouveau_pixmap(ppix); int mthd = is_src ? NV50_2D_SRC_FORMAT : NV50_2D_DST_FORMAT; uint32_t bo_flags; - bo_flags = NOUVEAU_BO_VRAM; + bo_flags = nvpix->shared ? NOUVEAU_BO_GART : NOUVEAU_BO_VRAM; bo_flags |= is_src ? NOUVEAU_BO_RD : NOUVEAU_BO_WR; if (!nv50_style_tiled_pixmap(ppix)) { diff --git a/src/nv_accel_common.c b/src/nv_accel_common.c index 7d56093..d58a76a 100644 --- a/src/nv_accel_common.c +++ b/src/nv_accel_common.c @@ -35,10 +35,15 @@ nouveau_allocate_surface(ScrnInfoPtr scrn, int width, int height, int bpp, NVPtr pNv = NVPTR(scrn); Bool scanout = (usage_hint & NOUVEAU_CREATE_PIXMAP_SCANOUT); Bool tiled = (usage_hint & NOUVEAU_CREATE_PIXMAP_TILED); + Bool shared = (usage_hint & CREATE_PIXMAP_USAGE_SHARED); union nouveau_bo_config cfg = {}; - int flags = NOUVEAU_BO_MAP | (bpp >= 8 ? NOUVEAU_BO_VRAM : 0); + int flags; int cpp = bpp / 8, ret; + flags = NOUVEAU_BO_MAP; + if (bpp >= 8) + flags |= shared ? NOUVEAU_BO_GART : NOUVEAU_BO_VRAM; + if (pNv->Architecture >= NV_ARCH_50) { if (scanout) { if (pNv->tiled_scanout) { @@ -48,7 +53,7 @@ nouveau_allocate_surface(ScrnInfoPtr scrn, int width, int height, int bpp, *pitch = NOUVEAU_ALIGN(width * cpp, 256); } } else { - if (bpp >= 8) + if (bpp >= 8 && !shared) tiled = TRUE; *pitch = NOUVEAU_ALIGN(width * cpp, 64); } -- cgit v1.2.3