From 612e6e6038fe8762e34a7b20f1e5cf2ea2cc8546 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Mon, 10 Apr 2023 12:39:42 -0700 Subject: [PATCH] iris: Allocate ZEROED BOs for shared resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A port of cbee2d1102c ("i965/screen: Allocate ZEROED BOs for images"). Cc: mesa-stable Reviewed-by: José Roberto de Souza Part-of: (cherry picked from commit 5e5faa11942decd5ddd53c7cd33117b72448e1e8) --- .pick_status.json | 2 +- src/gallium/drivers/iris/iris_resource.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 2f8c950b360..65bc4bdbac5 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -508,7 +508,7 @@ "description": "iris: Allocate ZEROED BOs for shared resources", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 07678dbb184..ff3318d4903 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -487,9 +487,16 @@ iris_resource_alloc_flags(const struct iris_screen *screen, if (templ->bind & PIPE_BIND_PROTECTED) flags |= BO_ALLOC_PROTECTED; - if (templ->bind & PIPE_BIND_SHARED) + if (templ->bind & PIPE_BIND_SHARED) { flags |= BO_ALLOC_SHARED; + /* We request that the bufmgr zero because, if a buffer gets re-used + * from the pool, we don't want to leak random garbage from our process + * to some other. + */ + flags |= BO_ALLOC_ZEROED; + } + return flags; }