#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/dma-direct.h>
#include <drm/drm_aperture.h>
#include <drm/drm_atomic_helper.h>
kfree(vc4file);
}
+struct drm_gem_object *
+vc4_prime_import_sg_table(struct drm_device *dev,
+ struct dma_buf_attachment *attach,
+ struct sg_table *sgt)
+{
+ phys_addr_t phys = dma_to_phys(dev->dev, sg_dma_address(sgt->sgl));
+
+ if (is_swiotlb_buffer(dev->dev, phys))
+ return ERR_PTR(-EINVAL);
+
+ return drm_gem_dma_prime_import_sg_table(dev, attach, sgt);
+}
+
DEFINE_DRM_GEM_FOPS(vc4_drm_fops);
static const struct drm_ioctl_desc vc4_drm_ioctls[] = {
.gem_create_object = vc4_create_object,
- DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(vc4_bo_dumb_create),
+ .dumb_create = vc4_bo_dumb_create,
+ .gem_prime_import_sg_table = vc4_prime_import_sg_table,
.ioctls = vc4_drm_ioctls,
.num_ioctls = ARRAY_SIZE(vc4_drm_ioctls),
.debugfs_init = vc4_debugfs_init,
#endif
- DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(vc5_dumb_create),
+ .dumb_create = vc5_dumb_create,
+ .gem_prime_import_sg_table = vc4_prime_import_sg_table,
.fops = &vc4_drm_fops,