summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amdgpu.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/amdgpu.c b/amdgpu.c
index dfcad22..e8a0ec8 100644
--- a/amdgpu.c
+++ b/amdgpu.c
@@ -105,6 +105,20 @@ static void amdgpu_close(struct driver *drv)
drv->priv = NULL;
}
+static int amdgpu_bo_create(struct bo *bo, uint32_t width, uint32_t height,
+ uint32_t format, uint64_t use_flags)
+{
+ /* TODO: The format checks should be redundant; this is really about
+ * providing linear surfaces for the camera system; using NV12 formats
+ * with the GPU shouldn't require linear.
+ */
+ if (format == DRM_FORMAT_NV12 || format == DRM_FORMAT_NV21 ||
+ use_flags & (BO_USE_CAMERA_WRITE | BO_USE_CAMERA_READ))
+ use_flags |= BO_USE_LINEAR;
+
+ return dri_bo_create(bo, width, height, format, use_flags);
+}
+
static uint32_t amdgpu_resolve_format(uint32_t format, uint64_t use_flags)
{
switch (format) {
@@ -125,7 +139,7 @@ const struct backend backend_amdgpu = {
.name = "amdgpu",
.init = amdgpu_init,
.close = amdgpu_close,
- .bo_create = dri_bo_create,
+ .bo_create = amdgpu_bo_create,
.bo_destroy = dri_bo_destroy,
.bo_import = dri_bo_import,
.bo_map = dri_bo_map,