History

iosys-map: Add offset to iosys_map_memcpy_to()

In certain situations it's useful to be able to write to an offset of the mapping. Add a dst_offset to iosys_map_memcpy_to().

Lucas De Marchi committed 4 years ago

Commit cccd73d1 parent 2f8a6693 files · +11 −10Browse files

Unified · Split

3 files
  1. drivers/gpu/drm/drm_cache.c +1 −1
  2. drivers/gpu/drm/drm_fb_helper.c +1 −1
  3. include/linux/iosys-map.h +9 −8
drivers/gpu/drm/drm_cache.c+1−1
@@ -221,7 +221,7 @@ static void memcpy_fallback(struct iosys_map *dst, · 220 unmodified lines
221 if (!dst->is_iomem && !src->is_iomem) {221 if (!dst->is_iomem && !src->is_iomem) {
222 memcpy(dst->vaddr, src->vaddr, len);222 memcpy(dst->vaddr, src->vaddr, len);
223 } else if (!src->is_iomem) {223 } else if (!src->is_iomem) {
224 iosys_map_memcpy_to(dst, src->vaddr, len);224 iosys_map_memcpy_to(dst, 0, src->vaddr, len);
225 } else if (!dst->is_iomem) {225 } else if (!dst->is_iomem) {
226 memcpy_fromio(dst->vaddr, src->vaddr_iomem, len);226 memcpy_fromio(dst->vaddr, src->vaddr_iomem, len);
227 } else {227 } else {
drivers/gpu/drm/drm_fb_helper.c+1−1
@@ -385,7 +385,7 @@ static void drm_fb_helper_damage_blit_real(struct drm_fb_helper *fb_helper, · 384 unmodified lines
385 iosys_map_incr(dst, offset); /* go to first pixel within clip rect */385 iosys_map_incr(dst, offset); /* go to first pixel within clip rect */
386 386
387 for (y = clip->y1; y < clip->y2; y++) {387 for (y = clip->y1; y < clip->y2; y++) {
388 iosys_map_memcpy_to(dst, src, len);388 iosys_map_memcpy_to(dst, 0, src, len);
389 iosys_map_incr(dst, fb->pitches[0]);389 iosys_map_incr(dst, fb->pitches[0]);
390 src += fb->pitches[0];390 src += fb->pitches[0];
391 }391 }
include/linux/iosys-map.h+9−8
@@ -220,22 +220,23 @@ static inline void iosys_map_clear(struct iosys_map *map) · 219 unmodified lines
220}220}
221 221
222/**222/**
223 * iosys_map_memcpy_to - Memcpy into iosys mapping223 * iosys_map_memcpy_to - Memcpy into offset of iosys_map
224 * @dst: The iosys_map structure224 * @dst: The iosys_map structure
225 * @dst_offset: The offset from which to copy
225 * @src: The source buffer226 * @src: The source buffer
226 * @len: The number of byte in src227 * @len: The number of byte in src
227 *228 *
228 * Copies data into a iosys mapping. The source buffer is in system229 * Copies data into a iosys_map with an offset. The source buffer is in
229 * memory. Depending on the buffer's location, the helper picks the correct230 * system memory. Depending on the buffer's location, the helper picks the
230 * method of accessing the memory.231 * correct method of accessing the memory.
231 */232 */
232static inline void iosys_map_memcpy_to(struct iosys_map *dst, const void *src,233static inline void iosys_map_memcpy_to(struct iosys_map *dst, size_t dst_offset,
233 size_t len)234 const void *src, size_t len)
234{235{
235 if (dst->is_iomem)236 if (dst->is_iomem)
236 memcpy_toio(dst->vaddr_iomem, src, len);237 memcpy_toio(dst->vaddr_iomem + dst_offset, src, len);
237 else238 else
238 memcpy(dst->vaddr, src, len);239 memcpy(dst->vaddr + dst_offset, src, len);
239}240}
240 241
241/**242/**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t