virtgpu_virgl: use blobs for ABGR8888

This is slightly modified version of another patch originally created by
David Stevens (stevensd@chromium.org), but since reverted.

https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3256451

Use blob buffers for ABGR8888 format buffers. This is necessary on ARCVM
to mitigate a performance problem with the
`testSurfaceTransaction_setEnableBackPressure` test from the
`CtsViewTestCases`, as the test expects to be able to read back rendered
buffers at 60fps.

Almost all the code is the same, with the only differences (besides some
minor conflict resolutions resurrecting this patch) being in the
switch statement in `should_use_blob` in `virtgpu_virgl.c` where a check
for ABGR8888 is added.

The rest of the change is as authored by stevensd@, which requires
knowing the host buffer layout before creating the blob resource, and
using an LRU cache of layouts to avoid the overhead of querying the host
every time a buffer is created.

As noted in stevensd@'s CL, virgpu_cross_domain will be the preferred
replacement to virgpu_virgl, and which is expected to have better
performance without this kludge.

TEST=CtsViewTestCases on hatch
BUG=b:235308831

Change-Id: Ia58573a8477e0c17239d6a0768ee53782fac1dd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4505920
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Lloyd Pique <lpique@chromium.org>
Auto-Submit: Lloyd Pique <lpique@chromium.org>
Tested-by: Lloyd Pique <lpique@chromium.org>
This commit is contained in:
Lloyd Pique 2023-05-04 17:13:40 -07:00 committed by Chromeos LUCI
parent 3940cbd883
commit b20510aefc
3 changed files with 238 additions and 21 deletions

View file

@ -56,4 +56,20 @@ void drv_resolve_format_and_use_flags_helper(struct driver *drv, uint32_t format
*/
const char *drv_get_os_option(const char *name);
struct lru_entry {
struct lru_entry *next;
struct lru_entry *prev;
};
struct lru {
struct lru_entry head;
int count;
int max;
};
struct lru_entry *lru_find(struct lru *lru, bool (*eq)(struct lru_entry *e, void *data),
void *data);
void lru_insert(struct lru *lru, struct lru_entry *entry);
void lru_init(struct lru *lru, int max);
#endif