[2/4] pipe-loader: Fallback to kmsro driver when no matching driver name found

Submitted by Rob Herring on Jan. 24, 2019, 10:36 p.m.

Details

Message ID 20190124223602.25478-3-robh@kernel.org
State New
Headers show
Series "Common KMS renderonly support" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Rob Herring Jan. 24, 2019, 10:36 p.m.
If we can't find a driver matching by name, then use the kmsro driver.
This removes the need for needing a driver descriptor for every possible
KMS driver.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 230bafe5e159..c1323ac65906 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -106,11 +106,6 @@  static const struct drm_driver_descriptor driver_descriptors[] = {
         .create_screen = pipe_freedreno_create_screen,
         .configuration = pipe_default_configuration_query,
     },
-    {
-       .driver_name = "pl111",
-        .create_screen = pipe_kmsro_create_screen,
-        .configuration = pipe_default_configuration_query,
-    },
     {
         .driver_name = "virtio_gpu",
         .create_screen = pipe_virgl_create_screen,
@@ -142,6 +137,13 @@  static const struct drm_driver_descriptor driver_descriptors[] = {
         .configuration = pipe_default_configuration_query,
     },
 };
+
+static const struct drm_driver_descriptor default_driver_descriptor = {
+        .driver_name = "kmsro",
+        .create_screen = pipe_kmsro_create_screen,
+        .configuration = pipe_default_configuration_query,
+};
+
 #endif
 
 static const struct drm_driver_descriptor *
@@ -152,6 +154,7 @@  get_driver_descriptor(const char *driver_name, struct util_dl_library **plib)
       if (strcmp(driver_descriptors[i].driver_name, driver_name) == 0)
          return &driver_descriptors[i];
    }
+   return &default_driver_descriptor;
 #else
    *plib = pipe_loader_find_module(driver_name, PIPE_SEARCH_DIR);
    if (!*plib)

Comments

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Rob Herring <robh@kernel.org> writes:

> If we can't find a driver matching by name, then use the kmsro driver.
> This removes the need for needing a driver descriptor for every possible
> KMS driver.
>
> Signed-off-by: Rob Herring <robh@kernel.org>

Oh, very nice.

There's some risk here -- for example, vkms (with prime enabled, which
it doesn't currently) will fail badly at prime sharing buffers with
hardware drivers doing WC mappings of buffers.  But I guess we should be
preventing that at the kernel level when we enable prime, and having
userspace maybe test creating a shared resource when loading kmsro with
a particular backend.
Eric Anholt <eric@anholt.net> writes:

> [ Unknown signature status ]
> Rob Herring <robh@kernel.org> writes:
>
>> If we can't find a driver matching by name, then use the kmsro driver.
>> This removes the need for needing a driver descriptor for every possible
>> KMS driver.
>>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>
> Oh, very nice.
>
> There's some risk here -- for example, vkms (with prime enabled, which
> it doesn't currently) will fail badly at prime sharing buffers with
> hardware drivers doing WC mappings of buffers.  But I guess we should be
> preventing that at the kernel level when we enable prime, and having
> userspace maybe test creating a shared resource when loading kmsro with
> a particular backend.

That is to say,

Reviewed-by: Eric Anholt <eric@anholt.net>

If you've got display-only KMS and a render node, we should make sure
that Mesa glues those two together.
Rob Herring <robh@kernel.org> writes:

> If we can't find a driver matching by name, then use the kmsro driver.
> This removes the need for needing a driver descriptor for every possible
> KMS driver.
>
> Signed-off-by: Rob Herring <robh@kernel.org>

I've pushed patch 1 and 2, and the hx8357d rebase.
Eric Anholt <eric@anholt.net> writes:

> [ Unknown signature status ]
> Rob Herring <robh@kernel.org> writes:
>
>> If we can't find a driver matching by name, then use the kmsro driver.
>> This removes the need for needing a driver descriptor for every possible
>> KMS driver.
>>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>
> I've pushed patch 1 and 2, and the hx8357d rebase.

And a followup for the rest of tinydrm:

https://gitlab.freedesktop.org/mesa/mesa/merge_requests/165