Reland "minigbm: introduce test allocation"
This reverts commit 08d8dbf094fdc5aa9b92c7257e292edcf28602b2.
The original change returned early from drv_bo_create_with_modifiers,
which broke reference counting. This must have hit some race condition
in the tests, as they no longer flake after fixing reference counting.
Original change's description:
> Revert "minigbm: introduce test allocation"
>
> This reverts commit f0e607c7d436134b53fd45a4ead36d714451be8a.
>
> Reason for revert: caused flaky regressions across the board.
>
> BUG=b:150997559
> Exempt-From-Owner-Approval: revert.
>
> Original change's description:
> > minigbm: introduce test allocation
> >
> > This change introduces a GBM_TEST_ALLOC flag to minigbm, which allows
> > for the creation of fake buffers that can be used to determine buffer
> > metadata without actually allocating a full buffer. The new flag is
> > supported by the i915 backends. This flag also alleviates the need to
> > cache buffers when virtio_gpu queries metadata properties.
> >
> > BUG=b:145994510
> > TEST=play youtube with arcvm demo image plus this and virgl change
> >
> > Change-Id: I9c6819aa3b5b674e4bb33b0656f2a9f155b0884e
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1980688
> > Tested-by: David Stevens <stevensd@chromium.org>
> > Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
> > Commit-Queue: David Stevens <stevensd@chromium.org>
>
> Bug: b:145994510
> Change-Id: I50079b7f0aabf38e1f373cac0f28c0e057eed760
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2093923
> Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
> Tested-by: Ilja H. Friedel <ihf@chromium.org>
> Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Bug: b:150997559, b:145994510
Change-Id: If0f02a4701bb6960b6413d6b0c00b481146914d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2094068
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
diff --git a/drv.h b/drv.h
index 39fd5dd..937487b 100644
--- a/drv.h
+++ b/drv.h
@@ -12,6 +12,7 @@
#endif
#include <drm_fourcc.h>
+#include <stdbool.h>
#include <stdint.h>
#define DRV_MAX_PLANES 4
@@ -35,7 +36,8 @@
#define BO_USE_SW_WRITE_RARELY (1ull << 12)
#define BO_USE_HW_VIDEO_DECODER (1ull << 13)
#define BO_USE_HW_VIDEO_ENCODER (1ull << 14)
-#define BO_USE_RENDERSCRIPT (1ull << 15)
+#define BO_USE_TEST_ALLOC (1ull << 15)
+#define BO_USE_RENDERSCRIPT (1ull << 16)
/* Quirks for allocating a buffer. */
#define BO_QUIRK_NONE 0
@@ -124,7 +126,7 @@
struct combination *drv_get_combination(struct driver *drv, uint32_t format, uint64_t use_flags);
struct bo *drv_bo_new(struct driver *drv, uint32_t width, uint32_t height, uint32_t format,
- uint64_t use_flags);
+ uint64_t use_flags, bool is_test_buffer);
struct bo *drv_bo_create(struct driver *drv, uint32_t width, uint32_t height, uint32_t format,
uint64_t use_flags);