Merge tag 'exynos-drm-fixes-for-v4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-fixes
- fix page fault issue due to using wrong device object in prime import. - drop NONCONTIG flag without IOMMU support. - remove unnecessary members and declaration. * tag 'exynos-drm-fixes-for-v4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos: drm/exynos: remove unnecessary function declaration drm/exynos: remove unnecessary descrptions drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU drm/exynos: Fix dma-buf import
This commit is contained in:
commit
c2ef3a67c3
|
@ -37,8 +37,6 @@
|
|||
#define DRIVER_MAJOR 1
|
||||
#define DRIVER_MINOR 0
|
||||
|
||||
static struct device *exynos_drm_get_dma_device(void);
|
||||
|
||||
int exynos_atomic_check(struct drm_device *dev,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
|
@ -148,7 +146,7 @@ static struct drm_driver exynos_drm_driver = {
|
|||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||
.gem_prime_export = drm_gem_prime_export,
|
||||
.gem_prime_import = drm_gem_prime_import,
|
||||
.gem_prime_import = exynos_drm_gem_prime_import,
|
||||
.gem_prime_get_sg_table = exynos_drm_gem_prime_get_sg_table,
|
||||
.gem_prime_import_sg_table = exynos_drm_gem_prime_import_sg_table,
|
||||
.gem_prime_vmap = exynos_drm_gem_prime_vmap,
|
||||
|
@ -301,6 +299,27 @@ static struct component_match *exynos_drm_match_add(struct device *dev)
|
|||
return match ?: ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static struct device *exynos_drm_get_dma_device(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
|
||||
struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
|
||||
struct device *dev;
|
||||
|
||||
if (!info->driver || !(info->flags & DRM_DMA_DEVICE))
|
||||
continue;
|
||||
|
||||
while ((dev = bus_find_device(&platform_bus_type, NULL,
|
||||
&info->driver->driver,
|
||||
(void *)platform_bus_type.match))) {
|
||||
put_device(dev);
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int exynos_drm_bind(struct device *dev)
|
||||
{
|
||||
struct exynos_drm_private *private;
|
||||
|
@ -469,27 +488,6 @@ static struct platform_driver exynos_drm_platform_driver = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct device *exynos_drm_get_dma_device(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
|
||||
struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
|
||||
struct device *dev;
|
||||
|
||||
if (!info->driver || !(info->flags & DRM_DMA_DEVICE))
|
||||
continue;
|
||||
|
||||
while ((dev = bus_find_device(&platform_bus_type, NULL,
|
||||
&info->driver->driver,
|
||||
(void *)platform_bus_type.match))) {
|
||||
put_device(dev);
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void exynos_drm_unregister_devices(void)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -194,11 +194,6 @@ struct drm_exynos_file_private {
|
|||
/*
|
||||
* Exynos drm private structure.
|
||||
*
|
||||
* @da_start: start address to device address space.
|
||||
* with iommu, device address space starts from this address
|
||||
* otherwise default one.
|
||||
* @da_space_size: size of device address space.
|
||||
* if 0 then default value is used for it.
|
||||
* @pending: the crtcs that have pending updates to finish
|
||||
* @lock: protect access to @pending
|
||||
* @wait: wait an atomic commit to finish
|
||||
|
|
|
@ -247,6 +247,15 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,
|
|||
if (IS_ERR(exynos_gem))
|
||||
return exynos_gem;
|
||||
|
||||
if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) {
|
||||
/*
|
||||
* when no IOMMU is available, all allocated buffers are
|
||||
* contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag
|
||||
*/
|
||||
flags &= ~EXYNOS_BO_NONCONTIG;
|
||||
DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n");
|
||||
}
|
||||
|
||||
/* set memory type and cache attribute from user side. */
|
||||
exynos_gem->flags = flags;
|
||||
|
||||
|
@ -506,6 +515,12 @@ int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
|
|||
}
|
||||
|
||||
/* low-level interface prime helpers */
|
||||
struct drm_gem_object *exynos_drm_gem_prime_import(struct drm_device *dev,
|
||||
struct dma_buf *dma_buf)
|
||||
{
|
||||
return drm_gem_prime_import_dev(dev, dma_buf, to_dma_dev(dev));
|
||||
}
|
||||
|
||||
struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj)
|
||||
{
|
||||
struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj);
|
||||
|
|
|
@ -117,6 +117,8 @@ int exynos_drm_gem_fault(struct vm_fault *vmf);
|
|||
int exynos_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
|
||||
|
||||
/* low-level interface prime helpers */
|
||||
struct drm_gem_object *exynos_drm_gem_prime_import(struct drm_device *dev,
|
||||
struct dma_buf *dma_buf);
|
||||
struct sg_table *exynos_drm_gem_prime_get_sg_table(struct drm_gem_object *obj);
|
||||
struct drm_gem_object *
|
||||
exynos_drm_gem_prime_import_sg_table(struct drm_device *dev,
|
||||
|
|
Loading…
Reference in New Issue
Block a user