summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/msm_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/msm/msm_drv.c')
-rw-r--r--drivers/gpu/drm/msm/msm_drv.c69
1 files changed, 10 insertions, 59 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index c224911..8d4d557 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -158,6 +158,7 @@ static int msm_unload(struct drm_device *dev)
mutex_lock(&dev->struct_mutex);
gpu->funcs->pm_suspend(gpu->gpu);
gpu->funcs->destroy(gpu->gpu);
+ msm_gpu_cleanup(gpu);
mutex_unlock(&dev->struct_mutex);
}
@@ -249,74 +250,24 @@ fail:
return ret;
}
-/* Urgh... this should all move a level down - when we got the init seq right */
-static struct drm_gem_object *
-gem_new(void *gem_priv, uint32_t size, uint32_t flags)
-{
- struct msm_gpu *gpu = gem_priv;
- return msm_gem_new(gpu->dev, size, flags);
-}
-
-static int
-gem_get_iova_locked(void *gem_priv, struct drm_gem_object *obj, uint32_t *iova)
-{
- struct msm_gpu *gpu = gem_priv;
- return msm_gem_get_iova_locked(obj, gpu->id, iova);
-}
-
-static int
-gem_get_iova(void *gem_priv, struct drm_gem_object *obj, uint32_t *iova)
-{
- struct msm_gpu *gpu = gem_priv;
- return msm_gem_get_iova(obj, gpu->id, iova);
-}
-
-static void
-gem_put_iova(void *gem_priv, struct drm_gem_object *obj)
-{
- struct msm_gpu *gpu = gem_priv;
- return msm_gem_put_iova(obj, gpu->id);
-}
-
-static void *
-gem_vaddr_locked(void *gem_priv, struct drm_gem_object *obj)
-{
- return msm_gem_vaddr_locked(obj);
-}
-
-static void *
-gem_vaddr(void *gem_priv, struct drm_gem_object *obj)
-{
- return msm_gem_vaddr(obj);
-}
-
-static void
-gem_retire(void *gem_priv)
-{
- struct msm_gpu *gpu = gem_priv;
- return msm_gpu_retire(gpu);
-}
-static struct adreno_gem msm_gem_funcs = {
- .gem_new = gem_new,
- .gem_get_iova = gem_get_iova,
- .gem_get_iova_locked = gem_get_iova_locked,
- .gem_put_iova = gem_put_iova,
- .gem_vaddr = gem_vaddr,
- .gem_vaddr_locked = gem_vaddr_locked,
- .gem_retire = gem_retire
-};
-
static void load_gpu(struct drm_device *dev)
{
struct msm_drm_private *priv = dev->dev_private;
struct msm_gpu *gpu;
+ int ret;
if (priv->gpu)
return;
mutex_lock(&dev->struct_mutex);
- gpu = a3xx_gpu_init(dev, &msm_gem_funcs, priv->wq, reglog);
- if (IS_ERR(gpu)) {
+
+ ret = msm_gpu_init(dev, &gpu);
+ if (ret < 0)
+ return; /* FIXME: better error reporting? */
+
+ ret = a3xx_gpu_init(dev, &gpu->gem, priv->wq, reglog, &gpu->gpu,
+ &gpu->funcs);
+ if (ret < 0) {
dev_warn(dev->dev, "failed to load a3xx gpu\n");
gpu = NULL;
/* not fatal */