summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorDavid Stevens <[email protected]>2020-03-05 12:52:38 +0900
committerDavid Stevens <[email protected]>2020-03-12 11:03:32 +0900
commit31c420565c713a0398c7b872119acaf4f8dc3978 (patch)
treec06288db93001c1a95dad9411018fae42a8b92c1 /src/egl
parentcf5ba9d409bcae3496d094def5c3b199a8847b3c (diff)
egl/android: set window usage flags
When creating an egl surface from an ANativeWindow, the window's usage flags need to be set so that buffers are allocated properly. Signed-off-by: David Stevens <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Lepton Wu <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/platform_android.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 8973017324b..c682b06d200 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -432,6 +432,11 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
window->query(window, NATIVE_WINDOW_WIDTH, &dri2_surf->base.Width);
window->query(window, NATIVE_WINDOW_HEIGHT, &dri2_surf->base.Height);
+
+ uint32_t usage = strcmp(dri2_dpy->driver_name, "kms_swrast") == 0
+ ? GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN
+ : GRALLOC_USAGE_HW_RENDER;
+ native_window_set_usage(window, usage);
}
config = dri2_get_dri_config(dri2_conf, type,