Module: Mesa
Branch: main
Commit: 98fa0c3351f4a87478d6629fdf8524094ce3ef63
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=98fa0c3351f4a87478d6629fdf8524094ce3ef63

Author: Yonggang Luo <[email protected]>
Date:   Thu Jul 28 13:54:55 2022 +0800

gallium: Do not call to pipe_loader_sw_probe_kms when not present

Signed-off-by: Yonggang Luo <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Adam Jackson <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17784>

---

 src/gallium/auxiliary/pipe-loader/pipe_loader.h | 2 ++
 src/gallium/frontends/dri/dri2.c                | 2 ++
 src/gallium/frontends/dri/drisw.c               | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h 
b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index e2522ddf3b5..03aa18d09eb 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -157,6 +157,7 @@ bool
 pipe_loader_vk_probe_dri(struct pipe_loader_device **devs,
                          const struct drisw_loader_funcs *drisw_lf);
 
+#ifdef HAVE_PIPE_LOADER_KMS
 /**
  * Initialize a kms backed sw device given an fd.
  *
@@ -169,6 +170,7 @@ pipe_loader_vk_probe_dri(struct pipe_loader_device **devs,
  */
 bool
 pipe_loader_sw_probe_kms(struct pipe_loader_device **devs, int fd);
+#endif
 
 /**
  * Initialize a null sw device.
diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
index c05316b2ad5..c65ab39ccc3 100644
--- a/src/gallium/frontends/dri/dri2.c
+++ b/src/gallium/frontends/dri/dri2.c
@@ -2528,10 +2528,12 @@ dri_swrast_kms_init_screen(__DRIscreen * sPriv)
 
    sPriv->driverPrivate = (void *)screen;
 
+#ifdef HAVE_PIPE_LOADER_KMS
    if (pipe_loader_sw_probe_kms(&screen->dev, screen->fd)) {
       pscreen = pipe_loader_create_screen(screen->dev);
       dri_init_options(screen);
    }
+#endif
 
    if (!pscreen)
        goto release_pipe;
diff --git a/src/gallium/frontends/dri/drisw.c 
b/src/gallium/frontends/dri/drisw.c
index 3ed69a1fd23..6817a99aea5 100644
--- a/src/gallium/frontends/dri/drisw.c
+++ b/src/gallium/frontends/dri/drisw.c
@@ -538,8 +538,10 @@ drisw_init_screen(__DRIscreen * sPriv)
    }
 
    bool success = false;
+#ifdef HAVE_PIPE_LOADER_KMS
    if (screen->fd != -1)
       success = pipe_loader_sw_probe_kms(&screen->dev, screen->fd);
+#endif
    if (!success)
       success = pipe_loader_sw_probe_dri(&screen->dev, lf);
    if (success) {

Reply via email to