[xorg-x11-drv-nouveau/f18] Enable reverse prime support

Dave Airlie airlied at fedoraproject.org
Tue Jan 8 03:17:44 UTC 2013


commit 4bbfac9112d2d22f31a975c0c27adcb34e4d5ab1
Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Jan 8 13:17:07 2013 +1000

    Enable reverse prime support

 0001-nouveau-add-reverse-prime-support.patch |  105 ++++++++++++++++++++++++++
 xorg-x11-drv-nouveau.spec                    |    7 ++-
 2 files changed, 111 insertions(+), 1 deletions(-)
---
diff --git a/0001-nouveau-add-reverse-prime-support.patch b/0001-nouveau-add-reverse-prime-support.patch
new file mode 100644
index 0000000..de80b7e
--- /dev/null
+++ b/0001-nouveau-add-reverse-prime-support.patch
@@ -0,0 +1,105 @@
+From de1cb49bec079fb350ef2fe7d47ed7ec20f6b26c Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied at redhat.com>
+Date: Mon, 7 Jan 2013 15:28:53 +1000
+Subject: [PATCH] nouveau: add reverse prime support
+
+This allows the nvidia card to scanout Intel cards rendering.
+
+Signed-off-by: Dave Airlie <airlied at redhat.com>
+---
+ src/drmmode_display.c | 35 ++++++++++++++++++++++++++++++++++-
+ src/nv_driver.c       |  4 ++--
+ 2 files changed, 36 insertions(+), 3 deletions(-)
+
+diff --git a/src/drmmode_display.c b/src/drmmode_display.c
+index 429e9cc..39d0151 100644
+--- a/src/drmmode_display.c
++++ b/src/drmmode_display.c
+@@ -42,6 +42,7 @@
+ #include "libudev.h"
+ #endif
+ 
++static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height);
+ typedef struct {
+     int fd;
+     uint32_t fb_id;
+@@ -345,7 +346,9 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
+ 	drmmode_ConvertToKMode(crtc->scrn, &kmode, mode);
+ 
+ 	fb_id = drmmode->fb_id;
+-	if (drmmode_crtc->rotate_fb_id) {
++	if (crtc->randr_crtc->scanout_pixmap)
++		x = y = 0;
++	else if (drmmode_crtc->rotate_fb_id) {
+ 		fb_id = drmmode_crtc->rotate_fb_id;
+ 		x = 0;
+ 		y = 0;
+@@ -536,6 +539,34 @@ drmmode_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
+ 	}
+ }
+ 
++static Bool
++drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
++{
++	ScreenPtr screen = xf86ScrnToScreen(crtc->scrn);
++	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
++	PixmapPtr screenpix = screen->GetScreenPixmap(screen);
++
++	if (!ppix) {
++		if (crtc->randr_crtc->scanout_pixmap)
++			PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap, screenpix);
++		return TRUE;
++	}
++
++	if (ppix->drawable.width > screenpix->drawable.width ||
++	    ppix->drawable.height > screenpix->drawable.height) {
++		Bool ret;
++		ret = drmmode_xf86crtc_resize(crtc->scrn, ppix->drawable.width, ppix->drawable.height);
++		if (ret == FALSE)
++			return FALSE;
++
++		screenpix = screen->GetScreenPixmap(screen);
++		screen->width = screenpix->drawable.width = ppix->drawable.width;
++		screen->height = screenpix->drawable.height = ppix->drawable.height;
++	}
++	PixmapStartDirtyTracking(ppix, screenpix, 0, 0);
++	return TRUE;
++}
++
+ static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
+ 	.dpms = drmmode_crtc_dpms,
+ 	.set_mode_major = drmmode_set_mode_major,
+@@ -547,6 +578,8 @@ static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
+ 	.shadow_allocate = drmmode_crtc_shadow_allocate,
+ 	.shadow_destroy = drmmode_crtc_shadow_destroy,
+ 	.gamma_set = drmmode_gamma_set,
++
++	.set_scanout_pixmap = drmmode_set_scanout_pixmap,
+ };
+ 
+ 
+diff --git a/src/nv_driver.c b/src/nv_driver.c
+index f14c847..9f62fe2 100644
+--- a/src/nv_driver.c
++++ b/src/nv_driver.c
+@@ -452,7 +452,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
+ {
+ 	RegionRec pixregion;
+ 
+-	PixmapRegionInit(&pixregion, dirty->slave_dst->master_pixmap);
++	PixmapRegionInit(&pixregion, dirty->slave_dst);
+ 
+ 	DamageRegionAppend(&dirty->slave_dst->drawable, &pixregion);
+ 	PixmapSyncDirtyHelper(dirty, &pixregion);
+@@ -676,7 +676,7 @@ nouveau_setup_capabilities(ScrnInfoPtr pScrn)
+ 		if (value & DRM_PRIME_CAP_EXPORT)
+ 			pScrn->capabilities |= RR_Capability_SourceOutput;
+ 		if (value & DRM_PRIME_CAP_IMPORT)
+-			pScrn->capabilities |= RR_Capability_SourceOffload;
++			pScrn->capabilities |= RR_Capability_SourceOffload | RR_Capability_SinkOutput;
+ 	}
+ #endif
+ }
+-- 
+1.8.1
+
diff --git a/xorg-x11-drv-nouveau.spec b/xorg-x11-drv-nouveau.spec
index 7ed4d04..8731e1d 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.6
-Release:   1%{?dist}
+Release:   2%{?dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X Hardware Support
@@ -21,6 +21,7 @@ Source0: http://xorg.freedesktop.org/archive/individual/driver/xf86-video-nouvea
 %endif
 Source1: make-git-snapshot.sh
 
+Patch0: 0001-nouveau-add-reverse-prime-support.patch
 ExcludeArch: s390 s390x %{?rhel:ppc ppc64}
 
 BuildRequires: libtool automake autoconf
@@ -49,6 +50,7 @@ X.Org X11 nouveau video driver.
 
 %prep
 %setup -q -n xf86-video-nouveau-%{dirsuffix}
+%patch0 -p1 -b .rp
 
 %build
 autoreconf -v --install
@@ -72,6 +74,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man4/nouveau.4*
 
 %changelog
+* Tue Jan 08 2013 Dave Airlie <airlied at redhat.com> 1.0.6-2
+- Enable reverse prime support
+
 * Mon Jan 07 2013 Ben Skeggs <bskeggs at redhat.com> 1.0.6-1
 - nouveau 1.0.6
 


More information about the scm-commits mailing list