return dev->driver->gem_prime_mmap(obj, vma);
}
+static int drm_gem_dmabuf_begin_cpu_access(struct dma_buf *dma_buf,
+ size_t start, size_t len,
+ enum dma_data_direction dir)
+{
+ struct drm_gem_object *obj = dma_buf->priv;
+ struct drm_device *dev = obj->dev;
+
+ if (!dev->driver->gem_prime_begin_cpu_access)
+ return -ENOSYS;
+
+ return dev->driver->gem_prime_begin_cpu_access(obj, start, len, dir);
+}
+
+static void drm_gem_dmabuf_end_cpu_access(struct dma_buf *dma_buf,
+ size_t start, size_t len,
+ enum dma_data_direction dir)
+{
+ struct drm_gem_object *obj = dma_buf->priv;
+ struct drm_device *dev = obj->dev;
+
+ if (!dev->driver->gem_prime_end_cpu_access)
+ return;
+
+ dev->driver->gem_prime_end_cpu_access(obj, start, len, dir);
+}
+
static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = {
.attach = drm_gem_map_attach,
.detach = drm_gem_map_detach,
.mmap = drm_gem_dmabuf_mmap,
.vmap = drm_gem_dmabuf_vmap,
.vunmap = drm_gem_dmabuf_vunmap,
+ .begin_cpu_access = drm_gem_dmabuf_begin_cpu_access,
+ .end_cpu_access = drm_gem_dmabuf_end_cpu_access,
};
/**
void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr);
int (*gem_prime_mmap)(struct drm_gem_object *obj,
struct vm_area_struct *vma);
+ int (*gem_prime_begin_cpu_access)(struct drm_gem_object *obj,
+ size_t, size_t,
+ enum dma_data_direction);
+ void (*gem_prime_end_cpu_access)(struct drm_gem_object *obj,
+ size_t, size_t,
+ enum dma_data_direction);
/* vga arb irq handler */
void (*vgaarb_irq)(struct drm_device *dev, bool state);