After pushing this (with my r-b), gitlab's travis complained.

It seems there needs to be some ifdefs to check if kms was built.

I reverted the patch until it is fixed.

Axel

On 07/03/2019 23:23, Axel Davy wrote:
From: Patrick Rudolph <s...@das-labor.org>

If D3D_ALWAYS_SOFTWARE is set for debugging purposes,
run on any DRI enabled platform.
Instead of probing for a compatible gallium driver (which might
fail if there's none) always use the KMS DRI software renderer.

Allows to run nine on i915 when D3D_ALWAYS_SOFTWARE=1.

Signed-off-by: Patrick Rudolph <s...@das-labor.org>
---
  src/gallium/targets/d3dadapter9/drm.c | 28 +++++++++++++++++++--------
  1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/gallium/targets/d3dadapter9/drm.c 
b/src/gallium/targets/d3dadapter9/drm.c
index 1d01d4a067c..28dbd2ef9db 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -205,6 +205,7 @@ drm_create_adapter( int fd,
      struct d3dadapter9drm_context *ctx = 
CALLOC_STRUCT(d3dadapter9drm_context);
      HRESULT hr;
      bool different_device;
+    bool software_device;
      const struct drm_conf_ret *throttle_ret = NULL;
      const struct drm_conf_ret *dmabuf_ret = NULL;
      driOptionCache defaultInitOptions;
@@ -222,7 +223,11 @@ drm_create_adapter( int fd,
      ctx->fd = fd;
      ctx->base.linear_framebuffer = different_device;
- if (!pipe_loader_drm_probe_fd(&ctx->dev, fd)) {
+    const char *force_sw = getenv("D3D_ALWAYS_SOFTWARE");
+    software_device = force_sw && !strcmp(force_sw, "1");
+
+    if ((software_device && !pipe_loader_sw_probe_kms(&ctx->dev, fd)) ||
+        (!software_device && !pipe_loader_drm_probe_fd(&ctx->dev, fd))) {
          ERR("Failed to probe drm fd %d.\n", fd);
          FREE(ctx);
          close(fd);
@@ -236,13 +241,20 @@ drm_create_adapter( int fd,
          return D3DERR_DRIVERINTERNALERROR;
      }
- dmabuf_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_SHARE_FD);
-    throttle_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_THROTTLE);
-    if (!dmabuf_ret || !dmabuf_ret->val.val_bool) {
-        ERR("The driver is not capable of dma-buf sharing."
-            "Abandon to load nine state tracker\n");
-        drm_destroy(&ctx->base);
-        return D3DERR_DRIVERINTERNALERROR;
+    if (!software_device) {
+        /*
+         * The software renderer isn't a DRM device and doesn't support
+         * pipe_loader_configuration.
+         * The KMS winsys supports SHARE_FD, so skip this check.
+         */
+        dmabuf_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_SHARE_FD);
+        throttle_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_THROTTLE);
+        if (!dmabuf_ret || !dmabuf_ret->val.val_bool) {
+            ERR("The driver is not capable of dma-buf sharing."
+                "Abandon to load nine state tracker\n");
+            drm_destroy(&ctx->base);
+            return D3DERR_DRIVERINTERNALERROR;
+        }
      }
if (throttle_ret && throttle_ret->val.val_int != -1) {


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to