]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
[media] gspca: Add a need_max_bandwidth flag to sd_desc
authorHans de Goede <hdegoede@redhat.com>
Sun, 1 Jan 2012 19:35:01 +0000 (16:35 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 6 Jan 2012 11:07:49 +0000 (09:07 -0200)
Some cameras will pretty much entirely fill all the image buffers all the
time even though they are using compression.

This patch adds a flag to sd_desc, which drivers for such cameras can set.

When this flag is set the bandwidth calculation code will no longer
assume that the image buffer size is a worst case and less bandwidth than
imagebufsize * fps will be used on average.

This patch sets this new flag for 3 drivers:
* For spca561 (for rev12a cameras) and nw80x cams as these simply don't work
  when given less bandwidth than imagebufsize * fps.
* For sn9c20x cameras, because these show severy jpeg artifacts when
  given less bandwidth than imagebufsize * fps and since these are usb2
  cameras there is plenty bandwidth anyways.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c
drivers/media/video/gspca/gspca.h
drivers/media/video/gspca/nw80x.c
drivers/media/video/gspca/sn9c20x.c
drivers/media/video/gspca/spca561.c

index a8643bcd2ecb4e73221b18c525e0203c5ff3c112..b044c8a10a1dcf26f007a45869787aaa68d38d46 100644 (file)
@@ -638,7 +638,8 @@ static u32 which_bandwidth(struct gspca_dev *gspca_dev)
        bandwidth = gspca_dev->cam.cam_mode[i].sizeimage;
 
        /* if the image is compressed, estimate its mean size */
-       if (bandwidth < gspca_dev->cam.cam_mode[i].width *
+       if (!gspca_dev->cam.needs_full_bandwidth &&
+           bandwidth < gspca_dev->cam.cam_mode[i].width *
                                gspca_dev->cam.cam_mode[i].height)
                bandwidth = bandwidth * 3 / 8;  /* 0.375 */
 
index 5f1f46c8e3731e5b5d1f6198d5c00c486df53a35..589009f4496fcfc2599bed9709f214cc082780f3 100644 (file)
@@ -69,6 +69,9 @@ struct cam {
        u8 bulk;                /* image transfer by 0:isoc / 1:bulk */
        u8 npkt;                /* number of packets in an ISOC message
                                 * 0 is the default value: 32 packets */
+       u8 needs_full_bandwidth;/* Set this flag to notify the bandwidth calc.
+                                * code that the cam fills all image buffers to
+                                * the max, even when using compression. */
 };
 
 struct gspca_dev;
index 3830054a683e1361eaa4bd1626f2edc11652bd8c..09f7db8ceffd884e2adc78394295ae12cd767ae9 100644 (file)
@@ -1764,6 +1764,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
                webcam = 0;
        sd->webcam = webcam;
        gspca_dev->cam.ctrls = sd->ctrls;
+       gspca_dev->cam.needs_full_bandwidth = 1;
        sd->ag_cnt = -1;
 
        /*
index 86e07a139a16e2867970baca2d217e42f89e99eb..7350718c613a663946b530e2d2512773e07d9a11 100644 (file)
@@ -2048,6 +2048,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct cam *cam;
 
        cam = &gspca_dev->cam;
+       cam->needs_full_bandwidth = 1;
 
        sd->sensor = (id->driver_info >> 8) & 0xff;
        sd->i2c_addr = id->driver_info & 0xff;
index 61743d4255849e7ff1698e2bf0c1736d881ebebc..8a6e258abf30a3f72448a400fedd3335d9e96cfd 100644 (file)
@@ -451,6 +451,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
        }
 
        cam = &gspca_dev->cam;
+       cam->needs_full_bandwidth = 1;
 
        sd->chip_revision = id->driver_info;
        if (sd->chip_revision == Rev012A) {