[Mesa-dev] [PATCH v2 09/11] egl/wayland: Remove more surface specifics from create_wl_buffer
Jason Ekstrand
jason at jlekstrand.net
Thu Jul 13 16:12:17 UTC 2017
On July 13, 2017 4:13:50 AM Daniel Stone <daniels at collabora.com> wrote:
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
> src/egl/drivers/dri2/platform_wayland.c | 31 ++++++++++++++-----------------
> 1 file changed, 14 insertions(+), 17 deletions(-)
>
> v2: Don't remove surf->back assignment. Oops.
>
> diff --git a/src/egl/drivers/dri2/platform_wayland.c
> b/src/egl/drivers/dri2/platform_wayland.c
> index e0a43553b8..9513069fd1 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -643,31 +643,28 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
> __DRIimage *image)
> {
> struct wl_buffer *ret;
> - int fd, stride, name;
> + int width, height, fourcc;
> +
> + dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_WIDTH, &width);
> + dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_HEIGHT, &height);
> + dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FOURCC, &fourcc);
>
> if (dri2_dpy->capabilities & WL_DRM_CAPABILITY_PRIME) {
> - dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FD, &fd);
> - dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
> + int stride, fd;
>
> + dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
> + dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FD, &fd);
If you didn't swap the order here the diff would be smaller.
> ret = wl_drm_create_prime_buffer(dri2_surf->wl_drm_wrapper,
> - fd,
> - dri2_surf->base.Width,
> - dri2_surf->base.Height,
> - dri2_surf->format,
> - 0, stride,
> - 0, 0,
> - 0, 0);
> + fd, width, height, fourcc, 0, stride,
> + 0, 0, 0, 0);
> close(fd);
> } else {
> - dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_NAME, &name);
> - dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
> + int stride, name;
>
> + dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
> + dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_NAME, &name);
Same here. Not that I care all that much.
> ret = wl_drm_create_buffer(dri2_surf->wl_drm_wrapper,
> - name,
> - dri2_surf->base.Width,
> - dri2_surf->base.Height,
> - stride,
> - dri2_surf->format);
> + name, width, height, stride, fourcc);
> }
>
> return ret;
> --
> 2.13.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list