aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2010-10-13 12:55:17 +0200
committerKoen Kooi <koen@openembedded.org>2010-10-13 13:40:43 +0200
commit1d07aed62a6d9e172e01ee523527a350f5ec37e8 (patch)
tree0d4ea036ea5aa3e2cd29e4efbd82e5a983f755c9 /recipes/linux
parentd0366603f0fd04c7f57d137df0956d01b0dcc38c (diff)
downloadopenembedded-1d07aed62a6d9e172e01ee523527a350f5ec37e8.tar.gz
linux-davinci 2.6.32rc2: fix typo in name and switch dm365 to use this recipe
Signed-off-by: Koen Kooi <k-kooi@ti.com>
Diffstat (limited to 'recipes/linux')
-rw-r--r--recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0001-changed-driver-for-MMAP-buffer.patch128
-rw-r--r--recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0002-Patch-for-adding-imagesize-corrected-for-MMAP-buffer.patch67
-rw-r--r--recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0003-Patch-for-capture-driver-MMAP-buffer-allocation.-The.patch129
-rw-r--r--recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0004-Patch-for-vpif-capture-driver-to-get-the-right-size-.patch50
-rw-r--r--recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0005-DM365-MMAP-buffer-allocation-for-display-driver.patch165
-rw-r--r--recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0006-DM365-capture-MMAP-buffer-allocation.patch110
-rw-r--r--recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0007-Patch-MMAP-buffer-bufsize-support-upto-1080p-resolut.patch51
-rw-r--r--recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0008-DM365-davinci_video-Enable-VENC-clock-for-COMPONEN.patch57
-rwxr-xr-xrecipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0009-Implement-V4L2-PARM-display-ioctls.patch435
-rwxr-xr-xrecipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0010-Replace-usage-of-cbcr_ofst-with-davinci_fb_desc.patch279
-rwxr-xr-xrecipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0011-dm365-Add-custom-display-ioctl-VIDIOC_S_YDOFST.patch118
-rw-r--r--recipes/linux/linux-davinci_2.6.31+2.6.32-rc2-psp03.01.00.37.bb (renamed from recipes/linux/linux-davinci_2.6.31%2B2.6.32-rc2-psp03.01.00.37.bb)0
-rw-r--r--recipes/linux/linux-davinci_git.bb1
13 files changed, 1590 insertions, 0 deletions
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0001-changed-driver-for-MMAP-buffer.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0001-changed-driver-for-MMAP-buffer.patch
new file mode 100644
index 0000000000..b47b149c08
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0001-changed-driver-for-MMAP-buffer.patch
@@ -0,0 +1,128 @@
+From 85c5511c87d2347fe2f58af498f24595c6948b19 Mon Sep 17 00:00:00 2001
+From: Asheesh Bhardwaj <asheesh@lab1.dmlab>
+Date: Tue, 30 Mar 2010 09:57:14 -0500
+Subject: [PATCH 1/7] changed driver for MMAP buffer
+
+---
+ 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
+
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0002-Patch-for-adding-imagesize-corrected-for-MMAP-buffer.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0002-Patch-for-adding-imagesize-corrected-for-MMAP-buffer.patch
new file mode 100644
index 0000000000..96bf029361
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0002-Patch-for-adding-imagesize-corrected-for-MMAP-buffer.patch
@@ -0,0 +1,67 @@
+From 5ce461b9f419ce715aba70dad60bde4b7db35a74 Mon Sep 17 00:00:00 2001
+From: Asheesh Bhardwaj <asheesh@lab1.dmlab>
+Date: Tue, 30 Mar 2010 10:37:44 -0500
+Subject: [PATCH 2/7] Patch for adding imagesize corrected for MMAP buffers and 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
+
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0003-Patch-for-capture-driver-MMAP-buffer-allocation.-The.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0003-Patch-for-capture-driver-MMAP-buffer-allocation.-The.patch
new file mode 100644
index 0000000000..f43bd029dc
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0003-Patch-for-capture-driver-MMAP-buffer-allocation.-The.patch
@@ -0,0 +1,129 @@
+From 7ac491b504d071713f4788027e130b409d7146e0 Mon Sep 17 00:00:00 2001
+From: Asheesh Bhardwaj <asheesh@lab1.dmlab>
+Date: Tue, 30 Mar 2010 11:03:38 -0500
+Subject: [PATCH 3/7] Patch for capture driver MMAP buffer allocation. 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
+
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0004-Patch-for-vpif-capture-driver-to-get-the-right-size-.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0004-Patch-for-vpif-capture-driver-to-get-the-right-size-.patch
new file mode 100644
index 0000000000..87e1c029c1
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0004-Patch-for-vpif-capture-driver-to-get-the-right-size-.patch
@@ -0,0 +1,50 @@
+From b0f67cc9a4fa269db76d47ae968ed4b0341e9e59 Mon Sep 17 00:00:00 2001
+From: Asheesh Bhardwaj <asheesh@lab1.dmlab>
+Date: Tue, 30 Mar 2010 11:15:49 -0500
+Subject: [PATCH 4/7] Patch for vpif capture driver to get the right size image for the MMAP buffers
+
+---
+ 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
+
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0005-DM365-MMAP-buffer-allocation-for-display-driver.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0005-DM365-MMAP-buffer-allocation-for-display-driver.patch
new file mode 100644
index 0000000000..25b8d8a254
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0005-DM365-MMAP-buffer-allocation-for-display-driver.patch
@@ -0,0 +1,165 @@
+From fcf7d6523e2f1dba5fb1ec6454cf78a86a7e77a7 Mon Sep 17 00:00:00 2001
+From: Asheesh Bhardwaj <asheesh@lab1.dmlab>
+Date: Thu, 8 Apr 2010 18:35:00 -0500
+Subject: [PATCH 5/7] DM365 MMAP buffer allocation for display driver
+
+---
+ 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
+
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0006-DM365-capture-MMAP-buffer-allocation.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0006-DM365-capture-MMAP-buffer-allocation.patch
new file mode 100644
index 0000000000..e11e79635c
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0006-DM365-capture-MMAP-buffer-allocation.patch
@@ -0,0 +1,110 @@
+From 704e30aee05bb2cdf4c338278ca9651fd588880b Mon Sep 17 00:00:00 2001
+From: Asheesh Bhardwaj <asheesh@lab1.dmlab>
+Date: Thu, 8 Apr 2010 18:39:54 -0500
+Subject: [PATCH 6/7] DM365 capture MMAP buffer allocation
+
+---
+ 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 7748ce8..aeee5bb 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
+
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0007-Patch-MMAP-buffer-bufsize-support-upto-1080p-resolut.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0007-Patch-MMAP-buffer-bufsize-support-upto-1080p-resolut.patch
new file mode 100644
index 0000000000..05d77efc5e
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0007-Patch-MMAP-buffer-bufsize-support-upto-1080p-resolut.patch
@@ -0,0 +1,51 @@
+From 32a08a25d76964c669414710e686aa65af0884fe Mon Sep 17 00:00:00 2001
+From: Asheesh Bhardwaj <asheesh@lab1.dmlab>
+Date: Thu, 15 Apr 2010 09:51:29 -0500
+Subject: [PATCH 7/7] Patch MMAP buffer bufsize support upto 1080p resolution on capture driver DM365
+
+---
+ 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 aeee5bb..112184d 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
+
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0008-DM365-davinci_video-Enable-VENC-clock-for-COMPONEN.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0008-DM365-davinci_video-Enable-VENC-clock-for-COMPONEN.patch
new file mode 100644
index 0000000000..2177b9e072
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0008-DM365-davinci_video-Enable-VENC-clock-for-COMPONEN.patch
@@ -0,0 +1,57 @@
+From b6a20b95729f056f285c1d9f5cdb79537dd343f3 Mon Sep 17 00:00:00 2001
+From: Prakash PM <prakash.pm@ti.com>
+Date: Fri, 16 Jul 2010 15:38:50 +0530
+Subject: [PATCH] DM365: davinci_video: Enable VENC clock for COMPONENT output
+
+In existing code VENC clock is enabled only in case of COMPOSITE
+output. So when target is booted with default output as COMPONENT,
+NOSIGNAL is observed on TV.
+
+This patch fixes the issue by enabling the clock for COMPONENT
+ouput in 480P-60, 720P-60 and 576P-60 modes.
+
+Signed-off-by: Prakash PM <prakash.pm@ti.com>
+---
+ drivers/media/video/davinci/davinci_platform.c | 12 ++++++++++++
+ 1 files changed, 12 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/media/video/davinci/davinci_platform.c b/drivers/media/video/davinci/davinci_platform.c
+index 394d6e7..baa1cad 100644
+--- a/drivers/media/video/davinci/davinci_platform.c
++++ b/drivers/media/video/davinci/davinci_platform.c
+@@ -677,6 +677,7 @@ static void davinci_enc_set_525p(struct vid_enc_mode_info *mode_info)
+ osd_write_upper_margin(mode_info->upper_margin);
+
+ if (cpu_is_davinci_dm365()) {
++ dispc_reg_out(VENC_CLKCTL, 0x01);
+ ths7303_setval(THS7303_FILTER_MODE_480P_576P);
+ msleep(40);
+ __raw_writel(0x081141EF, IO_ADDRESS(DM3XX_VDAC_CONFIG));
+@@ -717,6 +718,7 @@ static void davinci_enc_set_625p(struct vid_enc_mode_info *mode_info)
+ osd_write_upper_margin(mode_info->upper_margin);
+
+ if (cpu_is_davinci_dm365()) {
++ dispc_reg_out(VENC_CLKCTL, 0x01);
+ ths7303_setval(THS7303_FILTER_MODE_480P_576P);
+ msleep(40);
+ __raw_writel(0x081141EF, IO_ADDRESS(DM3XX_VDAC_CONFIG));
+@@ -1137,6 +1139,16 @@ void davinci_enc_priv_setmode(struct vid_enc_device_mgr *mgr)
+ * THS8200
+ */
+ if (cpu_is_davinci_dm365()) {
++ dispc_reg_out(VENC_CLKCTL, 0x01);
++ enableDigitalOutput(0);
++ dispc_reg_out(VENC_OSDCLK0, 0);
++ dispc_reg_out(VENC_OSDCLK1, 1);
++ dispc_reg_merge(VENC_VMOD,
++ VENC_VMOD_VDMD_YCBCR8 <<
++ VENC_VMOD_VDMD_SHIFT, VENC_VMOD_VDMD);
++ dispc_reg_out(VENC_YCCCTL, 0x1);
++ dispc_reg_merge(VENC_VMOD, VENC_VMOD_VENC,
++ VENC_VMOD_VENC);
+ davinci_enc_set_internal_hd(&mgr->current_mode);
+ /* changed for 720P demo */
+ davinci_enc_set_basep(0, 0xf0, 10);
+--
+1.5.6
+
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0009-Implement-V4L2-PARM-display-ioctls.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0009-Implement-V4L2-PARM-display-ioctls.patch
new file mode 100755
index 0000000000..abc4d596f1
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0009-Implement-V4L2-PARM-display-ioctls.patch
@@ -0,0 +1,435 @@
+From f58126c060db93d2757f2838530a2ce61bc16552 Mon Sep 17 00:00:00 2001
+From: Don Darling <don.osc2@gmail.com>
+Date: Mon, 23 Aug 2010 18:16:02 -0500
+Subject: [PATCH 1/3] Implement V4L2 PARM display ioctls.
+
+Implement VIDIOC_G_PARM and VIDIOC_S_PARM ioctls for the DaVinci display.
+
+These ioctls can be used to specify the desired framerate to the display
+driver. The desired framerate is simulated by skipping IRQ service requests.
+Any framerate lower than the hardware framerate is supported, to a precision
+of three decimal places.
+---
+ drivers/media/video/davinci/davinci_display.c | 322 +++++++++++++++++++++++++
+ include/media/davinci/davinci_display.h | 16 ++
+ 2 files changed, 338 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/media/video/davinci/davinci_display.c b/drivers/media/video/davinci/davinci_display.c
+index 4c4efef..5bff18a 100644
+--- a/drivers/media/video/davinci/davinci_display.c
++++ b/drivers/media/video/davinci/davinci_display.c
+@@ -33,6 +33,7 @@
+ #include <linux/mm.h>
+ #include <linux/mutex.h>
+ #include <linux/videodev2.h>
++#include <linux/gcd.h>
+ #include <asm/pgtable.h>
+ #include <mach/cputype.h>
+ #include <media/davinci/davinci_enc.h>
+@@ -222,6 +223,49 @@ static void davinci_buffer_release(struct videobuf_queue *q,
+ dev_dbg(davinci_display_dev, "</davinci_buffer_release>\n");
+ }
+
++/* davinci_frames_to_process()
++ * Return the number of frames to process to achieve the desired frame rate.
++ * If 0 is returned, the current displayed frame needs to be repeated.
++ * If >1 is returned, all buffers need to be skipped except the last one,
++ * which is displayed.
++ */
++static int davinci_frames_to_process(struct display_obj *layer)
++{
++ struct davinci_timeperframe_info *tpfInfo = &(layer->tpf_info);
++ unsigned long framesToSkip;
++
++ /* If we are not simulating a frame rate, we always process exactly
++ * one frame. */
++ if (tpfInfo->irq_service_rate == 0)
++ return 1;
++
++ /* Increment the IRQ counter by 1.000 */
++ tpfInfo->irq_count += 1000;
++
++ /* If we haven't reached the next threshold for processing a frame,
++ * we must repeat the current frame (return 0). This hapens when
++ * simulating a framerate lower than the hardware framerate.
++ */
++ if (tpfInfo->irq_count < tpfInfo->next_irq)
++ return 0;
++
++ /* In cases where we're simulating a framerate higher than the hardware
++ * we may need to dequeue additional buffers and throw them away. */
++ framesToSkip = 0;
++ while (tpfInfo->next_irq + tpfInfo->irq_service_rate <=
++ tpfInfo->irq_count) {
++
++ tpfInfo->next_irq += tpfInfo->irq_service_rate;
++ framesToSkip++;
++ }
++
++ tpfInfo->next_irq += tpfInfo->irq_service_rate;
++ tpfInfo->next_irq -= tpfInfo->irq_count;
++ tpfInfo->irq_count = 0;
++
++ return 1 + framesToSkip;
++}
++
+ static struct videobuf_queue_ops video_qops = {
+ .buf_setup = davinci_buffer_setup,
+ .buf_prepare = davinci_buffer_prepare,
+@@ -252,6 +296,17 @@ static void davinci_display_isr(unsigned int event, void *dispObj)
+ /* If streaming is started in this layer */
+ if (!layer->started)
+ continue;
++ /* Query the number of frames to process in this ISR call to
++ * simulate the desired frame rate. Right now, we only support
++ * simulated frame rates less than the hardware framerate, so
++ * this value will always be 0 or 1. When rates faster than
++ * the hardware rate are supported, * it can be > 1 in which
++ * case we need to dequeue and throw away (skip) additional
++ * buffers. Right now, all we do is repeat the current frame
++ * when it is 0.
++ */
++ if (davinci_frames_to_process(layer) == 0)
++ continue;
+ /* Check the field format */
+ if ((V4L2_FIELD_NONE == layer->pix_fmt.field) &&
+ (!list_empty(&layer->dma_queue)) &&
+@@ -530,6 +585,108 @@ static int davinci_disp_check_window_params(struct v4l2_rect *c)
+ return 0;
+ }
+
++/* vpbe_get_mode_timeperframe() : get framerate of current video mode
++ */
++static int vpbe_get_mode_timeperframe(unsigned char *mode_info_name,
++ struct v4l2_fract *frVal)
++{
++ int ret = 0;
++
++ if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_NTSC)) {
++ frVal->numerator = 30000;
++ frVal->denominator = 1001;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_NTSC_RGB)) {
++ frVal->numerator = 30000;
++ frVal->denominator = 1001;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_PAL)) {
++ frVal->numerator = 25;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_PAL_RGB)) {
++ frVal->numerator = 25;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_720P_24)) {
++ frVal->numerator = 24;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_720P_25)) {
++ frVal->numerator = 25;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_720P_30)) {
++ frVal->numerator = 30;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_720P_50)) {
++ frVal->numerator = 50;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_720P_60)) {
++ frVal->numerator = 60;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_1080I_25)) {
++ frVal->numerator = 25;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_1080I_30)) {
++ frVal->numerator = 30;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_1080P_24)) {
++ frVal->numerator = 24;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_1080P_25)) {
++ frVal->numerator = 25;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_1080P_30)) {
++ frVal->numerator = 30;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_1080P_50)) {
++ frVal->numerator = 50;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_1080P_60)) {
++ frVal->numerator = 60;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_480P_60)) {
++ frVal->numerator = 60;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_576P_50)) {
++ frVal->numerator = 50;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_640x480)) {
++ frVal->numerator = 60;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_640x400)) {
++ frVal->numerator = 60;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_640x350)) {
++ frVal->numerator = 60;
++ frVal->denominator = 1;
++ }
++ else if (!strcmp(davinci_dm.mode_info.name, VID_ENC_STD_800x480)) {
++ frVal->numerator = 60;
++ frVal->denominator = 1;
++ }
++ else {
++ dev_err(davinci_display_dev, "unknown video mode\n");
++ ret = -EINVAL;
++ }
++ return ret;
++}
++
+ /* vpbe_try_format()
+ * If user application provides width and height, and have bytesperline set
+ * to zero, driver calculates bytesperline and sizeimage based on hardware
+@@ -704,6 +861,161 @@ static int vpbe_s_priority(struct file *file, void *priv,
+ return ret;
+ }
+
++static int vpbe_g_parm(struct file *file, void *priv,
++ struct v4l2_streamparm *parm)
++{
++ struct davinci_fh *fh = file->private_data;
++ struct display_obj *layer = fh->layer;
++ int ret = 0;
++
++ /* Clear out the input structure */
++ memset(parm, 0, sizeof(struct v4l2_streamparm));
++
++ /* Set the buffer type */
++ parm->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
++
++ /* We support frame repeating controlled by the timeperframe setting.
++ * Frame skipping is still TBD */
++ parm->parm.output.capability |= V4L2_CAP_TIMEPERFRAME;
++
++ /* If a simulated frame rate is in effect, return it */
++ if (layer->tpf_info.irq_service_rate > 0) {
++ parm->parm.output.timeperframe =
++ layer->tpf_info.sim_timeperframe;
++ }
++ /* Othersise, retrieve the current mode's framerate */
++ else if ((ret = vpbe_get_mode_timeperframe(davinci_dm.mode_info.name,
++ &parm->parm.output.timeperframe)) < 0) {
++ goto hardware_framerate;
++ }
++
++ goto exit;
++
++hardware_framerate:
++ dev_err(davinci_display_dev, "Could not retrieve hardware framerate");
++ ret = -EINVAL;
++
++exit:
++ return ret;
++}
++
++static int vpbe_s_parm(struct file *file, void *priv,
++ struct v4l2_streamparm *parm)
++{
++ struct davinci_fh *fh = file->private_data;
++ struct display_obj *layer = fh->layer;
++ struct v4l2_streamparm result;
++ struct v4l2_fract *hw_tpf;
++ struct v4l2_fract *sim_tpf;
++ struct v4l2_fract service_rate;
++ unsigned long normalize_gcd;
++ int ret = 0;
++
++ /* Establish some aliases for code readability */
++ hw_tpf = &layer->tpf_info.hw_timeperframe;
++ sim_tpf = &parm->parm.output.timeperframe;
++
++ /* Get our current settings */
++ if ((ret = vpbe_g_parm(file, priv, &result)) < 0) {
++ goto g_parm_failed;
++ }
++
++ /* Division by zero is not allowed */
++ if (sim_tpf->denominator == 0) {
++ goto division_by_zero;
++ }
++
++ /* Get the hardware framerate */
++ if ((ret = vpbe_get_mode_timeperframe(davinci_dm.mode_info.name,
++ hw_tpf)) < 0) {
++ goto hardware_framerate;
++ }
++
++ /* Normalize the specified timeperframe */
++ normalize_gcd = gcd(sim_tpf->numerator, sim_tpf->denominator);
++ sim_tpf->numerator /= normalize_gcd;
++ sim_tpf->denominator /= normalize_gcd;
++
++ /* If zero was specified for timeperframe or the hardware rate was
++ * specified, use the hardware rate */
++ if (sim_tpf->numerator == 0 ||
++ (sim_tpf->numerator == hw_tpf->numerator &&
++ sim_tpf->denominator == hw_tpf->denominator)) {
++
++ /* Disable the simulated framerate */
++ layer->tpf_info.irq_service_rate = 0;
++ result.parm.output.timeperframe = *hw_tpf;
++ goto exit;
++ }
++
++ /* Since we're doing fixed-point math to three decimal places, we
++ * cannot support a numerator value larger than 2^32 / 1000 */
++ if (sim_tpf->numerator > (-1UL / 1000UL)) {
++ goto too_big;
++ }
++
++ /* Right now, a simulated framerate faster than the hardware is not
++ * supported. */
++ if ((sim_tpf->numerator * 1000 / sim_tpf->denominator) >
++ (hw_tpf->numerator * 1000 / hw_tpf->denominator)) {
++ goto too_fast;
++ }
++
++ /* If we get this far, we know that the specified framerate is valid.
++ * Update the simulated framerate. */
++ layer->tpf_info.sim_timeperframe = *sim_tpf;
++ sim_tpf = &layer->tpf_info.sim_timeperframe;
++
++ /* Calculate the irq service rate. */
++ service_rate.numerator = hw_tpf->numerator * sim_tpf->denominator;
++ service_rate.denominator = hw_tpf->denominator * sim_tpf->numerator;
++
++ normalize_gcd = gcd(service_rate.numerator, service_rate.denominator);
++ service_rate.numerator /= normalize_gcd;
++ service_rate.denominator /= normalize_gcd;
++
++ /* Store the service rate in integer form. Multiply the result by 1000
++ * to also include the first three decimal digits. */
++ layer->tpf_info.irq_service_rate =
++ (service_rate.numerator * 1000) / service_rate.denominator;
++ result.parm.output.timeperframe = *sim_tpf;
++
++ layer->tpf_info.next_irq = layer->tpf_info.irq_service_rate;
++ layer->tpf_info.irq_count = 0;
++
++ goto exit;
++
++too_fast:
++ dev_err(davinci_display_dev, "timeperframe cannot exceed hardware "
++ "framerate");
++ ret = -EINVAL;
++ goto exit;
++
++too_big:
++ dev_err(davinci_display_dev, "timeperframe numerator cannot exceed "
++ "%lu", -1UL / 1000UL);
++ ret = -EINVAL;
++ goto exit;
++
++hardware_framerate:
++ dev_err(davinci_display_dev, "Could not retrieve hardware framerate");
++ ret = -EINVAL;
++ goto exit;
++
++division_by_zero:
++ dev_err(davinci_display_dev, "timeperframe divides by zero");
++ ret = -EINVAL;
++ goto exit;
++
++g_parm_failed:
++ dev_err(davinci_display_dev, "Could not retrieve current settings");
++ ret = -EINVAL;
++
++exit:
++ *parm = result;
++ return ret;
++}
++
+ static int vpbe_querycap(struct file *file, void *priv,
+ struct v4l2_capability *cap)
+ {
+@@ -1463,6 +1775,11 @@ static int davinci_open(struct file *filep)
+ fh->prio = V4L2_PRIORITY_UNSET;
+ v4l2_prio_open(&layer->prio, &fh->prio);
+ dev_dbg(davinci_display_dev, "</davinci_open>\n");
++
++ /* Initialize framerate information */
++ memset(&fh->layer->tpf_info, 0,
++ sizeof(struct davinci_timeperframe_info));
++
+ return 0;
+ }
+
+@@ -1514,6 +1831,9 @@ static int davinci_release(struct file *filep)
+ davinci_disp_release_layer(layer->layer_info.id);
+ }
+
++ /* Clear any simulated frame rate */
++ memset(&layer->tpf_info, 0, sizeof(struct davinci_timeperframe_info));
++
+ /* Close the priority */
+ v4l2_prio_close(&layer->prio, &fh->prio);
+ filep->private_data = NULL;
+@@ -1563,6 +1883,8 @@ static const struct v4l2_ioctl_ops vpbe_ioctl_ops = {
+ .vidioc_s_crop = vpbe_s_crop,
+ .vidioc_g_priority = vpbe_g_priority,
+ .vidioc_s_priority = vpbe_s_priority,
++ .vidioc_g_parm = vpbe_g_parm,
++ .vidioc_s_parm = vpbe_s_parm,
+ .vidioc_default = vpbe_param_handler,
+ };
+
+diff --git a/include/media/davinci/davinci_display.h b/include/media/davinci/davinci_display.h
+index 8524328..e149624 100644
+--- a/include/media/davinci/davinci_display.h
++++ b/include/media/davinci/davinci_display.h
+@@ -92,6 +92,20 @@ struct display_layer_info {
+ enum davinci_v_exp_ratio v_exp;
+ };
+
++/* Frame rate simulation information */
++struct davinci_timeperframe_info {
++ /* Framerate of display hardware */
++ struct v4l2_fract hw_timeperframe;
++ /* Framerate to simulate by skipping irq requests */
++ struct v4l2_fract sim_timeperframe;
++ /* irq service rate (how often do we service an irq) */
++ u32 irq_service_rate;
++ /* Next irq to service */
++ u32 next_irq;
++ /* irq count since last one serviced */
++ u32 irq_count;
++};
++
+ /* display object structure */
+ struct display_obj {
+ /* Buffer specific parameters
+@@ -140,6 +154,8 @@ struct display_obj {
+ u8 started;
+ /* Identifies device object */
+ enum davinci_display_device_id device_id;
++ /* Frame rate information */
++ struct davinci_timeperframe_info tpf_info;
+ };
+
+ /* File handle structure */
+--
+1.7.0.4
+
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0010-Replace-usage-of-cbcr_ofst-with-davinci_fb_desc.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0010-Replace-usage-of-cbcr_ofst-with-davinci_fb_desc.patch
new file mode 100755
index 0000000000..f3fd096fa7
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0010-Replace-usage-of-cbcr_ofst-with-davinci_fb_desc.patch
@@ -0,0 +1,279 @@
+From aec8873c0aa8b3870dd1bf972319c33c7e92f9fe Mon Sep 17 00:00:00 2001
+From: Don Darling <don.osc2@gmail.com>
+Date: Wed, 11 Aug 2010 12:59:05 -0500
+Subject: [PATCH 2/3] Replace usage of cbcr_ofst with davinci_fb_desc.
+
+The value passed to VIDIOC_S_COFST is currently stored in a cbcr_ofst value in
+the display manager, and is passed directly to lower OSD levels by adding a
+cbcr_ofst parameter where needed.
+
+This change generalizes that infrastructure by creating a new davinci_fb_desc
+structure to contain frame buffer information such as cbcr_ofst, and the
+existing infrastructure that passes information the the lower OSD levels was
+updated to pass this instead.
+
+This allows re-use of this infrastructure by new ioctls to communicate
+information about the frame buffer with minimal modifications.
+---
+ drivers/media/video/davinci/davinci_display.c | 10 +++++-----
+ drivers/media/video/davinci/davinci_osd.c | 12 ++++++------
+ drivers/video/davincifb.c | 22 ++++++++++------------
+ include/media/davinci/davinci_display.h | 4 ++--
+ include/video/davinci_osd.h | 16 +++++++++++++++-
+ 5 files changed, 38 insertions(+), 26 deletions(-)
+
+diff --git a/drivers/media/video/davinci/davinci_display.c b/drivers/media/video/davinci/davinci_display.c
+index 5bff18a..bb3dd77 100644
+--- a/drivers/media/video/davinci/davinci_display.c
++++ b/drivers/media/video/davinci/davinci_display.c
+@@ -339,7 +339,7 @@ static void davinci_display_isr(unsigned int event, void *dispObj)
+ addr = videobuf_to_dma_contig(layer->nextFrm);
+ davinci_disp_start_layer(layer->layer_info.id,
+ addr,
+- davinci_dm.cbcr_ofst);
++ &davinci_dm.fb_desc);
+ } else {
+ /* Interlaced mode
+ * If it is first interrupt, ignore it
+@@ -415,7 +415,7 @@ static void davinci_display_isr(unsigned int event, void *dispObj)
+ addr = videobuf_to_dma_contig(layer->nextFrm);
+ davinci_disp_start_layer(layer->layer_info.id,
+ addr,
+- davinci_dm.cbcr_ofst);
++ &davinci_dm.fb_desc);
+ }
+ }
+ }
+@@ -442,7 +442,7 @@ static int davinci_set_video_display_params(struct display_obj *layer)
+ /* Set address in the display registers */
+ davinci_disp_start_layer(layer->layer_info.id,
+ addr,
+- davinci_dm.cbcr_ofst);
++ &davinci_dm.fb_desc);
+ davinci_disp_enable_layer(layer->layer_info.id, 0);
+ /* Enable the window */
+ layer->layer_info.enable = 1;
+@@ -1622,7 +1622,7 @@ static long vpbe_param_handler(struct file *file, void *priv,
+
+ switch (cmd) {
+ case VIDIOC_S_COFST:
+- davinci_dm.cbcr_ofst = *((unsigned long *) param);
++ davinci_dm.fb_desc.cbcr_ofst = *((unsigned long *) param);
+ mutex_unlock(&davinci_dm.lock);
+ break;
+ default:
+@@ -1844,7 +1844,7 @@ static int davinci_release(struct file *filep)
+ /* unlock mutex on layer object */
+ mutex_unlock(&davinci_dm.lock);
+
+- davinci_dm.cbcr_ofst = 0;
++ davinci_dm.fb_desc.cbcr_ofst = 0;
+
+ dev_dbg(davinci_display_dev, "</davinci_release>\n");
+ return 0;
+diff --git a/drivers/media/video/davinci/davinci_osd.c b/drivers/media/video/davinci/davinci_osd.c
+index 2a80125..b8095af 100644
+--- a/drivers/media/video/davinci/davinci_osd.c
++++ b/drivers/media/video/davinci/davinci_osd.c
+@@ -1401,7 +1401,7 @@ EXPORT_SYMBOL(davinci_disp_enable_layer);
+
+ static void _davinci_disp_start_layer(enum davinci_disp_layer layer,
+ unsigned long fb_base_phys,
+- unsigned long cbcr_ofst)
++ struct davinci_fb_desc *fb_desc)
+ {
+ if (cpu_is_davinci_dm644x()) {
+ switch (layer) {
+@@ -1461,8 +1461,8 @@ static void _davinci_disp_start_layer(enum davinci_disp_layer layer,
+ unsigned long fb_offset_32, cbcr_offset_32;
+
+ fb_offset_32 = fb_base_phys - DAVINCI_DDR_BASE;
+- if (cbcr_ofst)
+- cbcr_offset_32 = cbcr_ofst;
++ if (fb_desc && fb_desc->cbcr_ofst)
++ cbcr_offset_32 = fb_desc->cbcr_ofst;
+ else
+ cbcr_offset_32 = win->lconfig.line_length *
+ win->lconfig.ysize;
+@@ -1562,7 +1562,7 @@ static void _davinci_disp_start_layer(enum davinci_disp_layer layer,
+
+ void davinci_disp_start_layer(enum davinci_disp_layer layer,
+ unsigned long fb_base_phys,
+- unsigned long cbcr_ofst)
++ struct davinci_fb_desc *fb_desc)
+ {
+ struct davinci_window_state *win = &osd->win[layer];
+ unsigned long flags;
+@@ -1570,7 +1570,7 @@ void davinci_disp_start_layer(enum davinci_disp_layer layer,
+ spin_lock_irqsave(&osd->lock, flags);
+
+ win->fb_base_phys = fb_base_phys & ~0x1F;
+- _davinci_disp_start_layer(layer, fb_base_phys, cbcr_ofst);
++ _davinci_disp_start_layer(layer, fb_base_phys, fb_desc);
+
+ if (layer == WIN_VID0) {
+ osd->pingpong =
+@@ -2212,7 +2212,7 @@ void davinci_disp_init_layer(enum davinci_disp_layer layer)
+ _davinci_disp_set_zoom(layer, win->h_zoom, win->v_zoom);
+
+ win->fb_base_phys = 0;
+- _davinci_disp_start_layer(layer, win->fb_base_phys, 0);
++ _davinci_disp_start_layer(layer, win->fb_base_phys, NULL);
+
+ win->lconfig.line_length = 0;
+ win->lconfig.xsize = 0;
+diff --git a/drivers/video/davincifb.c b/drivers/video/davincifb.c
+index f8555fb..9ff3d63 100644
+--- a/drivers/video/davincifb.c
++++ b/drivers/video/davincifb.c
+@@ -95,8 +95,6 @@ static enum davinci_osd_layer fb_info_to_osd_enum(const struct fb_info *info)
+ #define is_display_interlaced(mode) (((mode)->vmode & FB_VMODE_INTERLACED) \
+ == FB_VMODE_INTERLACED)
+
+-static unsigned int fb_cbcr_ofst;
+-
+ /*
+ * Convert an fb_var_screeninfo struct to a Davinci display layer configuration.
+ * lconfig->xpos, lconfig->ypos, and lconfig->line_length are not modified
+@@ -577,7 +575,7 @@ static void davincifb_vsync_callback(unsigned event, void *arg)
+ davinci_disp_start_layer(dm->win[WIN_OSD0].layer,
+ dm->win[WIN_OSD0].
+ sdram_address,
+- fb_cbcr_ofst);
++ NULL);
+ dm->win[WIN_OSD0].sdram_address = 0;
+ }
+ addr = 0;
+@@ -586,7 +584,7 @@ static void davincifb_vsync_callback(unsigned event, void *arg)
+ davinci_disp_start_layer(dm->win[WIN_OSD1].layer,
+ dm->win[WIN_OSD1].
+ sdram_address,
+- fb_cbcr_ofst);
++ NULL);
+ dm->win[WIN_OSD1].sdram_address = 0;
+ }
+ addr = 0;
+@@ -595,7 +593,7 @@ static void davincifb_vsync_callback(unsigned event, void *arg)
+ davinci_disp_start_layer(dm->win[WIN_VID0].layer,
+ dm->win[WIN_VID0].
+ sdram_address,
+- fb_cbcr_ofst);
++ NULL);
+ dm->win[WIN_VID0].sdram_address = 0;
+ }
+ addr = 0;
+@@ -604,7 +602,7 @@ static void davincifb_vsync_callback(unsigned event, void *arg)
+ davinci_disp_start_layer(dm->win[WIN_VID1].layer,
+ dm->win[WIN_VID1].
+ sdram_address,
+- fb_cbcr_ofst);
++ NULL);
+ dm->win[WIN_VID1].sdram_address = 0;
+ }
+ ++dm->vsync_cnt;
+@@ -618,7 +616,7 @@ static void davincifb_vsync_callback(unsigned event, void *arg)
+ layer,
+ dm->win[WIN_OSD0].
+ sdram_address,
+- fb_cbcr_ofst);
++ NULL);
+ dm->win[WIN_OSD0].sdram_address = 0;
+ }
+ addr = 0;
+@@ -628,7 +626,7 @@ static void davincifb_vsync_callback(unsigned event, void *arg)
+ layer,
+ dm->win[WIN_OSD1].
+ sdram_address,
+- fb_cbcr_ofst);
++ NULL);
+ dm->win[WIN_OSD1].sdram_address = 0;
+ }
+ addr = 0;
+@@ -638,7 +636,7 @@ static void davincifb_vsync_callback(unsigned event, void *arg)
+ layer,
+ dm->win[WIN_VID0].
+ sdram_address,
+- fb_cbcr_ofst);
++ NULL);
+ dm->win[WIN_VID0].sdram_address = 0;
+ }
+ addr = 0;
+@@ -648,7 +646,7 @@ static void davincifb_vsync_callback(unsigned event, void *arg)
+ layer,
+ dm->win[WIN_VID1].
+ sdram_address,
+- fb_cbcr_ofst);
++ NULL);
+ dm->win[WIN_VID1].sdram_address = 0;
+ }
+ } else {
+@@ -1679,7 +1677,7 @@ static int davincifb_set_par(struct fb_info *info)
+ + var->yoffset * info->fix.line_length;
+ }
+ davinci_disp_set_layer_config(win->layer, &lconfig);
+- davinci_disp_start_layer(win->layer, start, fb_cbcr_ofst);
++ davinci_disp_start_layer(win->layer, start, NULL);
+ if (win->display_window)
+ davinci_disp_enable_layer(win->layer, 0);
+
+@@ -1805,7 +1803,7 @@ davincifb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
+ var->yoffset * info->fix.line_length;
+ }
+ if (davinci_disp_is_second_field()) {
+- davinci_disp_start_layer(win->layer, start, fb_cbcr_ofst);
++ davinci_disp_start_layer(win->layer, start, NULL);
+ } else
+ win->sdram_address = start;
+
+diff --git a/include/media/davinci/davinci_display.h b/include/media/davinci/davinci_display.h
+index e149624..4822405 100644
+--- a/include/media/davinci/davinci_display.h
++++ b/include/media/davinci/davinci_display.h
+@@ -175,8 +175,8 @@ struct davinci_display {
+ struct mutex lock;
+ /* Display mode information */
+ struct vid_enc_mode_info mode_info;
+- /* C-Plane offset from start of y-plane */
+- unsigned int cbcr_ofst;
++ /* Frame buffer information */
++ struct davinci_fb_desc fb_desc;
+ /* interrupt callback */
+ struct davinci_disp_callback event_callback;
+ struct display_obj *dev[DAVINCI_DISPLAY_MAX_DEVICES];
+diff --git a/include/video/davinci_osd.h b/include/video/davinci_osd.h
+index 6793f5e..7c4af2c 100644
+--- a/include/video/davinci_osd.h
++++ b/include/video/davinci_osd.h
+@@ -305,6 +305,20 @@ struct davinci_layer_config {
+ int interlaced;
+ };
+
++
++/**
++ * struct davinci_fb_desc
++ * @cbcr_ofst: offset of the cbcr data from the beginning of the frame buffer
++ *
++ * Description:
++ * A structure describing additional information about the frame buffers being
++ * passed to the display. This may be needed when the buffers have a
++ * non-standard layout.
++ */
++struct davinci_fb_desc {
++ unsigned long cbcr_ofst;
++};
++
+ /**
+ * davinci_disp_request_layer
+ * @layer: layer id
+@@ -444,7 +458,7 @@ void davinci_disp_get_layer_config(enum davinci_disp_layer layer,
+ */
+ void davinci_disp_start_layer(enum davinci_disp_layer layer,
+ unsigned long fb_base_phys,
+- unsigned long cbcr_ofst);
++ struct davinci_fb_desc *fb_desc);
+
+ /**
+ * davinci_disp_set_interpolation_filter
+--
+1.7.0.4
+
diff --git a/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0011-dm365-Add-custom-display-ioctl-VIDIOC_S_YDOFST.patch b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0011-dm365-Add-custom-display-ioctl-VIDIOC_S_YDOFST.patch
new file mode 100755
index 0000000000..6c8f9b2cf0
--- /dev/null
+++ b/recipes/linux/linux-davinci-2.6.31+2.6.32-rc2-psp03.01.00.37/0011-dm365-Add-custom-display-ioctl-VIDIOC_S_YDOFST.patch
@@ -0,0 +1,118 @@
+From 0d969cd5b772137a419ed6fbde70e4a2ec86693c Mon Sep 17 00:00:00 2001
+From: Don Darling <don.osc2@gmail.com>
+Date: Wed, 11 Aug 2010 13:16:19 -0500
+Subject: [PATCH 3/3] dm365: Add custom display ioctl VIDIOC_S_YDOFST
+
+This ioctl specifies the offset into the Y-plane where the display should
+start. This is useful when displaying codec output buffers that have
+padding around the edges of the frame.
+
+The offset must be 64-byte aligned. The hardware requirement is that both
+the Y and C planes are 32-byte aligned. However, the Y plane offset must be
+64-byte aligned in order to guarantee that the corresponding C plane offset is
+32-byte aligned.
+---
+ drivers/media/video/davinci/davinci_display.c | 14 ++++++++++++++
+ drivers/media/video/davinci/davinci_osd.c | 13 +++++++++++++
+ include/media/davinci/davinci_display.h | 6 ++++++
+ include/video/davinci_osd.h | 3 +++
+ 4 files changed, 36 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/media/video/davinci/davinci_display.c b/drivers/media/video/davinci/davinci_display.c
+index bb3dd77..d3bdeaa 100644
+--- a/drivers/media/video/davinci/davinci_display.c
++++ b/drivers/media/video/davinci/davinci_display.c
+@@ -1625,6 +1625,19 @@ static long vpbe_param_handler(struct file *file, void *priv,
+ davinci_dm.fb_desc.cbcr_ofst = *((unsigned long *) param);
+ mutex_unlock(&davinci_dm.lock);
+ break;
++ case VIDIOC_S_YDOFST:
++ davinci_dm.fb_desc.yd_ofst = *((unsigned long *) param);
++
++ /* The Y-plane display offset must be 64-byte aligned */
++ if (davinci_dm.fb_desc.yd_ofst & 0x3F) {
++ dev_err(davinci_display_dev, "fb_desc.yd_ofst is not "
++ "aligned to 64 bytes\n");
++ davinci_dm.fb_desc.yd_ofst = 0;
++ ret = -EINVAL;
++ }
++
++ mutex_unlock(&davinci_dm.lock);
++ break;
+ default:
+ ret = -EINVAL;
+ }
+@@ -1845,6 +1858,7 @@ static int davinci_release(struct file *filep)
+ mutex_unlock(&davinci_dm.lock);
+
+ davinci_dm.fb_desc.cbcr_ofst = 0;
++ davinci_dm.fb_desc.yd_ofst = 0;
+
+ dev_dbg(davinci_display_dev, "</davinci_release>\n");
+ return 0;
+diff --git a/drivers/media/video/davinci/davinci_osd.c b/drivers/media/video/davinci/davinci_osd.c
+index b8095af..2ee202c 100644
+--- a/drivers/media/video/davinci/davinci_osd.c
++++ b/drivers/media/video/davinci/davinci_osd.c
+@@ -1467,6 +1467,19 @@ static void _davinci_disp_start_layer(enum davinci_disp_layer layer,
+ cbcr_offset_32 = win->lconfig.line_length *
+ win->lconfig.ysize;
+ cbcr_offset_32 += fb_offset_32;
++
++ /* If a Y-plane display offset was specified, adjuest the fb
++ * and cbcr offsets to reflect the desired start of the
++ * display. This only applies when an NV12 colorspace is being
++ * used on the display.
++ */
++ if (fb_desc && fb_desc->yd_ofst) {
++ if (win->lconfig.pixfmt == PIXFMT_NV12) {
++ fb_offset_32 += fb_desc->yd_ofst;
++ cbcr_offset_32 += (fb_desc->yd_ofst) >> 1;
++ }
++ }
++
+ fb_offset_32 = fb_offset_32 >> 5;
+ cbcr_offset_32 = cbcr_offset_32 >> 5;
+ /*
+diff --git a/include/media/davinci/davinci_display.h b/include/media/davinci/davinci_display.h
+index 4822405..8433f12 100644
+--- a/include/media/davinci/davinci_display.h
++++ b/include/media/davinci/davinci_display.h
+@@ -26,6 +26,12 @@
+ */
+ #define VIDIOC_S_COFST _IOWR('V', 200, int)
+
++/* Application calls this ioctl for setting the offset into the Y-plane
++ * that represents the beginning of the displayed image. This is useful
++ * for cropping codec padding at the top of the Y-plane.
++ */
++#define VIDIOC_S_YDOFST _IOWR('V', 201, int)
++
+ #ifdef __KERNEL__
+
+ /* Header files */
+diff --git a/include/video/davinci_osd.h b/include/video/davinci_osd.h
+index 7c4af2c..642311f 100644
+--- a/include/video/davinci_osd.h
++++ b/include/video/davinci_osd.h
+@@ -309,14 +309,17 @@ struct davinci_layer_config {
+ /**
+ * struct davinci_fb_desc
+ * @cbcr_ofst: offset of the cbcr data from the beginning of the frame buffer
++ * @yd_offset: offset into the Y-plane where the layer should start displaying
+ *
+ * Description:
+ * A structure describing additional information about the frame buffers being
+ * passed to the display. This may be needed when the buffers have a
+ * non-standard layout.
++ * @yd_ofst must be 64-byte aligned.
+ */
+ struct davinci_fb_desc {
+ unsigned long cbcr_ofst;
++ unsigned long yd_ofst;
+ };
+
+ /**
+--
+1.7.0.4
+
diff --git a/recipes/linux/linux-davinci_2.6.31%2B2.6.32-rc2-psp03.01.00.37.bb b/recipes/linux/linux-davinci_2.6.31+2.6.32-rc2-psp03.01.00.37.bb
index 5b40f0e19c..5b40f0e19c 100644
--- a/recipes/linux/linux-davinci_2.6.31%2B2.6.32-rc2-psp03.01.00.37.bb
+++ b/recipes/linux/linux-davinci_2.6.31+2.6.32-rc2-psp03.01.00.37.bb
diff --git a/recipes/linux/linux-davinci_git.bb b/recipes/linux/linux-davinci_git.bb
index 3ea46de2d0..06b4dc89d5 100644
--- a/recipes/linux/linux-davinci_git.bb
+++ b/recipes/linux/linux-davinci_git.bb
@@ -6,6 +6,7 @@ KERNEL_IMAGETYPE = "uImage"
COMPATIBLE_MACHINE = "(dm355-evm|dm365-evm|dm6446-evm|dm6467-evm|dm6467t-evm|da830-omapl137-evm|da850-omapl138-evm|dm355-leopard|davinci-sffsdr|hawkboard)"
DEFAULT_PREFERENCE = "1"
+DEFAULT_PREFERENCE_dm365 = "-1"
BRANCH = "master"
SRC_URI = "file://defconfig "