summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri
diff options
context:
space:
mode:
authorAndreas Pokorny <[email protected]>2014-08-22 18:41:11 +0200
committerEmil Velikov <[email protected]>2014-09-05 14:14:37 +0100
commit8bcd57a46ce9d4a960253fd89ad21bd3e1776f8b (patch)
treefc0eedd41b477cafa4dca3880006f24feeef8128 /src/gallium/state_trackers/dri
parent76b906c9f6ebe1626e9ace5ea8336167aa210876 (diff)
kms-swrast: Support Prime fd handling
Allows using prime fds as display target and from display target. Test for PRIME capability after initializing kms_swrast screen. Cc: [email protected] Signed-off-by: Andreas Pokorny <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/dri')
-rw-r--r--src/gallium/state_trackers/dri/dri2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 1d79dfcd1aa..24c753ab001 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1328,6 +1328,7 @@ dri_kms_init_screen(__DRIscreen * sPriv)
const __DRIconfig **configs;
struct dri_screen *screen;
struct pipe_screen *pscreen = NULL;
+ uint64_t cap;
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
@@ -1339,6 +1340,13 @@ dri_kms_init_screen(__DRIscreen * sPriv)
sPriv->driverPrivate = (void *)screen;
pscreen = kms_swrast_create_screen(screen->fd);
+
+ if (drmGetCap(sPriv->fd, DRM_CAP_PRIME, &cap) == 0 &&
+ (cap & DRM_PRIME_CAP_IMPORT)) {
+ dri2ImageExtension.createImageFromFds = dri2_from_fds;
+ dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
+ }
+
sPriv->extensions = dri_screen_extensions;
/* dri_init_screen_helper checks pscreen for us */