summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-07-19 03:46:44 (GMT)
committerDave Airlie <airlied@redhat.com>2012-09-03 03:12:56 (GMT)
commit239f39977ebb64c9d545c6f3c905de3c0ad840d0 (patch)
tree7ff9a2e64ef7ead3de151e2bf9918aecb15e6674
parent28abba276e36fd0176f416996d44297ddf13f5cd (diff)
nouveau: enable provider/capabilities
this adds the provider object for nouveau and enables the capabilities on it. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/drmmode_display.c4
-rw-r--r--src/nv_driver.c21
2 files changed, 25 insertions, 0 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 62838fa..803785d 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -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/nv_driver.c b/src/nv_driver.c
index a02cef3..271f641 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -643,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;
+
+ pScrn->capabilities = 0;
+ ret = drmGetCap(pNv->dev->fd, DRM_CAP_PRIME, &value);
+ if (ret == 0) {
+ if (value & DRM_PRIME_CAP_EXPORT)
+ pScrn->capabilities |= RR_Capability_SourceOutput;
+ if (value & DRM_PRIME_CAP_IMPORT)
+ pScrn->capabilities |= RR_Capability_SourceOffload;
+ }
+#endif
+}
+
static Bool
NVPreInitDRM(ScrnInfoPtr pScrn)
{
@@ -751,6 +770,8 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
NVPreInitFail("\n");
dev = pNv->dev;
+ nouveau_setup_capabilities(pScrn);
+
pScrn->chipset = malloc(sizeof(char) * 25);
sprintf(pScrn->chipset, "NVIDIA NV%02x", dev->chipset);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Chipset: \"%s\"\n", pScrn->chipset);