From 4aac98f8a68b4c6407a5f41a91bfd7763f0607d7 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Sun, 14 Feb 2021 18:41:10 +0800 Subject: [PATCH] lima: fix xserver page flip fail for full screen client Need to import client buffer to display drm device, otherwise get following xserver error log: [ 190.982] (WW) modeset(0): Page flip failed: No such file or directory [ 190.982] (EE) modeset(0): present flip failed With this fix, full screen x11 client can display its window buffer directly without a copy. Tested on Allwinner H3, 1080p full screen glxgears go from 163FPS to 173FPS. Reviewed-by: Vasily Khoruzhick Reviewed-by: Erico Nunes Signed-off-by: Zan Dobersek Signed-off-by: Qiang Yu Part-of: --- src/gallium/drivers/lima/lima_resource.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gallium/drivers/lima/lima_resource.c b/src/gallium/drivers/lima/lima_resource.c index 0a122ced287..2c2c1a3cd5d 100644 --- a/src/gallium/drivers/lima/lima_resource.c +++ b/src/gallium/drivers/lima/lima_resource.c @@ -361,6 +361,18 @@ lima_resource_from_handle(struct pipe_screen *pscreen, else res->levels[0].width = pres->width0; + if (screen->ro) { + /* Make sure that renderonly has a handle to our buffer in the + * display's fd, so that a later renderonly_get_handle() + * returns correct handles or GEM names. + */ + res->scanout = + renderonly_create_gpu_import_for_resource(pres, + screen->ro, + NULL); + /* ignore failiure to allow importing non-displayable buffer */ + } + return pres; err_out: