| From 9e39ddf9e3940c705eb584a6b50ab4f2726049ea Mon Sep 17 00:00:00 2001 |
| From: "Kristian H. Kristensen" <hoegsberg@google.com> |
| Date: Mon, 10 Aug 2020 18:44:34 -0700 |
| Subject: [PATCH 06/11] egl/android: Use droid_create_image_from_prime_fds() in |
| get_back_bo() |
| |
| This function wants to create a __DRIimage for an ANativeWindowBuffer, |
| which is mostly the same logic as when we create an EGLImage for an |
| ANativeWindowBuffer. Reuse droid_create_image_from_prime_fds(). |
| |
| Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6055> |
| --- |
| src/egl/drivers/dri2/platform_android.c | 33 ++----------------------- |
| 1 file changed, 2 insertions(+), 31 deletions(-) |
| |
| diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c |
| index b77acb4c273..73955b6299e 100644 |
| --- a/src/egl/drivers/dri2/platform_android.c |
| +++ b/src/egl/drivers/dri2/platform_android.c |
| @@ -735,11 +735,7 @@ get_front_bo(struct dri2_egl_surface *dri2_surf, unsigned int format) |
| static int |
| get_back_bo(struct dri2_egl_surface *dri2_surf) |
| { |
| - struct dri2_egl_display *dri2_dpy = |
| - dri2_egl_display(dri2_surf->base.Resource.Display); |
| - int fourcc, pitch; |
| - int offset = 0, fds[3]; |
| - unsigned num_fds; |
| + _EGLDisplay *disp = dri2_surf->base.Resource.Display; |
| |
| if (dri2_surf->dri_image_back) |
| return 0; |
| @@ -750,33 +746,8 @@ get_back_bo(struct dri2_egl_surface *dri2_surf) |
| return -1; |
| } |
| |
| - num_fds = get_native_buffer_fds(dri2_surf->buffer, fds); |
| - if (num_fds == 0) { |
| - _eglLog(_EGL_WARNING, "Could not get native buffer FD"); |
| - return -1; |
| - } |
| - |
| - fourcc = get_fourcc(dri2_surf->buffer->format); |
| - |
| - pitch = dri2_surf->buffer->stride * |
| - get_format_bpp(dri2_surf->buffer->format); |
| - |
| - if (fourcc == -1 || pitch == 0) { |
| - _eglLog(_EGL_WARNING, "Invalid buffer fourcc(%x) or pitch(%d)", |
| - fourcc, pitch); |
| - return -1; |
| - } |
| - |
| dri2_surf->dri_image_back = |
| - dri2_dpy->image->createImageFromFds(dri2_dpy->dri_screen, |
| - dri2_surf->base.Width, |
| - dri2_surf->base.Height, |
| - fourcc, |
| - fds, |
| - num_fds, |
| - &pitch, |
| - &offset, |
| - dri2_surf); |
| + droid_create_image_from_prime_fds(disp, dri2_surf->buffer); |
| if (!dri2_surf->dri_image_back) { |
| _eglLog(_EGL_WARNING, "failed to create DRI image from FD"); |
| return -1; |
| -- |
| 2.29.2.684.gfbc64c5ab5-goog |
| |