summaryrefslogtreecommitdiff
path: root/src/egl
diff options
context:
space:
mode:
authorKristian H. Kristensen <hoegsberg@google.com>2020-08-06 16:45:28 -0700
committerMarge Bot <eric+marge@anholt.net>2020-08-18 17:20:16 +0000
commit9cc788f0ffc71df1b82bf1fb19fbed523bb970ac (patch)
treec3106c0deb5224eea007571bb2b0d4a7830a1813 /src/egl
parent972f36d8fa62442589b26885ef330c3306427ed1 (diff)
egl/android: Look up prime fds in droid_create_image_from_prime_fds()
We always need to look them up before calling this function, so move the lookup into the function to consolidate the code. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6055>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/platform_android.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 20681bd1b11..70d1d59930e 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -858,11 +858,17 @@ droid_create_image_from_prime_fds_yuv(_EGLDisplay *disp, _EGLContext *ctx,
static __DRIimage *
droid_create_image_from_prime_fds(_EGLDisplay *disp, _EGLContext *ctx,
- struct ANativeWindowBuffer *buf, int num_fds, int fds[3])
+ struct ANativeWindowBuffer *buf)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
int pitches[4] = { 0 }, offsets[4] = { 0 };
unsigned error;
+ int num_fds;
+ int fds[3];
+
+ num_fds = get_native_buffer_fds(buf, fds);
+ if (num_fds == 0)
+ return NULL;
if (is_yuv(buf->format)) {
__DRIimage *image;
@@ -1006,9 +1012,6 @@ dri2_create_image_android_native_buffer(_EGLDisplay *disp,
_EGLContext *ctx,
struct ANativeWindowBuffer *buf)
{
- int fds[3];
- unsigned num_fds;
-
if (ctx != NULL) {
/* From the EGL_ANDROID_image_native_buffer spec:
*
@@ -1027,15 +1030,10 @@ dri2_create_image_android_native_buffer(_EGLDisplay *disp,
return NULL;
}
- num_fds = get_native_buffer_fds(buf, fds);
- if (num_fds > 0) {
- __DRIimage *dri_image =
- droid_create_image_from_prime_fds(disp, ctx, buf, num_fds, fds);
- if (!dri_image)
- return EGL_NO_IMAGE_KHR;
-
+ __DRIimage *dri_image =
+ droid_create_image_from_prime_fds(disp, ctx, buf);
+ if (dri_image)
return dri2_create_image_from_dri(disp, dri_image);
- }
#ifdef HAVE_DRM_GRALLOC
return droid_create_image_from_name(disp, ctx, buf);