<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/include/media/videobuf2-memops.h, branch linux-6.12.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.12.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.12.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2022-12-06T07:14:31Z</updated>
<entry>
<title>media: videobuf2: revert "get_userptr: buffers are always writable"</title>
<updated>2022-12-06T07:14:31Z</updated>
<author>
<name>Hans Verkuil</name>
<email>hverkuil-cisco@xs4all.nl</email>
</author>
<published>2022-11-28T08:23:56Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e2fc6edd37ba487c64f4dd09f7118b3e45b12d88'/>
<id>urn:sha1:e2fc6edd37ba487c64f4dd09f7118b3e45b12d88</id>
<content type='text'>
Commit 707947247e95 ("media: videobuf2-vmalloc: get_userptr: buffers are
always writable") caused problems in a corner case (passing read-only
shmem memory as a userptr). So revert this patch.

The original problem for which that commit was originally made is
something that I could not reproduce after reverting it. So just go
back to the way it was for many years, and if problems arise in
the future, then another approach should be taken to resolve it.

This patch is based on a patch from Hirokazu.

Fixes: 707947247e95 ("media: videobuf2-vmalloc: get_userptr: buffers are always writable")
Signed-off-by: Hirokazu Honda &lt;hiroh@chromium.org&gt;
Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Acked-by: Tomasz Figa &lt;tfiga@chromium.org&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: videobuf2-vmalloc: get_userptr: buffers are always writable</title>
<updated>2019-05-29T12:05:58Z</updated>
<author>
<name>Hans Verkuil</name>
<email>hverkuil@xs4all.nl</email>
</author>
<published>2019-04-04T13:15:00Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=707947247e9517b94af5661b504467765edf16c3'/>
<id>urn:sha1:707947247e9517b94af5661b504467765edf16c3</id>
<content type='text'>
In vb2_vmalloc_get_userptr() the framevector is created with the
'write' argument set to false when vb2_create_framevec() is called
for OUTPUT buffers. So the pages are marked as read-only.

However, userspace will write to these buffers since it will fill
in the data to output. Since get_userptr is only called if the userptr
of the queued buffer has changed since the last time that same buffer
was queued, this will fail when the buffer contents is updated and the
buffer is queued again.

E.g., userspace fills buffer 1 with the output video and queues it.
The first time get_userptr is called and the pages are grabbed and
pinned in memory and marked read-only. The second time buffer 1 is
filled with different video data and queued again. Since the userptr
hasn't changed the get_userptr() callback isn't called again. Since
the pages were marked as read-only the new contents isn't updated.

Just always call vb2_create_framevec() with FOLL_WRITE to always
allow writing to the buffers.

Using USERPTR streaming with OUTPUT devices is almost never done. And
when it is done it is via v4l2-compliance and a driver like vim2m. But
since v4l2-compliance doesn't actually inspect the capture buffer and
compare it to the original output buffer, this issue was never noticed.

But the vicodec driver actually needs to parse the bitstream in the
OUTPUT buffers and any errors there will be immediately noticed. So
this time v4l2-compliance failed the USERPTR streaming test.

Signed-off-by: Hans Verkuil &lt;hverkuil-cisco@xs4all.nl&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+samsung@kernel.org&gt;
</content>
</entry>
<entry>
<title>media: vb2: add cross references at memops and v4l2 kernel-doc markups</title>
<updated>2017-12-18T17:27:41Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@s-opensource.com</email>
</author>
<published>2017-10-09T09:36:52Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=9fbe71b4d8020221268e5c5b6fe02665b046d199'/>
<id>urn:sha1:9fbe71b4d8020221268e5c5b6fe02665b046d199</id>
<content type='text'>
Add cross-references where needed and add periods at the end of
each kernel-doc paragraph, in order to make it coherent with other
VB2 descriptions.

Acked-by: Sakari Ailus &lt;sakari.ailus@linux.intel.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
</content>
</entry>
<entry>
<title>[media] vb2: convert vb2_vmarea_handler refcount from atomic_t to refcount_t</title>
<updated>2017-04-05T18:31:57Z</updated>
<author>
<name>Elena Reshetova</name>
<email>elena.reshetova@intel.com</email>
</author>
<published>2017-03-06T14:21:00Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=6c4bb65d0be8f34bc0aba982c9a47b19a1eea5ed'/>
<id>urn:sha1:6c4bb65d0be8f34bc0aba982c9a47b19a1eea5ed</id>
<content type='text'>
Use refcount_t to manage the refcount to the memory type specific buffer
videobuf2 buffer implementations. refcount_t is better suitable for the
purpose than atomic_t.

Signed-off-by: Elena Reshetova &lt;elena.reshetova@intel.com&gt;
Signed-off-by: Hans Liljestrand &lt;ishkamiel@gmail.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: David Windsor &lt;dwindsor@gmail.com&gt;
Signed-off-by: Sakari Ailus &lt;sakari.ailus@linux.intel.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@s-opensource.com&gt;
</content>
</entry>
<entry>
<title>[media] media: videobuf2: Replace videobuf2-core with videobuf2-v4l2</title>
<updated>2015-10-01T11:48:18Z</updated>
<author>
<name>Junghak Sung</name>
<email>jh1009.sung@samsung.com</email>
</author>
<published>2015-09-22T13:30:29Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c139990e842d550db2f59bd4f5993bba90f140e0'/>
<id>urn:sha1:c139990e842d550db2f59bd4f5993bba90f140e0</id>
<content type='text'>
Make videobuf2-v4l2 as a wrapper of videobuf2-core for v4l2-use.
And replace videobuf2-core.h with videobuf2-v4l2.h.
This renaming change should be accompanied by the modifications
of all device drivers that include videobuf2-core.h.
It can be done with just running this shell script.

replace()
{
str1=$1
str2=$2
dir=$3
for file in $(find $dir -name *.h -o -name *.c -o -name Makefile)
do
    echo $file
    sed "s/$str1/$str2/g" $file &gt; $file.out
    mv $file.out $file
done
}

replace "videobuf2-core" "videobuf2-v4l2" "include/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/media/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/usb/gadget/"
replace "videobuf2-core" "videobuf2-v4l2" "drivers/staging/media/"

Signed-off-by: Junghak Sung &lt;jh1009.sung@samsung.com&gt;
Signed-off-by: Geunyoung Kim &lt;nenggun.kim@samsung.com&gt;
Acked-by: Seung-Woo Kim &lt;sw0312.kim@samsung.com&gt;
Acked-by: Inki Dae &lt;inki.dae@samsung.com&gt;
Signed-off-by: Hans Verkuil &lt;hans.verkuil@cisco.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'media/v4.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media</title>
<updated>2015-09-11T23:42:39Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2015-09-11T23:42:39Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=06a660ada2064bbdcd09aeb8173f2ad128c71978'/>
<id>urn:sha1:06a660ada2064bbdcd09aeb8173f2ad128c71978</id>
<content type='text'>
Pull media updates from Mauro Carvalho Chehab:
 "A series of patches that move part of the code used to allocate memory
  from the media subsystem to the mm subsystem"

[ The mm parts have been acked by VM people, and the series was
  apparently in -mm for a while   - Linus ]

* tag 'media/v4.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  [media] drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames()
  [media] media: vb2: Remove unused functions
  [media] media: vb2: Convert vb2_dc_get_userptr() to use frame vector
  [media] media: vb2: Convert vb2_vmalloc_get_userptr() to use frame vector
  [media] media: vb2: Convert vb2_dma_sg_get_userptr() to use frame vector
  [media] vb2: Provide helpers for mapping virtual addresses
  [media] media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()
  [media] mm: Provide new get_vaddr_frames() helper
  [media] vb2: Push mmap_sem down to memops
</content>
</entry>
<entry>
<title>[media] videobuf2-memops.h: add to device-drivers DocBook</title>
<updated>2015-08-22T12:05:54Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@osg.samsung.com</email>
</author>
<published>2015-08-22T12:01:58Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b6836a6fbc4b7e35679bf7bb8b54bad294ae0b10'/>
<id>urn:sha1:b6836a6fbc4b7e35679bf7bb8b54bad294ae0b10</id>
<content type='text'>
The comment metadata was wrong:

Warning(.//include/media/videobuf2-memops.h:25): cannot understand function prototype: 'struct vb2_vmarea_handler '
Warning(.//include/media/videobuf2-memops.h): no structured comments found

Fix and add to DocBook.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
Acked-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>[media] media: vb2: Remove unused functions</title>
<updated>2015-08-16T16:15:21Z</updated>
<author>
<name>Jan Kara</name>
<email>jack@suse.cz</email>
</author>
<published>2015-07-13T14:55:50Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=6690c8c78c745239bb1f22b23f3889a0a14c249b'/>
<id>urn:sha1:6690c8c78c745239bb1f22b23f3889a0a14c249b</id>
<content type='text'>
Conversion to the use of pinned pfns made some functions unused. Remove
them. Also there's no need to lock mmap_sem in __buf_prepare() anymore.

Tested-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Hans Verkuil &lt;hans.verkuil@cisco.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
</entry>
<entry>
<title>[media] vb2: Provide helpers for mapping virtual addresses</title>
<updated>2015-08-16T16:10:42Z</updated>
<author>
<name>Jan Kara</name>
<email>jack@suse.cz</email>
</author>
<published>2015-07-13T14:55:46Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=21fb0cb7ec65a40b9f5f7cda59eba0eb2ae76473'/>
<id>urn:sha1:21fb0cb7ec65a40b9f5f7cda59eba0eb2ae76473</id>
<content type='text'>
Provide simple helper functions to map virtual address range into an
array of pfns / pages.

Tested-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Hans Verkuil &lt;hans.verkuil@cisco.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@osg.samsung.com&gt;
</content>
</entry>
<entry>
<title>[media] v4l: vb2-dma-contig: let mmap method to use dma_mmap_coherent call</title>
<updated>2012-11-25T19:20:25Z</updated>
<author>
<name>Marek Szyprowski</name>
<email>m.szyprowski@samsung.com</email>
</author>
<published>2012-06-14T14:32:21Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c60520fa50cd86d64bc8ebb34300ddc4ca91393d'/>
<id>urn:sha1:c60520fa50cd86d64bc8ebb34300ddc4ca91393d</id>
<content type='text'>
Let mmap method to use dma_mmap_coherent call.  Moreover, this patch removes
vb2_mmap_pfn_range from videobuf2 helpers as it was suggested by Laurent
Pinchart.  The function is no longer used in vb2 code.

Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Tomasz Stanislawski &lt;t.stanislaws@samsung.com&gt;
Acked-by: Laurent Pinchart &lt;laurent.pinchart@ideasonboard.com&gt;
Acked-by: Hans Verkuil &lt;hans.verkuil@cisco.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
</content>
</entry>
</feed>
