29 Oct, 2014

40 commits

  • this patch converts the driver to use fh handling provided by the
    v4l core instead of driver doing it.

    Signed-off-by: Lad, Prabhakar
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Prabhakar Lad
     
  • this patch teaches vpbe driver to use vb2_fop_mmap/poll helpers.

    Signed-off-by: Lad, Prabhakar
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Prabhakar Lad
     
  • this patch improve vpbe_buffer_prepare() callback, as buf_prepare()
    callback is never called with invalid state and check for
    vb2_plane_vaddr(vb, 0) is dropped as payload check should
    be done unconditionally.

    Signed-off-by: Lad, Prabhakar
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Prabhakar Lad
     
  • this patch drops buf_cleanup() callback as this callback
    is never called with buffer state active.

    Signed-off-by: Lad, Prabhakar
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Prabhakar Lad
     
  • this patch makes use of vb2_ops_wait_prepare/finish helper functions.

    Signed-off-by: Lad, Prabhakar
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Prabhakar Lad
     
  • this patch drops the buf_init() callback as init
    of buf list is not required.

    Signed-off-by: Lad, Prabhakar
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Prabhakar Lad
     
  • this patch moves the initialization of vb2 queue and the DMA
    context to probe() and clean up in remove() callback respectively.

    Signed-off-by: Lad, Prabhakar
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Prabhakar Lad
     
  • The NV12M is supported by all the version of MFC, so it is better
    to use it as default OUTPUT format.
    MFC v5 doesn't support NV21, I have tested it, for the SEC doc
    it is not supported either.

    Signed-off-by: ayaka
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    ayaka
     
  • Patch b906352c2338 ([media] coda: dequeue buffers if start_streaming fails)
    incorrectly marked buffers as DEQUEUED in case of start_streaming failure, when
    in fact they should be set to QUEUED. The videobuf2 core warns about this.

    Reported-by: Jean-Michel Hautbois
    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • Interrupt result flags have to be cleared before a hardware job is run.
    Otherwise, if they are cleared asynchronously, we may end up clearing them
    after the interrupt for which we wanted to wait has already arrived, thus
    overwriting the job results that we intended to wait for.

    To prevent this, clear the flags only under hw_lock and before running
    a hardware job.

    Signed-off-by: Pawel Osciak
    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Pawel Osciak
     
  • G_CTRL on V4L2_CID_MIN_BUFFERS_FOR_CAPTURE will fail if userspace happens to
    query it after getting a resolution change event and before the codec has
    a chance to parse the header and switch to an initialized state.

    Signed-off-by: Pawel Osciak
    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Pawel Osciak
     
  • This field is no longer used as MFC driver doesn't use vb2 alloc contexts
    anymore.

    Signed-off-by: Pawel Osciak
    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Pawel Osciak
     
  • While resolution change is detected by MFC, we flush out
    older dpbs, send the resolution change event to application,
    and then accept further queuing of new src buffers.

    Sometimes, we error out during dpb flush because of lack of src
    buffers. Since we have not started decoding new resolution yet,
    it is simpler to push zero-size buffer until we flush out all dpbs.

    This is already been done while handling EOS command, and this patch
    extends the same logic to resolution change as well.

    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Kiran AVND
     
  • If the software watchdog kicks in, we need to de-init MFC
    before reloading firmware and re-intializing it again.

    Signed-off-by: Arun Mankuzhi
    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Arun Mankuzhi
     
  • MFC wakeup command has to be sent after the host receives
    firmware load complete status from risc.

    Signed-off-by: Arun Mankuzhi
    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Arun Mankuzhi
     
  • If the software watchdog kicks in, the watchdog worker is not synchronized
    with hardware interrupts and does not block other instances. It's possible
    for it to clear the hw_lock, making other instances trigger a BUG() on
    hw_lock checks. Since it's not fatal to clear the hw_lock to zero twice,
    just WARN in those cases for now. We should not explode, as firmware will
    return errors as needed for other instances after it's reloaded, or they
    will time out.

    A clean fix should involve killing other instances when watchdog kicks in,
    but requires a major redesign of locking in the driver.

    Signed-off-by: Pawel Osciak
    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Pawel Osciak
     
  • drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c:132:5: warning: no previous prototype for 's5p_mfc_bus_reset' [-Wmissing-prototypes]
    int s5p_mfc_bus_reset(struct s5p_mfc_dev *dev)
    ^

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • during reset sequence, it is advisable to follow the below
    sequence, in order to avoid unexpected behavior from MFC
    . set SFR 0x7110 MFC_BUS_RESET_CTRL 0x1
    // wait for REQ_STATUS to be 1
    . get SFR 0x7110 MFC_BUS_RESET_CTRL 0x3
    // reset now

    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Kiran AVND
     
  • Reset sequence for MFC V7 and V8 do not need RISC_ON
    to be set to 0, while for MFC V6 it is still needed.

    Also, remove a couple of register settings during Reset
    which are not needed from V6 onwards.

    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Kiran AVND
     
  • Timestamp i of a previously decoded buffer was overwritten for some
    H.264 streams with timestamp i+1 of the next buffer. This happened when
    encountering frame_type S5P_FIMV_DECODE_FRAME_SKIPPED, indicating no
    new frame.

    In most cases this wrong indexing might not have been noticed except
    for a one frame delay in frame presentation. For H.264 streams though
    that require reordering of frames for presentation, it caused a slightly
    erratic presentation time lookup and consequently dropped frames in the
    Pepper Flash plugin.

    Signed-off-by: Ilja H. Friedel
    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Ilja Friedel
     
  • The enter_suspend flag is set after we enter mfc suspend function but if
    suspend fails after that due to any reason (like hardware timeout etc),
    this flag must be cleared before returning an error. Otherwise, this
    flag never gets cleared and the MFC suspend will always return an error
    on subsequent tries. If clock off fails, disable hw_lock also.

    Signed-off-by: Prathyush K
    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Prathyush K
     
  • Handle REQBUFS(0) for CAPTURE queue as well. Also use the proper queue to call
    it on for OUTPUT.

    Signed-off-by: Pawel Osciak
    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Pawel Osciak
     
  • Add V4L2_CID_MIN_BUFFERS_FOR_OUTPUT query for encoder.
    Once mfc encoder state is HEAD_PARSED, which is sequence
    header produced, dpb_count is avaialable. Let user space
    query this value.

    Signed-off-by: Kiran AVND
    Signed-off-by: Arun Kumar K
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Kiran AVND
     
  • This patch adds a quick check for valid JPEG frames before feeding them into
    the bitstream buffer: Frames that do not begin with the JPEG start of image
    marker and end with the end of image marker are dropped.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • This should fix CODA crashes due to timeouts when stopping
    the decoding process with SIGINT.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • For small frame sizes, allocating 1 MiB per compressed buffer is a waste of
    space. On the other hand, incompressible 1080p data can produce JPEGs larger
    than 1 MiB at higher quality settings. Allow userspace to set the compressed
    buffer size and clamp the value to a sensible range.
    Also set the initial sizeimage to a value inside the range allowed by try_fmt.
    While at it, reduce the default image size to a maximum of 1920*1088 (otherwise
    JPEG will default to 8k*8k and 96 MiB buffers).

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • With bitstream padding, it is possible to decode a single JPEG in the bitstream
    immediately. This allows us to only ever queue a single JPEG into the bitstream
    buffer, except to increase payload over 512 bytes or to back out of hold state.
    This is a measure to decrease JPEG decoder latency.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • Before starting a PIC_RUN, pad the bitstream with 0xff until 256 bytes
    past the next multiple of 256 bytes, if the buffer to be decoded is the
    last buffer in the bitstream.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • Storing the buffer position in the bitstream with the buffer metadata
    allows to later use that information to drop metadata for skipped buffers
    and to determine whether bitstream padding has to be applied.

    This patch also renames struct coda_timestamp to struct coda_buffer_meta
    to make clear that it contains more than only the buffer timestamp.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • This patch adds JPEG encoding and decoding support for CODA7541,
    using the BIT processor. Separate JPEG encoder and decoder video
    devices are created due to different streaming behaviour and
    different supported pixel formats.
    The hardware can not change subsampling on the fly, but encode
    and decode 4:2:2 subsampled JPEG images from and into this format.

    The CODA7541 JPEG decoder uses the bitstream buffer and thus can run
    without new buffers queued if there is a buffer in the bitstream.

    Since there is no standard way to store the colorspace used in
    JPEGs, and to make v4l2-compliance happy, the JPEG format always
    reports V4L2_COLORSPACE_JPEG.

    Signed-off-by: Lucas Stach
    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • Add JPEG specific sequence initialization registers and bit definitions.

    Signed-off-by: Lucas Stach
    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • This patch splits the encoder specific controls out of the main control setup
    function. This way each video device registers only relevant controls.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • Each video device descriptor determines the name, callback ops, and input and
    output formats on the corresponding video device. This simplifies coda_enum_fmt
    and coda_try_fmt a bit and will simplify adding separate video devices for JPEG
    codecs due to the slightly different behavior in the CodaDx6/CODA7542 case and
    a separate hardware unit on CODA960.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • We'll use this information to decide whether to request the JPEG IRQ later.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • This patch adds support for the three-plane YUV422P format with one luma plane
    and two horizontally subsampled chroma planes.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • This patch adds support for the two-plane NV12 format with one luma plane
    and one interleaved chroma plane.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • Since the firmware newer writes to FRAME_MEM_CTRL, we can initialize it once
    per context (incidentally, we already do write it in coda_hw_init) and never
    have to read it back.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • This will still do a 1:1 copy into the internal buffers, but stop
    producing visual artifacts in chroma interleaved (NV12) mode.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • Add a helper function that writes a vb2_buffer's Y, Cb, and
    Cr plane base addresses of into three consecutive registers.
    This moves common code out of coda-bit.c.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel
     
  • When devm_kzalloc causes an OOM condition, this is already reported by
    the MM subsystem.

    Signed-off-by: Philipp Zabel
    Signed-off-by: Kamil Debski
    Signed-off-by: Mauro Carvalho Chehab

    Philipp Zabel