[Mesa-dev] [PATCH 2/3] loader: Add an environment variable to override driver name choice.

Eric Anholt eric at anholt.net
Fri Feb 3 20:19:30 UTC 2017


Emil Velikov <emil.l.velikov at gmail.com> writes:

> On 3 February 2017 at 19:13, Eric Anholt <eric at anholt.net> wrote:
>> My vc4 simulator has been implemented so far by having an entrypoint
>> claiming to be i965, which was a bit gross.  The simulator would be a lot
>> less special if we entered through the vc4 entrypoint like normal, so add
>> a loader environment variable to allow the i965 fd to probe as vc4.
>> ---
>>  src/loader/loader.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/src/loader/loader.c b/src/loader/loader.c
>> index 449ff54d1377..4825151ad5e5 100644
>> --- a/src/loader/loader.c
>> +++ b/src/loader/loader.c
>> @@ -345,6 +345,17 @@ loader_get_driver_for_fd(int fd)
>>     int vendor_id, chip_id, i, j;
>>     char *driver = NULL;
>>
>> +   /* Allow an environment variable to force choosing a different driver
>> +    * binary.  If that driver binary can't survive on this FD, that's the
>> +    * user's problem, but this allows vc4 simulator to run on an i965 host,
>> +    * and may be useful for some touch testing of i915 on an i965 host.
>> +    */
>> +   if (geteuid() == getuid()) {
>> +      driver = getenv("MESA_LOADER_DRIVER_OVERRIDE");
> Having the override is quite useful even outside the context of vc4.
>
> With this in place we could drop a few other workarounds like
>
> 64a005e3eef2e12b11b2837dc7253020bb5c0e60
> c3b5afbd4e682f76e16ea85883af571165bd24ee
> and perhaps even
> 91681302d0308a70aece883c3b56a18f9a44041f
>
> We can do that another day, so the series is
> Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

Thanks!  I just remembered that I missed this junk in 3/3:

--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -93,17 +93,6 @@ static const struct drm_driver_descriptor driver_descriptors[] = {
         .create_screen = pipe_i915_create_screen,
         .configuration = configuration_query,
     },
-#ifdef USE_VC4_SIMULATOR
-    /* VC4 simulator and ILO (i965) are mutually exclusive (error at
-     * configure). As the latter is unconditionally added, keep this one above
-     * it.
-     */
-    {
-        .driver_name = "i965",
-        .create_screen = pipe_vc4_create_screen,
-        .configuration = configuration_query,
-    },
-#endif
     {
         .driver_name = "nouveau",
         .create_screen = pipe_nouveau_create_screen,

so it gets even better.  I'll give others a chance to get feedback in,
but I'm glad to hear it might be useful for other drivers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170203/5c6693f0/attachment.sig>


More information about the mesa-dev mailing list