diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2014-05-30 15:42:05 +0900 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-08-07 16:54:51 +0200 |
commit | cbe2eae98ca9512bad9ec2f9f0b7a703118e3519 (patch) | |
tree | ff653262106d1bd04516ce871306cc3705adbbba | |
parent | ae632fe157a70aa811b828a88c287269885c7215 (diff) |
drm/gk20a/fb: use dma_alloc_coherent() for VRAM
GK20A's RAM driver was using CMA functions in order to allocate VRAM.
This is wrong because these functions are not exported, which causes
compilation to fail when CMA is enabled and Nouveau is built as a
module. On top of that the driver was leaking (or rather bleeding)
memory.
dma_alloc_coherent() will also use CMA when needed but has the
advantage of being properly exported. It creates a permanent kernel
mapping, but experiment revealed that the lowmem mapping is actually
reused, and this mapping can also be taken advantage of to implement
faster instmem. We lose the ability to allocate memory at finer
granularity, but that's what CMA is here for and it also simplifies the
driver.
This driver is to be replaced by an IOMMU-based one in the future ;
until then, its current form will allow it to do its job.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c index 4d77d75e4673..10cdcf8b8a7f 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c @@ -24,6 +24,10 @@ #include <subdev/fb.h> +#include <linux/types.h> +#include <linux/mm.h> +#include <linux/dma-mapping.h> + struct gk20a_mem { struct nouveau_mem base; void *cpuaddr; |