Commit 9e7664e0 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] solo6x10: The size of the thresholds ioctls was too large

On powerpc the maximum size for the ioctl argument is 8191, and it was
8192. However, the 64x64 array of threshold values is more than is actually
needed in practice for PAL and NTSC formats. A 45x45 array will do just fine.
So change the size accordingly to fix this problem.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 4b0cac5e
...@@ -205,10 +205,11 @@ int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch, ...@@ -205,10 +205,11 @@ int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch,
const struct solo_motion_thresholds *thresholds) const struct solo_motion_thresholds *thresholds)
{ {
u32 off = SOLO_MOT_FLAG_AREA + ch * SOLO_MOT_THRESH_SIZE * 2; u32 off = SOLO_MOT_FLAG_AREA + ch * SOLO_MOT_THRESH_SIZE * 2;
u16 buf[SOLO_MOTION_SZ]; u16 buf[64];
int x, y; int x, y;
int ret = 0; int ret = 0;
memset(buf, 0, sizeof(buf));
for (y = 0; y < SOLO_MOTION_SZ; y++) { for (y = 0; y < SOLO_MOTION_SZ; y++) {
for (x = 0; x < SOLO_MOTION_SZ; x++) for (x = 0; x < SOLO_MOTION_SZ; x++)
buf[x] = cpu_to_le16(thresholds->thresholds[y][x]); buf[x] = cpu_to_le16(thresholds->thresholds[y][x]);
......
...@@ -113,8 +113,14 @@ ...@@ -113,8 +113,14 @@
* each sample representing 16x16 pixels of the source. In * each sample representing 16x16 pixels of the source. In
* effect, 44x30 samples are used for NTSC, and 44x36 for PAL. * effect, 44x30 samples are used for NTSC, and 44x36 for PAL.
* The 5th sample on the 10th row is (10*64)+5 = 645. * The 5th sample on the 10th row is (10*64)+5 = 645.
*
* Using a 64x64 array will result in a problem on some architectures like
* the powerpc where the size of the argument is limited to 13 bits.
* Since both PAL and NTSC do not use the full table anyway I've chosen
* to limit the array to 45x45 (45*16 = 720, which is the maximum PAL/NTSC
* width).
*/ */
#define SOLO_MOTION_SZ (64) #define SOLO_MOTION_SZ (45)
struct solo_motion_thresholds { struct solo_motion_thresholds {
__u16 thresholds[SOLO_MOTION_SZ][SOLO_MOTION_SZ]; __u16 thresholds[SOLO_MOTION_SZ][SOLO_MOTION_SZ];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment