[xorg-x11-drv-nouveau/f18] fix dri2 tfp rendering since prime support broke it.
Dave Airlie
airlied at fedoraproject.org
Fri Aug 17 04:57:08 UTC 2012
commit c4acfc900afbf2d9213fee5955c399f508cc97fc
Author: Dave Airlie <airlied at redhat.com>
Date: Fri Aug 17 14:56:05 2012 +1000
fix dri2 tfp rendering since prime support broke it.
nouveau-prime.patch | 97 ++++++++++++++++++++++++++++++++------------
xorg-x11-drv-nouveau.spec | 5 ++-
2 files changed, 74 insertions(+), 28 deletions(-)
---
diff --git a/nouveau-prime.patch b/nouveau-prime.patch
index d50cbe9..22803b7 100644
--- a/nouveau-prime.patch
+++ b/nouveau-prime.patch
@@ -1,23 +1,34 @@
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
-index 62838fa..71f38c9 100644
+index 62838fa..803785d 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
-@@ -1199,6 +1199,8 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
+@@ -1199,6 +1199,10 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp)
for (i = 0; i < drmmode->mode_res->count_connectors; i++)
drmmode_output_init(pScrn, drmmode, i);
++#ifdef NOUVEAU_PIXMAP_SHARING
+ xf86ProviderSetup(pScrn, NULL, "nouveau");
++#endif
+
xf86InitialConfiguration(pScrn, TRUE);
return TRUE;
diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
-index 62333b1..fbcc35c 100644
+index 62333b1..1fbbdaa 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
-@@ -22,33 +22,27 @@ nouveau_dri2_buffer(DRI2BufferPtr buf)
+@@ -21,34 +21,40 @@ nouveau_dri2_buffer(DRI2BufferPtr buf)
+ return (struct nouveau_dri2_buffer *)buf;
}
++static PixmapPtr get_drawable_pixmap(DrawablePtr drawable)
++{
++ if (drawable->type == DRAWABLE_PIXMAP)
++ return (PixmapPtr)drawable;
++ else
++ return (*drawable->pScreen->GetWindowPixmap)((WindowPtr)drawable);
++}
++
DRI2BufferPtr
-nouveau_dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment,
+nouveau_dri2_create_buffer2(ScreenPtr pScreen, DrawablePtr pDraw, unsigned int attachment,
@@ -40,7 +51,10 @@ index 62333b1..fbcc35c 100644
- } else {
- WindowPtr pwin = (WindowPtr)pDraw;
- ppix = pScreen->GetWindowPixmap(pwin);
--
++ ppix = get_drawable_pixmap(pDraw);
++ if (pScreen != ppix->drawable.pScreen)
++ ppix = NULL;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
#if DRI2INFOREC_VERSION >= 6
/* Set initial swap limit on drawable. */
@@ -54,7 +68,7 @@ index 62333b1..fbcc35c 100644
} else {
int bpp;
unsigned int usage_hint = NOUVEAU_CREATE_PIXMAP_TILED;
-@@ -67,31 +61,43 @@ nouveau_dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment,
+@@ -67,31 +73,43 @@ nouveau_dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment,
usage_hint);
}
@@ -111,7 +125,7 @@ index 62333b1..fbcc35c 100644
{
struct nouveau_dri2_buffer *nvbuf;
-@@ -99,38 +105,80 @@ nouveau_dri2_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buf)
+@@ -99,38 +117,82 @@ nouveau_dri2_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buf)
if (!nvbuf)
return;
@@ -156,12 +170,14 @@ index 62333b1..fbcc35c 100644
- pdpix = (PixmapPtr)pDraw;
+ src_draw = pDraw;
+ if (dst->base.attachment == DRI2BufferFrontLeft) {
++#ifdef NOUVEAU_PIXMAP_SHARING
+ if (pDraw->pScreen != pScreen) {
+ dst_draw = DRI2UpdatePrime(pDraw, pDstBuffer);
+ if (!dst_draw)
+ return;
+ }
+ else
++#endif
+ dst_draw = pDraw;
+ }
+
@@ -204,7 +220,7 @@ index 62333b1..fbcc35c 100644
struct nouveau_dri2_vblank_state {
enum {
SWAP,
-@@ -169,7 +217,9 @@ update_front(DrawablePtr draw, DRI2BufferPtr front)
+@@ -169,7 +231,9 @@ update_front(DrawablePtr draw, DRI2BufferPtr front)
return FALSE;
}
@@ -215,7 +231,7 @@ index 62333b1..fbcc35c 100644
front->pitch = pixmap->devKind;
front->cpp = pixmap->drawable.bitsPerPixel / 8;
nvbuf->ppix = pixmap;
-@@ -689,6 +739,17 @@ nouveau_dri2_init(ScreenPtr pScreen)
+@@ -689,6 +753,17 @@ nouveau_dri2_init(ScreenPtr pScreen)
dri2.SwapLimitValidate = nouveau_dri2_swap_limit_validate;
#endif
@@ -234,13 +250,14 @@ index 62333b1..fbcc35c 100644
}
diff --git a/src/nouveau_exa.c b/src/nouveau_exa.c
-index 9b6b1f3..29bf003 100644
+index 9b6b1f3..13d7e1f 100644
--- a/src/nouveau_exa.c
+++ b/src/nouveau_exa.c
-@@ -154,6 +154,45 @@ nouveau_exa_destroy_pixmap(ScreenPtr pScreen, void *priv)
+@@ -154,6 +154,47 @@ nouveau_exa_destroy_pixmap(ScreenPtr pScreen, void *priv)
free(nvpix);
}
++#ifdef NOUVEAU_PIXMAP_SHARING
+static Bool
+nouveau_exa_share_pixmap_backing(PixmapPtr ppix, ScreenPtr slave, void **handle_p)
+{
@@ -279,16 +296,19 @@ index 9b6b1f3..29bf003 100644
+ close(ihandle);
+ return TRUE;
+}
++#endif
+
bool
nv50_style_tiled_pixmap(PixmapPtr ppix)
{
-@@ -381,6 +420,8 @@ nouveau_exa_init(ScreenPtr pScreen)
+@@ -381,6 +422,10 @@ nouveau_exa_init(ScreenPtr pScreen)
exa->CreatePixmap2 = nouveau_exa_create_pixmap;
exa->DestroyPixmap = nouveau_exa_destroy_pixmap;
++#ifdef NOUVEAU_PIXMAP_SHARING
+ exa->SharePixmapBacking = nouveau_exa_share_pixmap_backing;
+ exa->SetSharedPixmapBacking = nouveau_exa_set_shared_pixmap_backing;
++#endif
if (pNv->Architecture >= NV_ARCH_50) {
exa->maxX = 8192;
@@ -310,7 +330,7 @@ index 2a25e74..d6f38eb 100644
if (!nv50_style_tiled_pixmap(ppix)) {
diff --git a/src/nv_driver.c b/src/nv_driver.c
-index e8725f5..e17be19 100644
+index e8725f5..271f641 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -73,6 +73,39 @@ static Bool NVPciProbe ( DriverPtr drv,
@@ -365,10 +385,11 @@ index e8725f5..e17be19 100644
};
struct NvFamily
-@@ -392,6 +428,37 @@ NVFlushCallback(CallbackListPtr *list, pointer user_data, pointer call_data)
+@@ -392,6 +428,39 @@ NVFlushCallback(CallbackListPtr *list, pointer user_data, pointer call_data)
nouveau_pushbuf_kick(pNv->pushbuf, pNv->pushbuf->channel);
}
++#ifdef NOUVEAU_PIXMAP_SHARING
+static void
+redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
+{
@@ -399,26 +420,30 @@ index e8725f5..e17be19 100644
+ }
+ }
+}
++#endif
+
static void
NVBlockHandler (BLOCKHANDLER_ARGS_DECL)
{
-@@ -399,6 +466,8 @@ NVBlockHandler (BLOCKHANDLER_ARGS_DECL)
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- NVPtr pNv = NVPTR(pScrn);
+@@ -403,6 +472,10 @@ NVBlockHandler (BLOCKHANDLER_ARGS_DECL)
+ (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
+ pScreen->BlockHandler = NVBlockHandler;
++#ifdef NOUVEAU_PIXMAP_SHARING
+ nouveau_dirty_update(pScreen);
++#endif
+
- pScreen->BlockHandler = pNv->BlockHandler;
- (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
- pScreen->BlockHandler = NVBlockHandler;
-@@ -570,6 +639,23 @@ NVDRIGetVersion(ScrnInfoPtr pScrn)
+ if (pScrn->vtSema && !pNv->NoAccel)
+ nouveau_pushbuf_kick(pNv->pushbuf, pNv->pushbuf->channel);
+
+@@ -570,6 +643,25 @@ NVDRIGetVersion(ScrnInfoPtr pScrn)
return TRUE;
}
+static void
+nouveau_setup_capabilities(ScrnInfoPtr pScrn)
+{
++#ifdef NOUVEAU_PIXMAP_SHARING
+ NVPtr pNv = NVPTR(pScrn);
+ uint64_t value;
+ int ret;
@@ -431,21 +456,26 @@ index e8725f5..e17be19 100644
+ if (value & DRM_PRIME_CAP_IMPORT)
+ pScrn->capabilities |= RR_Capability_SourceOffload;
+ }
++#endif
+}
+
static Bool
NVPreInitDRM(ScrnInfoPtr pScrn)
{
-@@ -654,7 +740,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
+@@ -654,7 +746,11 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
/* Get the entity, and make sure it is PCI. */
pNv->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
- if (pNv->pEnt->location.type != BUS_PCI)
-+ if (pNv->pEnt->location.type != BUS_PCI && pNv->pEnt->location.type != BUS_PLATFORM)
++ if (pNv->pEnt->location.type != BUS_PCI
++#ifdef XSERVER_PLATFORM_BUS
++ && pNv->pEnt->location.type != BUS_PLATFORM
++#endif
++ )
return FALSE;
if (xf86IsEntityShared(pScrn->entityList[0])) {
-@@ -674,6 +760,8 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
+@@ -674,6 +770,8 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
NVPreInitFail("\n");
dev = pNv->dev;
@@ -454,12 +484,14 @@ index e8725f5..e17be19 100644
pScrn->chipset = malloc(sizeof(char) * 25);
sprintf(pScrn->chipset, "NVIDIA NV%02x", dev->chipset);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Chipset: \"%s\"\n", pScrn->chipset);
-@@ -1238,6 +1326,9 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
+@@ -1238,6 +1336,11 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
pNv->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = NVCreateScreenResources;
++#ifdef NOUVEAU_PIXMAP_SHARING
+ pScreen->StartPixmapTracking = PixmapStartDirtyTracking;
+ pScreen->StopPixmapTracking = PixmapStopDirtyTracking;
++#endif
+
if (!xf86CrtcScreenInit(pScreen))
return FALSE;
@@ -480,10 +512,21 @@ index 1e382b2..3984227 100644
#include "mipointer.h"
diff --git a/src/nv_type.h b/src/nv_type.h
-index 930b7ee..b6007e5 100644
+index 930b7ee..5a99dbd 100644
--- a/src/nv_type.h
+++ b/src/nv_type.h
-@@ -165,6 +165,7 @@ struct nouveau_pixmap {
+@@ -15,6 +15,10 @@
+ #error "This driver requires a DRI-enabled X server"
+ #endif
+
++#if XF86_CRTC_VERSION >= 5
++#define NOUVEAU_PIXMAP_SHARING 1
++#endif
++
+ #define NV_ARCH_03 0x03
+ #define NV_ARCH_04 0x04
+ #define NV_ARCH_10 0x10
+@@ -165,6 +169,7 @@ struct nouveau_pixmap {
struct nouveau_bo *bo;
void *linear;
unsigned size;
diff --git a/xorg-x11-drv-nouveau.spec b/xorg-x11-drv-nouveau.spec
index d1c4393..48e2ca5 100644
--- a/xorg-x11-drv-nouveau.spec
+++ b/xorg-x11-drv-nouveau.spec
@@ -8,7 +8,7 @@ Name: xorg-x11-drv-nouveau
# need to set an epoch to get version number in sync with upstream
Epoch: 1
Version: 1.0.1
-Release: 5%{?dist}
+Release: 6%{?dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X Hardware Support
@@ -75,6 +75,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man4/nouveau.4*
%changelog
+* Fri Aug 17 2012 Dave Airlie <airlied at redhat.com> 1.0.1-6
+- fix dri2 tfp rendering since prime support broke it.
+
* Thu Aug 16 2012 Dave Airlie <airlied at redhat.com> 1.0.1-5
- upstream snapshot + prime support
More information about the scm-commits
mailing list