[PATCH 2/3] radeon: add support for reverse prime (v2)
alexdeucher at gmail.com
alexdeucher at gmail.com
Tue Jul 30 16:21:27 PDT 2013
From: Dave Airlie <airlied at redhat.com>
This adds support for reverse prime configurations
v2: fix compilation with older xservers
Signed-off-by: Alex Deucher <alexdeucher at gmail.com>
---
src/drmmode_display.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/radeon_kms.c | 4 ++--
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 76a7333..c593997 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -52,6 +52,9 @@
#define DEFAULT_NOMINAL_FRAME_RATE 60
static Bool
+drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height);
+
+static Bool
RADEONZaphodStringMatches(ScrnInfoPtr pScrn, const char *s, char *output_name)
{
int i = 0;
@@ -522,6 +525,11 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drmmode_ConvertToKMode(crtc->scrn, &kmode, mode);
fb_id = drmmode->fb_id;
+#ifdef RADEON_PIXMAP_SHARING
+ if (crtc->randr_crtc && crtc->randr_crtc->scanout_pixmap)
+ x = y = 0;
+ else
+#endif
if (drmmode_crtc->rotate_fb_id) {
fb_id = drmmode_crtc->rotate_fb_id;
x = y = 0;
@@ -727,6 +735,35 @@ drmmode_crtc_gamma_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
size, red, green, blue);
}
+#ifdef RADEON_PIXMAP_SHARING
+static Bool
+drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
+{
+ ScreenPtr screen = xf86ScrnToScreen(crtc->scrn);
+ 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;
+}
+#endif
+
static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
.dpms = drmmode_crtc_dpms,
.set_mode_major = drmmode_set_mode_major,
@@ -741,6 +778,9 @@ static const xf86CrtcFuncsRec drmmode_crtc_funcs = {
.shadow_allocate = drmmode_crtc_shadow_allocate,
.shadow_destroy = drmmode_crtc_shadow_destroy,
.destroy = NULL, /* XXX */
+#ifdef RADEON_PIXMAP_SHARING
+ .set_scanout_pixmap = drmmode_set_scanout_pixmap,
+#endif
};
int drmmode_get_crtc_id(xf86CrtcPtr crtc)
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index c3f50d5..edc3b04 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -257,7 +257,7 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
RegionRec pixregion;
- PixmapRegionInit(&pixregion, dirty->slave_dst->master_pixmap);
+ PixmapRegionInit(&pixregion, dirty->slave_dst);
DamageRegionAppend(&dirty->slave_dst->drawable, &pixregion);
PixmapSyncDirtyHelper(dirty, &pixregion);
@@ -766,7 +766,7 @@ static void RADEONSetupCapabilities(ScrnInfoPtr pScrn)
if (value & DRM_PRIME_CAP_EXPORT)
pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SinkOffload;
if (value & DRM_PRIME_CAP_IMPORT)
- pScrn->capabilities |= RR_Capability_SourceOffload;
+ pScrn->capabilities |= RR_Capability_SourceOffload | RR_Capability_SinkOutput;
}
#endif
}
--
1.7.7.5
More information about the xorg-driver-ati
mailing list