[PATCH 2/2] drm/etnaviv: call correct function when trying to vmap a DMABUF

2016-01-26 Thread Russell King - ARM Linux
On Tue, Jan 26, 2016 at 04:45:26PM +0100, Lucas Stach wrote:
> When trying to get the vmap address of an imported buffer, we must
> call into the appropriate helper function, to allow the exporter to
> establish the vmap, instead of trying to vmap the buffer on our own.

Rather than this way, please add a vmap() method to struct etnaviv_gem_ops
and indirect through that.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


[PATCH 2/2] drm/etnaviv: call correct function when trying to vmap a DMABUF

2016-01-26 Thread Lucas Stach
When trying to get the vmap address of an imported buffer, we must
call into the appropriate helper function, to allow the exporter to
establish the vmap, instead of trying to vmap the buffer on our own.

Signed-off-by: Lucas Stach 
---
 drivers/gpu/drm/etnaviv/etnaviv_gem.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index b22712fdd31e..ce458d8473fe 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -14,6 +14,7 @@
  * this program.  If not, see .
  */

+#include 
 #include 
 #include 

@@ -357,8 +358,14 @@ void *etnaviv_gem_vaddr(struct drm_gem_object *obj)
 {
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);

+   if (etnaviv_obj->vaddr)
+   return etnaviv_obj->vaddr;
+
mutex_lock(&etnaviv_obj->lock);
-   if (!etnaviv_obj->vaddr) {
+   if (etnaviv_obj->base.import_attach) {
+   etnaviv_obj->vaddr =
+   dma_buf_vmap(etnaviv_obj->base.import_attach->dmabuf);
+   } else {
struct page **pages = etnaviv_gem_get_pages(etnaviv_obj);

if (IS_ERR(pages)) {
-- 
2.7.0.rc3