mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
dma-buf-map: Rename to iosys-map
Rename struct dma_buf_map to struct iosys_map and corresponding APIs. Over time dma-buf-map grew up to more functionality than the one used by dma-buf: in fact it's just a shim layer to abstract system memory, that can be accessed via regular load and store, from IO memory that needs to be acessed via arch helpers. The idea is to extend this API so it can fulfill other needs, internal to a single driver. Example: in the i915 driver it's desired to share the implementation for integrated graphics, which uses mostly system memory, with discrete graphics, which may need to access IO memory. The conversion was mostly done with the following semantic patch: @r1@ @@ - struct dma_buf_map + struct iosys_map @r2@ @@ ( - DMA_BUF_MAP_INIT_VADDR + IOSYS_MAP_INIT_VADDR | - dma_buf_map_set_vaddr + iosys_map_set_vaddr | - dma_buf_map_set_vaddr_iomem + iosys_map_set_vaddr_iomem | - dma_buf_map_is_equal + iosys_map_is_equal | - dma_buf_map_is_null + iosys_map_is_null | - dma_buf_map_is_set + iosys_map_is_set | - dma_buf_map_clear + iosys_map_clear | - dma_buf_map_memcpy_to + iosys_map_memcpy_to | - dma_buf_map_incr + iosys_map_incr ) @@ @@ - #include <linux/dma-buf-map.h> + #include <linux/iosys-map.h> Then some files had their includes adjusted and some comments were update to remove mentions to dma-buf-map. Since this is not specific to dma-buf anymore, move the documentation to the "Bus-Independent Device Accesses" section. v2: - Squash patches v3: - Fix wrong removal of dma-buf.h from MAINTAINERS - Move documentation from dma-buf.rst to device-io.rst v4: - Change documentation title and level Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Acked-by: Christian König <christian.koenig@amd.com> Acked-by: Sumit Semwal <sumit.semwal@linaro.org> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20220204170541.829227-1-lucas.demarchi@intel.com
This commit is contained in:
@@ -502,6 +502,15 @@ pcim_iomap()
|
||||
Not using these wrappers may make drivers unusable on certain platforms with
|
||||
stricter rules for mapping I/O memory.
|
||||
|
||||
Generalizing Access to System and I/O Memory
|
||||
============================================
|
||||
|
||||
.. kernel-doc:: include/linux/iosys-map.h
|
||||
:doc: overview
|
||||
|
||||
.. kernel-doc:: include/linux/iosys-map.h
|
||||
:internal:
|
||||
|
||||
Public Functions Provided
|
||||
=========================
|
||||
|
||||
|
||||
@@ -128,15 +128,6 @@ Kernel Functions and Structures Reference
|
||||
.. kernel-doc:: include/linux/dma-buf.h
|
||||
:internal:
|
||||
|
||||
Buffer Mapping Helpers
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. kernel-doc:: include/linux/dma-buf-map.h
|
||||
:doc: overview
|
||||
|
||||
.. kernel-doc:: include/linux/dma-buf-map.h
|
||||
:internal:
|
||||
|
||||
Reservation Objects
|
||||
-------------------
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ Convert drivers to use drm_fbdev_generic_setup()
|
||||
Most drivers can use drm_fbdev_generic_setup(). Driver have to implement
|
||||
atomic modesetting and GEM vmap support. Historically, generic fbdev emulation
|
||||
expected the framebuffer in system memory or system-like memory. By employing
|
||||
struct dma_buf_map, drivers with frambuffers in I/O memory can be supported
|
||||
struct iosys_map, drivers with frambuffers in I/O memory can be supported
|
||||
as well.
|
||||
|
||||
Contact: Maintainer of the driver you plan to convert
|
||||
@@ -234,7 +234,7 @@ Reimplement functions in drm_fbdev_fb_ops without fbdev
|
||||
|
||||
A number of callback functions in drm_fbdev_fb_ops could benefit from
|
||||
being rewritten without dependencies on the fbdev module. Some of the
|
||||
helpers could further benefit from using struct dma_buf_map instead of
|
||||
helpers could further benefit from using struct iosys_map instead of
|
||||
raw pointers.
|
||||
|
||||
Contact: Thomas Zimmermann <tzimmermann@suse.de>, Daniel Vetter
|
||||
@@ -434,19 +434,19 @@ Contact: Emil Velikov, respective driver maintainers
|
||||
|
||||
Level: Intermediate
|
||||
|
||||
Use struct dma_buf_map throughout codebase
|
||||
------------------------------------------
|
||||
Use struct iosys_map throughout codebase
|
||||
----------------------------------------
|
||||
|
||||
Pointers to shared device memory are stored in struct dma_buf_map. Each
|
||||
Pointers to shared device memory are stored in struct iosys_map. Each
|
||||
instance knows whether it refers to system or I/O memory. Most of the DRM-wide
|
||||
interface have been converted to use struct dma_buf_map, but implementations
|
||||
interface have been converted to use struct iosys_map, but implementations
|
||||
often still use raw pointers.
|
||||
|
||||
The task is to use struct dma_buf_map where it makes sense.
|
||||
The task is to use struct iosys_map where it makes sense.
|
||||
|
||||
* Memory managers should use struct dma_buf_map for dma-buf-imported buffers.
|
||||
* TTM might benefit from using struct dma_buf_map internally.
|
||||
* Framebuffer copying and blitting helpers should operate on struct dma_buf_map.
|
||||
* Memory managers should use struct iosys_map for dma-buf-imported buffers.
|
||||
* TTM might benefit from using struct iosys_map internally.
|
||||
* Framebuffer copying and blitting helpers should operate on struct iosys_map.
|
||||
|
||||
Contact: Thomas Zimmermann <tzimmermann@suse.de>, Christian König, Daniel Vetter
|
||||
|
||||
|
||||
@@ -5734,7 +5734,7 @@ T: git git://anongit.freedesktop.org/drm/drm-misc
|
||||
F: Documentation/driver-api/dma-buf.rst
|
||||
F: drivers/dma-buf/
|
||||
F: include/linux/*fence.h
|
||||
F: include/linux/dma-buf*
|
||||
F: include/linux/dma-buf.h
|
||||
F: include/linux/dma-resv.h
|
||||
K: \bdma_(?:buf|fence|resv)\b
|
||||
|
||||
@@ -10050,6 +10050,13 @@ F: include/linux/iova.h
|
||||
F: include/linux/of_iommu.h
|
||||
F: include/uapi/linux/iommu.h
|
||||
|
||||
IOSYS-MAP HELPERS
|
||||
M: Thomas Zimmermann <tzimmermann@suse.de>
|
||||
L: dri-devel@lists.freedesktop.org
|
||||
S: Maintained
|
||||
T: git git://anongit.freedesktop.org/drm/drm-misc
|
||||
F: include/linux/iosys-map.h
|
||||
|
||||
IO_URING
|
||||
M: Jens Axboe <axboe@kernel.dk>
|
||||
R: Pavel Begunkov <asml.silence@gmail.com>
|
||||
|
||||
@@ -1047,8 +1047,8 @@ EXPORT_SYMBOL_NS_GPL(dma_buf_move_notify, DMA_BUF);
|
||||
*
|
||||
* Interfaces::
|
||||
*
|
||||
* void \*dma_buf_vmap(struct dma_buf \*dmabuf, struct dma_buf_map \*map)
|
||||
* void dma_buf_vunmap(struct dma_buf \*dmabuf, struct dma_buf_map \*map)
|
||||
* void \*dma_buf_vmap(struct dma_buf \*dmabuf, struct iosys_map \*map)
|
||||
* void dma_buf_vunmap(struct dma_buf \*dmabuf, struct iosys_map \*map)
|
||||
*
|
||||
* The vmap call can fail if there is no vmap support in the exporter, or if
|
||||
* it runs out of vmalloc space. Note that the dma-buf layer keeps a reference
|
||||
@@ -1260,12 +1260,12 @@ EXPORT_SYMBOL_NS_GPL(dma_buf_mmap, DMA_BUF);
|
||||
*
|
||||
* Returns 0 on success, or a negative errno code otherwise.
|
||||
*/
|
||||
int dma_buf_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *map)
|
||||
{
|
||||
struct dma_buf_map ptr;
|
||||
struct iosys_map ptr;
|
||||
int ret = 0;
|
||||
|
||||
dma_buf_map_clear(map);
|
||||
iosys_map_clear(map);
|
||||
|
||||
if (WARN_ON(!dmabuf))
|
||||
return -EINVAL;
|
||||
@@ -1276,12 +1276,12 @@ int dma_buf_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
mutex_lock(&dmabuf->lock);
|
||||
if (dmabuf->vmapping_counter) {
|
||||
dmabuf->vmapping_counter++;
|
||||
BUG_ON(dma_buf_map_is_null(&dmabuf->vmap_ptr));
|
||||
BUG_ON(iosys_map_is_null(&dmabuf->vmap_ptr));
|
||||
*map = dmabuf->vmap_ptr;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
BUG_ON(dma_buf_map_is_set(&dmabuf->vmap_ptr));
|
||||
BUG_ON(iosys_map_is_set(&dmabuf->vmap_ptr));
|
||||
|
||||
ret = dmabuf->ops->vmap(dmabuf, &ptr);
|
||||
if (WARN_ON_ONCE(ret))
|
||||
@@ -1303,20 +1303,20 @@ EXPORT_SYMBOL_NS_GPL(dma_buf_vmap, DMA_BUF);
|
||||
* @dmabuf: [in] buffer to vunmap
|
||||
* @map: [in] vmap pointer to vunmap
|
||||
*/
|
||||
void dma_buf_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
void dma_buf_vunmap(struct dma_buf *dmabuf, struct iosys_map *map)
|
||||
{
|
||||
if (WARN_ON(!dmabuf))
|
||||
return;
|
||||
|
||||
BUG_ON(dma_buf_map_is_null(&dmabuf->vmap_ptr));
|
||||
BUG_ON(iosys_map_is_null(&dmabuf->vmap_ptr));
|
||||
BUG_ON(dmabuf->vmapping_counter == 0);
|
||||
BUG_ON(!dma_buf_map_is_equal(&dmabuf->vmap_ptr, map));
|
||||
BUG_ON(!iosys_map_is_equal(&dmabuf->vmap_ptr, map));
|
||||
|
||||
mutex_lock(&dmabuf->lock);
|
||||
if (--dmabuf->vmapping_counter == 0) {
|
||||
if (dmabuf->ops->vunmap)
|
||||
dmabuf->ops->vunmap(dmabuf, map);
|
||||
dma_buf_map_clear(&dmabuf->vmap_ptr);
|
||||
iosys_map_clear(&dmabuf->vmap_ptr);
|
||||
}
|
||||
mutex_unlock(&dmabuf->lock);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ static void *cma_heap_do_vmap(struct cma_heap_buffer *buffer)
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
static int cma_heap_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
static int cma_heap_vmap(struct dma_buf *dmabuf, struct iosys_map *map)
|
||||
{
|
||||
struct cma_heap_buffer *buffer = dmabuf->priv;
|
||||
void *vaddr;
|
||||
@@ -211,7 +211,7 @@ static int cma_heap_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
mutex_lock(&buffer->lock);
|
||||
if (buffer->vmap_cnt) {
|
||||
buffer->vmap_cnt++;
|
||||
dma_buf_map_set_vaddr(map, buffer->vaddr);
|
||||
iosys_map_set_vaddr(map, buffer->vaddr);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -222,14 +222,14 @@ static int cma_heap_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
}
|
||||
buffer->vaddr = vaddr;
|
||||
buffer->vmap_cnt++;
|
||||
dma_buf_map_set_vaddr(map, buffer->vaddr);
|
||||
iosys_map_set_vaddr(map, buffer->vaddr);
|
||||
out:
|
||||
mutex_unlock(&buffer->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void cma_heap_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
static void cma_heap_vunmap(struct dma_buf *dmabuf, struct iosys_map *map)
|
||||
{
|
||||
struct cma_heap_buffer *buffer = dmabuf->priv;
|
||||
|
||||
@@ -239,7 +239,7 @@ static void cma_heap_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
buffer->vaddr = NULL;
|
||||
}
|
||||
mutex_unlock(&buffer->lock);
|
||||
dma_buf_map_clear(map);
|
||||
iosys_map_clear(map);
|
||||
}
|
||||
|
||||
static void cma_heap_dma_buf_release(struct dma_buf *dmabuf)
|
||||
|
||||
@@ -241,7 +241,7 @@ static void *system_heap_do_vmap(struct system_heap_buffer *buffer)
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
static int system_heap_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
static int system_heap_vmap(struct dma_buf *dmabuf, struct iosys_map *map)
|
||||
{
|
||||
struct system_heap_buffer *buffer = dmabuf->priv;
|
||||
void *vaddr;
|
||||
@@ -250,7 +250,7 @@ static int system_heap_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
mutex_lock(&buffer->lock);
|
||||
if (buffer->vmap_cnt) {
|
||||
buffer->vmap_cnt++;
|
||||
dma_buf_map_set_vaddr(map, buffer->vaddr);
|
||||
iosys_map_set_vaddr(map, buffer->vaddr);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -262,14 +262,14 @@ static int system_heap_vmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
|
||||
buffer->vaddr = vaddr;
|
||||
buffer->vmap_cnt++;
|
||||
dma_buf_map_set_vaddr(map, buffer->vaddr);
|
||||
iosys_map_set_vaddr(map, buffer->vaddr);
|
||||
out:
|
||||
mutex_unlock(&buffer->lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void system_heap_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
static void system_heap_vunmap(struct dma_buf *dmabuf, struct iosys_map *map)
|
||||
{
|
||||
struct system_heap_buffer *buffer = dmabuf->priv;
|
||||
|
||||
@@ -279,7 +279,7 @@ static void system_heap_vunmap(struct dma_buf *dmabuf, struct dma_buf_map *map)
|
||||
buffer->vaddr = NULL;
|
||||
}
|
||||
mutex_unlock(&buffer->lock);
|
||||
dma_buf_map_clear(map);
|
||||
iosys_map_clear(map);
|
||||
}
|
||||
|
||||
static void system_heap_dma_buf_release(struct dma_buf *dmabuf)
|
||||
|
||||
@@ -107,7 +107,7 @@ struct ast_cursor_plane {
|
||||
|
||||
struct {
|
||||
struct drm_gem_vram_object *gbo;
|
||||
struct dma_buf_map map;
|
||||
struct iosys_map map;
|
||||
u64 off;
|
||||
} hwc[AST_DEFAULT_HWC_NUM];
|
||||
|
||||
|
||||
@@ -801,11 +801,11 @@ ast_cursor_plane_helper_atomic_update(struct drm_plane *plane,
|
||||
struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(new_state);
|
||||
struct drm_framebuffer *fb = new_state->fb;
|
||||
struct ast_private *ast = to_ast_private(plane->dev);
|
||||
struct dma_buf_map dst_map =
|
||||
struct iosys_map dst_map =
|
||||
ast_cursor_plane->hwc[ast_cursor_plane->next_hwc_index].map;
|
||||
u64 dst_off =
|
||||
ast_cursor_plane->hwc[ast_cursor_plane->next_hwc_index].off;
|
||||
struct dma_buf_map src_map = shadow_plane_state->data[0];
|
||||
struct iosys_map src_map = shadow_plane_state->data[0];
|
||||
unsigned int offset_x, offset_y;
|
||||
u16 x, y;
|
||||
u8 x_offset, y_offset;
|
||||
@@ -883,7 +883,7 @@ static void ast_cursor_plane_destroy(struct drm_plane *plane)
|
||||
struct ast_cursor_plane *ast_cursor_plane = to_ast_cursor_plane(plane);
|
||||
size_t i;
|
||||
struct drm_gem_vram_object *gbo;
|
||||
struct dma_buf_map map;
|
||||
struct iosys_map map;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ast_cursor_plane->hwc); ++i) {
|
||||
gbo = ast_cursor_plane->hwc[i].gbo;
|
||||
@@ -910,7 +910,7 @@ static int ast_cursor_plane_init(struct ast_private *ast)
|
||||
struct drm_plane *cursor_plane = &ast_cursor_plane->base;
|
||||
size_t size, i;
|
||||
struct drm_gem_vram_object *gbo;
|
||||
struct dma_buf_map map;
|
||||
struct iosys_map map;
|
||||
int ret;
|
||||
s64 off;
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
* Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
|
||||
*/
|
||||
|
||||
#include <linux/dma-buf-map.h>
|
||||
#include <linux/cc_platform.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/cc_platform.h>
|
||||
#include <linux/iosys-map.h>
|
||||
#include <xen/xen.h>
|
||||
|
||||
#include <drm/drm_cache.h>
|
||||
@@ -214,14 +214,14 @@ bool drm_need_swiotlb(int dma_bits)
|
||||
}
|
||||
EXPORT_SYMBOL(drm_need_swiotlb);
|
||||
|
||||
static void memcpy_fallback(struct dma_buf_map *dst,
|
||||
const struct dma_buf_map *src,
|
||||
static void memcpy_fallback(struct iosys_map *dst,
|
||||
const struct iosys_map *src,
|
||||
unsigned long len)
|
||||
{
|
||||
if (!dst->is_iomem && !src->is_iomem) {
|
||||
memcpy(dst->vaddr, src->vaddr, len);
|
||||
} else if (!src->is_iomem) {
|
||||
dma_buf_map_memcpy_to(dst, src->vaddr, len);
|
||||
iosys_map_memcpy_to(dst, src->vaddr, len);
|
||||
} else if (!dst->is_iomem) {
|
||||
memcpy_fromio(dst->vaddr, src->vaddr_iomem, len);
|
||||
} else {
|
||||
@@ -305,8 +305,8 @@ static void __drm_memcpy_from_wc(void *dst, const void *src, unsigned long len)
|
||||
* Tries an arch optimized memcpy for prefetching reading out of a WC region,
|
||||
* and if no such beast is available, falls back to a normal memcpy.
|
||||
*/
|
||||
void drm_memcpy_from_wc(struct dma_buf_map *dst,
|
||||
const struct dma_buf_map *src,
|
||||
void drm_memcpy_from_wc(struct iosys_map *dst,
|
||||
const struct iosys_map *src,
|
||||
unsigned long len)
|
||||
{
|
||||
if (WARN_ON(in_interrupt())) {
|
||||
@@ -343,8 +343,8 @@ void drm_memcpy_init_early(void)
|
||||
static_branch_enable(&has_movntdqa);
|
||||
}
|
||||
#else
|
||||
void drm_memcpy_from_wc(struct dma_buf_map *dst,
|
||||
const struct dma_buf_map *src,
|
||||
void drm_memcpy_from_wc(struct iosys_map *dst,
|
||||
const struct iosys_map *src,
|
||||
unsigned long len)
|
||||
{
|
||||
WARN_ON(in_interrupt());
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright 2018 Noralf Trønnes
|
||||
*/
|
||||
|
||||
#include <linux/dma-buf-map.h>
|
||||
#include <linux/iosys-map.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
@@ -309,9 +309,10 @@ err_delete:
|
||||
* 0 on success, or a negative errno code otherwise.
|
||||
*/
|
||||
int
|
||||
drm_client_buffer_vmap(struct drm_client_buffer *buffer, struct dma_buf_map *map_copy)
|
||||
drm_client_buffer_vmap(struct drm_client_buffer *buffer,
|
||||
struct iosys_map *map_copy)
|
||||
{
|
||||
struct dma_buf_map *map = &buffer->map;
|
||||
struct iosys_map *map = &buffer->map;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
@@ -342,7 +343,7 @@ EXPORT_SYMBOL(drm_client_buffer_vmap);
|
||||
*/
|
||||
void drm_client_buffer_vunmap(struct drm_client_buffer *buffer)
|
||||
{
|
||||
struct dma_buf_map *map = &buffer->map;
|
||||
struct iosys_map *map = &buffer->map;
|
||||
|
||||
drm_gem_vunmap(buffer->gem, map);
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ static void drm_fb_helper_resume_worker(struct work_struct *work)
|
||||
|
||||
static void drm_fb_helper_damage_blit_real(struct drm_fb_helper *fb_helper,
|
||||
struct drm_clip_rect *clip,
|
||||
struct dma_buf_map *dst)
|
||||
struct iosys_map *dst)
|
||||
{
|
||||
struct drm_framebuffer *fb = fb_helper->fb;
|
||||
unsigned int cpp = fb->format->cpp[0];
|
||||
@@ -382,11 +382,11 @@ static void drm_fb_helper_damage_blit_real(struct drm_fb_helper *fb_helper,
|
||||
size_t len = (clip->x2 - clip->x1) * cpp;
|
||||
unsigned int y;
|
||||
|
||||
dma_buf_map_incr(dst, offset); /* go to first pixel within clip rect */
|
||||
iosys_map_incr(dst, offset); /* go to first pixel within clip rect */
|
||||
|
||||
for (y = clip->y1; y < clip->y2; y++) {
|
||||
dma_buf_map_memcpy_to(dst, src, len);
|
||||
dma_buf_map_incr(dst, fb->pitches[0]);
|
||||
iosys_map_memcpy_to(dst, src, len);
|
||||
iosys_map_incr(dst, fb->pitches[0]);
|
||||
src += fb->pitches[0];
|
||||
}
|
||||
}
|
||||
@@ -395,7 +395,7 @@ static int drm_fb_helper_damage_blit(struct drm_fb_helper *fb_helper,
|
||||
struct drm_clip_rect *clip)
|
||||
{
|
||||
struct drm_client_buffer *buffer = fb_helper->buffer;
|
||||
struct dma_buf_map map, dst;
|
||||
struct iosys_map map, dst;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
@@ -2322,7 +2322,7 @@ static int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper,
|
||||
struct drm_framebuffer *fb;
|
||||
struct fb_info *fbi;
|
||||
u32 format;
|
||||
struct dma_buf_map map;
|
||||
struct iosys_map map;
|
||||
int ret;
|
||||
|
||||
drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n",
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/shmem_fs.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <linux/dma-buf-map.h>
|
||||
#include <linux/iosys-map.h>
|
||||
#include <linux/mem_encrypt.h>
|
||||
#include <linux/pagevec.h>
|
||||
|
||||
@@ -1165,7 +1165,7 @@ void drm_gem_unpin(struct drm_gem_object *obj)
|
||||
obj->funcs->unpin(obj);
|
||||
}
|
||||
|
||||
int drm_gem_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)
|
||||
int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -1175,23 +1175,23 @@ int drm_gem_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)
|
||||
ret = obj->funcs->vmap(obj, map);
|
||||
if (ret)
|
||||
return ret;
|
||||
else if (dma_buf_map_is_null(map))
|
||||
else if (iosys_map_is_null(map))
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_gem_vmap);
|
||||
|
||||
void drm_gem_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map)
|
||||
void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map)
|
||||
{
|
||||
if (dma_buf_map_is_null(map))
|
||||
if (iosys_map_is_null(map))
|
||||
return;
|
||||
|
||||
if (obj->funcs->vunmap)
|
||||
obj->funcs->vunmap(obj, map);
|
||||
|
||||
/* Always set the mapping to NULL. Callers may rely on this. */
|
||||
dma_buf_map_clear(map);
|
||||
iosys_map_clear(map);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_gem_vunmap);
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,
|
||||
void drm_gem_cma_free(struct drm_gem_cma_object *cma_obj)
|
||||
{
|
||||
struct drm_gem_object *gem_obj = &cma_obj->base;
|
||||
struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(cma_obj->vaddr);
|
||||
struct iosys_map map = IOSYS_MAP_INIT_VADDR(cma_obj->vaddr);
|
||||
|
||||
if (gem_obj->import_attach) {
|
||||
if (cma_obj->vaddr)
|
||||
@@ -480,9 +480,10 @@ EXPORT_SYMBOL_GPL(drm_gem_cma_prime_import_sg_table);
|
||||
* Returns:
|
||||
* 0 on success, or a negative error code otherwise.
|
||||
*/
|
||||
int drm_gem_cma_vmap(struct drm_gem_cma_object *cma_obj, struct dma_buf_map *map)
|
||||
int drm_gem_cma_vmap(struct drm_gem_cma_object *cma_obj,
|
||||
struct iosys_map *map)
|
||||
{
|
||||
dma_buf_map_set_vaddr(map, cma_obj->vaddr);
|
||||
iosys_map_set_vaddr(map, cma_obj->vaddr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -557,7 +558,7 @@ drm_gem_cma_prime_import_sg_table_vmap(struct drm_device *dev,
|
||||
{
|
||||
struct drm_gem_cma_object *cma_obj;
|
||||
struct drm_gem_object *obj;
|
||||
struct dma_buf_map map;
|
||||
struct iosys_map map;
|
||||
int ret;
|
||||
|
||||
ret = dma_buf_vmap(attach->dmabuf, &map);
|
||||
|
||||
@@ -321,7 +321,7 @@ EXPORT_SYMBOL_GPL(drm_gem_fb_create_with_dirty);
|
||||
* @data: returns the data address for each BO, can be NULL
|
||||
*
|
||||
* This function maps all buffer objects of the given framebuffer into
|
||||
* kernel address space and stores them in struct dma_buf_map. If the
|
||||
* kernel address space and stores them in struct iosys_map. If the
|
||||
* mapping operation fails for one of the BOs, the function unmaps the
|
||||
* already established mappings automatically.
|
||||
*
|
||||
@@ -335,8 +335,8 @@ EXPORT_SYMBOL_GPL(drm_gem_fb_create_with_dirty);
|
||||
* 0 on success, or a negative errno code otherwise.
|
||||
*/
|
||||
int drm_gem_fb_vmap(struct drm_framebuffer *fb,
|
||||
struct dma_buf_map map[static DRM_FORMAT_MAX_PLANES],
|
||||
struct dma_buf_map data[DRM_FORMAT_MAX_PLANES])
|
||||
struct iosys_map map[static DRM_FORMAT_MAX_PLANES],
|
||||
struct iosys_map data[DRM_FORMAT_MAX_PLANES])
|
||||
{
|
||||
struct drm_gem_object *obj;
|
||||
unsigned int i;
|
||||
@@ -345,7 +345,7 @@ int drm_gem_fb_vmap(struct drm_framebuffer *fb,
|
||||
for (i = 0; i < DRM_FORMAT_MAX_PLANES; ++i) {
|
||||
obj = drm_gem_fb_get_obj(fb, i);
|
||||
if (!obj) {
|
||||
dma_buf_map_clear(&map[i]);
|
||||
iosys_map_clear(&map[i]);
|
||||
continue;
|
||||
}
|
||||
ret = drm_gem_vmap(obj, &map[i]);
|
||||
@@ -356,9 +356,9 @@ int drm_gem_fb_vmap(struct drm_framebuffer *fb,
|
||||
if (data) {
|
||||
for (i = 0; i < DRM_FORMAT_MAX_PLANES; ++i) {
|
||||
memcpy(&data[i], &map[i], sizeof(data[i]));
|
||||
if (dma_buf_map_is_null(&data[i]))
|
||||
if (iosys_map_is_null(&data[i]))
|
||||
continue;
|
||||
dma_buf_map_incr(&data[i], fb->offsets[i]);
|
||||
iosys_map_incr(&data[i], fb->offsets[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ EXPORT_SYMBOL(drm_gem_fb_vmap);
|
||||
* See drm_gem_fb_vmap() for more information.
|
||||
*/
|
||||
void drm_gem_fb_vunmap(struct drm_framebuffer *fb,
|
||||
struct dma_buf_map map[static DRM_FORMAT_MAX_PLANES])
|
||||
struct iosys_map map[static DRM_FORMAT_MAX_PLANES])
|
||||
{
|
||||
unsigned int i = DRM_FORMAT_MAX_PLANES;
|
||||
struct drm_gem_object *obj;
|
||||
@@ -396,7 +396,7 @@ void drm_gem_fb_vunmap(struct drm_framebuffer *fb,
|
||||
obj = drm_gem_fb_get_obj(fb, i);
|
||||
if (!obj)
|
||||
continue;
|
||||
if (dma_buf_map_is_null(&map[i]))
|
||||
if (iosys_map_is_null(&map[i]))
|
||||
continue;
|
||||
drm_gem_vunmap(obj, &map[i]);
|
||||
}
|
||||
|
||||
@@ -286,13 +286,14 @@ void drm_gem_shmem_unpin(struct drm_gem_shmem_object *shmem)
|
||||
}
|
||||
EXPORT_SYMBOL(drm_gem_shmem_unpin);
|
||||
|
||||
static int drm_gem_shmem_vmap_locked(struct drm_gem_shmem_object *shmem, struct dma_buf_map *map)
|
||||
static int drm_gem_shmem_vmap_locked(struct drm_gem_shmem_object *shmem,
|
||||
struct iosys_map *map)
|
||||
{
|
||||
struct drm_gem_object *obj = &shmem->base;
|
||||
int ret = 0;
|
||||
|
||||
if (shmem->vmap_use_count++ > 0) {
|
||||
dma_buf_map_set_vaddr(map, shmem->vaddr);
|
||||
iosys_map_set_vaddr(map, shmem->vaddr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -319,7 +320,7 @@ static int drm_gem_shmem_vmap_locked(struct drm_gem_shmem_object *shmem, struct
|
||||
if (!shmem->vaddr)
|
||||
ret = -ENOMEM;
|
||||
else
|
||||
dma_buf_map_set_vaddr(map, shmem->vaddr);
|
||||
iosys_map_set_vaddr(map, shmem->vaddr);
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
@@ -353,7 +354,8 @@ err_zero_use:
|
||||
* Returns:
|
||||
* 0 on success or a negative error code on failure.
|
||||
*/
|
||||
int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, struct dma_buf_map *map)
|
||||
int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem,
|
||||
struct iosys_map *map)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -368,7 +370,7 @@ int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, struct dma_buf_map *m
|
||||
EXPORT_SYMBOL(drm_gem_shmem_vmap);
|
||||
|
||||
static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem,
|
||||
struct dma_buf_map *map)
|
||||
struct iosys_map *map)
|
||||
{
|
||||
struct drm_gem_object *obj = &shmem->base;
|
||||
|
||||
@@ -400,7 +402,8 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem,
|
||||
* This function hides the differences between dma-buf imported and natively
|
||||
* allocated objects.
|
||||
*/
|
||||
void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem, struct dma_buf_map *map)
|
||||
void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem,
|
||||
struct iosys_map *map)
|
||||
{
|
||||
mutex_lock(&shmem->vmap_lock);
|
||||
drm_gem_shmem_vunmap_locked(shmem, map);
|
||||
|
||||
@@ -61,7 +61,7 @@ EXPORT_SYMBOL(drm_gem_ttm_print_info);
|
||||
* 0 on success, or a negative errno code otherwise.
|
||||
*/
|
||||
int drm_gem_ttm_vmap(struct drm_gem_object *gem,
|
||||
struct dma_buf_map *map)
|
||||
struct iosys_map *map)
|
||||
{
|
||||
struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem);
|
||||
|
||||
@@ -78,7 +78,7 @@ EXPORT_SYMBOL(drm_gem_ttm_vmap);
|
||||
* &drm_gem_object_funcs.vmap callback.
|
||||
*/
|
||||
void drm_gem_ttm_vunmap(struct drm_gem_object *gem,
|
||||
struct dma_buf_map *map)
|
||||
struct iosys_map *map)
|
||||
{
|
||||
struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <linux/dma-buf-map.h>
|
||||
#include <linux/iosys-map.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <drm/drm_debugfs.h>
|
||||
@@ -116,7 +116,7 @@ static void drm_gem_vram_cleanup(struct drm_gem_vram_object *gbo)
|
||||
*/
|
||||
|
||||
WARN_ON(gbo->vmap_use_count);
|
||||
WARN_ON(dma_buf_map_is_set(&gbo->map));
|
||||
WARN_ON(iosys_map_is_set(&gbo->map));
|
||||
|
||||
drm_gem_object_release(&gbo->bo.base);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo)
|
||||
EXPORT_SYMBOL(drm_gem_vram_unpin);
|
||||
|
||||
static int drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo,
|
||||
struct dma_buf_map *map)
|
||||
struct iosys_map *map)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -377,7 +377,7 @@ static int drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo,
|
||||
* page mapping might still be around. Only vmap if the there's
|
||||
* no mapping present.
|
||||
*/
|
||||
if (dma_buf_map_is_null(&gbo->map)) {
|
||||
if (iosys_map_is_null(&gbo->map)) {
|
||||
ret = ttm_bo_vmap(&gbo->bo, &gbo->map);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -391,14 +391,14 @@ out:
|
||||
}
|
||||
|
||||
static void drm_gem_vram_kunmap_locked(struct drm_gem_vram_object *gbo,
|
||||
struct dma_buf_map *map)
|
||||
struct iosys_map *map)
|
||||
{
|
||||
struct drm_device *dev = gbo->bo.base.dev;
|
||||
|
||||
if (drm_WARN_ON_ONCE(dev, !gbo->vmap_use_count))
|
||||
return;
|
||||
|
||||
if (drm_WARN_ON_ONCE(dev, !dma_buf_map_is_equal(&gbo->map, map)))
|
||||
if (drm_WARN_ON_ONCE(dev, !iosys_map_is_equal(&gbo->map, map)))
|
||||
return; /* BUG: map not mapped from this BO */
|
||||
|
||||
if (--gbo->vmap_use_count > 0)
|
||||
@@ -428,7 +428,7 @@ static void drm_gem_vram_kunmap_locked(struct drm_gem_vram_object *gbo,
|
||||
* Returns:
|
||||
* 0 on success, or a negative error code otherwise.
|
||||
*/
|
||||
int drm_gem_vram_vmap(struct drm_gem_vram_object *gbo, struct dma_buf_map *map)
|
||||
int drm_gem_vram_vmap(struct drm_gem_vram_object *gbo, struct iosys_map *map)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -463,7 +463,8 @@ EXPORT_SYMBOL(drm_gem_vram_vmap);
|
||||
* A call to drm_gem_vram_vunmap() unmaps and unpins a GEM VRAM buffer. See
|
||||
* the documentation for drm_gem_vram_vmap() for more information.
|
||||
*/
|
||||
void drm_gem_vram_vunmap(struct drm_gem_vram_object *gbo, struct dma_buf_map *map)
|
||||
void drm_gem_vram_vunmap(struct drm_gem_vram_object *gbo,
|
||||
struct iosys_map *map)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -567,7 +568,7 @@ static void drm_gem_vram_bo_driver_move_notify(struct drm_gem_vram_object *gbo)
|
||||
return;
|
||||
|
||||
ttm_bo_vunmap(bo, &gbo->map);
|
||||
dma_buf_map_clear(&gbo->map); /* explicitly clear mapping for next vmap call */
|
||||
iosys_map_clear(&gbo->map); /* explicitly clear mapping for next vmap call */
|
||||
}
|
||||
|
||||
static int drm_gem_vram_bo_driver_move(struct drm_gem_vram_object *gbo,
|
||||
@@ -802,7 +803,8 @@ static void drm_gem_vram_object_unpin(struct drm_gem_object *gem)
|
||||
* Returns:
|
||||
* 0 on success, or a negative error code otherwise.
|
||||
*/
|
||||
static int drm_gem_vram_object_vmap(struct drm_gem_object *gem, struct dma_buf_map *map)
|
||||
static int drm_gem_vram_object_vmap(struct drm_gem_object *gem,
|
||||
struct iosys_map *map)
|
||||
{
|
||||
struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(gem);
|
||||
|
||||
@@ -815,7 +817,8 @@ static int drm_gem_vram_object_vmap(struct drm_gem_object *gem, struct dma_buf_m
|
||||
* @gem: The GEM object to unmap
|
||||
* @map: Kernel virtual address where the VRAM GEM object was mapped
|
||||
*/
|
||||
static void drm_gem_vram_object_vunmap(struct drm_gem_object *gem, struct dma_buf_map *map)
|
||||
static void drm_gem_vram_object_vunmap(struct drm_gem_object *gem,
|
||||
struct iosys_map *map)
|
||||
{
|
||||
struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(gem);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
struct dentry;
|
||||
struct dma_buf;
|
||||
struct dma_buf_map;
|
||||
struct iosys_map;
|
||||
struct drm_connector;
|
||||
struct drm_crtc;
|
||||
struct drm_framebuffer;
|
||||
@@ -174,8 +174,8 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
|
||||
|
||||
int drm_gem_pin(struct drm_gem_object *obj);
|
||||
void drm_gem_unpin(struct drm_gem_object *obj);
|
||||
int drm_gem_vmap(struct drm_gem_object *obj, struct dma_buf_map *map);
|
||||
void drm_gem_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map);
|
||||
int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map);
|
||||
void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map);
|
||||
|
||||
int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev,
|
||||
u32 handle);
|
||||
|
||||
@@ -201,8 +201,8 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
|
||||
struct drm_rect *clip, bool swap)
|
||||
{
|
||||
struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0);
|
||||
struct dma_buf_map map[DRM_FORMAT_MAX_PLANES];
|
||||
struct dma_buf_map data[DRM_FORMAT_MAX_PLANES];
|
||||
struct iosys_map map[DRM_FORMAT_MAX_PLANES];
|
||||
struct iosys_map data[DRM_FORMAT_MAX_PLANES];
|
||||
void *src;
|
||||
int ret;
|
||||
|
||||
@@ -258,8 +258,8 @@ static void mipi_dbi_set_window_address(struct mipi_dbi_dev *dbidev,
|
||||
|
||||
static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
|
||||
{
|
||||
struct dma_buf_map map[DRM_FORMAT_MAX_PLANES];
|
||||
struct dma_buf_map data[DRM_FORMAT_MAX_PLANES];
|
||||
struct iosys_map map[DRM_FORMAT_MAX_PLANES];
|
||||
struct iosys_map data[DRM_FORMAT_MAX_PLANES];
|
||||
struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(fb->dev);
|
||||
unsigned int height = rect->y2 - rect->y1;
|
||||
unsigned int width = rect->x2 - rect->x1;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user