Enable -Wall

This commit is contained in:
Kamil Trzcinski
2022-04-14 10:13:18 +02:00
parent eaf4e06989
commit 9c7f5fed12
25 changed files with 41 additions and 57 deletions

View File

@ -128,7 +128,6 @@ int buffer_lock_write_loop(buffer_lock_t *buf_lock, int nframes, buffer_write_fn
}
}
ok:
buffer_lock_use(buf_lock, -1);
return frames;

View File

@ -127,7 +127,7 @@ int buffer_list_enqueue(buffer_list_t *buf_list, buffer_t *dma_buf)
memcpy(buf->start, dma_buf->start, dma_buf->used);
uint64_t after = get_monotonic_time_us(NULL, NULL);
LOG_DEBUG(buf, "mmap copy: dest=%p, src=%p (%s), size=%zu, space=%zu, time=%dllus",
LOG_DEBUG(buf, "mmap copy: dest=%p, src=%p (%s), size=%zu, space=%zu, time=%luus",
buf->start, dma_buf->start, dma_buf->name, dma_buf->used, buf->length, after-before);
} else {
LOG_DEBUG(buf, "dmabuf copy: dest=%p, src=%p (%s, dma_fd=%d), size=%zu",
@ -141,8 +141,6 @@ int buffer_list_enqueue(buffer_list_t *buf_list, buffer_t *dma_buf)
buf->used = dma_buf->used;
buffer_consumed(buf, "copy-data");
return 1;
error:
return -1;
}
buffer_t *buffer_list_dequeue(buffer_list_t *buf_list)
@ -162,7 +160,7 @@ buffer_t *buffer_list_dequeue(buffer_list_t *buf_list)
buf->enqueued = false;
buf->mmap_reflinks = 1;
LOG_DEBUG(buf_list, "Grabbed mmap buffer=%u, bytes=%d, used=%d, frame=%d, linked=%s",
LOG_DEBUG(buf_list, "Grabbed mmap buffer=%u, bytes=%zu, used=%zu, frame=%d, linked=%s",
buf->index,
buf->length,
buf->used,

View File

@ -22,7 +22,7 @@ typedef struct camera_options_s {
bool allow_dma;
float high_res_factor;
float low_res_factor;
int auto_reconnect;
unsigned auto_reconnect;
char options[CAMERA_OPTIONS_LENGTH];

View File

@ -54,7 +54,6 @@ buffer_list_t *device_open_buffer_list(device_t *dev, bool do_capture, unsigned
buffer_list_t *device_open_buffer_list2(device_t *dev, const char *path, bool do_capture, unsigned width, unsigned height, unsigned format, unsigned bytesperline, int nbufs, bool do_mmap)
{
unsigned type;
char name[64];
int index = 0;
buffer_list_t *buf_list;
@ -239,7 +238,7 @@ void device_set_option_list(device_t *dev, const char *option_list)
char *string = start;
char *option;
while (option = strsep(&string, OPTION_VALUE_LIST_SEP)) {
while ((option = strsep(&string, OPTION_VALUE_LIST_SEP)) != NULL) {
char *value = option;
char *key = strsep(&value, "=");

View File

@ -37,7 +37,7 @@ int libcamera_buffer_open(buffer_t *buf)
}
if (offset + length != plane.offset) {
LOG_ERROR(buf, "Plane is not continuous: offset=%lld, expected=%lld", plane.offset, offset + length);
LOG_ERROR(buf, "Plane is not continuous: offset=%u, expected=%lu", plane.offset, offset + length);
}
length += plane.length;
@ -51,7 +51,7 @@ int libcamera_buffer_open(buffer_t *buf)
buf->dma_fd = dma_fd.get();
buf->length = length;
LOG_DEBUG(buf, "Mapped buffer: start=%p, length=%d, fd=%d, planes=%d",
LOG_DEBUG(buf, "Mapped buffer: start=%p, length=%zu, fd=%d, planes=%lu",
buf->start, buf->length, buf->dma_fd, buffer->planes().size());
}
@ -76,7 +76,7 @@ int libcamera_buffer_enqueue(buffer_t *buf, const char *who)
request->reuse(libcamera::Request::ReuseBuffers);
if (buf->buf_list->dev->libcamera->camera->queueRequest(buf->libcamera->request.get()) < 0) {
if (camera->queueRequest(buf->libcamera->request.get()) < 0) {
LOG_ERROR(buf, "Can't queue buffer.");
}
return 0;
@ -107,7 +107,7 @@ int libcamera_buffer_list_dequeue(buffer_list_t *buf_list, buffer_t **bufp)
return -1;
}
if (index >= buf_list->nbufs) {
if (index >= (unsigned)buf_list->nbufs) {
LOG_INFO(buf_list, "Received invalid index from `read`: %d >= %d", index, buf_list->nbufs);
return -1;
}

View File

@ -86,6 +86,9 @@ int libcamera_device_set_option(device_t *dev, const char *keyp, const char *val
libcamera::ControlValue control_value;
switch (control_id->type()) {
case libcamera::ControlTypeNone:
break;
case libcamera::ControlTypeBool:
control_value.set<bool>(atoi(value));
break;

View File

@ -11,7 +11,6 @@
int _build_fds(link_t *all_links, struct pollfd *fds, link_t **links, buffer_list_t **buf_lists, int max_n, int *max_timeout_ms)
{
int n = 0, nlinks = 0;
uint64_t now_us = get_monotonic_time_us(NULL, NULL);
for (nlinks = 0; all_links[nlinks].source; nlinks++);
@ -143,7 +142,6 @@ int links_step(link_t *all_links, int timeout_now_ms, int *timeout_next_ms)
struct pollfd fds[N_FDS] = {0};
link_t *links[N_FDS];
buffer_list_t *buf_lists[N_FDS];
buffer_t *buf;
int n = _build_fds(all_links, fds, links, buf_lists, N_FDS, &timeout_now_ms);
print_pollfds(fds, n);
@ -220,7 +218,7 @@ int links_step(link_t *all_links, int timeout_now_ms, int *timeout_next_ms)
continue;
#endif
if (buf = buffer_list_find_slot(buf_list)) {
if ((buf = buffer_list_find_slot(buf_list)) != NULL) {
buffer_consumed(buf, "enqueued");
}
}

View File

@ -10,7 +10,6 @@ int v4l2_buffer_open(buffer_t *buf)
struct v4l2_plane v4l2_plane = {0};
buffer_list_t *buf_list = buf->buf_list;
device_t *dev = buf_list->dev;
buf->v4l2 = calloc(1, sizeof(buffer_v4l2_t));
@ -29,7 +28,7 @@ int v4l2_buffer_open(buffer_t *buf)
v4l2_buf.memory = V4L2_MEMORY_DMABUF;
}
ERR_IOCTL(buf_list, buf_list->v4l2->dev_fd, VIDIOC_QUERYBUF, &v4l2_buf, "Cannot query buffer %d", index);
ERR_IOCTL(buf_list, buf_list->v4l2->dev_fd, VIDIOC_QUERYBUF, &v4l2_buf, "Cannot query buffer %d", buf->index);
uint64_t mem_offset = 0;
@ -51,7 +50,7 @@ int v4l2_buffer_open(buffer_t *buf)
v4l2_exp.type = v4l2_buf.type;
v4l2_exp.index = buf->index;
v4l2_exp.plane = 0;
ERR_IOCTL(buf_list, buf_list->v4l2->dev_fd, VIDIOC_EXPBUF, &v4l2_exp, "Can't export queue buffer=%u to DMA", index);
ERR_IOCTL(buf_list, buf_list->v4l2->dev_fd, VIDIOC_EXPBUF, &v4l2_exp, "Can't export queue buffer=%u to DMA", buf->index);
buf->dma_fd = v4l2_exp.fd;
}

View File

@ -62,7 +62,7 @@ int v4l2_buffer_list_open(buffer_list_t *buf_list)
// JPEG is in 16x16 blocks (shrink image to fit) (but adapt to 32x32)
// And ISP output
if (strstr(buf_list->name, "JPEG") || strstr(buf_list->name, "H264") || buf_list->do_capture && strstr(buf_list->name, "ISP")) {
if (strstr(buf_list->name, "JPEG") || strstr(buf_list->name, "H264") || (buf_list->do_capture && strstr(buf_list->name, "ISP"))) {
buffer_format_t org_fmt = buf_list->fmt;
fmt.width = shrink_to_block(fmt.width, 32);
fmt.height = shrink_to_block(fmt.height, 32);

View File

@ -24,7 +24,7 @@ int v4l2_device_open(device_t *dev)
LOG_ERROR(dev, "Device doesn't support streaming IO");
}
strcpy(dev->bus_info, v4l2_cap.bus_info);
strcpy(dev->bus_info, (char *)v4l2_cap.bus_info);
dev->v4l2->subdev_fd = v4l2_device_open_v4l2_subdev(dev, 0);
v4l2_device_query_controls(dev, dev->v4l2->dev_fd);

View File

@ -22,7 +22,7 @@ int v4l2_device_open_media_device(device_t *dev)
return -1;
}
char path[256];
char path[300];
sprintf(path, "/sys/dev/char/%d:%d/device", major(st.st_rdev), minor(st.st_rdev));
struct dirent **namelist;
@ -47,7 +47,6 @@ int v4l2_device_open_media_device(device_t *dev)
}
free(namelist);
error:
return ret;
}
@ -94,7 +93,7 @@ int v4l2_device_open_v4l2_subdev(device_t *dev, int subdev)
}
if (strstr(last, "/v4l-subdev") != last) {
LOG_VERBOSE(dev, "Link '%s' does not contain '/v4l-subdev'", link, path);
LOG_VERBOSE(dev, "Link '%s' does not contain '/v4l-subdev'", link);
goto error;
}

View File

@ -23,7 +23,6 @@ error:
static int v4l2_device_query_control_iter_id(device_t *dev, int fd, uint32_t *id)
{
struct v4l2_query_ext_ctrl qctrl = { .id = *id };
void *data = NULL;
if (0 != ioctl (fd, VIDIOC_QUERY_EXT_CTRL, &qctrl)) {
return -1;
@ -120,7 +119,7 @@ int v4l2_device_set_option(device_t *dev, const char *key, const char *value)
char *token;
int tokens = 0;
for ( ; token = strsep(&string, ","); tokens++) {
for ( ; (token = strsep(&string, ",")) != NULL; tokens++) {
if (tokens >= control->control.elems)
continue;

View File

@ -1,5 +1,6 @@
#pragma once
#include <time.h>
#include <linux/videodev2.h>
#include <linux/v4l2-subdev.h>
#include <stdbool.h>