diff --git a/xen/include/public/io/cameraif.h b/xen/include/public/io/cameraif.h index 38b9b3741e75..9aae0f47743b 100644 --- a/xen/include/public/io/cameraif.h +++ b/xen/include/public/io/cameraif.h @@ -87,6 +87,7 @@ * *---------------------------- Device 0 configuration ------------------------- * + * /local/domain/1/device/vcamera/0/max-buffers = "3" * /local/domain/1/device/vcamera/0/controls = "contrast,hue" * /local/domain/1/device/vcamera/0/formats/YUYV/640x480/frame-rates = "30/1,15/1" * /local/domain/1/device/vcamera/0/formats/YUYV/1920x1080/frame-rates = "15/2" @@ -100,6 +101,7 @@ * *---------------------------- Device 1 configuration ------------------------- * + * /local/domain/1/device/vcamera/1/max-buffers = "8" * /local/domain/1/device/vcamera/1/controls = "brightness,saturation,hue" * /local/domain/1/device/vcamera/1/formats/YUYV/640x480/frame-rates = "30/1,15/2" * /local/domain/1/device/vcamera/1/formats/YUYV/1920x1080/frame-rates = "15/2" @@ -165,6 +167,11 @@ * unique ID, so it can be identified by the backend by this ID. * This can be UUID or such. * + * max-buffers + * Values: + * + * Maximum number of camera buffers this frontend may use. + * * controls * Values: * @@ -173,12 +180,17 @@ * ordering requirement. * * formats - * Values: + * Values: * * Formats are organized as a set of directories one per each * supported pixel format. The name of the directory is the * corresponding FOURCC string label. The next level of * the directory under represents supported resolutions. + * If the format represents a big-endian variant of a little + * endian format, then the "-BE" suffix must be added. E.g. 'AR15' vs + * 'AR15-BE'. + * If FOURCC string label has spaces then those are only allowed to + * be at the end of the label and must be trimmed. * * resolution * Values: x @@ -335,16 +347,19 @@ */ #define XENCAMERA_OP_CONFIG_SET 0x00 #define XENCAMERA_OP_CONFIG_GET 0x01 -#define XENCAMERA_OP_BUF_REQUEST 0x02 -#define XENCAMERA_OP_BUF_CREATE 0x03 -#define XENCAMERA_OP_BUF_DESTROY 0x04 -#define XENCAMERA_OP_BUF_QUEUE 0x05 -#define XENCAMERA_OP_BUF_DEQUEUE 0x06 -#define XENCAMERA_OP_CTRL_ENUM 0x07 -#define XENCAMERA_OP_CTRL_SET 0x08 -#define XENCAMERA_OP_CTRL_GET 0x09 -#define XENCAMERA_OP_STREAM_START 0x0a -#define XENCAMERA_OP_STREAM_STOP 0x0b +#define XENCAMERA_OP_CONFIG_VALIDATE 0x02 +#define XENCAMERA_OP_FRAME_RATE_SET 0x03 +#define XENCAMERA_OP_BUF_GET_LAYOUT 0x04 +#define XENCAMERA_OP_BUF_REQUEST 0x05 +#define XENCAMERA_OP_BUF_CREATE 0x06 +#define XENCAMERA_OP_BUF_DESTROY 0x07 +#define XENCAMERA_OP_BUF_QUEUE 0x08 +#define XENCAMERA_OP_BUF_DEQUEUE 0x09 +#define XENCAMERA_OP_CTRL_ENUM 0x0a +#define XENCAMERA_OP_CTRL_SET 0x0b +#define XENCAMERA_OP_CTRL_GET 0x0c +#define XENCAMERA_OP_STREAM_START 0x0d +#define XENCAMERA_OP_STREAM_STOP 0x0e #define XENCAMERA_CTRL_BRIGHTNESS 0 #define XENCAMERA_CTRL_CONTRAST 1 @@ -362,33 +377,36 @@ #define XENCAMERA_CTRL_FLG_VOLATILE (1 << 2) /* Supported color spaces. */ -#define XENCAMERA_COLORSPACE_SMPTE170M 0 -#define XENCAMERA_COLORSPACE_REC709 1 -#define XENCAMERA_COLORSPACE_SRGB 2 -#define XENCAMERA_COLORSPACE_ADOBERGB 3 -#define XENCAMERA_COLORSPACE_BT2020 4 -#define XENCAMERA_COLORSPACE_DCI_P3 5 -#define XENCAMERA_COLORSPACE_RAW 6 +#define XENCAMERA_COLORSPACE_DEFAULT 0 +#define XENCAMERA_COLORSPACE_SMPTE170M 1 +#define XENCAMERA_COLORSPACE_REC709 2 +#define XENCAMERA_COLORSPACE_SRGB 3 +#define XENCAMERA_COLORSPACE_OPRGB 4 +#define XENCAMERA_COLORSPACE_BT2020 5 +#define XENCAMERA_COLORSPACE_DCI_P3 6 /* Color space transfer function. */ -#define XENCAMERA_XFER_FUNC_709 0 -#define XENCAMERA_XFER_FUNC_SRGB 1 -#define XENCAMERA_XFER_FUNC_ADOBERGB 2 -#define XENCAMERA_XFER_FUNC_NONE 3 -#define XENCAMERA_XFER_FUNC_DCI_P3 4 -#define XENCAMERA_XFER_FUNC_SMPTE2084 5 +#define XENCAMERA_XFER_FUNC_DEFAULT 0 +#define XENCAMERA_XFER_FUNC_709 1 +#define XENCAMERA_XFER_FUNC_SRGB 2 +#define XENCAMERA_XFER_FUNC_OPRGB 3 +#define XENCAMERA_XFER_FUNC_NONE 4 +#define XENCAMERA_XFER_FUNC_DCI_P3 5 +#define XENCAMERA_XFER_FUNC_SMPTE2084 6 /* Color space Y’CbCr encoding. */ -#define XENCAMERA_YCBCR_ENC_601 0 -#define XENCAMERA_YCBCR_ENC_709 1 -#define XENCAMERA_YCBCR_ENC_XV601 2 -#define XENCAMERA_YCBCR_ENC_XV709 3 -#define XENCAMERA_YCBCR_ENC_BT2020 4 -#define XENCAMERA_YCBCR_ENC_BT2020_CONST_LUM 5 +#define XENCAMERA_YCBCR_ENC_IGNORE 0 +#define XENCAMERA_YCBCR_ENC_601 1 +#define XENCAMERA_YCBCR_ENC_709 2 +#define XENCAMERA_YCBCR_ENC_XV601 3 +#define XENCAMERA_YCBCR_ENC_XV709 4 +#define XENCAMERA_YCBCR_ENC_BT2020 5 +#define XENCAMERA_YCBCR_ENC_BT2020_CONST_LUM 6 /* Quantization range. */ -#define XENCAMERA_QUANTIZATION_FULL_RANGE 0 -#define XENCAMERA_QUANTIZATION_LIM_RANGE 1 +#define XENCAMERA_QUANTIZATION_DEFAULT 0 +#define XENCAMERA_QUANTIZATION_FULL_RANGE 1 +#define XENCAMERA_QUANTIZATION_LIM_RANGE 2 /* ****************************************************************************** @@ -396,8 +414,7 @@ ****************************************************************************** */ #define XENCAMERA_EVT_FRAME_AVAIL 0x00 -#define XENCAMERA_EVT_CONFIG_CHANGE 0x01 -#define XENCAMERA_EVT_CTRL_CHANGE 0x02 +#define XENCAMERA_EVT_CTRL_CHANGE 0x01 /* Resolution has changed. */ #define XENCAMERA_EVT_CFG_FLG_RESOL (1 << 0) @@ -419,6 +436,7 @@ #define XENCAMERA_FIELD_REQ_CHANNEL "req-event-channel" #define XENCAMERA_FIELD_EVT_RING_REF "evt-ring-ref" #define XENCAMERA_FIELD_EVT_CHANNEL "evt-event-channel" +#define XENCAMERA_FIELD_MAX_BUFFERS "max-buffers" #define XENCAMERA_FIELD_CONTROLS "controls" #define XENCAMERA_FIELD_FORMATS "formats" #define XENCAMERA_FIELD_FRAME_RATES "frame-rates" @@ -430,6 +448,8 @@ #define XENCAMERA_CTRL_SATURATION_STR "saturation" #define XENCAMERA_CTRL_HUE_STR "hue" +#define XENCAMERA_FOURCC_BIGENDIAN_STR "-BE" + /* Maximum number of buffer planes supported. */ #define XENCAMERA_MAX_PLANE 4 @@ -449,6 +469,16 @@ * because of the fact it is already in use/reserved by the PV console. * - all references in this document to page sizes must be treated * as pages of size XEN_PAGE_SIZE unless otherwise noted. + * - all FOURCC mappings used for configuration and messaging are + * Linux V4L2 ones: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/videodev2.h + * with the following exceptions: + * - characters are allowed in [0x20; 0x7f] range + * - when used for XenStore configuration entries the following + * are not allowed: + * - '/', '\', ' ' (space), '<', '>', ':', '"', '|', '?', '*' + * - if trailing spaces are part of the FOURCC code then those must be + * trimmed + * * ****************************************************************************** * Description of the protocol between frontend and backend driver @@ -486,11 +516,13 @@ * operation - uint8_t, operation code, XENCAMERA_OP_XXX. * * - * Request to set configuration - request to set the configuration/mode - * of the camera: + * Request to set/validate the configuration - request to set the + * configuration/mode of the camera (XENCAMERA_OP_CONFIG_SET) or to + * check if the configuration is valid and can be used + * (XENCAMERA_OP_CONFIG_VALIDATE): * 0 1 2 3 octet * +----------------+----------------+----------------+----------------+ - * | id | _OP_CONFIG_SET | reserved | 4 + * | id | _OP_CONFIG_XXX | reserved | 4 * +----------------+----------------+----------------+----------------+ * | reserved | 8 * +----------------+----------------+----------------+----------------+ @@ -508,15 +540,7 @@ * +----------------+----------------+----------------+----------------+ * | quantization | 36 * +----------------+----------------+----------------+----------------+ - * | displ_asp_ratio_numer | 40 - * +----------------+----------------+----------------+----------------+ - * | displ_asp_ratio_denom | 44 - * +----------------+----------------+----------------+----------------+ - * | frame_rate_numer | 48 - * +----------------+----------------+----------------+----------------+ - * | frame_rate_denom | 52 - * +----------------+----------------+----------------+----------------+ - * | reserved | 56 + * | reserved | 40 * +----------------+----------------+----------------+----------------+ * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| * +----------------+----------------+----------------+----------------+ @@ -531,25 +555,29 @@ * xfer_func - uint32_t, this supplements colorspace parameter, * one of the XENCAMERA_XFER_FUNC_XXX. * ycbcr_enc - uint32_t, this supplements colorspace parameter, - * one of the XENCAMERA_YCBCR_ENC_XXX. + * one of the XENCAMERA_YCBCR_ENC_XXX. Please note, that ycbcr_enc is only + * valid for YCbCr pixelformats and should be ignored otherwise. * quantization - uint32_t, this supplements colorspace parameter, * one of the XENCAMERA_QUANTIZATION_XXX. - * displ_asp_ratio_numer - uint32_t, numerator of the display aspect ratio. - * displ_asp_ratio_denom - uint32_t, denominator of the display aspect ratio. - * frame_rate_numer - uint32_t, numerator of the frame rate. - * frame_rate_denom - uint32_t, denominator of the frame rate. * * See response format for this request. * * Notes: + * - the only difference between XENCAMERA_OP_CONFIG_VALIDATE and + * XENCAMERA_OP_CONFIG_SET is that the former doesn't actually change + * camera configuration, but queries if the configuration is valid. + * This can be used while stream is active and/or buffers allocated. * - frontend must check the corresponding response in order to see * if the values reported back by the backend do match the desired ones * and can be accepted. * - frontend may send multiple XENCAMERA_OP_CONFIG_SET requests before * sending XENCAMERA_OP_STREAM_START request to update or tune the - * configuration. + * final stream configuration. + * - configuration cannot be changed during active streaming, e.g. + * after XENCAMERA_OP_STREAM_START and before XENCAMERA_OP_STREAM_STOP + * requests. */ -struct xencamera_config { +struct xencamera_config_req { uint32_t pixel_format; uint32_t width; uint32_t height; @@ -557,10 +585,6 @@ struct xencamera_config { uint32_t xfer_func; uint32_t ycbcr_enc; uint32_t quantization; - uint32_t displ_asp_ratio_numer; - uint32_t displ_asp_ratio_denom; - uint32_t frame_rate_numer; - uint32_t frame_rate_denom; }; /* @@ -579,6 +603,61 @@ struct xencamera_config { * See response format for this request. * * + * Request to set the frame rate of the stream: + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | id | _FRAME_RATE_SET| reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | reserved | 8 + * +----------------+----------------+----------------+----------------+ + * | frame_rate_numer | 12 + * +----------------+----------------+----------------+----------------+ + * | frame_rate_denom | 16 + * +----------------+----------------+----------------+----------------+ + * | reserved | 20 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 64 + * +----------------+----------------+----------------+----------------+ + * + * frame_rate_numer - uint32_t, numerator of the frame rate. + * frame_rate_denom - uint32_t, denominator of the frame rate. + * + * Notes: + * - to query the current (actual) frame rate use XENCAMERA_OP_CONFIG_GET + * request. + * - this request can be used with camera buffers allocated, but stream + * stopped, e.g. frontend is allowed to stop the stream with + * XENCAMERA_OP_STREAM_STOP, hold the buffers allocated (e.g. keep the + * configuration set with XENCAMERA_OP_CONFIG_SET), change the + * frame rate of the stream and (re)start the stream again with + * XENCAMERA_OP_STREAM_START. + * - frame rate cannot be changed during active streaming, e.g. + * after XENCAMERA_OP_STREAM_START and before XENCAMERA_OP_STREAM_STOP + * commands. + */ +struct xencamera_frame_rate_req { + uint32_t frame_rate_numer; + uint32_t frame_rate_denom; +}; + +/* + * Request camera buffer's layout: + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | id | _BUF_GET_LAYOUT| reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | reserved | 8 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 64 + * +----------------+----------------+----------------+----------------+ + * + * See response format for this request. + * + * * Request number of buffers to be used: * 0 1 2 3 octet * +----------------+----------------+----------------+----------------+ @@ -606,6 +685,10 @@ struct xencamera_config { * - frontend may send multiple XENCAMERA_OP_BUF_REQUEST requests before * sending XENCAMERA_OP_STREAM_START request to update or tune the * configuration. + * - after this request camera configuration cannot be changed, unless + * streaming is stopped and buffers destroyed + * - passing zero num_bufs in this request (after streaming has stopped + * and all buffers destroyed) unblocks camera configuration changes. */ struct xencamera_buf_request { uint8_t num_bufs; @@ -621,9 +704,17 @@ struct xencamera_buf_request { * +----------------+----------------+----------------+----------------+ * | index | reserved | 12 * +----------------+----------------+----------------+----------------+ - * | gref_directory | 16 + * | plane_offset[0] | 16 * +----------------+----------------+----------------+----------------+ - * | reserved | 20 + * | plane_offset[1] | 20 + * +----------------+----------------+----------------+----------------+ + * | plane_offset[2] | 24 + * +----------------+----------------+----------------+----------------+ + * | plane_offset[3] | 28 + * +----------------+----------------+----------------+----------------+ + * | gref_directory | 32 + * +----------------+----------------+----------------+----------------+ + * | reserved | 36 * +----------------+----------------+----------------+----------------+ * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| * +----------------+----------------+----------------+----------------+ @@ -634,9 +725,12 @@ struct xencamera_buf_request { * index can be re-used after destroying the corresponding camera buffer. * * index - uint8_t, index of the buffer to be created. + * plane_offset - array of uint32_t, offset of the corresponding plane + * in octets from the buffer start. Number of offsets returned is + * equal to the value returned in XENCAMERA_OP_BUF_GET_LAYOUT.num_planes. * gref_directory - grant_ref_t, a reference to the first shared page * describing shared buffer references. The size of the buffer is equal to - * XENCAMERA_OP_GET_BUF_DETAILS.size response. At least one page exists. If + * XENCAMERA_OP_BUF_GET_LAYOUT.size response. At least one page exists. If * shared buffer size exceeds what can be addressed by this single page, * then reference to the next shared page must be supplied (see * gref_dir_next_page below). @@ -658,6 +752,7 @@ struct xencamera_buf_request { struct xencamera_buf_create_req { uint8_t index; uint8_t reserved[3]; + uint32_t plane_offset[XENCAMERA_MAX_PLANE]; grant_ref_t gref_directory; }; @@ -884,11 +979,11 @@ struct xencamera_get_ctrl_req { * status - int32_t, response status, zero on success and -XEN_EXX on failure. * * - * Set/get configuration response - response for XENCAMERA_OP_CONFIG_SET - * and XENCAMERA_OP_CONFIG_GET + * Configuration response - response for XENCAMERA_OP_CONFIG_SET, + * XENCAMERA_OP_CONFIG_GET and XENCAMERA_OP_CONFIG_VALIDATE requests: * 0 1 2 3 octet * +----------------+----------------+----------------+----------------+ - * | id | _OP_CONFIG_?ET | reserved | 4 + * | id | _OP_CONFIG_XXX | reserved | 4 * +----------------+----------------+----------------+----------------+ * | status | 8 * +----------------+----------------+----------------+----------------+ @@ -922,68 +1017,100 @@ struct xencamera_get_ctrl_req { * +----------------+----------------+----------------+----------------+ * * Meaning of the corresponding values in this response is the same as for - * XENCAMERA_OP_CONFIG_SET request. + * XENCAMERA_OP_CONFIG_SET and XENCAMERA_OP_FRAME_RATE_SET requests. * - * - * Request buffer response - response for XENCAMERA_OP_BUF_REQUEST + * displ_asp_ratio_numer - uint32_t, numerator of the display aspect ratio. + * displ_asp_ratio_denom - uint32_t, denominator of the display aspect ratio. + */ +struct xencamera_config_resp { + uint32_t pixel_format; + uint32_t width; + uint32_t height; + uint32_t colorspace; + uint32_t xfer_func; + uint32_t ycbcr_enc; + uint32_t quantization; + uint32_t displ_asp_ratio_numer; + uint32_t displ_asp_ratio_denom; + uint32_t frame_rate_numer; + uint32_t frame_rate_denom; +}; + +/* + * Request buffer response - response for XENCAMERA_OP_BUF_GET_LAYOUT * request: * 0 1 2 3 octet * +----------------+----------------+----------------+----------------+ - * | id |_OP_BUF_REQUEST | reserved | 4 + * | id |_BUF_GET_LAYOUT | reserved | 4 * +----------------+----------------+----------------+----------------+ * | status | 8 * +----------------+----------------+----------------+----------------+ - * | num_buffers | num_planes | reserved | 12 + * | num_planes | reserved | 12 * +----------------+----------------+----------------+----------------+ * | size | 16 * +----------------+----------------+----------------+----------------+ - * | plane_offset[0] | 20 - * +----------------+----------------+----------------+----------------+ - * | plane_offset[1] | 24 - * +----------------+----------------+----------------+----------------+ - * | plane_offset[2] | 28 + * | plane_size[0] | 20 * +----------------+----------------+----------------+----------------+ - * | plane_offset[3] | 32 + * | plane_size[1] | 24 * +----------------+----------------+----------------+----------------+ - * | plane_size[0] | 36 + * | plane_size[2] | 28 * +----------------+----------------+----------------+----------------+ - * | plane_size[1] | 40 + * | plane_size[3] | 32 * +----------------+----------------+----------------+----------------+ - * | plane_size[2] | 44 + * | plane_stride[0] | 36 * +----------------+----------------+----------------+----------------+ - * | plane_size[3] | 48 + * | plane_stride[1] | 40 * +----------------+----------------+----------------+----------------+ - * | plane_stride[0] | plane_stride[1] | 52 + * | plane_stride[2] | 44 * +----------------+----------------+----------------+----------------+ - * | plane_stride[2] | plane_stride[3] | 56 + * | plane_stride[3] | 48 * +----------------+----------------+----------------+----------------+ - * | reserved | 60 + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| * +----------------+----------------+----------------+----------------+ * | reserved | 64 * +----------------+----------------+----------------+----------------+ * - * num_buffers - uint8_t, number of buffers to be used. * num_planes - uint8_t, number of planes of the buffer. * size - uint32_t, overall size of the buffer including sizes of the * individual planes and padding if applicable. - * plane_offset - array of uint32_t, offset of the corresponding plane - * in octets from the buffer start. * plane_size - array of uint32_t, size in octets of the corresponding plane * including padding. * plane_stride - array of uint32_t, size in octets occupied by the * corresponding single image line including padding if applicable. + * + * Note! The sizes and strides in this response apply to all buffers created + * with XENCAMERA_OP_BUF_CREATE command, but individual buffers may have + * different plane offsets, see XENCAMERA_OP_BUF_REQUEST.plane_offset. */ -struct xencamera_buf_request_resp { - uint8_t num_buffers; +struct xencamera_buf_get_layout_resp { uint8_t num_planes; - uint8_t reserved[2]; + uint8_t reserved[3]; uint32_t size; - uint32_t plane_offset[XENCAMERA_MAX_PLANE]; uint32_t plane_size[XENCAMERA_MAX_PLANE]; - uint16_t plane_stride[XENCAMERA_MAX_PLANE]; + uint32_t plane_stride[XENCAMERA_MAX_PLANE]; }; /* + * Request buffer response - response for XENCAMERA_OP_BUF_REQUEST + * request: + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | id |_OP_BUF_REQUEST | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | status | 8 + * +----------------+----------------+----------------+----------------+ + * | num_buffers | reserved | 12 + * +----------------+----------------+----------------+----------------+ + * | reserved | 16 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 64 + * +----------------+----------------+----------------+----------------+ + * + * num_buffers - uint8_t, number of buffers to be used. + * + * * Control enumerate response - response for XENCAMERA_OP_CTRL_ENUM: * 0 1 2 3 octet * +----------------+----------------+----------------+----------------+ @@ -991,9 +1118,9 @@ struct xencamera_buf_request_resp { * +----------------+----------------+----------------+----------------+ * | status | 8 * +----------------+----------------+----------------+----------------+ - * | index | type | flags | 12 + * | index | type | reserved | 12 * +----------------+----------------+----------------+----------------+ - * | reserved | 16 + * | flags | 16 * +----------------+----------------+----------------+----------------+ * | min low 32-bits | 20 * +----------------+----------------+----------------+----------------+ @@ -1020,7 +1147,7 @@ struct xencamera_buf_request_resp { * * index - uint8_t, index of the camera control in response. * type - uint8_t, type of the control, one of the XENCAMERA_CTRL_XXX. - * flags - uint16_t, flags of the control, one of the XENCAMERA_CTRL_FLG_XXX. + * flags - uint32_t, flags of the control, one of the XENCAMERA_CTRL_FLG_XXX. * min - int64_t, minimum value of the control. * max - int64_t, maximum value of the control. * step - int64_t, minimum size in which control value can be changed. @@ -1029,8 +1156,8 @@ struct xencamera_buf_request_resp { struct xencamera_ctrl_enum_resp { uint8_t index; uint8_t type; - uint16_t flags; - uint8_t reserved[4]; + uint8_t reserved[2]; + uint32_t flags; int64_t min; int64_t max; int64_t step; @@ -1113,7 +1240,9 @@ struct xencamera_ctrl_enum_resp { * index - uint8_t, index of the buffer that contains new captured frame. * used_sz - uint32_t, number of octets this frame has. This can be less * than the XENCAMERA_OP_BUF_REQUEST.size (response) for compressed formats. - * seq_num - uint64_t, sequential number of the frame. + * seq_num - uint64_t, sequential number of the frame. Must be + * monotonically increasing. If skips are detected in seq_num then that + * means that the frames in-between were dropped. */ struct xencamera_frame_avail_evt { uint8_t index; @@ -1123,30 +1252,6 @@ struct xencamera_frame_avail_evt { uint64_t seq_num; }; -/* - * Configuration change - event from back to front when current - * configuration has changed: - * 0 1 2 3 octet - * +----------------+----------------+----------------+----------------+ - * | id | _CONFIG_CHANGE | reserved | 4 - * +----------------+----------------+----------------+----------------+ - * | reserved | 8 - * +----------------+----------------+----------------+----------------+ - * | flags | 12 - * +----------------+----------------+----------------+----------------+ - * | reserved | 16 - * +----------------+----------------+----------------+----------------+ - * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| - * +----------------+----------------+----------------+----------------+ - * | reserved | 64 - * +----------------+----------------+----------------+----------------+ - * - * flags - uint32_t, set of the XENCAMERA_EVT_CFG_FLG_XXX flags. - */ -struct xencamera_cfg_change_evt { - uint32_t flags; -}; - /* * Control change event- event from back to front when camera control * has changed: @@ -1173,15 +1278,21 @@ struct xencamera_cfg_change_evt { * * type - uint8_t, type of the control, one of the XENCAMERA_CTRL_XXX. * value - int64_t, new value of the control. + * + * Notes: + * - this event is not sent for write-only controls + * - this event is not sent to the originator of the control change + * - this event is not sent when frontend first connects, e.g. initial + * control state must be explicitly queried */ - struct xencamera_req { uint16_t id; uint8_t operation; uint8_t reserved[5]; union { - struct xencamera_config config; + struct xencamera_config_req config; + struct xencamera_frame_rate_req frame_rate; struct xencamera_buf_request buf_request; struct xencamera_buf_create_req buf_create; struct xencamera_index index; @@ -1197,8 +1308,9 @@ struct xencamera_resp { uint8_t reserved; int32_t status; union { - struct xencamera_config config; - struct xencamera_buf_request_resp buf_request; + struct xencamera_config_resp config; + struct xencamera_buf_get_layout_resp buf_layout; + struct xencamera_buf_request buf_request; struct xencamera_ctrl_enum_resp ctrl_enum; struct xencamera_ctrl_value ctrl_value; uint8_t reserved1[56]; @@ -1211,7 +1323,6 @@ struct xencamera_evt { uint8_t reserved[5]; union { struct xencamera_frame_avail_evt frame_avail; - struct xencamera_cfg_change_evt cfg_change; struct xencamera_ctrl_value ctrl_value; uint8_t reserved[56]; } evt;