• H
    [media] gspca_main: Set memory type to GSPCA_MEMORY_NO on buffer release · d642de2e
    Hans de Goede 提交于
    Before this patch we were not setting the memory type to GSPCA_MEMORY_NO
    when the buffers were released by the app doing a reqbufs 0. Nor would
    the memory type be set to GSPCA_MEMORY_NO on device close, as capture_file
    already is NULL on device close because of the reqbufs 0. This caused the
    following problem:
    -app1 does reqbufs USERPTR for 4 buffers
    -app1 does reqbufs USERPTR for 0 buffers
    -app2 tries to do reqbufs MMAP for 4 buffers
     fails because gspca_dev->memory still is USERPTR
    
    Fixing this also allows an app to switch memory type's by unrequesting
    the buffers and re-requesting them of a different type.
    
    This patch also moves the setting of gspca_dev->frsz and gscpa_dev->memory
    to after alloc_frame succeeding, so that they are not changed when allocating
    fails.
    Signed-off-by: NHans de Goede <hdegoede@redhat.com>
    Acked-by: NJean-Francois Moine <moinejf@free.fr>
    Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
    d642de2e
gspca.c 59.5 KB