aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm/omap_gem.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-04-20 17:33:51 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-06-02 03:57:05 -0400
commit16869083b9bec8c1090442bd176a5b376708aba0 (patch)
tree828fc7af582c1f46e73f5c6e3611dc62ed8737aa /drivers/gpu/drm/omapdrm/omap_gem.c
parentaa0408bcb1b8c2c5941b6e0e7ce0ad2b733bb971 (diff)
drm: omapdrm: Rename occurrences of paddr to dma_addr
The fields, variables and functions deal with DMA addresses, name them accordingly. The omap_gem_get_paddr() and omap_gem_put_paddr() will be addressed differently separately. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_gem.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_gem.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index 3d94ea8684e6..038a05918002 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -50,7 +50,7 @@ struct omap_gem_object {
50 uint32_t roll; 50 uint32_t roll;
51 51
52 /** 52 /**
53 * paddr contains the buffer DMA address. It is valid for 53 * dma_addr contains the buffer DMA address. It is valid for
54 * 54 *
55 * - buffers allocated through the DMA mapping API (with the 55 * - buffers allocated through the DMA mapping API (with the
56 * OMAP_BO_MEM_DMA_API flag set) 56 * OMAP_BO_MEM_DMA_API flag set)
@@ -58,24 +58,24 @@ struct omap_gem_object {
58 * - buffers imported from dmabuf (with the OMAP_BO_MEM_DMABUF flag set) 58 * - buffers imported from dmabuf (with the OMAP_BO_MEM_DMABUF flag set)
59 * if they are physically contiguous (when sgt->orig_nents == 1) 59 * if they are physically contiguous (when sgt->orig_nents == 1)
60 * 60 *
61 * - buffers mapped through the TILER when paddr_cnt is not zero, in 61 * - buffers mapped through the TILER when dma_addr_cnt is not zero, in
62 * which case the DMA address points to the TILER aperture 62 * which case the DMA address points to the TILER aperture
63 * 63 *
64 * Physically contiguous buffers have their DMA address equal to the 64 * Physically contiguous buffers have their DMA address equal to the
65 * physical address as we don't remap those buffers through the TILER. 65 * physical address as we don't remap those buffers through the TILER.
66 * 66 *
67 * Buffers mapped to the TILER have their DMA address pointing to the 67 * Buffers mapped to the TILER have their DMA address pointing to the
68 * TILER aperture. As TILER mappings are refcounted (through paddr_cnt) 68 * TILER aperture. As TILER mappings are refcounted (through
69 * the DMA address must be accessed through omap_get_get_paddr() to 69 * dma_addr_cnt) the DMA address must be accessed through
70 * ensure that the mapping won't disappear unexpectedly. References must 70 * omap_get_get_paddr() to ensure that the mapping won't disappear
71 * be released with omap_gem_put_paddr(). 71 * unexpectedly. References must be released with omap_gem_put_paddr().
72 */ 72 */
73 dma_addr_t paddr; 73 dma_addr_t dma_addr;
74 74
75 /** 75 /**
76 * # of users of paddr 76 * # of users of dma_addr
77 */ 77 */
78 uint32_t paddr_cnt; 78 uint32_t dma_addr_cnt;
79 79
80 /** 80 /**
81 * If the buffer has been imported from a dmabuf the OMAP_DB_DMABUF flag 81 * If the buffer has been imported from a dmabuf the OMAP_DB_DMABUF flag
@@ -119,7 +119,7 @@ struct omap_gem_object {
119#define NUM_USERGART_ENTRIES 2 119#define NUM_USERGART_ENTRIES 2
120struct omap_drm_usergart_entry { 120struct omap_drm_usergart_entry {
121 struct tiler_block *block; /* the reserved tiler block */ 121 struct tiler_block *block; /* the reserved tiler block */
122 dma_addr_t paddr; 122 dma_addr_t dma_addr;
123 struct drm_gem_object *obj; /* the current pinned obj */ 123 struct drm_gem_object *obj; /* the current pinned obj */
124 pgoff_t obj_pgoff; /* page offset of obj currently 124 pgoff_t obj_pgoff; /* page offset of obj currently
125 mapped in */ 125 mapped in */
@@ -392,7 +392,7 @@ static int fault_1d(struct drm_gem_object *obj,
392 pfn = page_to_pfn(omap_obj->pages[pgoff]); 392 pfn = page_to_pfn(omap_obj->pages[pgoff]);
393 } else { 393 } else {
394 BUG_ON(!is_contiguous(omap_obj)); 394 BUG_ON(!is_contiguous(omap_obj));
395 pfn = (omap_obj->paddr >> PAGE_SHIFT) + pgoff; 395 pfn = (omap_obj->dma_addr >> PAGE_SHIFT) + pgoff;
396 } 396 }
397 397
398 VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address, 398 VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
@@ -485,7 +485,7 @@ static int fault_2d(struct drm_gem_object *obj,
485 return ret; 485 return ret;
486 } 486 }
487 487
488 pfn = entry->paddr >> PAGE_SHIFT; 488 pfn = entry->dma_addr >> PAGE_SHIFT;
489 489
490 VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address, 490 VERB("Inserting %p pfn %lx, pa %lx", (void *)vmf->address,
491 pfn, pfn << PAGE_SHIFT); 491 pfn, pfn << PAGE_SHIFT);
@@ -787,7 +787,7 @@ void omap_gem_dma_sync(struct drm_gem_object *obj,
787/* Get physical address for DMA.. if the buffer is not already contiguous, remap 787/* Get physical address for DMA.. if the buffer is not already contiguous, remap
788 * it to pin in physically contiguous memory.. (ie. map in TILER) 788 * it to pin in physically contiguous memory.. (ie. map in TILER)
789 */ 789 */
790int omap_gem_get_paddr(struct drm_gem_object *obj, dma_addr_t *paddr) 790int omap_gem_get_paddr(struct drm_gem_object *obj, dma_addr_t *dma_addr)
791{ 791{
792 struct omap_drm_private *priv = obj->dev->dev_private; 792 struct omap_drm_private *priv = obj->dev->dev_private;
793 struct omap_gem_object *omap_obj = to_omap_bo(obj); 793 struct omap_gem_object *omap_obj = to_omap_bo(obj);
@@ -796,7 +796,7 @@ int omap_gem_get_paddr(struct drm_gem_object *obj, dma_addr_t *paddr)
796 mutex_lock(&obj->dev->struct_mutex); 796 mutex_lock(&obj->dev->struct_mutex);
797 797
798 if (!is_contiguous(omap_obj) && priv->has_dmm) { 798 if (!is_contiguous(omap_obj) && priv->has_dmm) {
799 if (omap_obj->paddr_cnt == 0) { 799 if (omap_obj->dma_addr_cnt == 0) {
800 struct page **pages; 800 struct page **pages;
801 uint32_t npages = obj->size >> PAGE_SHIFT; 801 uint32_t npages = obj->size >> PAGE_SHIFT;
802 enum tiler_fmt fmt = gem2fmt(omap_obj->flags); 802 enum tiler_fmt fmt = gem2fmt(omap_obj->flags);
@@ -833,17 +833,17 @@ int omap_gem_get_paddr(struct drm_gem_object *obj, dma_addr_t *paddr)
833 goto fail; 833 goto fail;
834 } 834 }
835 835
836 omap_obj->paddr = tiler_ssptr(block); 836 omap_obj->dma_addr = tiler_ssptr(block);
837 omap_obj->block = block; 837 omap_obj->block = block;
838 838
839 DBG("got paddr: %pad", &omap_obj->paddr); 839 DBG("got dma address: %pad", &omap_obj->dma_addr);
840 } 840 }
841 841
842 omap_obj->paddr_cnt++; 842 omap_obj->dma_addr_cnt++;
843 843
844 *paddr = omap_obj->paddr; 844 *dma_addr = omap_obj->dma_addr;
845 } else if (is_contiguous(omap_obj)) { 845 } else if (is_contiguous(omap_obj)) {
846 *paddr = omap_obj->paddr; 846 *dma_addr = omap_obj->dma_addr;
847 } else { 847 } else {
848 ret = -EINVAL; 848 ret = -EINVAL;
849 goto fail; 849 goto fail;
@@ -864,9 +864,9 @@ void omap_gem_put_paddr(struct drm_gem_object *obj)
864 int ret; 864 int ret;
865 865
866 mutex_lock(&obj->dev->struct_mutex); 866 mutex_lock(&obj->dev->struct_mutex);
867 if (omap_obj->paddr_cnt > 0) { 867 if (omap_obj->dma_addr_cnt > 0) {
868 omap_obj->paddr_cnt--; 868 omap_obj->dma_addr_cnt--;
869 if (omap_obj->paddr_cnt == 0) { 869 if (omap_obj->dma_addr_cnt == 0) {
870 ret = tiler_unpin(omap_obj->block); 870 ret = tiler_unpin(omap_obj->block);
871 if (ret) { 871 if (ret) {
872 dev_err(obj->dev->dev, 872 dev_err(obj->dev->dev,
@@ -877,7 +877,7 @@ void omap_gem_put_paddr(struct drm_gem_object *obj)
877 dev_err(obj->dev->dev, 877 dev_err(obj->dev->dev,
878 "could not release unmap: %d\n", ret); 878 "could not release unmap: %d\n", ret);
879 } 879 }
880 omap_obj->paddr = 0; 880 omap_obj->dma_addr = 0;
881 omap_obj->block = NULL; 881 omap_obj->block = NULL;
882 } 882 }
883 } 883 }
@@ -889,16 +889,16 @@ void omap_gem_put_paddr(struct drm_gem_object *obj)
889 * specified orientation and x,y offset from top-left corner of buffer 889 * specified orientation and x,y offset from top-left corner of buffer
890 * (only valid for tiled 2d buffers) 890 * (only valid for tiled 2d buffers)
891 */ 891 */
892int omap_gem_rotated_paddr(struct drm_gem_object *obj, uint32_t orient, 892int omap_gem_rotated_dma_addr(struct drm_gem_object *obj, uint32_t orient,
893 int x, int y, dma_addr_t *paddr) 893 int x, int y, dma_addr_t *dma_addr)
894{ 894{
895 struct omap_gem_object *omap_obj = to_omap_bo(obj); 895 struct omap_gem_object *omap_obj = to_omap_bo(obj);
896 int ret = -EINVAL; 896 int ret = -EINVAL;
897 897
898 mutex_lock(&obj->dev->struct_mutex); 898 mutex_lock(&obj->dev->struct_mutex);
899 if ((omap_obj->paddr_cnt > 0) && omap_obj->block && 899 if ((omap_obj->dma_addr_cnt > 0) && omap_obj->block &&
900 (omap_obj->flags & OMAP_BO_TILED)) { 900 (omap_obj->flags & OMAP_BO_TILED)) {
901 *paddr = tiler_tsptr(omap_obj->block, orient, x, y); 901 *dma_addr = tiler_tsptr(omap_obj->block, orient, x, y);
902 ret = 0; 902 ret = 0;
903 } 903 }
904 mutex_unlock(&obj->dev->struct_mutex); 904 mutex_unlock(&obj->dev->struct_mutex);
@@ -1019,7 +1019,7 @@ void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
1019 1019
1020 seq_printf(m, "%08x: %2d (%2d) %08llx %pad (%2d) %p %4d", 1020 seq_printf(m, "%08x: %2d (%2d) %08llx %pad (%2d) %p %4d",
1021 omap_obj->flags, obj->name, kref_read(&obj->refcount), 1021 omap_obj->flags, obj->name, kref_read(&obj->refcount),
1022 off, &omap_obj->paddr, omap_obj->paddr_cnt, 1022 off, &omap_obj->dma_addr, omap_obj->dma_addr_cnt,
1023 omap_obj->vaddr, omap_obj->roll); 1023 omap_obj->vaddr, omap_obj->roll);
1024 1024
1025 if (omap_obj->flags & OMAP_BO_TILED) { 1025 if (omap_obj->flags & OMAP_BO_TILED) {
@@ -1076,7 +1076,7 @@ void omap_gem_free_object(struct drm_gem_object *obj)
1076 /* this means the object is still pinned.. which really should 1076 /* this means the object is still pinned.. which really should
1077 * not happen. I think.. 1077 * not happen. I think..
1078 */ 1078 */
1079 WARN_ON(omap_obj->paddr_cnt > 0); 1079 WARN_ON(omap_obj->dma_addr_cnt > 0);
1080 1080
1081 if (omap_obj->pages) { 1081 if (omap_obj->pages) {
1082 if (omap_obj->flags & OMAP_BO_MEM_DMABUF) 1082 if (omap_obj->flags & OMAP_BO_MEM_DMABUF)
@@ -1087,7 +1087,7 @@ void omap_gem_free_object(struct drm_gem_object *obj)
1087 1087
1088 if (omap_obj->flags & OMAP_BO_MEM_DMA_API) { 1088 if (omap_obj->flags & OMAP_BO_MEM_DMA_API) {
1089 dma_free_wc(dev->dev, obj->size, omap_obj->vaddr, 1089 dma_free_wc(dev->dev, obj->size, omap_obj->vaddr,
1090 omap_obj->paddr); 1090 omap_obj->dma_addr);
1091 } else if (omap_obj->vaddr) { 1091 } else if (omap_obj->vaddr) {
1092 vunmap(omap_obj->vaddr); 1092 vunmap(omap_obj->vaddr);
1093 } else if (obj->import_attach) { 1093 } else if (obj->import_attach) {
@@ -1184,7 +1184,7 @@ struct drm_gem_object *omap_gem_new(struct drm_device *dev,
1184 /* Allocate memory if needed. */ 1184 /* Allocate memory if needed. */
1185 if (flags & OMAP_BO_MEM_DMA_API) { 1185 if (flags & OMAP_BO_MEM_DMA_API) {
1186 omap_obj->vaddr = dma_alloc_wc(dev->dev, size, 1186 omap_obj->vaddr = dma_alloc_wc(dev->dev, size,
1187 &omap_obj->paddr, 1187 &omap_obj->dma_addr,
1188 GFP_KERNEL); 1188 GFP_KERNEL);
1189 if (!omap_obj->vaddr) 1189 if (!omap_obj->vaddr)
1190 goto err_release; 1190 goto err_release;
@@ -1228,7 +1228,7 @@ struct drm_gem_object *omap_gem_new_dmabuf(struct drm_device *dev, size_t size,
1228 omap_obj->sgt = sgt; 1228 omap_obj->sgt = sgt;
1229 1229
1230 if (sgt->orig_nents == 1) { 1230 if (sgt->orig_nents == 1) {
1231 omap_obj->paddr = sg_dma_address(sgt->sgl); 1231 omap_obj->dma_addr = sg_dma_address(sgt->sgl);
1232 } else { 1232 } else {
1233 /* Create pages list from sgt */ 1233 /* Create pages list from sgt */
1234 struct sg_page_iter iter; 1234 struct sg_page_iter iter;
@@ -1335,11 +1335,11 @@ void omap_gem_init(struct drm_device *dev)
1335 i, j, PTR_ERR(block)); 1335 i, j, PTR_ERR(block));
1336 return; 1336 return;
1337 } 1337 }
1338 entry->paddr = tiler_ssptr(block); 1338 entry->dma_addr = tiler_ssptr(block);
1339 entry->block = block; 1339 entry->block = block;
1340 1340
1341 DBG("%d:%d: %dx%d: paddr=%pad stride=%d", i, j, w, h, 1341 DBG("%d:%d: %dx%d: dma_addr=%pad stride=%d", i, j, w, h,
1342 &entry->paddr, 1342 &entry->dma_addr,
1343 usergart[i].stride_pfn << PAGE_SHIFT); 1343 usergart[i].stride_pfn << PAGE_SHIFT);
1344 } 1344 }
1345 } 1345 }