aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/modes
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-10 14:56:29 +0200
committermarha <marha@users.sourceforge.net>2012-07-10 14:56:29 +0200
commitd137057fd13e83ec15ab416c7fe774741da06047 (patch)
treef4b38caa4f3ecb983f00e84f4f4d8d66699ecbc5 /xorg-server/hw/xfree86/modes
parentc29d91cfd8df084f16d0d2dfa82c3a86f7719a73 (diff)
downloadvcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.tar.gz
vcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.tar.bz2
vcxsrv-d137057fd13e83ec15ab416c7fe774741da06047.zip
fontconfig mesa xserver git update 10 Jul 2012
Diffstat (limited to 'xorg-server/hw/xfree86/modes')
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c54
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.h48
-rw-r--r--xorg-server/hw/xfree86/modes/xf86DiDGA.c2
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.c122
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Rotate.c6
5 files changed, 230 insertions, 2 deletions
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index 2c8878fa7..d20152ce6 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -734,10 +734,27 @@ xf86CrtcCloseScreen(ScreenPtr screen)
for (c = 0; c < config->num_crtc; c++) {
xf86CrtcPtr crtc = config->crtc[c];
+ if (crtc->randr_crtc->scanout_pixmap)
+ RRCrtcDetachScanoutPixmap(crtc->randr_crtc);
+
crtc->randr_crtc = NULL;
}
+ /* detach any providers */
+ if (config->randr_provider) {
+ if (config->randr_provider->offload_sink) {
+ DetachOffloadGPU(screen);
+ config->randr_provider->offload_sink = NULL;
+ }
+ else if (config->randr_provider->output_source) {
+ DetachOutputGPU(screen);
+ config->randr_provider->output_source = NULL;
+ }
+ else if (screen->current_master)
+ DetachUnboundGPU(screen);
+ }
xf86RandR12CloseScreen(screen);
+ free(config->name);
return screen->CloseScreen(screen);
}
@@ -3202,3 +3219,40 @@ xf86_crtc_supports_gamma(ScrnInfoPtr pScrn)
return FALSE;
}
+
+void
+xf86ProviderSetup(ScrnInfoPtr scrn,
+ const xf86ProviderFuncsRec *funcs, const char *name)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ assert(!xf86_config->name);
+ assert(name);
+
+ xf86_config->name = strdup(name);
+ xf86_config->provider_funcs = funcs;
+#ifdef RANDR_12_INTERFACE
+ xf86_config->randr_provider = NULL;
+#endif
+}
+
+void
+xf86DetachAllCrtc(ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+
+ if (crtc->randr_crtc)
+ RRCrtcDetachScanoutPixmap(crtc->randr_crtc);
+
+ /* dpms off */
+ (*crtc->funcs->dpms) (crtc, DPMSModeOff);
+ /* force a reset the next time its used */
+ crtc->randr_crtc->mode = NULL;
+ crtc->mode.HDisplay = 0;
+ crtc->x = crtc->y = 0;
+ }
+}
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.h b/xorg-server/hw/xfree86/modes/xf86Crtc.h
index a6a3c2e95..802303f74 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.h
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.h
@@ -218,9 +218,14 @@ typedef struct _xf86CrtcFuncs {
void
(*set_origin) (xf86CrtcPtr crtc, int x, int y);
+ /**
+ */
+ Bool
+ (*set_scanout_pixmap)(xf86CrtcPtr crtc, PixmapPtr pixmap);
+
} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
-#define XF86_CRTC_VERSION 4
+#define XF86_CRTC_VERSION 5
struct _xf86Crtc {
/**
@@ -371,6 +376,10 @@ struct _xf86Crtc {
* Added in ABI version 4
*/
Bool driverIsPerformingTransform;
+
+ /* Added in ABI version 5
+ */
+ PixmapPtr current_scanout;
};
typedef struct _xf86OutputFuncs {
@@ -607,6 +616,29 @@ struct _xf86Output {
INT16 initialBorder[4];
};
+typedef struct _xf86ProviderFuncs {
+ /**
+ * Called to allow the provider a chance to create properties after the
+ * RandR objects have been created.
+ */
+ void
+ (*create_resources) (ScrnInfoPtr scrn);
+
+ /**
+ * Callback when an provider's property has changed.
+ */
+ Bool
+ (*set_property) (ScrnInfoPtr scrn,
+ Atom property, RRPropertyValuePtr value);
+
+ /**
+ * Callback to get an updated property value
+ */
+ Bool
+ (*get_property) (ScrnInfoPtr provider, Atom property);
+
+} xf86ProviderFuncsRec, *xf86ProviderFuncsPtr;
+
typedef struct _xf86CrtcConfigFuncs {
/**
* Requests that the driver resize the screen.
@@ -681,6 +713,13 @@ typedef struct _xf86CrtcConfig {
/* callback when crtc configuration changes */
xf86_crtc_notify_proc_ptr xf86_crtc_notify;
+ char *name;
+ const xf86ProviderFuncsRec *provider_funcs;
+#ifdef RANDR_12_INTERFACE
+ RRProviderPtr randr_provider;
+#else
+ void *randr_provider;
+#endif
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
@@ -975,4 +1014,11 @@ extern _X_EXPORT void
extern _X_EXPORT Bool
xf86_crtc_supports_gamma(ScrnInfoPtr pScrn);
+extern _X_EXPORT void
+xf86ProviderSetup(ScrnInfoPtr scrn,
+ const xf86ProviderFuncsRec * funcs, const char *name);
+
+extern _X_EXPORT void
+xf86DetachAllCrtc(ScrnInfoPtr scrn);
+
#endif /* _XF86CRTC_H_ */
diff --git a/xorg-server/hw/xfree86/modes/xf86DiDGA.c b/xorg-server/hw/xfree86/modes/xf86DiDGA.c
index bb954ac4b..3f1a3309f 100644
--- a/xorg-server/hw/xfree86/modes/xf86DiDGA.c
+++ b/xorg-server/hw/xfree86/modes/xf86DiDGA.c
@@ -178,7 +178,7 @@ _xf86_di_dga_reinit_internal(ScreenPtr pScreen)
ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
- if (!DGAAvailable(pScreen->myNum))
+ if (!DGAScreenAvailable(pScreen))
return TRUE;
if (!xf86_dga_get_modes(pScreen))
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c
index 59b6f8217..b4ed46aeb 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.c
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c
@@ -1157,6 +1157,9 @@ xf86RandR12CrtcSet(ScreenPtr pScreen,
if (rotation != crtc->rotation)
changed = TRUE;
+ if (crtc->current_scanout != randr_crtc->scanout_pixmap)
+ changed = TRUE;
+
transform = RRCrtcGetTransform(randr_crtc);
if ((transform != NULL) != crtc->transformPresent)
changed = TRUE;
@@ -1218,6 +1221,7 @@ xf86RandR12CrtcSet(ScreenPtr pScreen,
*/
crtc->desiredMode = mode;
crtc->desiredRotation = rotation;
+ crtc->current_scanout = randr_crtc->scanout_pixmap;
if (transform) {
crtc->desiredTransform = *transform;
crtc->desiredTransformPresent = TRUE;
@@ -1552,6 +1556,14 @@ xf86RandR12CreateObjects12(ScreenPtr pScreen)
output->funcs->create_resources(output);
RRPostPendingProperties(output->randr_output);
}
+
+ if (config->name) {
+ config->randr_provider = RRProviderCreate(pScreen, config->name,
+ strlen(config->name));
+
+ RRProviderSetCapabilities(config->randr_provider, pScrn->capabilities);
+ }
+
return TRUE;
}
@@ -1746,6 +1758,108 @@ xf86RandR12EnterVT(ScrnInfoPtr pScrn)
}
static Bool
+xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen,
+ RRProviderPtr provider,
+ RRProviderPtr source_provider)
+{
+
+
+ if (!source_provider) {
+ if (provider->output_source) {
+ ScreenPtr cmScreen = pScreen->current_master;
+
+ DetachOutputGPU(pScreen);
+ AttachUnboundGPU(cmScreen, pScreen);
+ }
+ provider->output_source = NULL;
+ return TRUE;
+ }
+
+ if (provider->output_source == source_provider)
+ return TRUE;
+
+ SetRootClip(source_provider->pScreen, FALSE);
+
+ DetachUnboundGPU(pScreen);
+ AttachOutputGPU(source_provider->pScreen, pScreen);
+
+ provider->output_source = source_provider;
+ SetRootClip(source_provider->pScreen, TRUE);
+ return TRUE;
+}
+
+static Bool
+xf86RandR14ProviderSetOffloadSink(ScreenPtr pScreen,
+ RRProviderPtr provider,
+ RRProviderPtr sink_provider)
+{
+ if (!sink_provider) {
+ if (provider->offload_sink) {
+ ScreenPtr cmScreen = pScreen->current_master;
+ DetachOutputGPU(pScreen);
+ AttachUnboundGPU(cmScreen, pScreen);
+ }
+
+ provider->offload_sink = NULL;
+ return TRUE;
+ }
+
+ if (provider->offload_sink == sink_provider)
+ return TRUE;
+
+ DetachUnboundGPU(pScreen);
+ AttachOffloadGPU(sink_provider->pScreen, pScreen);
+
+ provider->offload_sink = sink_provider;
+ return TRUE;
+}
+
+static Bool
+xf86RandR14ProviderSetProperty(ScreenPtr pScreen,
+ RRProviderPtr randr_provider,
+ Atom property, RRPropertyValuePtr value)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+
+ /* If we don't have any property handler, then we don't care what the
+ * user is setting properties to.
+ */
+ if (config->provider_funcs->set_property == NULL)
+ return TRUE;
+
+ /*
+ * This function gets called even when vtSema is FALSE, as
+ * drivers will need to remember the correct value to apply
+ * when the VT switch occurs
+ */
+ return config->provider_funcs->set_property(pScrn, property, value);
+}
+
+static Bool
+xf86RandR14ProviderGetProperty(ScreenPtr pScreen,
+ RRProviderPtr randr_provider, Atom property)
+{
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+
+ if (config->provider_funcs->get_property == NULL)
+ return TRUE;
+
+ /* Should be safe even w/o vtSema */
+ return config->provider_funcs->get_property(pScrn, property);
+}
+
+static Bool
+xf86CrtcSetScanoutPixmap(RRCrtcPtr randr_crtc, PixmapPtr pixmap)
+{
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ if (!crtc->funcs->set_scanout_pixmap)
+ return FALSE;
+ return crtc->funcs->set_scanout_pixmap(crtc, pixmap);
+}
+
+static Bool
xf86RandR12Init12(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
@@ -1767,6 +1881,14 @@ xf86RandR12Init12(ScreenPtr pScreen)
#endif
rp->rrModeDestroy = xf86RandR12ModeDestroy;
rp->rrSetConfig = NULL;
+
+ rp->rrProviderSetOutputSource = xf86RandR14ProviderSetOutputSource;
+ rp->rrProviderSetOffloadSink = xf86RandR14ProviderSetOffloadSink;
+
+ rp->rrProviderSetProperty = xf86RandR14ProviderSetProperty;
+ rp->rrProviderGetProperty = xf86RandR14ProviderGetProperty;
+ rp->rrCrtcSetScanoutPixmap = xf86CrtcSetScanoutPixmap;
+
pScrn->PointerMoved = xf86RandR12PointerMoved;
pScrn->ChangeGamma = xf86RandR12ChangeGamma;
diff --git a/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c
index 31e03727e..a3937478f 100644
--- a/xorg-server/hw/xfree86/modes/xf86Rotate.c
+++ b/xorg-server/hw/xfree86/modes/xf86Rotate.c
@@ -322,6 +322,12 @@ xf86CrtcFitsScreen(xf86CrtcPtr crtc, struct pict_f_transform *crtc_to_fb)
/* When called before PreInit, the driver is
* presumably doing load detect
*/
+ if (pScrn->is_gpu) {
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
+ if (pScreen->current_master)
+ pScrn = xf86ScreenToScrn(pScreen->current_master);
+ }
+
if (pScrn->virtualX == 0 || pScrn->virtualY == 0)
return TRUE;