summaryrefslogtreecommitdiffstats
path: root/src/gallium/targets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/targets')
-rw-r--r--src/gallium/targets/r300/common/drm_target.c27
-rw-r--r--src/gallium/targets/r600/common/drm_target.c16
-rw-r--r--src/gallium/targets/radeonsi/common/drm_target.c16
3 files changed, 58 insertions, 1 deletions
diff --git a/src/gallium/targets/r300/common/drm_target.c b/src/gallium/targets/r300/common/drm_target.c
index 2c10bbd7bb1..9b484469d47 100644
--- a/src/gallium/targets/r300/common/drm_target.c
+++ b/src/gallium/targets/r300/common/drm_target.c
@@ -51,4 +51,29 @@ create_screen(int fd)
return sws->screen;
}
-DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen, NULL)
+/* Technically this is only true for kernels >= 3.12, which
+ * support lseek on dma-buf fds.
+ *
+ * We could check for this in create_screen and return the correct
+ * value, but for now just return true in all cases.
+ *
+ * createImageFromFds fails gracefully on kernel < 3.12, so this
+ * shouldn't be a huge problem.
+ */
+static const struct drm_conf_ret share_fd_ret = {
+ .type = DRM_CONF_BOOL,
+ .val.val_int = true,
+};
+
+static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
+{
+ switch (conf) {
+ case DRM_CONF_SHARE_FD:
+ return &share_fd_ret;
+ default:
+ break;
+ }
+ return NULL;
+}
+
+DRM_DRIVER_DESCRIPTOR("r300", "radeon", create_screen, drm_configuration)
diff --git a/src/gallium/targets/r600/common/drm_target.c b/src/gallium/targets/r600/common/drm_target.c
index 28004ac58e2..ab1eec6ac9a 100644
--- a/src/gallium/targets/r600/common/drm_target.c
+++ b/src/gallium/targets/r600/common/drm_target.c
@@ -55,11 +55,27 @@ static const struct drm_conf_ret throttle_ret = {
.val.val_int = 2,
};
+/* Technically this is only true for kernels >= 3.12, which
+ * support lseek on dma-buf fds.
+ *
+ * We could check for this in create_screen and return the correct
+ * value, but for now just return true in all cases.
+ *
+ * createImageFromFds fails gracefully on kernel < 3.12, so this
+ * shouldn't be a huge problem.
+ */
+static const struct drm_conf_ret share_fd_ret = {
+ .type = DRM_CONF_BOOL,
+ .val.val_int = true,
+};
+
static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
{
switch (conf) {
case DRM_CONF_THROTTLE:
return &throttle_ret;
+ case DRM_CONF_SHARE_FD:
+ return &share_fd_ret;
default:
break;
}
diff --git a/src/gallium/targets/radeonsi/common/drm_target.c b/src/gallium/targets/radeonsi/common/drm_target.c
index 9eef368529f..08ff47dfb68 100644
--- a/src/gallium/targets/radeonsi/common/drm_target.c
+++ b/src/gallium/targets/radeonsi/common/drm_target.c
@@ -55,11 +55,27 @@ static const struct drm_conf_ret throttle_ret = {
.val.val_int = 2,
};
+/* Technically this is only true for kernels >= 3.12, which
+ * support lseek on dma-buf fds.
+ *
+ * We could check for this in create_screen and return the correct
+ * value, but for now just return true in all cases.
+ *
+ * createImageFromFds fails gracefully on kernel < 3.12, so this
+ * shouldn't be a huge problem.
+ */
+static const struct drm_conf_ret share_fd_ret = {
+ .type = DRM_CONF_BOOL,
+ .val.val_int = true,
+};
+
static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
{
switch (conf) {
case DRM_CONF_THROTTLE:
return &throttle_ret;
+ case DRM_CONF_SHARE_FD:
+ return &share_fd_ret;
default:
break;
}