diff options
author | Rob Clark <robdclark@gmail.com> | 2015-09-01 07:35:59 -0400 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2015-09-01 07:36:01 -0400 |
commit | 27c863a3d549dbbb98cd31c7518b0204207e29fe (patch) | |
tree | a55c906a72421354a4369d6de2b883799bbd914b | |
parent | 9f8b37ecbdb201dfb5722c7e6c4596076ca37ac3 (diff) | |
download | drm_gralloc-27c863a3d549dbbb98cd31c7518b0204207e29fe.tar.gz |
WIP: freedreno: map/unmap should cpu_prep/fini
We'd need to use pipe_transfer to synchronize w/ rendering done in the
same process.. so let's hope that never happens. But locking for cpu
access should sync w/ pending gpu access to the buffer to at least get
the sw rendered client sharing buffers safely w/ surfaceflinger using
the gpu.
-rw-r--r-- | gralloc_drm_freedreno.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gralloc_drm_freedreno.c b/gralloc_drm_freedreno.c index 15f7291..a2203fc 100644 --- a/gralloc_drm_freedreno.c +++ b/gralloc_drm_freedreno.c @@ -163,9 +163,21 @@ static int fd_map(struct gralloc_drm_drv_t *drv, int enable_write, void **addr) { struct fd_buffer *fd_buf = (struct fd_buffer *) bo; - if (*addr = fd_bo_map(fd_buf->bo)) { + uint32_t flags = DRM_FREEDRENO_PREP_READ; + + if (enable_write) + flags |= DRM_FREEDRENO_PREP_WRITE; + + /* NOTE: pipe arg is only required for kgsl backend of + * libdrm_freedreno (which only supports x11, no kms, + * so impossible to use drm_gralloc with.. so we can + * ignore pipe arg.) + */ + fd_bo_cpu_prep(fd_buf->bo, NULL, flags); + + if ((*addr = fd_bo_map(fd_buf->bo))) { return 0; - } + } return -errno; } @@ -173,7 +185,8 @@ static int fd_map(struct gralloc_drm_drv_t *drv, static void fd_unmap(struct gralloc_drm_drv_t *drv, struct gralloc_drm_bo_t *bo) { - // TODO should add fd_bo_unmap() to libdrm_freedreno someday.. + struct fd_buffer *fd_buf = (struct fd_buffer *) bo; + fd_bo_cpu_fini(fd_buf->bo); } static void fd_init_kms_features(struct gralloc_drm_drv_t *drv, |