Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 366642
b: refs/heads/master
c: b6ba205
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 21, 2013
1 parent a99fc2e commit 4679745
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 808d24d6c0b5c30c8f804b251caf476ea63954ef
refs/heads/master: b6ba2057f7823352bbc44ee846faa03b36e8b6ac
2 changes: 1 addition & 1 deletion trunk/drivers/media/v4l2-core/videobuf2-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
/* Allocate memory for all planes in this buffer */
for (plane = 0; plane < vb->num_planes; ++plane) {
mem_priv = call_memop(q, alloc, q->alloc_ctx[plane],
q->plane_sizes[plane]);
q->plane_sizes[plane], q->gfp_flags);
if (IS_ERR_OR_NULL(mem_priv))
goto free;

Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/media/v4l2-core/videobuf2-dma-contig.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static void vb2_dc_put(void *buf_priv)
kfree(buf);
}

static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size)
static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size, gfp_t gfp_flags)
{
struct vb2_dc_conf *conf = alloc_ctx;
struct device *dev = conf->dev;
Expand All @@ -165,7 +165,8 @@ static void *vb2_dc_alloc(void *alloc_ctx, unsigned long size)
/* align image size to PAGE_SIZE */
size = PAGE_ALIGN(size);

buf->vaddr = dma_alloc_coherent(dev, size, &buf->dma_addr, GFP_KERNEL);
buf->vaddr = dma_alloc_coherent(dev, size, &buf->dma_addr,
GFP_KERNEL | gfp_flags);
if (!buf->vaddr) {
dev_err(dev, "dma_alloc_coherent of size %ld failed\n", size);
kfree(buf);
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/media/v4l2-core/videobuf2-dma-sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct vb2_dma_sg_buf {

static void vb2_dma_sg_put(void *buf_priv);

static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size)
static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size, gfp_t gfp_flags)
{
struct vb2_dma_sg_buf *buf;
int i;
Expand All @@ -60,7 +60,8 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size)
goto fail_pages_array_alloc;

for (i = 0; i < buf->sg_desc.num_pages; ++i) {
buf->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN);
buf->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO |
__GFP_NOWARN | gfp_flags);
if (NULL == buf->pages[i])
goto fail_pages_alloc;
sg_set_page(&buf->sg_desc.sglist[i],
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/media/v4l2-core/videobuf2-vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ struct vb2_vmalloc_buf {

static void vb2_vmalloc_put(void *buf_priv);

static void *vb2_vmalloc_alloc(void *alloc_ctx, unsigned long size)
static void *vb2_vmalloc_alloc(void *alloc_ctx, unsigned long size, gfp_t gfp_flags)
{
struct vb2_vmalloc_buf *buf;

buf = kzalloc(sizeof(*buf), GFP_KERNEL);
buf = kzalloc(sizeof(*buf), GFP_KERNEL | gfp_flags);
if (!buf)
return NULL;

Expand Down
10 changes: 8 additions & 2 deletions trunk/include/media/videobuf2-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ struct vb2_fileio_data;
* return NULL on failure or a pointer to allocator private,
* per-buffer data on success; the returned private structure
* will then be passed as buf_priv argument to other ops in this
* structure
* structure. Additional gfp_flags to use when allocating the
* are also passed to this operation. These flags are from the
* gfp_flags field of vb2_queue.
* @put: inform the allocator that the buffer will no longer be used;
* usually will result in the allocator freeing the buffer (if
* no other users of this buffer are present); the buf_priv
Expand Down Expand Up @@ -79,7 +81,7 @@ struct vb2_fileio_data;
* unmap_dmabuf.
*/
struct vb2_mem_ops {
void *(*alloc)(void *alloc_ctx, unsigned long size);
void *(*alloc)(void *alloc_ctx, unsigned long size, gfp_t gfp_flags);
void (*put)(void *buf_priv);
struct dma_buf *(*get_dmabuf)(void *buf_priv);

Expand Down Expand Up @@ -302,6 +304,9 @@ struct v4l2_fh;
* @buf_struct_size: size of the driver-specific buffer structure;
* "0" indicates the driver doesn't want to use a custom buffer
* structure type, so sizeof(struct vb2_buffer) will is used
* @gfp_flags: additional gfp flags used when allocating the buffers.
* Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32
* to force the buffer allocation to a specific memory zone.
*
* @memory: current memory type used
* @bufs: videobuf buffer structures
Expand All @@ -327,6 +332,7 @@ struct vb2_queue {
void *drv_priv;
unsigned int buf_struct_size;
u32 timestamp_type;
gfp_t gfp_flags;

/* private: internal use only */
enum v4l2_memory memory;
Expand Down

0 comments on commit 4679745

Please sign in to comment.