[Mesa-dev] [PATCH 10/11] egl/wayland: Remove duplicate wl_buffer creation code

Daniel Stone daniel at fooishbar.org
Fri Jul 7 15:34:44 UTC 2017


Hi,

On 28 June 2017 at 16:35, Lucas Stach <l.stach at pengutronix.de> wrote:
> Am Freitag, den 16.06.2017, 18:14 +0100 schrieb Daniel Stone:
>>     if (dri2_dpy->capabilities & WL_DRM_CAPABILITY_PRIME) {
>> +      struct wl_drm *wl_drm =
>> +         dri2_surf ? dri2_surf->wl_drm_wrapper : dri2_dpy->wl_drm;
>
> This and...
>
>>        int stride, fd;
>>
>>        dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
>>        dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FD, &fd);
>> -      ret = wl_drm_create_prime_buffer(dri2_surf->wl_drm_wrapper,
>> -                                       fd, width, height, fourcc, 0, stride,
>> -                                       0, 0, 0, 0);
>> +      ret = wl_drm_create_prime_buffer(wl_drm, fd, width, height, fourcc, 0,
>> +                                       stride, 0, 0, 0, 0);
>>        close(fd);
>>     } else {
>> +      struct wl_drm *wl_drm =
>> +         dri2_surf ? dri2_surf->wl_drm_wrapper : dri2_dpy->wl_drm;
>
> .. this can be moved out of the if/else path to get rid of even more
> duplication.

Sure. I deliberately left them lowered though, so it couldn't be in
scope in the dmabuf branch. Happy to change it if you feel strongly
about it though.

Cheers,
Daniel


More information about the mesa-dev mailing list