summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/target-helpers/drm_helper.h11
-rw-r--r--src/gallium/auxiliary/util/u_screen.c7
-rw-r--r--src/gallium/docs/source/screen.rst2
-rw-r--r--src/gallium/include/pipe/p_defines.h1
-rw-r--r--src/gallium/include/state_tracker/drm_driver.h6
-rw-r--r--src/gallium/state_trackers/dri/dri2.c5
-rw-r--r--src/gallium/targets/d3dadapter9/drm.c4
-rw-r--r--src/gallium/targets/pipe-loader/pipe_i915.c11
-rw-r--r--src/gallium/targets/pipe-loader/pipe_msm.c11
-rw-r--r--src/gallium/targets/pipe-loader/pipe_nouveau.c11
-rw-r--r--src/gallium/targets/pipe-loader/pipe_r300.c11
-rw-r--r--src/gallium/targets/pipe-loader/pipe_r600.c11
-rw-r--r--src/gallium/targets/pipe-loader/pipe_radeonsi.c7
-rw-r--r--src/gallium/targets/pipe-loader/pipe_vmwgfx.c11
14 files changed, 12 insertions, 97 deletions
diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h b/src/gallium/auxiliary/target-helpers/drm_helper.h
index a89c47e4861..101e0e2c22c 100644
--- a/src/gallium/auxiliary/target-helpers/drm_helper.h
+++ b/src/gallium/auxiliary/target-helpers/drm_helper.h
@@ -7,20 +7,9 @@
#include "state_tracker/drm_driver.h"
#include "util/xmlpool.h"
-static const struct drm_conf_ret share_fd_ret = {
- .type = DRM_CONF_BOOL,
- .val.val_bool = true,
-};
-
const struct drm_conf_ret *
pipe_default_configuration_query(enum drm_conf conf)
{
- switch (conf) {
- case DRM_CONF_SHARE_FD:
- return &share_fd_ret;
- default:
- break;
- }
return NULL;
}
diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index 46aae302520..dffd0436cb0 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -355,6 +355,13 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_MAX_FRAMES_IN_FLIGHT:
return 0;
+ case PIPE_CAP_DMABUF:
+#ifdef PIPE_OS_LINUX
+ return 1;
+#else
+ return 0;
+#endif
+
default:
unreachable("bad PIPE_CAP_*");
}
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 60184116312..f2fa7856ad2 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -519,6 +519,8 @@ The integer capabilities:
* ``PIPE_CAP_MAX_FRAMES_IN_FLIGHT``: Maximum number of frames that state
trackers should allow to be in flight before throttling pipe_context
execution. 0 = throttling is disabled.
+* ``PIPE_CAP_DMABUF``: Whether Linux DMABUF handles are supported by
+ resource_from_handle and resource_get_handle.
.. _pipe_capf:
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 1760fc2f101..27118dbe4e8 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -881,6 +881,7 @@ enum pipe_cap
PIPE_CAP_TGSI_SKIP_SHRINK_IO_ARRAYS,
PIPE_CAP_IMAGE_LOAD_FORMATTED,
PIPE_CAP_MAX_FRAMES_IN_FLIGHT,
+ PIPE_CAP_DMABUF,
};
/**
diff --git a/src/gallium/include/state_tracker/drm_driver.h b/src/gallium/include/state_tracker/drm_driver.h
index 8094734b672..3f52f1be885 100644
--- a/src/gallium/include/state_tracker/drm_driver.h
+++ b/src/gallium/include/state_tracker/drm_driver.h
@@ -15,8 +15,6 @@ struct pipe_resource;
* Configuration queries.
*/
enum drm_conf {
- /* Can this driver, running on this kernel, import and export dma-buf fds? */
- DRM_CONF_SHARE_FD, /* DRM_CONF_BOOL. */
/* XML string describing the available config options. */
DRM_CONF_XML_OPTIONS, /* DRM_CONF_POINTER */
DRM_CONF_MAX
@@ -26,8 +24,6 @@ enum drm_conf {
* Type of configuration answer
*/
enum drm_conf_type {
- DRM_CONF_BOOL,
- DRM_CONF_FLOAT,
DRM_CONF_POINTER
};
@@ -37,8 +33,6 @@ enum drm_conf_type {
struct drm_conf_ret {
enum drm_conf_type type;
union {
- bool val_bool;
- float val_float;
void *val_pointer;
} val;
};
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 2a4a6ac6dad..f7672bcae06 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1908,7 +1908,6 @@ dri2_init_screen(__DRIscreen * sPriv)
const __DRIconfig **configs;
struct dri_screen *screen;
struct pipe_screen *pscreen = NULL;
- const struct drm_conf_ret *dmabuf_ret;
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
@@ -1932,13 +1931,11 @@ dri2_init_screen(__DRIscreen * sPriv)
screen->default_throttle_frames =
pscreen->get_param(pscreen, PIPE_CAP_MAX_FRAMES_IN_FLIGHT);
- dmabuf_ret = pipe_loader_configuration(screen->dev, DRM_CONF_SHARE_FD);
-
if (pscreen->resource_create_with_modifiers)
dri2ImageExtension.createImageWithModifiers =
dri2_create_image_with_modifiers;
- if (dmabuf_ret && dmabuf_ret->val.val_bool) {
+ if (pscreen->get_param(pscreen, PIPE_CAP_DMABUF)) {
uint64_t cap;
if (drmGetCap(sPriv->fd, DRM_CAP_PRIME, &cap) == 0 &&
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index 1c8460f7f03..4418ceb93d6 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -205,7 +205,6 @@ drm_create_adapter( int fd,
struct d3dadapter9drm_context *ctx = CALLOC_STRUCT(d3dadapter9drm_context);
HRESULT hr;
bool different_device;
- const struct drm_conf_ret *dmabuf_ret = NULL;
driOptionCache defaultInitOptions;
driOptionCache userInitOptions;
int throttling_value_user = -2;
@@ -235,8 +234,7 @@ drm_create_adapter( int fd,
return D3DERR_DRIVERINTERNALERROR;
}
- dmabuf_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_SHARE_FD);
- if (!dmabuf_ret || !dmabuf_ret->val.val_bool) {
+ if (!ctx->base.hal->get_param(ctx->base.hal, PIPE_CAP_DMABUF)) {
ERR("The driver is not capable of dma-buf sharing."
"Abandon to load nine state tracker\n");
drm_destroy(&ctx->base);
diff --git a/src/gallium/targets/pipe-loader/pipe_i915.c b/src/gallium/targets/pipe-loader/pipe_i915.c
index 841990e0e23..61429858445 100644
--- a/src/gallium/targets/pipe-loader/pipe_i915.c
+++ b/src/gallium/targets/pipe-loader/pipe_i915.c
@@ -23,19 +23,8 @@ create_screen(int fd, const struct pipe_screen_config *config)
return screen;
}
-static const struct drm_conf_ret share_fd_ret = {
- .type = DRM_CONF_BOOL,
- .val.val_bool = 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;
}
diff --git a/src/gallium/targets/pipe-loader/pipe_msm.c b/src/gallium/targets/pipe-loader/pipe_msm.c
index eb38be586ac..004db95e78a 100644
--- a/src/gallium/targets/pipe-loader/pipe_msm.c
+++ b/src/gallium/targets/pipe-loader/pipe_msm.c
@@ -17,19 +17,8 @@ create_screen(int fd, const struct pipe_screen_config *config)
return screen;
}
-static const struct drm_conf_ret share_fd_ret = {
- .type = DRM_CONF_BOOL,
- .val.val_bool = 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;
}
diff --git a/src/gallium/targets/pipe-loader/pipe_nouveau.c b/src/gallium/targets/pipe-loader/pipe_nouveau.c
index ead5a182738..9adba1c85c0 100644
--- a/src/gallium/targets/pipe-loader/pipe_nouveau.c
+++ b/src/gallium/targets/pipe-loader/pipe_nouveau.c
@@ -17,19 +17,8 @@ create_screen(int fd, const struct pipe_screen_config *config)
return screen;
}
-static const struct drm_conf_ret share_fd_ret = {
- .type = DRM_CONF_BOOL,
- .val.val_bool = 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;
}
diff --git a/src/gallium/targets/pipe-loader/pipe_r300.c b/src/gallium/targets/pipe-loader/pipe_r300.c
index 2a03580223d..1c42f4e36ad 100644
--- a/src/gallium/targets/pipe-loader/pipe_r300.c
+++ b/src/gallium/targets/pipe-loader/pipe_r300.c
@@ -13,19 +13,8 @@ create_screen(int fd, const struct pipe_screen_config *config)
return sws ? debug_screen_wrap(sws->screen) : NULL;
}
-static const struct drm_conf_ret share_fd_ret = {
- .type = DRM_CONF_BOOL,
- .val.val_bool = 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;
}
diff --git a/src/gallium/targets/pipe-loader/pipe_r600.c b/src/gallium/targets/pipe-loader/pipe_r600.c
index a35e0a6179f..f5f1c446e2d 100644
--- a/src/gallium/targets/pipe-loader/pipe_r600.c
+++ b/src/gallium/targets/pipe-loader/pipe_r600.c
@@ -13,19 +13,8 @@ create_screen(int fd, const struct pipe_screen_config *config)
return rw ? debug_screen_wrap(rw->screen) : NULL;
}
-static const struct drm_conf_ret share_fd_ret = {
- .type = DRM_CONF_BOOL,
- .val.val_bool = 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;
}
diff --git a/src/gallium/targets/pipe-loader/pipe_radeonsi.c b/src/gallium/targets/pipe-loader/pipe_radeonsi.c
index 947c9e1990e..09c06b380d6 100644
--- a/src/gallium/targets/pipe-loader/pipe_radeonsi.c
+++ b/src/gallium/targets/pipe-loader/pipe_radeonsi.c
@@ -20,11 +20,6 @@ create_screen(int fd, const struct pipe_screen_config *config)
return rw ? debug_screen_wrap(rw->screen) : NULL;
}
-static const struct drm_conf_ret share_fd_ret = {
- .type = DRM_CONF_BOOL,
- .val.val_bool = true,
-};
-
static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
{
static const struct drm_conf_ret xml_options_ret = {
@@ -34,8 +29,6 @@ static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
};
switch (conf) {
- case DRM_CONF_SHARE_FD:
- return &share_fd_ret;
case DRM_CONF_XML_OPTIONS:
return &xml_options_ret;
default:
diff --git a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
index 3b8c748594c..c4484e03344 100644
--- a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
+++ b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
@@ -23,19 +23,8 @@ create_screen(int fd, const struct pipe_screen_config *config)
return screen;
}
-static const struct drm_conf_ret share_fd_ret = {
- .type = DRM_CONF_BOOL,
- .val.val_bool = 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;
}