#include <linux/dma-mapping.h>
#include <linux/fault-inject.h>
#include <linux/of_address.h>
#include <linux/uaccess.h>
#include <drm/drm_drv.h>
#include <drm/drm_file.h>
#include <drm/drm_ioctl.h>
#include <drm/drm_of.h>
#include "msm_drv.h"
#include "msm_debugfs.h"
#include "msm_gem.h"
#include "msm_gpu.h"
#include "msm_kms.h"
#define MSM_VERSION_MAJOR …
#define MSM_VERSION_MINOR …
#define MSM_VERSION_PATCHLEVEL …
static void msm_deinit_vram(struct drm_device *ddev);
static char *vram = …;
MODULE_PARM_DESC(…) …;
module_param(vram, charp, 0);
bool dumpstate;
MODULE_PARM_DESC(…) …;
module_param(dumpstate, bool, 0600);
static bool modeset = …;
MODULE_PARM_DESC(…) …;
module_param(modeset, bool, 0600);
#ifdef CONFIG_FAULT_INJECTION
DECLARE_FAULT_ATTR(fail_gem_alloc);
DECLARE_FAULT_ATTR(fail_gem_iova);
#endif
static int msm_drm_uninit(struct device *dev)
{ … }
bool msm_use_mmu(struct drm_device *dev)
{ … }
static int msm_init_vram(struct drm_device *dev)
{ … }
static void msm_deinit_vram(struct drm_device *ddev)
{ … }
static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
{ … }
static void load_gpu(struct drm_device *dev)
{ … }
static int context_init(struct drm_device *dev, struct drm_file *file)
{ … }
static int msm_open(struct drm_device *dev, struct drm_file *file)
{ … }
static void context_close(struct msm_file_private *ctx)
{ … }
static void msm_postclose(struct drm_device *dev, struct drm_file *file)
{ … }
static int msm_ioctl_get_param(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static int msm_ioctl_set_param(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static int msm_ioctl_gem_new(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static inline ktime_t to_ktime(struct drm_msm_timespec timeout)
{ … }
static int msm_ioctl_gem_cpu_prep(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static int msm_ioctl_gem_cpu_fini(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static int msm_ioctl_gem_info_iova(struct drm_device *dev,
struct drm_file *file, struct drm_gem_object *obj,
uint64_t *iova)
{ … }
static int msm_ioctl_gem_info_set_iova(struct drm_device *dev,
struct drm_file *file, struct drm_gem_object *obj,
uint64_t iova)
{ … }
static int msm_ioctl_gem_info_set_metadata(struct drm_gem_object *obj,
__user void *metadata,
u32 metadata_size)
{ … }
static int msm_ioctl_gem_info_get_metadata(struct drm_gem_object *obj,
__user void *metadata,
u32 *metadata_size)
{ … }
static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static int wait_fence(struct msm_gpu_submitqueue *queue, uint32_t fence_id,
ktime_t timeout, uint32_t flags)
{ … }
static int msm_ioctl_wait_fence(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static int msm_ioctl_submitqueue_new(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static int msm_ioctl_submitqueue_query(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static int msm_ioctl_submitqueue_close(struct drm_device *dev, void *data,
struct drm_file *file)
{ … }
static const struct drm_ioctl_desc msm_ioctls[] = …;
static void msm_show_fdinfo(struct drm_printer *p, struct drm_file *file)
{ … }
static const struct file_operations fops = …;
static const struct drm_driver msm_driver = …;
static int add_components_mdp(struct device *master_dev,
struct component_match **matchptr)
{ … }
#if !IS_REACHABLE(CONFIG_DRM_MSM_MDP5) || !IS_REACHABLE(CONFIG_DRM_MSM_DPU)
bool msm_disp_drv_should_bind(struct device *dev, bool dpu_driver)
{
return true;
}
#else
static bool prefer_mdp5 = …;
MODULE_PARM_DESC(…) …;
module_param(prefer_mdp5, bool, 0444);
static const char *const msm_mdp5_dpu_migration[] = …;
bool msm_disp_drv_should_bind(struct device *dev, bool dpu_driver)
{ … }
#endif
static const struct of_device_id msm_gpu_match[] = …;
static int add_gpu_components(struct device *dev,
struct component_match **matchptr)
{ … }
static int msm_drm_bind(struct device *dev)
{ … }
static void msm_drm_unbind(struct device *dev)
{ … }
const struct component_master_ops msm_drm_ops = …;
int msm_drv_probe(struct device *master_dev,
int (*kms_init)(struct drm_device *dev),
struct msm_kms *kms)
{ … }
static int msm_pdev_probe(struct platform_device *pdev)
{ … }
static void msm_pdev_remove(struct platform_device *pdev)
{ … }
static struct platform_driver msm_platform_driver = …;
static int __init msm_drm_register(void)
{ … }
static void __exit msm_drm_unregister(void)
{ … }
module_init(…) …;
module_exit(msm_drm_unregister);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;