egl: Implement getImage/putImage on pbuffer swrast.
authorMathias Fröhlich <mathias.froehlich@web.de>
Fri, 13 Dec 2019 16:09:56 +0000 (17:09 +0100)
committerDaniel Stone <daniels@collabora.com>
Mon, 17 Feb 2020 04:01:37 +0000 (04:01 +0000)
commitc7617d8908a970124321ce731b43d5996c3c5775
treeaa39bb22306678f050838f40fbf5e724fbdb2f8e
parent6fc0890cd9cf53dc41fee070faf4570314fdcbc3
egl: Implement getImage/putImage on pbuffer swrast.

This change adds getImage/putImage callbacks to the swrast pbuffer
loader extension.
This fixes a recent crash with Weston as well as a crashing
test with classic swrast without an official gitlab issue.

v2: Determine bytes per pixel differently and fix non X11 builds.
v3: Plug memory leak and fix crash on out of bounds access.
    (Daniel Stone)
v4: Follow the code structure of the wayland get/put image
    implementation - hopefully being more obvious.
    Handle 64 bits formats.
    Use BufferSize directly.
    (Emil Velikov)
v5: Change pixel size computation.
    (Eric Engestrom)

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2219
Fixes: d6edccee8da "egl: add EGL_platform_device support"
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3711>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3711>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/platform_device.c
src/egl/drivers/dri2/platform_surfaceless.c