Comment 8 for bug 1560498

Revision history for this message
Thomas Hellström (thellstrom) wrote :

OK, So I tried to debug this on 17.04 with the mir demos.

What happens is that while the Mir server seems to run fine,
when the EGL mir clients import a surface from the mir server (using fds / prime) they
typecast the XRGB surface from the mir server to an ARGB surface, which the svga gallium driver doesn't like that and it returns an error.

That error is never caught in the mir platform EGL layer and when the corresponding "bo" is dereferenced, the mir platform EGL layer instead dereferences NULL, which is the error code...

So I'd say this is a combination of two Mir errors: One illegal typecast and one failure to check
for errors.

As a side note, it would be possible for the svga driver to implement a workaround and not error
in this case, but while real hardware may be more forgiving in this case, the surface that the
mir client thinks is an argb surface will still be an xrgb surface and any operation involving the
alpha channel will yield unexpected results so IMHO this needs to be fixed in the MIR EGL layer:

Offending code: (platform_mir.c)

static struct gbm_bo *create_gbm_bo_from_buffer(struct gbm_device* gbm_dev,
                                                MirBufferPackage *package)
{
   struct gbm_import_fd_data data;

   data.fd = package->fd[0];
   data.width = package->width;
   data.height = package->height;
   data.format = GBM_FORMAT_ARGB8888; /* TODO: Use mir surface format */ <= HERE!
   data.stride = package->stride;

   return gbm_bo_import(gbm_dev, GBM_BO_IMPORT_FD, &data, GBM_BO_USE_RENDERING);
}

/Thomas