summaryrefslogtreecommitdiff
authorDave Airlie <airlied@redhat.com>2013-01-07 05:28:53 (GMT)
committer Dave Airlie <airlied@redhat.com>2013-02-06 04:32:51 (GMT)
commit1fdd7db94b55c65ea62cc9eaefff620b20e9e4ea (patch) (side-by-side diff)
treeff2a5b3150cd74f9b6fa471c61e6c6c619271bf2
parent58284cf32778d54cde139423450bc33360784503 (diff)
downloadxf86-video-nouveau-1fdd7db94b55c65ea62cc9eaefff620b20e9e4ea.zip
xf86-video-nouveau-1fdd7db94b55c65ea62cc9eaefff620b20e9e4ea.tar.gz
nouveau: add reverse prime support
This allows the nvidia card to scanout Intel cards rendering. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/drmmode_display.c35
-rw-r--r--src/nv_driver.c4
2 files changed, 36 insertions, 3 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 06f7a24..71c9ff9 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
}