diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-12-01 12:28:39 +0100 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-12-01 12:28:39 +0100 |
commit | 624d580ad3a5533c6e178fd00ef2904a5cd85f44 (patch) | |
tree | e189b870ea2e16a083bb84e453d3802e7a64fa2d | |
parent | 9de762055ba5713d3500f3f89bc3914ccf489267 (diff) |
amdgpu: force linear surfaces with camera use flagswip
-rw-r--r-- | amdgpu.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -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, |