[Mesa-dev] [PATCH 5/9] egl/wayland: Implement DRI_PRIME support
Emil Velikov
emil.l.velikov at gmail.com
Fri May 8 09:56:07 PDT 2015
On 2 May 2015 at 11:15, Axel Davy <axel.davy at ens.fr> wrote:
> When the server gpu and requested gpu are different:
> . They likely don't support the same tiling modes
> . They likely do not have fast access to the same locations
>
> Thus we do:
> . render to a tiled buffer we do not share with the server
> . Copy the content at every swap to a buffer with no tiling
> that we share with the server.
>
> This is similar to the glx dri3 DRI_PRIME implementation.
>
> Signed-off-by: Axel Davy <axel.davy at ens.fr>
> ---
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -632,6 +658,8 @@ dri2_wl_swap_buffers_with_damage(_EGLDriver *drv,
> {
> struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
> struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
> + struct dri2_egl_context *dri2_ctx;
> + _EGLContext *ctx;
Nit: Move the variable declarations where they're used. Otherwise
static analysis tools flag lovely message(s).
> @@ -1084,6 +1123,24 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
> if (roundtrip(dri2_dpy) < 0 || !dri2_dpy->authenticated)
> goto cleanup_fd;
>
> + dri2_dpy->fd = loader_get_user_preferred_fd(dri2_dpy->fd,
> + &dri2_dpy->is_different_gpu);
> + if (dri2_dpy->is_different_gpu) {
> + free(dri2_dpy->device_name);
> + dri2_dpy->device_name = loader_get_device_name_for_fd(dri2_dpy->fd);
> + if (!dri2_dpy->device_name) {
> + _eglError(EGL_BAD_ALLOC, "wayland-egl: failed to get device name "
> + "for requested GPU");
> + goto cleanup_fd;
> + }
> + }
> +
Shouldn't we authenticate with the correct gpu or master/render node ?
This implementation will auth with GPU1, and then use GPU2 which seems
a bit odd. I might be missing something ?
> @@ -1127,6 +1184,15 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
> goto cleanup_screen;
> }
>
> + if (dri2_dpy->is_different_gpu &&
> + (dri2_dpy->image->base.version < 9 ||
> + dri2_dpy->image->blitImage == NULL)) {
> + _eglLog(_EGL_WARNING, "wayland-egl: Different GPU, but image extension "
> + "version 9 or later not found, or blitImage not "
> + "implemented for this driver");
Nit: Alternative message:
"Different GPU selected, but the Image extension in the driver is not
compatible. Version 9 or later and blitImage() are required."
Thanks
Emil
More information about the mesa-dev
mailing list