[PATCH] Revert "drm/virtio: drop prime import/export callbacks"

Gerd Hoffmann kraxel at redhat.com
Tue Apr 23 08:01:44 UTC 2019


On Fri, Apr 19, 2019 at 05:57:09PM +0200, Marc-André Lureau wrote:
> This patch does more harm than good, as it breaks both Xwayland and
> gnome-shell with X11.
> 
> Xwayland requires DRI3 & DRI3 requires PRIME.
> 
> X11 crash for obscure double-free reason which are hard to debug
> (starting X11 by hand doesn't trigger the crash).
> 
> I don't see an apparent problem implementing those stub prime
> functions, they may return an error at run-time, and it seems to be
> handled fine by GNOME at least.

Well, problem is they are *not* handled fine, this is why the patch is
there in the first place.

Problem case: gnome-shell (in wayland display server mode) fails to come
up with a working desktop in case both a intel vgpu and an emulated
display device are present in the system.  Looks like wayland tries to
render using the intel vgpu, then import the rendered buffers to the
emulated display device (qxl or virtio-gpu), and it does not handle the
failure.

I've tried to add a DRM_PRIME_CAP_LOCAL flag for self-import support:
https://patchwork.freedesktop.org/patch/297672/

But looks like Daniel Vetter (Cc'ed) thinks userspace is to blame here
for not handling the import failure properly.

> +struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj)
> +{
> +	WARN_ONCE(1, "not implemented");
> +	return ERR_PTR(-ENODEV);
> +}

That is actually implemented meanwhile (branch drm-misc-next, will land
in 5.2, commit "98f41dc3b3ee drm/virtio: implement prime export".

> +struct drm_gem_object *virtgpu_gem_prime_import_sg_table(
> +	struct drm_device *dev, struct dma_buf_attachment *attach,
> +	struct sg_table *table)
> +{
> +	WARN_ONCE(1, "not implemented");

I don't think we should re-add this.  Either drop this completely,
or replace by a less noisy printk_once("can do self-import only").

cheers,
  Gerd



More information about the dri-devel mailing list