All of lore.kernel.org
 help / color / mirror / Atom feed
* (no subject)
@ 2010-05-19 16:44 asheeshb
  2010-05-19 16:44 ` [PATCH 1/7] changed driver for MMAP buffer asheeshb
  2010-05-20 17:51 ` Karicheri, Muralidharan
  0 siblings, 2 replies; 11+ messages in thread
From: asheeshb @ 2010-05-19 16:44 UTC (permalink / raw)
  To: linux-media

The patches will be applied to the davinci tree the ../drivers/media/video/davinci and will affect the both the capture and display drivers. Apply these patches to the git kernel.
>From asheeshb@ti.com # This line is ignored.
GIT:
From: asheeshb@ti.com
Subject: 
In-Reply-To: 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/7] changed driver for MMAP buffer
  2010-05-19 16:44 asheeshb
@ 2010-05-19 16:44 ` asheeshb
  2010-05-19 16:44   ` [PATCH 2/7] Patch for adding imagesize corrected for MMAP buffers asheeshb
  2010-05-23 12:07   ` [PATCH 1/7] changed driver for MMAP buffer Hans Verkuil
  2010-05-20 17:51 ` Karicheri, Muralidharan
  1 sibling, 2 replies; 11+ messages in thread
From: asheeshb @ 2010-05-19 16:44 UTC (permalink / raw)
  To: linux-media; +Cc: Asheesh Bhardwaj

From: Asheesh Bhardwaj <asheeshb@ti.com>

---
 drivers/media/video/davinci/vpif_display.c |   59 ++++++++++++++++++++++++++++
 drivers/media/video/davinci/vpif_display.h |    1 +
 2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c
index f8d0e72..e10f7c5 100644
--- a/drivers/media/video/davinci/vpif_display.c
+++ b/drivers/media/video/davinci/vpif_display.c
@@ -62,18 +62,24 @@ static u32 ch2_numbuffers = 3;
 static u32 ch3_numbuffers = 3;
 static u32 ch2_bufsize = 1920 * 1080 * 2;
 static u32 ch3_bufsize = 720 * 576 * 2;
+static u32 cont_bufoffset = 0;
+static u32 cont_bufsize = 0;
 
 module_param(debug, int, 0644);
 module_param(ch2_numbuffers, uint, S_IRUGO);
 module_param(ch3_numbuffers, uint, S_IRUGO);
 module_param(ch2_bufsize, uint, S_IRUGO);
 module_param(ch3_bufsize, uint, S_IRUGO);
+module_param(cont_bufoffset, uint, S_IRUGO);
+module_param(cont_bufsize, uint, S_IRUGO);
 
 MODULE_PARM_DESC(debug, "Debug level 0-1");
 MODULE_PARM_DESC(ch2_numbuffers, "Channel2 buffer count (default:3)");
 MODULE_PARM_DESC(ch3_numbuffers, "Channel3 buffer count (default:3)");
 MODULE_PARM_DESC(ch2_bufsize, "Channel2 buffer size (default:1920 x 1080 x 2)");
 MODULE_PARM_DESC(ch3_bufsize, "Channel3 buffer size (default:720 x 576 x 2)");
+MODULE_PARM_DESC(cont_bufoffset,"Display offset(default 0)");
+MODULE_PARM_DESC(cont_bufsize,"Display buffer size(default 0)");
 
 static struct vpif_config_params config_params = {
 	.min_numbuffers		= 3,
@@ -184,6 +190,23 @@ static int vpif_buffer_setup(struct videobuf_queue *q, unsigned int *count,
 		return 0;
 
 	*size = config_params.channel_bufsize[ch->channel_id];
+ 	
+        /*Checking if the buffer size exceeds the available buffer*/
+        /*ycmux_mode = 0 means 1 channel mode HD and ycmuxmode = 1 means 2 channels mode SD */
+        if (ch->vpifparams.std_info.ycmux_mode == 0) {
+            if (config_params.video_limit[ch->channel_id]) {
+		while (*size * *count > (config_params.video_limit[0] 
+                         + config_params.video_limit[1]))
+			(*count)--;
+            }
+        }
+        else {
+             if (config_params.video_limit[ch->channel_id]) {
+		while (*size * *count > config_params.video_limit[ch->channel_id])
+			(*count)--;
+            }
+        }
+
 	if (*count < config_params.min_numbuffers)
 		*count = config_params.min_numbuffers;
 
@@ -1404,6 +1427,8 @@ static __init int vpif_probe(struct platform_device *pdev)
 	struct video_device *vfd;
 	struct resource *res;
 	int subdev_count;
+        unsigned long phys_end_kernel;
+        size_t size;
 
 	vpif_dev = &pdev->dev;
 
@@ -1466,6 +1491,40 @@ static __init int vpif_probe(struct platform_device *pdev)
 		ch->video_dev = vfd;
 	}
 
+        /* Initialising the memory from the input arguments file for contiguous memory buffers and avoid defragmentation */
+       
+        if(cont_bufsize) {
+	    /* attempt to determine the end of Linux kernel memory */
+            phys_end_kernel = virt_to_phys((void *)PAGE_OFFSET) +
+                   (num_physpages << PAGE_SHIFT);
+            phys_end_kernel += cont_bufoffset; 
+            size = cont_bufsize;
+            
+	    err = dma_declare_coherent_memory(&pdev->dev, phys_end_kernel,
+		  phys_end_kernel,
+		  size,
+	          DMA_MEMORY_MAP |
+		  DMA_MEMORY_EXCLUSIVE);
+
+		if (!err) {
+			dev_err(&pdev->dev, "Unable to declare MMAP memory.\n");
+			err = -ENOMEM;
+			goto probe_out;
+         } 
+
+       
+        /*The resources are divided into two equal memory and when we have HD output we can add them together*/	
+         for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
+		   ch = vpif_obj.dev[j];
+		   ch->channel_id = j;
+        	   config_params.video_limit[ch->channel_id] = 0; /* only enabled if second resource exists */
+                   if(cont_bufsize) {
+                          config_params.video_limit[ch->channel_id] = size/2;
+                    }
+            }
+        }
+
+
 	for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
 		ch = vpif_obj.dev[j];
 		/* Initialize field of the channel objects */
diff --git a/drivers/media/video/davinci/vpif_display.h b/drivers/media/video/davinci/vpif_display.h
index ffa237b..fdef83d 100644
--- a/drivers/media/video/davinci/vpif_display.h
+++ b/drivers/media/video/davinci/vpif_display.h
@@ -162,6 +162,7 @@ struct vpif_config_params {
 	u32 channel_bufsize[VPIF_DISPLAY_NUM_CHANNELS];
 	u8 numbuffers[VPIF_DISPLAY_NUM_CHANNELS];
 	u8 min_numbuffers;
+	u32 video_limit[VPIF_DISPLAY_NUM_CHANNELS];
 };
 
 /* Struct which keeps track of the line numbers for the sliced vbi service */
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/7] Patch for adding imagesize corrected for MMAP buffers
  2010-05-19 16:44 ` [PATCH 1/7] changed driver for MMAP buffer asheeshb
@ 2010-05-19 16:44   ` asheeshb
  2010-05-19 16:44     ` [PATCH 3/7] Patch for capture driver MMAP buffer allocation asheeshb
  2010-05-23 12:07   ` [PATCH 1/7] changed driver for MMAP buffer Hans Verkuil
  1 sibling, 1 reply; 11+ messages in thread
From: asheeshb @ 2010-05-19 16:44 UTC (permalink / raw)
  To: linux-media; +Cc: Asheesh Bhardwaj

From: Asheesh Bhardwaj <asheeshb@ti.com>

Behave the same as user allocated buffers. The sizeimage parameter is giving
the wrong size from the driver and it has to be corrected in S_FMT and TRY_FMT
ioctls.
---
 drivers/media/video/davinci/vpif_display.c |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c
index e10f7c5..a206980 100644
--- a/drivers/media/video/davinci/vpif_display.c
+++ b/drivers/media/video/davinci/vpif_display.c
@@ -151,7 +151,8 @@ static int vpif_buffer_prepare(struct videobuf_queue *q,
 	if (VIDEOBUF_NEEDS_INIT == vb->state) {
 		vb->width	= common->width;
 		vb->height	= common->height;
-		vb->size	= vb->width * vb->height;
+		/* Updating the size based on the application requirement */
+                vb->size        = common->fmt.fmt.pix.sizeimage;
 		vb->field	= field;
 
 		ret = videobuf_iolock(q, vb, NULL);
@@ -440,11 +441,8 @@ static void vpif_calculate_offsets(struct channel_obj *ch)
 	} else {
 		vid_ch->buf_field = common->fmt.fmt.pix.field;
 	}
-
-	if (V4L2_MEMORY_USERPTR == common->memory)
-		sizeimage = common->fmt.fmt.pix.sizeimage;
-	else
-		sizeimage = config_params.channel_bufsize[ch->channel_id];
+	
+        sizeimage = common->fmt.fmt.pix.sizeimage;
 
 	hpitch = common->fmt.fmt.pix.bytesperline;
 	vpitch = sizeimage / (hpitch * 2);
@@ -520,11 +518,9 @@ static int vpif_check_format(struct channel_obj *ch,
 
 	if (pixfmt->bytesperline <= 0)
 		goto invalid_pitch_exit;
-
-	if (V4L2_MEMORY_USERPTR == common->memory)
-		sizeimage = pixfmt->sizeimage;
-	else
-		sizeimage = config_params.channel_bufsize[ch->channel_id];
+	
+        /* sizeimage is same for both MMAP and user allocated buffers, the size is updated for mmap buffers*/
+        sizeimage = pixfmt->sizeimage;
 
 	if (vpif_get_std_info(ch)) {
 		vpif_err("Error getting the standard info\n");
@@ -1067,10 +1063,7 @@ static int vpif_streamon(struct file *file, void *priv,
 		goto streamon_exit;
 	}
 
-	if (common->memory == V4L2_MEMORY_MMAP)
-		sizeimage = config_params.channel_bufsize[ch->channel_id];
-	else
-		sizeimage = common->fmt.fmt.pix.sizeimage;
+	sizeimage = common->fmt.fmt.pix.sizeimage;
 
 	if ((ch->vpifparams.std_info.width *
 		ch->vpifparams.std_info.height * 2) >
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/7] Patch for capture driver MMAP buffer allocation.
  2010-05-19 16:44   ` [PATCH 2/7] Patch for adding imagesize corrected for MMAP buffers asheeshb
@ 2010-05-19 16:44     ` asheeshb
  2010-05-19 16:44       ` [PATCH 4/7] Change vpif capture driver to get the right size image for the MMAP buffers asheeshb
  0 siblings, 1 reply; 11+ messages in thread
From: asheeshb @ 2010-05-19 16:44 UTC (permalink / raw)
  To: linux-media; +Cc: Asheesh Bhardwaj

From: Asheesh Bhardwaj <asheeshb@ti.com>

The user can specify the size of the buffers with an offset from the kernel
images.
---
 drivers/media/video/davinci/vpif_capture.c |   56 +++++++++++++++++++++++++++-
 drivers/media/video/davinci/vpif_capture.h |    2 +
 2 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c
index b4b5905..9ba015d 100644
--- a/drivers/media/video/davinci/vpif_capture.c
+++ b/drivers/media/video/davinci/vpif_capture.c
@@ -53,18 +53,24 @@ static u32 ch0_numbuffers = 3;
 static u32 ch1_numbuffers = 3;
 static u32 ch0_bufsize = 1920 * 1080 * 2;
 static u32 ch1_bufsize = 720 * 576 * 2;
+static u32 cont_bufoffset = 0;
+static u32 cont_bufsize = 0;
 
 module_param(debug, int, 0644);
 module_param(ch0_numbuffers, uint, S_IRUGO);
 module_param(ch1_numbuffers, uint, S_IRUGO);
 module_param(ch0_bufsize, uint, S_IRUGO);
 module_param(ch1_bufsize, uint, S_IRUGO);
+module_param(cont_bufoffset, uint, S_IRUGO);
+module_param(cont_bufsize, uint, S_IRUGO);
 
 MODULE_PARM_DESC(debug, "Debug level 0-1");
 MODULE_PARM_DESC(ch2_numbuffers, "Channel0 buffer count (default:3)");
 MODULE_PARM_DESC(ch3_numbuffers, "Channel1 buffer count (default:3)");
 MODULE_PARM_DESC(ch2_bufsize, "Channel0 buffer size (default:1920 x 1080 x 2)");
 MODULE_PARM_DESC(ch3_bufsize, "Channel1 buffer size (default:720 x 576 x 2)");
+MODULE_PARM_DESC(cont_bufoffset,"Capture buffer offset(default 0)");
+MODULE_PARM_DESC(cont_bufsize,"Capture buffer size(default 0)");
 
 static struct vpif_config_params config_params = {
 	.min_numbuffers = 3,
@@ -187,10 +193,27 @@ static int vpif_buffer_setup(struct videobuf_queue *q, unsigned int *count,
 
 	/* Calculate the size of the buffer */
 	*size = config_params.channel_bufsize[ch->channel_id];
+        
+        /*Checking if the buffer size exceeds the available buffer*/
+        /*ycmux_mode = 0 means 1 channel mode HD and ycmuxmode = 1 means 2 channels mode SD */
+        if (ch->vpifparams.std_info.ycmux_mode == 0) {
+            if (config_params.video_limit[ch->channel_id]) {
+		while (*size * *count > (config_params.video_limit[0] 
+                         + config_params.video_limit[1]))
+			(*count)--;
+            }
+        }
+        else {
+             if (config_params.video_limit[ch->channel_id]) {
+		while (*size * *count > config_params.video_limit[ch->channel_id])
+			(*count)--;
+            }
+        }
 
 	if (*count < config_params.min_numbuffers)
 		*count = config_params.min_numbuffers;
-	return 0;
+	
+        return 0;
 }
 
 /**
@@ -1892,6 +1915,8 @@ static __init int vpif_probe(struct platform_device *pdev)
 	struct video_device *vfd;
 	struct resource *res;
 	int subdev_count;
+        unsigned long phys_end_kernel;
+        size_t size;
 
 	vpif_dev = &pdev->dev;
 
@@ -1941,6 +1966,35 @@ static __init int vpif_probe(struct platform_device *pdev)
 		/* Set video_dev to the video device */
 		ch->video_dev = vfd;
 	}
+       
+        /* Initialising the memory from the bootargs for contiguous memory buffers and avoid defragmentation */
+        if(cont_bufsize) {
+            /* attempt to determine the end of Linux kernel memory */
+            phys_end_kernel = virt_to_phys((void *)PAGE_OFFSET) +
+                   (num_physpages << PAGE_SHIFT);
+            size = cont_bufsize;
+            phys_end_kernel += cont_bufoffset; 
+            err = dma_declare_coherent_memory(&pdev->dev, phys_end_kernel,
+		  phys_end_kernel,
+		  size,
+		  DMA_MEMORY_MAP |
+         	  DMA_MEMORY_EXCLUSIVE);
+	if (!err) {
+		dev_err(&pdev->dev, "Unable to declare MMAP memory.\n");
+		err = -ENOMEM;
+		goto probe_out;
+         } 
+        
+        /*The resources are divided into two equal memory and when we have HD output we can add them together*/	
+         for (j = 0; j < VPIF_CAPTURE_MAX_DEVICES; j++) {
+		   ch = vpif_obj.dev[j];
+		   ch->channel_id = j;
+        	   config_params.video_limit[ch->channel_id] = 0; /* only enabled if second resource exists */
+                   if(cont_bufsize) {
+                          config_params.video_limit[ch->channel_id] = size/2;
+                    }
+            }
+        }
 
 	for (j = 0; j < VPIF_CAPTURE_MAX_DEVICES; j++) {
 		ch = vpif_obj.dev[j];
diff --git a/drivers/media/video/davinci/vpif_capture.h b/drivers/media/video/davinci/vpif_capture.h
index 4e12ec8..b526887 100644
--- a/drivers/media/video/davinci/vpif_capture.h
+++ b/drivers/media/video/davinci/vpif_capture.h
@@ -155,6 +155,8 @@ struct vpif_config_params {
 	u32 channel_bufsize[VPIF_CAPTURE_NUM_CHANNELS];
 	u8 default_device[VPIF_CAPTURE_NUM_CHANNELS];
 	u8 max_device_type;
+        /* Used for limiting the video buffers when we allocate memory*/
+        u32 video_limit[VPIF_CAPTURE_NUM_CHANNELS];
 };
 /* Struct which keeps track of the line numbers for the sliced vbi service */
 struct vpif_service_line {
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/7] Change vpif capture driver to get the right size image for the MMAP buffers
  2010-05-19 16:44     ` [PATCH 3/7] Patch for capture driver MMAP buffer allocation asheeshb
@ 2010-05-19 16:44       ` asheeshb
  2010-05-19 16:44         ` [PATCH 5/7] DM365 MMAP buffer allocation for display driver asheeshb
  0 siblings, 1 reply; 11+ messages in thread
From: asheeshb @ 2010-05-19 16:44 UTC (permalink / raw)
  To: linux-media; +Cc: Asheesh Bhardwaj

From: Asheesh Bhardwaj <asheeshb@ti.com>

---
 drivers/media/video/davinci/vpif_capture.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c
index 9ba015d..d18a378 100644
--- a/drivers/media/video/davinci/vpif_capture.c
+++ b/drivers/media/video/davinci/vpif_capture.c
@@ -142,7 +142,7 @@ static int vpif_buffer_prepare(struct videobuf_queue *q,
 	if (VIDEOBUF_NEEDS_INIT == vb->state) {
 		vb->width = common->width;
 		vb->height = common->height;
-		vb->size = vb->width * vb->height;
+		vb->size = common->fmt.fmt.pix.sizeimage;
 		vb->field = field;
 
 		ret = videobuf_iolock(q, vb, NULL);
@@ -469,10 +469,8 @@ static void vpif_calculate_offsets(struct channel_obj *ch)
 	} else
 		vid_ch->buf_field = common->fmt.fmt.pix.field;
 
-	if (V4L2_MEMORY_USERPTR == common->memory)
-		sizeimage = common->fmt.fmt.pix.sizeimage;
-	else
-		sizeimage = config_params.channel_bufsize[ch->channel_id];
+	/*sizeimage is same for both user and MMAP allocated buffers*/
+        sizeimage = common->fmt.fmt.pix.sizeimage;
 
 	hpitch = common->fmt.fmt.pix.bytesperline;
 	vpitch = sizeimage / (hpitch * 2);
@@ -630,10 +628,7 @@ static int vpif_check_format(struct channel_obj *ch,
 		goto exit;
 	}
 
-	if (V4L2_MEMORY_USERPTR == common->memory)
-		sizeimage = pixfmt->sizeimage;
-	else
-		sizeimage = config_params.channel_bufsize[ch->channel_id];
+	sizeimage = pixfmt->sizeimage;
 
 	vpitch = sizeimage / (hpitch * 2);
 
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/7] DM365 MMAP buffer allocation for display driver
  2010-05-19 16:44       ` [PATCH 4/7] Change vpif capture driver to get the right size image for the MMAP buffers asheeshb
@ 2010-05-19 16:44         ` asheeshb
  2010-05-19 16:44           ` [PATCH 6/7] DM365 capture MMAP buffer allocation asheeshb
  0 siblings, 1 reply; 11+ messages in thread
From: asheeshb @ 2010-05-19 16:44 UTC (permalink / raw)
  To: linux-media; +Cc: Asheesh Bhardwaj

From: Asheesh Bhardwaj <asheeshb@ti.com>

---
 drivers/media/video/davinci/davinci_display.c |   79 ++++++++++++++++++++++++-
 include/media/davinci/davinci_display.h       |    1 +
 2 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/davinci/davinci_display.c b/drivers/media/video/davinci/davinci_display.c
index 4c4efef..8eb98c4 100644
--- a/drivers/media/video/davinci/davinci_display.c
+++ b/drivers/media/video/davinci/davinci_display.c
@@ -45,11 +45,15 @@
 
 static u32 video2_numbuffers = 3;
 static u32 video3_numbuffers = 3;
+static u32 cont2_bufoffset = 0;
+static u32 cont2_bufsize = 0;
+static u32 cont3_bufoffset = 0;
+static u32 cont3_bufsize = 0;
 
 #define DAVINCI_DISPLAY_HD_BUF_SIZE (1280*720*2)
 #define DAVINCI_DISPLAY_SD_BUF_SIZE (720*576*2)
 
-static u32 video2_bufsize = DAVINCI_DISPLAY_SD_BUF_SIZE;
+static u32 video2_bufsize = DAVINCI_DISPLAY_HD_BUF_SIZE;
 static u32 video3_bufsize = DAVINCI_DISPLAY_SD_BUF_SIZE;
 
 module_param(video2_numbuffers, uint, S_IRUGO);
@@ -57,15 +61,24 @@ module_param(video3_numbuffers, uint, S_IRUGO);
 
 module_param(video2_bufsize, uint, S_IRUGO);
 module_param(video3_bufsize, uint, S_IRUGO);
+module_param(cont2_bufoffset, uint, S_IRUGO);
+module_param(cont2_bufsize, uint, S_IRUGO);
+module_param(cont3_bufoffset, uint, S_IRUGO);
+module_param(cont3_bufsize, uint, S_IRUGO);
+
+MODULE_PARM_DESC(cont2_bufoffset,"Display offset(default 0)");
+MODULE_PARM_DESC(cont2_bufsize,"Display buffer size(default 0)");
+MODULE_PARM_DESC(cont3_bufoffset,"Display offset(default 0)");
+MODULE_PARM_DESC(cont3_bufsize,"Display buffer size(default 0)");
 
 #define DAVINCI_DEFAULT_NUM_BUFS 3
 static struct buf_config_params display_buf_config_params = {
 	.min_numbuffers = DAVINCI_DEFAULT_NUM_BUFS,
 	.numbuffers[0] = DAVINCI_DEFAULT_NUM_BUFS,
 	.numbuffers[1] = DAVINCI_DEFAULT_NUM_BUFS,
-	.min_bufsize[0] = DAVINCI_DISPLAY_SD_BUF_SIZE,
+	.min_bufsize[0] = DAVINCI_DISPLAY_HD_BUF_SIZE,
 	.min_bufsize[1] = DAVINCI_DISPLAY_SD_BUF_SIZE,
-	.layer_bufsize[0] = DAVINCI_DISPLAY_SD_BUF_SIZE,
+	.layer_bufsize[0] = DAVINCI_DISPLAY_HD_BUF_SIZE,
 	.layer_bufsize[1] = DAVINCI_DISPLAY_SD_BUF_SIZE,
 };
 
@@ -167,10 +180,17 @@ static int davinci_buffer_setup(struct videobuf_queue *q, unsigned int *count,
 		if (*size > buf_size)
 			*size = buf_size;
 
+        /*Checking if the buffer size exceeds the available buffer*/
+	if (display_buf_config_params.video_limit[layer->device_id]) {
+		while (*size * *count > ( display_buf_config_params.video_limit[layer->device_id]))
+			(*count)--;
+        }
+      
 	/* Store number of buffers allocated in numbuffer member */
 	if (*count < display_buf_config_params.min_numbuffers)
 		*count = layer->numbuffers = display_buf_config_params.numbuffers[layer->device_id];
 	dev_dbg(davinci_display_dev, "</davinci_buffer_setup>\n");
+
 	return 0;
 }
 
@@ -1577,6 +1597,8 @@ static __init int davinci_probe(struct device *device)
 	struct video_device *vbd = NULL;
 	struct display_obj *layer = NULL;
 	struct platform_device *pdev;
+	unsigned long phys_end_kernel;
+	size_t size;
 
 	davinci_display_dev = device;
 
@@ -1588,6 +1610,51 @@ static __init int davinci_probe(struct device *device)
 		dev_err(davinci_display_dev, "probed for an unknown device\n");
 		return -ENODEV;
 	}
+
+       /* Initialising the memory from the input arguments file for contiguous memory buffers and avoid defragmentation */
+       
+	if(cont2_bufsize) {
+		/* attempt to determine the end of Linux kernel memory */
+		phys_end_kernel = virt_to_phys((void *)PAGE_OFFSET) +
+			(num_physpages << PAGE_SHIFT);
+		phys_end_kernel += cont2_bufoffset; 
+		size = cont2_bufsize;
+                       
+		err = dma_declare_coherent_memory(&pdev->dev, phys_end_kernel,
+			phys_end_kernel,
+			size,
+			DMA_MEMORY_MAP |
+			DMA_MEMORY_EXCLUSIVE);
+
+		if (!err) {
+			dev_err(&pdev->dev, "Unable to declare MMAP memory.\n");
+			err = -ENOMEM;
+			goto probe_out;
+		display_buf_config_params.video_limit[DAVINCI_DISPLAY_DEVICE_0] = size;
+		}
+	} 
+	
+	if(cont3_bufsize) {
+	    /* attempt to determine the end of Linux kernel memory */
+		phys_end_kernel = virt_to_phys((void *)PAGE_OFFSET) +
+			(num_physpages << PAGE_SHIFT);
+			phys_end_kernel += cont3_bufoffset; 
+			size = cont3_bufsize;
+                       
+		err = dma_declare_coherent_memory(&pdev->dev, phys_end_kernel,
+			phys_end_kernel,
+			size,
+			DMA_MEMORY_MAP |
+			DMA_MEMORY_EXCLUSIVE);
+
+		if (!err) {
+			dev_err(&pdev->dev, "Unable to declare MMAP memory.\n");
+			err = -ENOMEM;
+			goto probe_out;
+		display_buf_config_params.video_limit[DAVINCI_DISPLAY_DEVICE_1] = size;
+		} 
+	}
+
 	for (i = 0; i < DAVINCI_DISPLAY_MAX_DEVICES; i++) {
 		/* Get the pointer to the layer object */
 		layer = davinci_dm.dev[i];
@@ -1743,6 +1810,12 @@ static __init int davinci_display_init(void)
 	display_buf_config_params.numbuffers[DAVINCI_DISPLAY_DEVICE_1] =
 		video3_numbuffers;
 
+	/*set size of buffers, they could come from bootargs*/
+	display_buf_config_params.layer_bufsize[DAVINCI_DISPLAY_DEVICE_0] =
+		video2_bufsize;
+	display_buf_config_params.layer_bufsize[DAVINCI_DISPLAY_DEVICE_1] =
+		video3_bufsize;
+   
 	if (cpu_is_davinci_dm355()) {
 		strcpy(davinci_display_videocap.card, DM355_EVM_CARD);
 	} else if (cpu_is_davinci_dm365())
diff --git a/include/media/davinci/davinci_display.h b/include/media/davinci/davinci_display.h
index 8524328..d62b849 100644
--- a/include/media/davinci/davinci_display.h
+++ b/include/media/davinci/davinci_display.h
@@ -171,6 +171,7 @@ struct buf_config_params {
 	u8 numbuffers[DAVINCI_DISPLAY_MAX_DEVICES];
 	u32 min_bufsize[DAVINCI_DISPLAY_MAX_DEVICES];
 	u32 layer_bufsize[DAVINCI_DISPLAY_MAX_DEVICES];
+	u32 video_limit[DAVINCI_DISPLAY_MAX_DEVICES];
 };
 
 #endif				/* End of __KERNEL__ */
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/7] DM365 capture MMAP buffer allocation
  2010-05-19 16:44         ` [PATCH 5/7] DM365 MMAP buffer allocation for display driver asheeshb
@ 2010-05-19 16:44           ` asheeshb
  2010-05-19 16:44             ` [PATCH 7/7] Support upto 1080p resolution for MMAP buffers DM365 capture asheeshb
  0 siblings, 1 reply; 11+ messages in thread
From: asheeshb @ 2010-05-19 16:44 UTC (permalink / raw)
  To: linux-media; +Cc: Asheesh Bhardwaj

From: Asheesh Bhardwaj <asheeshb@ti.com>

---
 drivers/media/video/davinci/vpfe_capture.c |   39 +++++++++++++++++++++++++---
 include/media/davinci/vpfe_capture.h       |    1 +
 2 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index b26b9d5..c6eadba 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -87,11 +87,15 @@ static int debug;
 static u32 numbuffers = 3;
 static u32 bufsize = PAL_IMAGE_SIZE + SECOND_IMAGE_SIZE_MAX;
 static int interface;
+static u32 cont_bufoffset = 0;
+static u32 cont_bufsize = 0;
 
 module_param(interface, bool, S_IRUGO);
 module_param(numbuffers, uint, S_IRUGO);
 module_param(bufsize, uint, S_IRUGO);
 module_param(debug, bool, 0644);
+module_param(cont_bufoffset, uint, S_IRUGO);
+module_param(cont_bufsize, uint, S_IRUGO);
 
 /**
  * VPFE capture can be used for capturing video such as from TVP5146 or TVP7002
@@ -107,6 +111,8 @@ MODULE_PARM_DESC(interface, "interface 0-1 (default:0)");
 MODULE_PARM_DESC(numbuffers, "buffer count (default:3)");
 MODULE_PARM_DESC(bufsize, "buffer size in bytes, (default:1443840 bytes)");
 MODULE_PARM_DESC(debug, "Debug level 0-1");
+MODULE_PARM_DESC(cont_bufoffset,"Capture buffer offset(default 0)");
+MODULE_PARM_DESC(cont_bufsize,"Capture buffer size(default 0)");
 
 MODULE_DESCRIPTION("VPFE Video for Linux Capture Driver");
 MODULE_LICENSE("GPL");
@@ -1828,10 +1834,14 @@ static int vpfe_videobuf_setup(struct videobuf_queue *vq,
 			*size = config_params.device_bufsize;
 	}
 
-	if (*count < config_params.min_numbuffers)
-		*count = config_params.min_numbuffers;
+	if ( config_params.video_limit) {
+		while (*size * *count > config_params.video_limit)
+			(*count)--;
+	}
 
-	v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
+ 	if (*count < config_params.min_numbuffers)
+		*count = config_params.min_numbuffers;
+        v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
 		"count=%d, size=%d\n", *count, *size);
 	return 0;
 }
@@ -2608,8 +2618,10 @@ static __init int vpfe_probe(struct platform_device *pdev)
 	struct vpfe_device *vpfe_dev;
 	struct i2c_adapter *i2c_adap;
 	struct video_device *vfd;
-	int ret = -ENOMEM, i, j;
+	int ret = -ENOMEM, i, j, err;
 	int num_subdevs = 0;
+	unsigned long phys_end_kernel;
+	size_t size;
 
 	/* Get the pointer to the device object */
 	vpfe_dev = vpfe_initialize();
@@ -2622,6 +2634,25 @@ static __init int vpfe_probe(struct platform_device *pdev)
 
 	vpfe_dev->pdev = &pdev->dev;
 
+        if(cont_bufsize) {
+            /* attempt to determine the end of Linux kernel memory */
+            phys_end_kernel = virt_to_phys((void *)PAGE_OFFSET) +
+                   (num_physpages << PAGE_SHIFT);
+            size = cont_bufsize;
+            phys_end_kernel += cont_bufoffset; 
+            err = dma_declare_coherent_memory(&pdev->dev, phys_end_kernel,
+		  phys_end_kernel,
+		  size,
+		  DMA_MEMORY_MAP |
+         	  DMA_MEMORY_EXCLUSIVE);
+		if (!err) {
+			dev_err(&pdev->dev, "Unable to declare MMAP memory.\n");
+			ret = -ENOENT;
+		        goto probe_free_dev_mem;
+         	}
+            config_params.video_limit = size;
+        }  
+
 	if (NULL == pdev->dev.platform_data) {
 		v4l2_err(pdev->dev.driver, "Unable to get vpfe config\n");
 		ret = -ENOENT;
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
index bd0f13a..785157c 100644
--- a/include/media/davinci/vpfe_capture.h
+++ b/include/media/davinci/vpfe_capture.h
@@ -228,6 +228,7 @@ struct vpfe_config_params {
 	u8 numbuffers;
 	u32 min_bufsize;
 	u32 device_bufsize;
+	u32 video_limit;
 };
 
 #endif				/* End of __KERNEL__ */
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 7/7] Support upto 1080p resolution for MMAP buffers DM365 capture
  2010-05-19 16:44           ` [PATCH 6/7] DM365 capture MMAP buffer allocation asheeshb
@ 2010-05-19 16:44             ` asheeshb
  0 siblings, 0 replies; 11+ messages in thread
From: asheeshb @ 2010-05-19 16:44 UTC (permalink / raw)
  To: linux-media; +Cc: Asheesh Bhardwaj

From: Asheesh Bhardwaj <asheeshb@ti.com>

---
 drivers/media/video/davinci/vpfe_capture.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index c6eadba..f7f4041 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -80,12 +80,13 @@
 
 #include "ccdc_hw_device.h"
 
+#define HD_IMAGE_SIZE		(1920 * 1080 * 2)
 #define PAL_IMAGE_SIZE		(720 * 576 * 2)
 #define SECOND_IMAGE_SIZE_MAX	(640 * 480 * 2)
 
 static int debug;
 static u32 numbuffers = 3;
-static u32 bufsize = PAL_IMAGE_SIZE + SECOND_IMAGE_SIZE_MAX;
+static u32 bufsize = HD_IMAGE_SIZE + SECOND_IMAGE_SIZE_MAX;
 static int interface;
 static u32 cont_bufoffset = 0;
 static u32 cont_bufsize = 0;
@@ -109,7 +110,7 @@ module_param(cont_bufsize, uint, S_IRUGO);
  */
 MODULE_PARM_DESC(interface, "interface 0-1 (default:0)");
 MODULE_PARM_DESC(numbuffers, "buffer count (default:3)");
-MODULE_PARM_DESC(bufsize, "buffer size in bytes, (default:1443840 bytes)");
+MODULE_PARM_DESC(bufsize, "buffer size in bytes, (default:4147200 bytes)");
 MODULE_PARM_DESC(debug, "Debug level 0-1");
 MODULE_PARM_DESC(cont_bufoffset,"Capture buffer offset(default 0)");
 MODULE_PARM_DESC(cont_bufsize,"Capture buffer size(default 0)");
@@ -141,8 +142,8 @@ struct ccdc_config {
 static struct vpfe_config_params config_params = {
 	.min_numbuffers = 3,
 	.numbuffers = 3,
-	.min_bufsize = 720 * 480 * 2,
-	.device_bufsize = 720 * 576 * 2,
+	.min_bufsize = 1280 * 720 * 2,
+	.device_bufsize = 1920* 1080 * 2,
 };
 
 /* ccdc device registered */
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* RE:
  2010-05-19 16:44 asheeshb
  2010-05-19 16:44 ` [PATCH 1/7] changed driver for MMAP buffer asheeshb
@ 2010-05-20 17:51 ` Karicheri, Muralidharan
  2010-05-20 20:03   ` MMAP buffer allocation Davinci Asheesh Bhardwaj
  1 sibling, 1 reply; 11+ messages in thread
From: Karicheri, Muralidharan @ 2010-05-20 17:51 UTC (permalink / raw)
  To: Bhardwaj, Asheesh, linux-media@vger.kernel.org

Asheesh,

Please re-send this patch with following:-

1) A detailed description of what you are trying to fix in each of this patch. You need to also run the checkpatch.pl script to make sure there are no errors.
2) Please make this patch based on the http://git.linuxtv.org/v4l-dvb.git master branch. I am assuming you have based it upon the Arago tree.
3) add the Signed-off-by field.

Murali Karicheri
Software Design Engineer
Texas Instruments Inc.
Germantown, MD 20874
phone: 301-407-9583
email: m-karicheri2@ti.com

>-----Original Message-----
>From: linux-media-owner@vger.kernel.org [mailto:linux-media-
>owner@vger.kernel.org] On Behalf Of Bhardwaj, Asheesh
>Sent: Wednesday, May 19, 2010 12:45 PM
>To: linux-media@vger.kernel.org
>Subject:
>
>The patches will be applied to the davinci tree
>the ../drivers/media/video/davinci and will affect the both the capture and
>display drivers. Apply these patches to the git kernel.
>From asheeshb@ti.com # This line is ignored.
>GIT:
>From: asheeshb@ti.com
>Subject:
>In-Reply-To:
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-media" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* MMAP buffer allocation Davinci
  2010-05-20 17:51 ` Karicheri, Muralidharan
@ 2010-05-20 20:03   ` Asheesh Bhardwaj
  0 siblings, 0 replies; 11+ messages in thread
From: Asheesh Bhardwaj @ 2010-05-20 20:03 UTC (permalink / raw)
  To: linux-media

Karicheri, Muralidharan <m-karicheri2 <at> ti.com> writes:

> 
> Asheesh,
> 
> Please re-send this patch with following:-
> 
> 1) A detailed description of what you are trying to fix in each of this 
patch. You need to also run the
> checkpatch.pl script to make sure there are no errors.
> 2) Please make this patch based on the http://git.linuxtv.org/v4l-dvb.git 
master branch. I am assuming
> you have based it upon the Arago tree.
> 3) add the Signed-off-by field.
> 
> Murali Karicheri
> Software Design Engineer
> Texas Instruments Inc.
> Germantown, MD 20874
> phone: 301-407-9583
> email: m-karicheri2 <at> ti.com
> 
> >-----Original Message-----
> >From: linux-media-owner <at> vger.kernel.org [mailto:linux-media-
> >owner <at> vger.kernel.org] On Behalf Of Bhardwaj, Asheesh
> >Sent: Wednesday, May 19, 2010 12:45 PM
> >To: linux-media <at> vger.kernel.org
> >Subject:
> >
> >The patches will be applied to the davinci tree
> >the ../drivers/media/video/davinci and will affect the both the capture and
> >display drivers. Apply these patches to the git kernel.
> >From asheeshb <at> ti.com # This line is ignored.
> >GIT:
> >From: asheeshb <at> ti.com
> >Subject:
> >In-Reply-To:
> >
> >--
> >To unsubscribe from this list: send the line "unsubscribe linux-media" in
> >the body of a message to majordomo <at> vger.kernel.org
> >More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
The following portion of the mail was truncted from the originla post. Thers 
are 1-7 patches on this series. The kernel patches are targetted for support 
of memory allocation during boot time for large buffers. This will allow the 
user to get contiguous buffers beyond linux memory and can configure the 
location and size of the buffer using parametrs configured during boot time 
using bootargs. The current implementation will allow the application to get 
MMAP buffers but those buffers cannot be contiguous  and create 
defragmentation. The approach to provide contiguous buffers is inherited from 
the ../drivers/media/video/sh_mobile_ceu_camera.c already exist in the 
community code which uses dma_alloc_coherent function to get the contiguous 
buffers from the memory. During runtime the driver will allocate the required 
buffers from the contiguous memory.
The memory can be configured using the following arguments on the bootargs
1. Davinci display and vpfe cature driver
davinci_display.cont2_bufsize=<size of the total display buffers in bytes> 
davinci_display.cont2_bufoffset=<offset for the display buffers from linux 
memory in bytes> 
vpfe_capture.cont_bufsize==<size of the total capture buffers in bytes>
vpfe_capture.cont_bufoffset==<offset for the capture buffer from linux memory 
bytes> 
 

2. DavinciHD VPIF display and capture driver
vpif_display.cont_bufsize=<size of the display buffers in bytes> 
vpif_display.cont_bufoffset=<offset for the display buffers from linux memory 
in bytes> 
vpif_capture.cont_bufsize=<size of the capture buffers in 
bytes>                                             
vpif_capture.cont_bufoffset=<offset for the capture buffers from linux memory 
in bytes>
 


The patches will be applied to the davinci tree 
the ../drivers/media/video/davinci and will affect the both the capture and 
display drivers. Apply these patches to the git kernel.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/7] changed driver for MMAP buffer
  2010-05-19 16:44 ` [PATCH 1/7] changed driver for MMAP buffer asheeshb
  2010-05-19 16:44   ` [PATCH 2/7] Patch for adding imagesize corrected for MMAP buffers asheeshb
@ 2010-05-23 12:07   ` Hans Verkuil
  1 sibling, 0 replies; 11+ messages in thread
From: Hans Verkuil @ 2010-05-23 12:07 UTC (permalink / raw)
  To: asheeshb; +Cc: linux-media

On Wednesday 19 May 2010 18:44:32 asheeshb@ti.com wrote:
> From: Asheesh Bhardwaj <asheeshb@ti.com>
> 
> ---
>  drivers/media/video/davinci/vpif_display.c |   59 ++++++++++++++++++++++++++++
>  drivers/media/video/davinci/vpif_display.h |    1 +
>  2 files changed, 60 insertions(+), 0 deletions(-)

Hi Asheesh,

This is a general comment for this patch series: I think these drivers are
in need of some comments in the code describing these buffer module options
and how to use them.

Or perhaps instead of comments there should be a document in the
Documentation/video4linux directory. Although comments have the advantage of
being more likely to be kept up to date.

You should also run checkpatch.pl over your patches: I saw several coding style
violations.

Regards,

	Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-05-23 12:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-19 16:44 asheeshb
2010-05-19 16:44 ` [PATCH 1/7] changed driver for MMAP buffer asheeshb
2010-05-19 16:44   ` [PATCH 2/7] Patch for adding imagesize corrected for MMAP buffers asheeshb
2010-05-19 16:44     ` [PATCH 3/7] Patch for capture driver MMAP buffer allocation asheeshb
2010-05-19 16:44       ` [PATCH 4/7] Change vpif capture driver to get the right size image for the MMAP buffers asheeshb
2010-05-19 16:44         ` [PATCH 5/7] DM365 MMAP buffer allocation for display driver asheeshb
2010-05-19 16:44           ` [PATCH 6/7] DM365 capture MMAP buffer allocation asheeshb
2010-05-19 16:44             ` [PATCH 7/7] Support upto 1080p resolution for MMAP buffers DM365 capture asheeshb
2010-05-23 12:07   ` [PATCH 1/7] changed driver for MMAP buffer Hans Verkuil
2010-05-20 17:51 ` Karicheri, Muralidharan
2010-05-20 20:03   ` MMAP buffer allocation Davinci Asheesh Bhardwaj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.