From 8bcd57a46ce9d4a960253fd89ad21bd3e1776f8b Mon Sep 17 00:00:00 2001 From: Andreas Pokorny Date: Fri, 22 Aug 2014 18:41:11 +0200 Subject: 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: mesa-stable@lists.freedesktop.org Signed-off-by: Andreas Pokorny --- src/gallium/state_trackers/dri/dri2.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/gallium/state_trackers/dri/dri2.c') 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 */ -- cgit v1.2.3