[PATCH 1/8] drm/vram-helper: Tell caller if vmap() returned I/O memory
Thomas Zimmermann
tzimmermann at suse.de
Wed Nov 6 09:31:14 UTC 2019
Returning a flag from kmap() whether mapped pages refer to system or
I/O memory. This prepares for a respective change to vmap().
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
drivers/gpu/drm/ast/ast_mode.c | 6 +++---
drivers/gpu/drm/drm_gem_vram_helper.c | 8 +++++---
drivers/gpu/drm/mgag200/mgag200_cursor.c | 4 ++--
include/drm/drm_gem_vram_helper.h | 2 +-
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index b13eaa2619ab..bcfab641c3a9 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -1165,7 +1165,7 @@ static int ast_show_cursor(struct drm_crtc *crtc, void *src,
u8 jreg;
gbo = ast->cursor.gbo[ast->cursor.next_index];
- dst = drm_gem_vram_vmap(gbo);
+ dst = drm_gem_vram_vmap(gbo, NULL);
if (IS_ERR(dst))
return PTR_ERR(dst);
off = drm_gem_vram_offset(gbo);
@@ -1231,7 +1231,7 @@ static int ast_cursor_set(struct drm_crtc *crtc,
return -ENOENT;
}
gbo = drm_gem_vram_of_gem(obj);
- src = drm_gem_vram_vmap(gbo);
+ src = drm_gem_vram_vmap(gbo, NULL);
if (IS_ERR(src)) {
ret = PTR_ERR(src);
goto err_drm_gem_object_put_unlocked;
@@ -1264,7 +1264,7 @@ static int ast_cursor_move(struct drm_crtc *crtc,
u8 jreg;
gbo = ast->cursor.gbo[ast->cursor.next_index];
- dst = drm_gem_vram_vmap(gbo);
+ dst = drm_gem_vram_vmap(gbo, NULL);
if (IS_ERR(dst))
return PTR_ERR(dst);
diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
index 666cb4c22bb9..05f63f28814d 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -411,6 +411,8 @@ EXPORT_SYMBOL(drm_gem_vram_kunmap);
* drm_gem_vram_vmap() - Pins and maps a GEM VRAM object into kernel address
* space
* @gbo: The GEM VRAM object to map
+ * @is_iomem: returns true if the mapped memory is I/O memory, or false
+ * otherwise; can be NULL
*
* The vmap function pins a GEM VRAM object to its current location, either
* system or video memory, and maps its buffer into kernel address space.
@@ -425,7 +427,7 @@ EXPORT_SYMBOL(drm_gem_vram_kunmap);
* The buffer's virtual address on success, or
* an ERR_PTR()-encoded error code otherwise.
*/
-void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo)
+void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo, bool *is_iomem)
{
int ret;
void *base;
@@ -437,7 +439,7 @@ void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo)
ret = drm_gem_vram_pin_locked(gbo, 0);
if (ret)
goto err_ttm_bo_unreserve;
- base = drm_gem_vram_kmap_locked(gbo, true, NULL);
+ base = drm_gem_vram_kmap_locked(gbo, true, is_iomem);
if (IS_ERR(base)) {
ret = PTR_ERR(base);
goto err_drm_gem_vram_unpin_locked;
@@ -826,7 +828,7 @@ static void *drm_gem_vram_object_vmap(struct drm_gem_object *gem)
struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(gem);
void *base;
- base = drm_gem_vram_vmap(gbo);
+ base = drm_gem_vram_vmap(gbo, NULL);
if (IS_ERR(base))
return NULL;
return base;
diff --git a/drivers/gpu/drm/mgag200/mgag200_cursor.c b/drivers/gpu/drm/mgag200/mgag200_cursor.c
index 79711dbb5b03..765c59e25f3b 100644
--- a/drivers/gpu/drm/mgag200/mgag200_cursor.c
+++ b/drivers/gpu/drm/mgag200/mgag200_cursor.c
@@ -131,7 +131,7 @@ static int mgag200_show_cursor(struct mga_device *mdev, void *src,
WREG8(MGA_CURPOSXH, 0);
return -ENOTSUPP; /* Didn't allocate space for cursors */
}
- dst = drm_gem_vram_vmap(gbo);
+ dst = drm_gem_vram_vmap(gbo, NULL);
if (IS_ERR(dst)) {
ret = PTR_ERR(dst);
dev_err(&dev->pdev->dev,
@@ -282,7 +282,7 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
if (!obj)
return -ENOENT;
gbo = drm_gem_vram_of_gem(obj);
- src = drm_gem_vram_vmap(gbo);
+ src = drm_gem_vram_vmap(gbo, NULL);
if (IS_ERR(src)) {
ret = PTR_ERR(src);
dev_err(&dev->pdev->dev,
diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h
index e040541a105f..ef8f81acff91 100644
--- a/include/drm/drm_gem_vram_helper.h
+++ b/include/drm/drm_gem_vram_helper.h
@@ -106,7 +106,7 @@ int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo);
void *drm_gem_vram_kmap(struct drm_gem_vram_object *gbo, bool map,
bool *is_iomem);
void drm_gem_vram_kunmap(struct drm_gem_vram_object *gbo);
-void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo);
+void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo, bool *is_iomem);
void drm_gem_vram_vunmap(struct drm_gem_vram_object *gbo, void *vaddr);
int drm_gem_vram_fill_create_dumb(struct drm_file *file,
--
2.23.0
More information about the dri-devel
mailing list