diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-14 09:29:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-14 09:29:21 -0500 |
commit | 747ae0a96f1a78b35c5a3d93ad37a16655e16340 (patch) | |
tree | 880b33cf70674a5cccc6508cc327f01e93971017 | |
parent | 7089db84e356562f8ba737c29e472cc42d530dbc (diff) | |
parent | 42980da2eb7eb9695d8efc0c0ef145cbbb993b2c (diff) |
Merge tag 'media/v4.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media fixes from Mauro Carvalho Chehab:
"A colorspace regression fix in V4L2 core and a CEC core bug that makes
it discard valid messages"
* tag 'media/v4.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
[media] cec: initiator should be the same as the destination for, poll
[media] videodev2.h: go back to limited range Y'CbCr for SRGB and, ADOBERGB
-rw-r--r-- | Documentation/media/uapi/v4l/pixfmt-007.rst | 23 | ||||
-rw-r--r-- | drivers/media/cec/cec-adap.c | 7 | ||||
-rw-r--r-- | include/uapi/linux/videodev2.h | 7 |
3 files changed, 23 insertions, 14 deletions
diff --git a/Documentation/media/uapi/v4l/pixfmt-007.rst b/Documentation/media/uapi/v4l/pixfmt-007.rst index 44bb5a7059b3..95a23a28c595 100644 --- a/Documentation/media/uapi/v4l/pixfmt-007.rst +++ b/Documentation/media/uapi/v4l/pixfmt-007.rst | |||
@@ -211,7 +211,13 @@ Colorspace sRGB (V4L2_COLORSPACE_SRGB) | |||
211 | The :ref:`srgb` standard defines the colorspace used by most webcams | 211 | The :ref:`srgb` standard defines the colorspace used by most webcams |
212 | and computer graphics. The default transfer function is | 212 | and computer graphics. The default transfer function is |
213 | ``V4L2_XFER_FUNC_SRGB``. The default Y'CbCr encoding is | 213 | ``V4L2_XFER_FUNC_SRGB``. The default Y'CbCr encoding is |
214 | ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is full range. | 214 | ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited range. |
215 | |||
216 | Note that the :ref:`sycc` standard specifies full range quantization, | ||
217 | however all current capture hardware supported by the kernel convert | ||
218 | R'G'B' to limited range Y'CbCr. So choosing full range as the default | ||
219 | would break how applications interpret the quantization range. | ||
220 | |||
215 | The chromaticities of the primary colors and the white reference are: | 221 | The chromaticities of the primary colors and the white reference are: |
216 | 222 | ||
217 | 223 | ||
@@ -276,7 +282,7 @@ the following ``V4L2_YCBCR_ENC_601`` encoding as defined by :ref:`sycc`: | |||
276 | 282 | ||
277 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | 283 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range |
278 | [-0.5…0.5]. This transform is identical to one defined in SMPTE | 284 | [-0.5…0.5]. This transform is identical to one defined in SMPTE |
279 | 170M/BT.601. The Y'CbCr quantization is full range. | 285 | 170M/BT.601. The Y'CbCr quantization is limited range. |
280 | 286 | ||
281 | 287 | ||
282 | .. _col-adobergb: | 288 | .. _col-adobergb: |
@@ -288,10 +294,15 @@ The :ref:`adobergb` standard defines the colorspace used by computer | |||
288 | graphics that use the AdobeRGB colorspace. This is also known as the | 294 | graphics that use the AdobeRGB colorspace. This is also known as the |
289 | :ref:`oprgb` standard. The default transfer function is | 295 | :ref:`oprgb` standard. The default transfer function is |
290 | ``V4L2_XFER_FUNC_ADOBERGB``. The default Y'CbCr encoding is | 296 | ``V4L2_XFER_FUNC_ADOBERGB``. The default Y'CbCr encoding is |
291 | ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is full | 297 | ``V4L2_YCBCR_ENC_601``. The default Y'CbCr quantization is limited |
292 | range. The chromaticities of the primary colors and the white reference | 298 | range. |
293 | are: | 299 | |
300 | Note that the :ref:`oprgb` standard specifies full range quantization, | ||
301 | however all current capture hardware supported by the kernel convert | ||
302 | R'G'B' to limited range Y'CbCr. So choosing full range as the default | ||
303 | would break how applications interpret the quantization range. | ||
294 | 304 | ||
305 | The chromaticities of the primary colors and the white reference are: | ||
295 | 306 | ||
296 | 307 | ||
297 | .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| | 308 | .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| |
@@ -344,7 +355,7 @@ the following ``V4L2_YCBCR_ENC_601`` encoding: | |||
344 | 355 | ||
345 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range | 356 | Y' is clamped to the range [0…1] and Cb and Cr are clamped to the range |
346 | [-0.5…0.5]. This transform is identical to one defined in SMPTE | 357 | [-0.5…0.5]. This transform is identical to one defined in SMPTE |
347 | 170M/BT.601. The Y'CbCr quantization is full range. | 358 | 170M/BT.601. The Y'CbCr quantization is limited range. |
348 | 359 | ||
349 | 360 | ||
350 | .. _col-bt2020: | 361 | .. _col-bt2020: |
diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c index 87a6b65ed3af..ccda41c2c9e4 100644 --- a/drivers/media/cec/cec-adap.c +++ b/drivers/media/cec/cec-adap.c | |||
@@ -612,8 +612,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, | |||
612 | } | 612 | } |
613 | memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); | 613 | memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); |
614 | if (msg->len == 1) { | 614 | if (msg->len == 1) { |
615 | if (cec_msg_initiator(msg) != 0xf || | 615 | if (cec_msg_destination(msg) == 0xf) { |
616 | cec_msg_destination(msg) == 0xf) { | ||
617 | dprintk(1, "cec_transmit_msg: invalid poll message\n"); | 616 | dprintk(1, "cec_transmit_msg: invalid poll message\n"); |
618 | return -EINVAL; | 617 | return -EINVAL; |
619 | } | 618 | } |
@@ -638,7 +637,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, | |||
638 | dprintk(1, "cec_transmit_msg: destination is the adapter itself\n"); | 637 | dprintk(1, "cec_transmit_msg: destination is the adapter itself\n"); |
639 | return -EINVAL; | 638 | return -EINVAL; |
640 | } | 639 | } |
641 | if (cec_msg_initiator(msg) != 0xf && | 640 | if (msg->len > 1 && adap->is_configured && |
642 | !cec_has_log_addr(adap, cec_msg_initiator(msg))) { | 641 | !cec_has_log_addr(adap, cec_msg_initiator(msg))) { |
643 | dprintk(1, "cec_transmit_msg: initiator has unknown logical address %d\n", | 642 | dprintk(1, "cec_transmit_msg: initiator has unknown logical address %d\n", |
644 | cec_msg_initiator(msg)); | 643 | cec_msg_initiator(msg)); |
@@ -1072,7 +1071,7 @@ static int cec_config_log_addr(struct cec_adapter *adap, | |||
1072 | 1071 | ||
1073 | /* Send poll message */ | 1072 | /* Send poll message */ |
1074 | msg.len = 1; | 1073 | msg.len = 1; |
1075 | msg.msg[0] = 0xf0 | log_addr; | 1074 | msg.msg[0] = (log_addr << 4) | log_addr; |
1076 | err = cec_transmit_msg_fh(adap, &msg, NULL, true); | 1075 | err = cec_transmit_msg_fh(adap, &msg, NULL, true); |
1077 | 1076 | ||
1078 | /* | 1077 | /* |
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 46e8a2e369f9..45184a2ef66c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h | |||
@@ -362,8 +362,8 @@ enum v4l2_quantization { | |||
362 | /* | 362 | /* |
363 | * The default for R'G'B' quantization is always full range, except | 363 | * The default for R'G'B' quantization is always full range, except |
364 | * for the BT2020 colorspace. For Y'CbCr the quantization is always | 364 | * for the BT2020 colorspace. For Y'CbCr the quantization is always |
365 | * limited range, except for COLORSPACE_JPEG, SRGB, ADOBERGB, | 365 | * limited range, except for COLORSPACE_JPEG, XV601 or XV709: those |
366 | * XV601 or XV709: those are full range. | 366 | * are full range. |
367 | */ | 367 | */ |
368 | V4L2_QUANTIZATION_DEFAULT = 0, | 368 | V4L2_QUANTIZATION_DEFAULT = 0, |
369 | V4L2_QUANTIZATION_FULL_RANGE = 1, | 369 | V4L2_QUANTIZATION_FULL_RANGE = 1, |
@@ -379,8 +379,7 @@ enum v4l2_quantization { | |||
379 | (((is_rgb_or_hsv) && (colsp) == V4L2_COLORSPACE_BT2020) ? \ | 379 | (((is_rgb_or_hsv) && (colsp) == V4L2_COLORSPACE_BT2020) ? \ |
380 | V4L2_QUANTIZATION_LIM_RANGE : \ | 380 | V4L2_QUANTIZATION_LIM_RANGE : \ |
381 | (((is_rgb_or_hsv) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ | 381 | (((is_rgb_or_hsv) || (ycbcr_enc) == V4L2_YCBCR_ENC_XV601 || \ |
382 | (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) || \ | 382 | (ycbcr_enc) == V4L2_YCBCR_ENC_XV709 || (colsp) == V4L2_COLORSPACE_JPEG) ? \ |
383 | (colsp) == V4L2_COLORSPACE_ADOBERGB || (colsp) == V4L2_COLORSPACE_SRGB ? \ | ||
384 | V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)) | 383 | V4L2_QUANTIZATION_FULL_RANGE : V4L2_QUANTIZATION_LIM_RANGE)) |
385 | 384 | ||
386 | enum v4l2_priority { | 385 | enum v4l2_priority { |