[1/2] panfrost: Set bo->imported_size in the DRM backend

Submitted by Tomeu Vizoso on March 11, 2019, 12:40 p.m.

Details

Message ID 20190311124029.36792-2-tomeu.vizoso@collabora.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Tomeu Vizoso March 11, 2019, 12:40 p.m.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
 src/gallium/drivers/panfrost/pan_drm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
index 6d1129ff5f2b..62a7b0ce5a30 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -125,7 +125,7 @@  panfrost_drm_import_bo(struct panfrost_screen *screen, struct winsys_handle *wha
 	struct panfrost_drm *drm = (struct panfrost_drm *)screen->driver;
         struct drm_panfrost_get_bo_offset get_bo_offset = {0,};
 	struct drm_panfrost_mmap_bo mmap_bo = {0,};
-        int ret, size;
+        int ret;
         unsigned gem_handle;
 
 	ret = drmPrimeFDToHandle(drm->fd, whandle->handle, &gem_handle);
@@ -146,9 +146,9 @@  panfrost_drm_import_bo(struct panfrost_screen *screen, struct winsys_handle *wha
 		assert(0);
 	}
 
-	size = lseek(whandle->handle, 0, SEEK_END);
-	assert(size > 0);
-        bo->cpu[0] = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
+        bo->imported_size = lseek(whandle->handle, 0, SEEK_END);
+        assert(bo->imported_size > 0);
+        bo->cpu[0] = mmap(NULL, bo->imported_size, PROT_READ | PROT_WRITE, MAP_SHARED,
                        drm->fd, mmap_bo.offset);
         if (bo->cpu[0] == MAP_FAILED) {
                 fprintf(stderr, "mmap failed: %p\n", bo->cpu[0]);
@@ -156,7 +156,7 @@  panfrost_drm_import_bo(struct panfrost_screen *screen, struct winsys_handle *wha
 	}
 
         /* Record the mmap if we're tracing */
-        pantrace_mmap(bo->gpu[0], bo->cpu[0], size, NULL);
+        pantrace_mmap(bo->gpu[0], bo->cpu[0], bo->imported_size, NULL);
 
         return bo;
 }