external/minigbm
Revision | dfd2fef97c3efffdd2a10940569a4c7e6a5259da (tree) |
---|---|
Zeit | 2020-01-27 06:47:42 |
Autor | Deepak Sharma <Deepak.sharma@amd....> |
Commiter | Mauro Rossi |
amdgpu: use amdgpu_gem_wait_idle_ioctl to wait for GPU to finish.
For linear path we don't wait for GPU to finish before CPU access
which may case issues in gralloc lock() case.
Bug=b:115585732
TEST=android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual1920x1080
Change-Id: If827fe4a18726797082046b4f24fc8c75ff1bcb7
Signed-off-by: Deepak Sharma <Deepak.sharma@amd.com>
Reviewed-on: https://chromium-review.googlesource.com/1340484
Commit-Ready: Deepak Sharma <deepak.sharma@amd.com>
Tested-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Deepak Sharma <deepak.sharma@amd.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
@@ -237,6 +237,32 @@ static int amdgpu_unmap_bo(struct bo *bo, struct vma *vma) | ||
237 | 237 | return munmap(vma->addr, vma->length); |
238 | 238 | } |
239 | 239 | |
240 | +static int amdgpu_bo_invalidate(struct bo *bo, struct mapping *mapping) | |
241 | +{ | |
242 | + int ret; | |
243 | + union drm_amdgpu_gem_wait_idle wait_idle; | |
244 | + | |
245 | + if (bo->priv) | |
246 | + return 0; | |
247 | + | |
248 | + memset(&wait_idle, 0, sizeof(wait_idle)); | |
249 | + wait_idle.in.handle = bo->handles[0].u32; | |
250 | + wait_idle.in.timeout = AMDGPU_TIMEOUT_INFINITE; | |
251 | + | |
252 | + ret = drmCommandWriteRead(bo->drv->fd, DRM_AMDGPU_GEM_WAIT_IDLE, &wait_idle, | |
253 | + sizeof(wait_idle)); | |
254 | + | |
255 | + if (ret < 0) { | |
256 | + drv_log("DRM_AMDGPU_GEM_WAIT_IDLE failed with %d\n", ret); | |
257 | + return ret; | |
258 | + } | |
259 | + | |
260 | + if (ret == 0 && wait_idle.out.status) | |
261 | + drv_log("DRM_AMDGPU_GEM_WAIT_IDLE BO is busy\n"); | |
262 | + | |
263 | + return 0; | |
264 | +} | |
265 | + | |
240 | 266 | static uint32_t amdgpu_resolve_format(uint32_t format, uint64_t use_flags) |
241 | 267 | { |
242 | 268 | switch (format) { |
@@ -262,6 +288,7 @@ const struct backend backend_amdgpu = { | ||
262 | 288 | .bo_import = amdgpu_import_bo, |
263 | 289 | .bo_map = amdgpu_map_bo, |
264 | 290 | .bo_unmap = amdgpu_unmap_bo, |
291 | + .bo_invalidate = amdgpu_bo_invalidate, | |
265 | 292 | .resolve_format = amdgpu_resolve_format, |
266 | 293 | }; |
267 | 294 |