diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2014-05-25 06:45:39 -0400 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-07-07 18:29:16 -0400 |
commit | ab5a60c3ee41ff22304e2bcf63c151aa2851df0c (patch) | |
tree | fcdfe459bbbd820c7f46df819f179b29d91e3c2c /drivers/gpu/drm/omapdrm/omap_gem.c | |
parent | 4661270797f0c172da4b54415574421cd27f1bf3 (diff) |
drm/omap: use __GFP_DMA32 for shmem-backed gem
OMAP requires bo-pages to be in the DMA32 zone. Explicitly request this by
setting __GFP_DMA32 as mapping-gfp-mask during shmem initialization. This
drops HIGHMEM from the gfp-mask and uses DMA32 instead. shmem-core takes
care to relocate pages during swap-in in case they have been loaded into
the wrong zone.
It is _not_ possible to pass __GFP_DMA32 to shmem_read_mapping_page_gfp()
as the page might have already been swapped-in at that time. The zone-mask
must be set during initialization and be kept constant for now.
Remove the now superfluous TODO in omap_gem.c.
Reviewed-by: Rob Clark <robdclark@gmail.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_gem.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_gem.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 95dbce286a41..1331fd538398 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c | |||
@@ -233,10 +233,6 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj) | |||
233 | 233 | ||
234 | WARN_ON(omap_obj->pages); | 234 | WARN_ON(omap_obj->pages); |
235 | 235 | ||
236 | /* TODO: __GFP_DMA32 .. but somehow GFP_HIGHMEM is coming from the | ||
237 | * mapping_gfp_mask(mapping) which conflicts w/ GFP_DMA32.. probably | ||
238 | * we actually want CMA memory for it all anyways.. | ||
239 | */ | ||
240 | pages = drm_gem_get_pages(obj, GFP_KERNEL); | 236 | pages = drm_gem_get_pages(obj, GFP_KERNEL); |
241 | if (IS_ERR(pages)) { | 237 | if (IS_ERR(pages)) { |
242 | dev_err(obj->dev->dev, "could not get pages: %ld\n", PTR_ERR(pages)); | 238 | dev_err(obj->dev->dev, "could not get pages: %ld\n", PTR_ERR(pages)); |
@@ -1347,6 +1343,7 @@ struct drm_gem_object *omap_gem_new(struct drm_device *dev, | |||
1347 | struct omap_drm_private *priv = dev->dev_private; | 1343 | struct omap_drm_private *priv = dev->dev_private; |
1348 | struct omap_gem_object *omap_obj; | 1344 | struct omap_gem_object *omap_obj; |
1349 | struct drm_gem_object *obj = NULL; | 1345 | struct drm_gem_object *obj = NULL; |
1346 | struct address_space *mapping; | ||
1350 | size_t size; | 1347 | size_t size; |
1351 | int ret; | 1348 | int ret; |
1352 | 1349 | ||
@@ -1404,14 +1401,16 @@ struct drm_gem_object *omap_gem_new(struct drm_device *dev, | |||
1404 | omap_obj->height = gsize.tiled.height; | 1401 | omap_obj->height = gsize.tiled.height; |
1405 | } | 1402 | } |
1406 | 1403 | ||
1407 | ret = 0; | 1404 | if (flags & (OMAP_BO_DMA|OMAP_BO_EXT_MEM)) { |
1408 | if (flags & (OMAP_BO_DMA|OMAP_BO_EXT_MEM)) | ||
1409 | drm_gem_private_object_init(dev, obj, size); | 1405 | drm_gem_private_object_init(dev, obj, size); |
1410 | else | 1406 | } else { |
1411 | ret = drm_gem_object_init(dev, obj, size); | 1407 | ret = drm_gem_object_init(dev, obj, size); |
1408 | if (ret) | ||
1409 | goto fail; | ||
1412 | 1410 | ||
1413 | if (ret) | 1411 | mapping = file_inode(obj->filp)->i_mapping; |
1414 | goto fail; | 1412 | mapping_set_gfp_mask(mapping, GFP_USER | __GFP_DMA32); |
1413 | } | ||
1415 | 1414 | ||
1416 | return obj; | 1415 | return obj; |
1417 | 1416 | ||