summaryrefslogtreecommitdiff
path: root/drivers/media/platform/vivid
AgeCommit message (Collapse)Author
2015-04-08[media] vivid: use V4L2_DV_FL_IS_CE_VIDEO instead of V4L2_DV_BT_STD_CEA861Hans Verkuil
Don't rely on V4L2_DV_BT_STD_CEA861 since that include the 640x480p format, which is an IT format, not CE. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08[media] vivid: add support to set CVT, GTF timingsPrashant Laddha
In addition to v4l2_find_dv_timings_cap(), where timings are searched against the list of preset timings, the incoming timing from v4l2-ctl is checked against CVT and GTF standards. If it confirms to be CVT or GTF, it is treated as valid timing and vivid format is updated with new timings. Signed-off-by: Prashant Laddha <prladdha@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08[media] vivid: add CVT,GTF standards to vivid dv timings capsPrashant Laddha
Currently vivid supports V4L2_DV_BT_STD_DMT and V4L2_DV_BT_STD_CEA861 discrete video standards. Extending the capability set to allow for setting CVT and GTF standards. This change, along with adding the support for calculating CVT, GTF timings in v4l2-ctl would extend the number of resolutions supported by vivid to almost any custom resolution. Also extending the limits on min and max pixel clock to accommodate pixel clock range provided by cvt/gtf for resolutions ranging from 640x360p50 to 4kx2Kp60. Signed-off-by: Prashant Laddha <prladdha@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg.c: fix wrong Bt.2020 coefficientsHans Verkuil
Mistyping 0.2627 as 0.2726 I can understand, but -0.4598 as -0.4629? No idea how I managed that. Anyway, these coefficients are now correct again. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: sanitize selection rectangleHans Verkuil
Handle values like ~0 as width, height, left or top fields. Just strip off the top 16 bits will ensure that the calculations remain OK. Found with v4l2-compliance. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: report only one frameintervalHans Verkuil
The vivid driver reports a range of frame intervals for non-webcams, when in fact the frame interval is fixed for those inputs as it depends on the DV timings or standard. Just report the single discrete frame interval instead. Caught by v4l2-compliance. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: allow s_dv_timings if it is the same as the currentHans Verkuil
Allow setting the same timings as the current timings (i.e., do nothing in that case). The code was actually there, but the vb2_is_busy() call was done before the timings check instead of afterwards. Found by v4l2-compliance. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add support for 8-bit Bayer formatsHans Verkuil
Add support for: PIX_FMT_SBGGR8, SGBRG8, SGRBG8 and SRGGB8. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: use v4l2_device.release to clean up the driverHans Verkuil
Use the release callback of the v4l2_device to clean up the memory. This prevents vivid from breaking if someone tries to unbind the driver. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: turn this into a platform_deviceHans Verkuil
This turns this driver into a platform device. This ensures that it appears in /sys/bus/platform_device since it now has a proper parent device. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add support for packed YUV formatsHans Verkuil
Add support for the packed YUV formats YUV444, YUV555, YUV565 and YUV32. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add support for BGR666Hans Verkuil
Add support for the four byte BGR666 format. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add support for PIX_FMT_RGB332Hans Verkuil
Add support for the one-byte-per-pixel RGB332 format. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add support for NV24 and NV42Hans Verkuil
Add support for the YUV 4:4:4 formats NV24 and NV42. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add support for [A|X]RGB555XHans Verkuil
Only RGB555X was supported, add support for the other two variants. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: fix format commentsHans Verkuil
Clarify which formats have an alpha channel and which do not by using 'x' instead of 'a' if there is no alpha channel. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add RGB444 supportHans Verkuil
Add support for (A/X)RGB444 formats. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add the new planar and monochrome formatsHans Verkuil
Everything is in place to support these formats, so add them to the list. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add downsampling supportHans Verkuil
Add support in vivid for downsampling. Most of the changes are in vivid_copy_buffer which needs to know about the right line widths. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add support for single buffer planar formatsHans Verkuil
Make vivid aware of the difference of planes and buffers. Note that this does not yet add support for hor/vert downsampled formats. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add new format fieldsHans Verkuil
These fields are necessary to handle the new planar formats. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: split off the pattern drawing codeHans Verkuil
The last part of the vivid-tpg refactoring: split off the pattern drawing code into a function of its own. This greatly improves the readability and maintainability of this code. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: move the 'extras' drawing to a separate functionHans Verkuil
This moves the drawing code for the extras (border, square, etc) to a function of its own instead of having this in the main for loop. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: move 'extras' parameters to tpg_draw_paramsHans Verkuil
Any parameters related to drawing 'extras' like the border, the square, etc. are moved to struct tpg_draw_params. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: move pattern-related fields to struct tpg_draw_paramsHans Verkuil
Add a new function that fills in pattern-related fields in struct tpg_draw_params. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: move common parameters to tpg_draw_paramsHans Verkuil
Replace local variables by fields in the tpg_draw_params struct. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: add a new tpg_draw_params structureHans Verkuil
This is needed to refactor the drawing function which is much too big. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: add const where appropriateHans Verkuil
Added 'const' to several functions where that is possible to do. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: add helper functions to simplify common calculationsHans Verkuil
Add helper functions to handle horizontal downscaling and horizontal scaling. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: add support for V4L2_PIX_FMT_GREYHans Verkuil
Add monochrome support to the TPG. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: add support for more planar formatsHans Verkuil
Now that the support for hor/vert downsampled planar formats is in place we can add support for such formats to the TPG. This patch adds support for: V4L2_PIX_FMT_YUV420M V4L2_PIX_FMT_YVU420M V4L2_PIX_FMT_YUV420 V4L2_PIX_FMT_YVU420 V4L2_PIX_FMT_YUV422P V4L2_PIX_FMT_NV16 V4L2_PIX_FMT_NV61 V4L2_PIX_FMT_NV12 V4L2_PIX_FMT_NV21 V4L2_PIX_FMT_NV12P V4L2_PIX_FMT_NV21P Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: finish hor/vert downsampling supportHans Verkuil
Implement horizontal and vertical downsampling when filling in the plane. The TPG is now ready to support such formats. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: add hor/vert downsampling support to tpg_gen_textHans Verkuil
This will just skip lines/pixels since color fidelity is not quite as important here as it is with the test patterns themselves. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: correctly average the two pixels in gen_twopix()Hans Verkuil
gen_twopix() is always called twice: once for the first and once for the second pixel. Improve the code to properly average the two if the format requires horizontal downsampling. This is necessary for patterns like 1x1 red/blue checkers. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: precalculate downsampled linesHans Verkuil
When dealing with vertical downsampling two successive lines have to be averaged. In the case of the test pattern generator that only happens if the two lines are using different patterns. So precalculate the average between two pattern lines: one of pattern P and one of pattern P + 1. That way there is no need to do any on-the-fly downsampling: it's all done in the precalculate phase. This patch also implements horizontal downsampling in the precalculate phase. The only thing that needs to be done is to half the width since the actual downsampling happens when two pixels at a time are generated. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: add hor/vert downsampling fieldsHans Verkuil
This is step one of supporting horizontal and vertical downsampling. This just adds support for the h/vdownsampling fields and it increases the maximum number of planes to 3. Currently none of the planar formats need horizontal or vertical downsampling, so this change has no effect at the moment. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: add helper functions for single buffer planar formatsHans Verkuil
Add helpers functions to determine the line widths and image sizes for planar formats that are stores in a single buffer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: separate planes and buffersHans Verkuil
Add a new field that contains the number of buffers. This may be less than the number of planes in case multiple planes are combined into one buffer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: do not allow video loopback for SEQ_TB/BTHans Verkuil
Sequential top-bottom/bottom-top fields are not supported as video loopback. This is too much work to implement for field settings that are rarely used. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid-tpg: don't add offset when switching to monochromeHans Verkuil
The grayscale values are still full range sRGB, so don't add the limited range offset. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: add new checkboard patternsHans Verkuil
Add a 2x2 checker patterns and 1x1 and 2x2 red/blue checker patterns. Useful for testing 4:2:2 and 4:2:0 formats. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: fix test pattern movement for V4L2_FIELD_ALTERNATEHans Verkuil
The successive TOP/BOTTOM fields did not move as they should: only every other field actually changed position. The cause was that the tpg needs to know if it is dealing with a FIELD_ALTERNATE case since that requires slightly different handling. So tell the TPG whether or not the field setting is for the ALTERNATE case or not. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: use TPG_MAX_PLANES instead of hardcoding plane-arraysHans Verkuil
Two arrays of size 'max number of planes' have a hardcoded size instead of using TPG_MAX_PLANES. Fix that, since TPG_MAX_PLANES will be increased later on. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: wrong top/bottom order for FIELD_ALTERNATEHans Verkuil
The condition to decide whether the current field is top or bottom was inverted. Fix this. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: fix typo in plane size checksHans Verkuil
The plane size check was hardcoded to plane 0 instead of using the plane index. This failed when using the NV61M format which has a larger plane size for the second plane compared to the first plane. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: the overlay API wasn't disabled completely for multiplanarHans Verkuil
If the vivid driver is loaded in multiplanar mode, then the capture overlay functionality should be disabled. This wasn't fully done, which led to v4l2-compliance errors. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] vivid: BT.2020 R'G'B' is limited rangeHans Verkuil
According to the standard the R'G'B' BT.2020 colorspace is limited range, not full range. Fix this. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02[media] drivers: media: platform: vivid: Fix possible null derefrenceTapasweni Pathak
Check for dev_fmt being null before derefrencing it, to assign it to planes. Found using Coccinelle. Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02[media] vivid sdr: fix broken sine tone generated for sdr FMPrashant Laddha
FM (frequency modulated) signal for SDR is generated by varying the phase, where phase variation is proportional to input signal. It is seen that, the larger phase increments leads to discontinuities in the signal recovered after demodulation. Reducing the extent of phase variation with respect to input signal, equivalent to reducing the modulation index. Tested using FM receiver flow graph in gnuradio-companion. Cc: Antti Palosaari <crope@iki.fi> Signed-off-by: Prashant Laddha <prladdha@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02[media] vivid sdr: Use LUT based implementation for sin/cos()Prashant Laddha
The common implementation for sin/cos in include/linux/fixp-arith.h has been improved recently to provide higher precision. Replacing native implementation of sin/cos in vivid sdr with common implementation. This serves two purposes: 1. Improved accuracy: the native implementation based on the Taylor series is more prone to rounding errors. 2. Reuse of common function: this is better compared to maintaining native versions for each driver. Suggested by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Cc: Antti Palosaari <crope@iki.fi> Signed-off-by: Prashant Laddha <prladdha@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>