Skip to content

Commit

Permalink
drm/msm: split out vram initialization
Browse files Browse the repository at this point in the history
We'll want to extend this a bit to handle also a reserved-memory
("stolen") region, so that drm/msm can take-over bootloader splash
screen.  First split it out into it's own fxn to reduce noise in
the following patch.

Signed-off-by: Rob Clark <robdclark@gmail.com>
  • Loading branch information
Rob Clark committed Apr 1, 2015
1 parent 564b687 commit 5bf9c0b
Showing 1 changed file with 34 additions and 24 deletions.
58 changes: 34 additions & 24 deletions drivers/gpu/drm/msm/msm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,29 +182,9 @@ static int get_mdp_ver(struct platform_device *pdev)
return 4;
}

static int msm_load(struct drm_device *dev, unsigned long flags)
static int msm_init_vram(struct drm_device *dev)
{
struct platform_device *pdev = dev->platformdev;
struct msm_drm_private *priv;
struct msm_kms *kms;
int ret;

priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) {
dev_err(dev->dev, "failed to allocate private data\n");
return -ENOMEM;
}

dev->dev_private = priv;

priv->wq = alloc_ordered_workqueue("msm", 0);
init_waitqueue_head(&priv->fence_event);
init_waitqueue_head(&priv->pending_crtcs_event);

INIT_LIST_HEAD(&priv->inactive_list);
INIT_LIST_HEAD(&priv->fence_cbs);

drm_mode_config_init(dev);
struct msm_drm_private *priv = dev->dev_private;

/* if we have no IOMMU, then we need to use carveout allocator.
* Grab the entire CMA chunk carved out in early startup in
Expand Down Expand Up @@ -232,15 +212,45 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
if (!p) {
dev_err(dev->dev, "failed to allocate VRAM\n");
priv->vram.paddr = 0;
ret = -ENOMEM;
goto fail;
return -ENOMEM;
}

dev_info(dev->dev, "VRAM: %08x->%08x\n",
(uint32_t)priv->vram.paddr,
(uint32_t)(priv->vram.paddr + size));
}

return 0;
}

static int msm_load(struct drm_device *dev, unsigned long flags)
{
struct platform_device *pdev = dev->platformdev;
struct msm_drm_private *priv;
struct msm_kms *kms;
int ret;

priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) {
dev_err(dev->dev, "failed to allocate private data\n");
return -ENOMEM;
}

dev->dev_private = priv;

priv->wq = alloc_ordered_workqueue("msm", 0);
init_waitqueue_head(&priv->fence_event);
init_waitqueue_head(&priv->pending_crtcs_event);

INIT_LIST_HEAD(&priv->inactive_list);
INIT_LIST_HEAD(&priv->fence_cbs);

drm_mode_config_init(dev);

ret = msm_init_vram(dev);
if (ret)
goto fail;

platform_set_drvdata(pdev, dev);

/* Bind all our sub-components: */
Expand Down

0 comments on commit 5bf9c0b

Please sign in to comment.