Add device->opts.allow_dma
This commit is contained in:
@ -57,11 +57,11 @@ camera_t *camera_open(camera_options_t *options)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
camera->camera->allow_dma = camera->options.allow_dma;
|
camera->camera->opts.allow_dma = camera->options.allow_dma;
|
||||||
|
|
||||||
if (strstr(camera->camera->bus_info, "usb")) {
|
if (strstr(camera->camera->bus_info, "usb")) {
|
||||||
LOG_INFO(camera, "Disabling DMA since device uses USB (which is likely not working properly).");
|
LOG_INFO(camera, "Disabling DMA since device uses USB (which is likely not working properly).");
|
||||||
camera->camera->allow_dma = false;
|
camera->camera->opts.allow_dma = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: mpad format
|
// TODO: mpad format
|
||||||
|
@ -9,7 +9,7 @@ device_t *device_open(const char *name, const char *path, device_hw_t *hw) {
|
|||||||
dev->name = strdup(name);
|
dev->name = strdup(name);
|
||||||
dev->path = strdup(path);
|
dev->path = strdup(path);
|
||||||
dev->hw = hw;
|
dev->hw = hw;
|
||||||
dev->allow_dma = true;
|
dev->opts.allow_dma = true;
|
||||||
|
|
||||||
if (dev->hw->device_open(dev) < 0) {
|
if (dev->hw->device_open(dev) < 0) {
|
||||||
LOG_ERROR(dev, "Can't open device: %s", path);
|
LOG_ERROR(dev, "Can't open device: %s", path);
|
||||||
@ -53,7 +53,7 @@ int device_open_buffer_list(device_t *dev, bool do_capture, unsigned width, unsi
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dev->allow_dma) {
|
if (!dev->opts.allow_dma) {
|
||||||
do_mmap = true;
|
do_mmap = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ int device_open_buffer_list_output(device_t *dev, buffer_list_t *capture_list)
|
|||||||
capture_list->fmt_width, capture_list->fmt_height,
|
capture_list->fmt_width, capture_list->fmt_height,
|
||||||
capture_list->fmt_format, capture_list->fmt_bytesperline,
|
capture_list->fmt_format, capture_list->fmt_bytesperline,
|
||||||
capture_list->nbufs,
|
capture_list->nbufs,
|
||||||
capture_list->dev->allow_dma ? !capture_list->do_mmap : true);
|
capture_list->dev->opts.allow_dma ? !capture_list->do_mmap : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int device_open_buffer_list_capture(device_t *dev, buffer_list_t *output_list, float div, unsigned format, bool do_mmap)
|
int device_open_buffer_list_capture(device_t *dev, buffer_list_t *output_list, float div, unsigned format, bool do_mmap)
|
||||||
|
@ -31,12 +31,15 @@ typedef struct device_s {
|
|||||||
char *name;
|
char *name;
|
||||||
char *path;
|
char *path;
|
||||||
char bus_info[64];
|
char bus_info[64];
|
||||||
bool allow_dma;
|
|
||||||
|
|
||||||
device_hw_t *hw;
|
device_hw_t *hw;
|
||||||
buffer_list_t *capture_list;
|
buffer_list_t *capture_list;
|
||||||
buffer_list_t *output_list;
|
buffer_list_t *output_list;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool allow_dma;
|
||||||
|
} opts;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
struct device_v4l2_s *v4l2;
|
struct device_v4l2_s *v4l2;
|
||||||
struct device_dummy_s *dummy;
|
struct device_dummy_s *dummy;
|
||||||
|
Reference in New Issue
Block a user