diff options
author | Daniel Stone <daniels@collabora.com> | 2017-02-08 12:02:03 +0000 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2017-02-08 12:02:03 +0000 |
commit | d5fa0909046d51f69a809f3ae7b2f6b98fcf3cac (patch) | |
tree | 2df3a6464e3318b4f8b585c36de36fc11c10a01d | |
parent | a32986ecf56e6011fd0fa38a098ea58721b24563 (diff) |
Revert "clients: teach simple-dmabuf-v4l to deal with flipped input"
This reverts commit 0fee977c46423e496a6eda6418c31bfe09a1f27b.
This commit introduces a requirement on v4l2_query_ext_ctrl and
VIDIOC_QUERY_EXT_CTRL, which were introduced in kernel 3.17. Some Ubuntu
LTS releases ship with much older kernels (and, significantly, UAPI),
which don't have these.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
-rw-r--r-- | clients/simple-dmabuf-v4l.c | 62 |
1 files changed, 8 insertions, 54 deletions
diff --git a/clients/simple-dmabuf-v4l.c b/clients/simple-dmabuf-v4l.c index 6f41b2a7..af25d0ea 100644 --- a/clients/simple-dmabuf-v4l.c +++ b/clients/simple-dmabuf-v4l.c @@ -351,67 +351,21 @@ static const struct zwp_linux_buffer_params_v1_listener params_listener = { create_failed }; -static bool -check_v4l2_control_bool(const int fd, - const struct v4l2_query_ext_ctrl *qectrl, - const char *control_name, - const int expected_value) -{ - struct v4l2_control ctrl; - - memset(&ctrl, 0, sizeof(ctrl)); - ctrl.id = qectrl->id; - - if (qectrl->flags & V4L2_CTRL_FLAG_DISABLED) - return false; - - if (!(qectrl->type == V4L2_CTRL_TYPE_BOOLEAN)) - return false; - - if (strcmp(qectrl->name, control_name)) - return false; - - /* with the early-outs out of the way, do the actual check */ - if (xioctl(fd, VIDIOC_G_CTRL, &ctrl)) - return false; - - if (ctrl.value != expected_value) - return false; - - return true; -} - static void create_dmabuf_buffer(struct display *display, struct buffer *buffer) { struct zwp_linux_buffer_params_v1 *params; uint64_t modifier; - uint32_t lbp_flags; + uint32_t flags; unsigned i; - struct v4l2_query_ext_ctrl qectrl; - const unsigned int v4l2_qec_flags = - V4L2_CTRL_FLAG_NEXT_CTRL | V4L2_CTRL_FLAG_NEXT_COMPOUND; - const char *vflip_ctrl = "Vertical Flip"; - const char *hflip_ctrl = "Horizontal Flip"; modifier = 0; - lbp_flags = 0; - - /* handle relevant v4l2 controls */ - memset(&qectrl, 0, sizeof(qectrl)); - qectrl.id |= v4l2_qec_flags; - while (!xioctl(display->v4l_fd, VIDIOC_QUERY_EXT_CTRL, &qectrl)) { - if (check_v4l2_control_bool(display->v4l_fd, &qectrl, - vflip_ctrl, 0x1)) { - lbp_flags = ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT; - printf ("\"%s\" control is set, inverting Y\n", vflip_ctrl); - } else if (check_v4l2_control_bool(display->v4l_fd, &qectrl, - hflip_ctrl, 0x1)) { - printf ("\"%s\" control is set, but dmabuf output cannot" - "be flipped horizontally\n", hflip_ctrl); - } - qectrl.id |= v4l2_qec_flags; - } + flags = 0; + + /* XXX: apparently some webcams may actually provide y-inverted images, + * in which case we should set + * flags = ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT + */ params = zwp_linux_dmabuf_v1_create_params(display->dmabuf); for (i = 0; i < display->format.num_planes; ++i) @@ -428,7 +382,7 @@ create_dmabuf_buffer(struct display *display, struct buffer *buffer) display->format.width, display->format.height, display->drm_format, - lbp_flags); + flags); } static int |