Mesa (master): panfrost: Set bo->size[0] in the DRM backend

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 13 07:33:25 UTC 2019


Module: Mesa
Branch: master
Commit: bfbad30543dd896459b09e0e05bc70ea1727e0b9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfbad30543dd896459b09e0e05bc70ea1727e0b9

Author: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Date:   Mon Mar 11 13:34:53 2019 +0100

panfrost: Set bo->size[0] in the DRM backend

So we can unmap it later.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>

---

 include/drm-uapi/panfrost_drm.h        |  1 -
 src/gallium/drivers/panfrost/pan_drm.c | 10 +++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/include/drm-uapi/panfrost_drm.h b/include/drm-uapi/panfrost_drm.h
index 7618f14f9e2..a0ead4979cc 100644
--- a/include/drm-uapi/panfrost_drm.h
+++ b/include/drm-uapi/panfrost_drm.h
@@ -27,7 +27,6 @@ extern "C" {
 #define DRM_IOCTL_PANFROST_GET_BO_OFFSET	DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)
 
 #define PANFROST_JD_REQ_FS (1 << 0)
-
 /**
  * struct drm_panfrost_submit - ioctl argument for submitting commands to the 3D
  * engine.
diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
index 6d1129ff5f2..71e8c6ac1f9 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->size[0] = lseek(whandle->handle, 0, SEEK_END);
+        assert(bo->size[0] > 0);
+        bo->cpu[0] = mmap(NULL, bo->size[0], 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->size[0], NULL);
 
         return bo;
 }




More information about the mesa-commit mailing list