1. 24 5月, 2014 4 次提交
    • A
      [media] v4l: ti-vpe: Add selection API in VPE driver · 2ef114f6
      Archit Taneja 提交于
      Add selection ioctl ops. For VPE, cropping makes sense only for the input to
      VPE(or V4L2_BUF_TYPE_VIDEO_OUTPUT/MPLANE buffers) and composing makes sense
      only for the output of VPE(or V4L2_BUF_TYPE_VIDEO_CAPTURE/MPLANE buffers).
      
      For the CAPTURE type, V4L2_SEL_TGT_COMPOSE results in VPE writing the output
      in a rectangle within the capture buffer. For the OUTPUT type, V4L2_SEL_TGT_CROP
      results in selecting a rectangle region within the source buffer.
      
      Setting the crop/compose rectangles should successfully result in
      re-configuration of registers which are affected when either source or
      destination dimensions change, set_srcdst_params() is called for this purpose.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NKamil Debski <k.debski@samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      2ef114f6
    • A
      [media] v4l: ti-vpe: Fix some params in VPE data descriptors · 928bf2ba
      Archit Taneja 提交于
      Some parameters of the VPE descriptors were understood incorrectly. They are now
      fixed. The fixes are explained as follows:
      
      - When adding an inbound data descriptor to the VPDMA descriptor list, we intend
        to use c_rect as the cropped region fetched by VPDMA. Therefore, c_rect->width
        shouldn't be used to calculate the line stride, the original image width
        should be used for that. We add a 'width' argument which gives the buffer
        width in memory.
      
      - frame_width and frame_height describe the complete width and height of the
        client to which the channel is connected. If there are multiple channels
        fetching data and providing to the same client, the above 2 arguments should
        be the width and height of the region covered by all the channels. In the case
        where there is only one channel providing pixel data to the client
        (like in VPE), frame_width and frame_height should be the cropped width and
        cropped height respectively. The calculation of these params is done in the
        vpe driver now.
      
      - start_h and start_v is also used in the case of multiple channels to describe
        where each channel should start filling pixel data. We don't use this in VPE,
        and pass 0s to the vpdma_add_in_dtd() helper.
      
      - Some minor changes are made to the vpdma_add_out_dtd() helper. The c_rect
        param is used for specifying the 'composition' target, and 'width'  is added
        to calculate the line stride.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Acked-by: NKamil Debski <k.debski@samsung.com>
      Signed-off-by: NKamil Debski <k.debski@samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      928bf2ba
    • A
      [media] v4l: ti-vpe: Allow DMABUF buffer type support · 668f91d4
      Archit Taneja 提交于
      For OMAP and DRA7x, we generally allocate video and graphics buffers through
      omapdrm since the corresponding omap-gem driver provides DMM-Tiler backed
      contiguous buffers. omapdrm is a dma-buf exporter. These buffers are used by
      other drivers in the video pipeline.
      
      Add VB2_DMABUF flag to the io_modes of the vb2 output and capture queues. This
      allows the driver to import dma shared buffers.
      Reviewed-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NKamil Debski <k.debski@samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      668f91d4
    • A
      [media] v4l: ti-vpe: register video device only when firmware is loaded · b2c9472f
      Archit Taneja 提交于
      vpe fops(vpe_open in particular) should be called only when VPDMA firmware
      is loaded. File operations on the video device are possible the moment it is
      registered.
      
      Currently, we register the video device for VPE at driver probe, after calling
      a vpdma helper to initialize VPDMA and load firmware. This function is
      non-blocking(it calls request_firmware_nowait()), and doesn't ensure that the
      firmware is actually loaded when it returns.
      
      We remove the device registration from vpe probe, and move it to a callback
      provided by the vpe driver to the vpdma library, through vpdma_create().
      
      The ready field in vpdma_data is no longer needed since we always have firmware
      loaded before the device is registered.
      
      A minor problem with this approach is that if the video_register_device
      fails(which doesn't really happen), the vpe platform device would be registered.
      however, there won't be any v4l2 device corresponding to it.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NKamil Debski <k.debski@samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      b2c9472f
  2. 07 4月, 2014 9 次提交
  3. 06 3月, 2014 2 次提交
  4. 07 1月, 2014 5 次提交
    • A
      [media] v4l: ti-vpe: enable CSC support for VPE · 30496799
      Archit Taneja 提交于
      Use the csc library functions to configure the CSC block in VPE.
      
      Some changes are required in try_fmt to handle the pix->colorspace parameter
      more correctly. Previously, we copied the source queue colorspace to the
      destination queue colorspace as we didn't support RGB formats. Now, we configure
      pix->colorspace based on the color format set(and the height of the image if
      it's a YUV format).
      
      Add basic RGB color formats to the list of supported vpe formats.
      
      If the destination format is RGB colorspace, we also need to use the RGB output
      port instead of the Luma and Chroma output ports. This requires configuring the
      output data descriptors differently.
      
      Also, make the default colorspace V4L2_COLORSPACE_SMPTE170M as that resembles
      the Standard Definition colorspace more closely.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      30496799
    • A
      [media] v4l: ti-vpe: create a color space converter block library · 6948082d
      Archit Taneja 提交于
      VPE and VIP IPs in DAR7x contain a color space converter(CSC) sub block. Create
      a library which will perform CSC related configurations and hold CSC register
      definitions. The functions provided by this library will be called by the vpe
      and vip drivers using a csc_data handle.
      
      The vpe_dev holds the csc_data handle. The handle represents an instance of the
      CSC hardware, and the vpe driver uses it to access the CSC register offsets or
      helper functions to configure these registers.
      
      The CSC register offsets are now relative to the CSC block itself, so we need
      to use the macro GET_OFFSET_TOP to get the CSC register offset relative to the
      VPE IP in the vpe driver.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      6948082d
    • A
      [media] v4l: ti-vpe: enable basic scaler support · bbee8b39
      Archit Taneja 提交于
      Add the required SC register configurations which lets us perform linear scaling
      for the supported range of horizontal and vertical scaling ratios.
      
      The horizontal scaler performs polyphase scaling using it's 8 tap 32 phase
      filter, decimation is performed when downscaling passes beyond 2x or 4x.
      
      The vertical scaler performs polyphase scaling using it's 5 tap 32 phase filter,
      it switches to a simpler form of scaling using the running average filter when
      the downscale ratio is more than 4x.
      
      Many of the SC features like peaking, trimming and non-linear scaling aren't
      implemented for now. Only the minimal register fields required for basic scaling
      operation are configured.
      
      The function to configure SC registers takes the sc_data handle, the source and
      destination widths and heights, and the scaler address data block offsets for
      the current context so that they can be configured.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      bbee8b39
    • A
      [media] v4l: ti-vpe: make vpe driver load scaler coefficients · 773f0657
      Archit Taneja 提交于
      Make the driver allocate dma buffers to store horizontal and scaler coeffs.
      Use the scaler library api to choose and copy scaler coefficients to a
      the above buffers based on the scaling ratio. Since the SC block comes after
      the de-interlacer, make sure that the source height is doubled if de-interlacer
      was used.
      
      These buffers now need to be used by VPDMA to load the coefficients into the
      SRAM within SC.
      
      In device_run, add configuration descriptors which have payloads pointing to
      the scaler coefficients in memory. Use the members in sc_data handle to prevent
      addition of these descriptors if there isn't a need to re-load coefficients into
      SC. This comes helps unnecessary re-loading of the coefficients when we switch
      back and forth between vpe contexts.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      773f0657
    • A
      [media] v4l: ti-vpe: create a scaler block library · 44687b2e
      Archit Taneja 提交于
      VPE and VIP IPs in DAR7x contain a scaler(SC) sub block. Create a library which
      will perform scaler block related configurations and hold SC register
      definitions. The functions provided by this library will be called by the vpe
      and vip drivers using a sc_data handle.
      
      The vpe_dev holds the sc_data handle. The handle represents an instance of the
      SC hardware, and the vpe driver uses it to access the scaler register offsets
      or helper functions to configure these registers.
      
      We move the SC register definitions to sc.h so that they aren't specific to
      VPE anymore. The register offsets are now relative to the sub-block, and not the
      VPE IP as a whole. In order for VPDMA to configure registers, it requires it's
      offset from the top level VPE module. A macro called GET_OFFSET_TOP is added to
      return the offset of the register relative to the VPE IP.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      44687b2e
  5. 11 12月, 2013 1 次提交
    • A
      [media] v4l: ti-vpe: make sure VPDMA line stride constraints are met · a51cd8f5
      Archit Taneja 提交于
      When VPDMA fetches or writes to an image buffer, the line stride must be a
      multiple of 16 bytes. If it isn't, VPDMA HW will write/fetch until the next
      16 byte boundry. This causes VPE to work incorrectly for source or destination
      widths which don't satisfy the above alignment requirement.
      In order to prevent this, we now make sure that when we set pix format for the
      input and output buffers, the VPE source and destination image line strides are
      16 byte aligned. Also, the motion vector buffers for the de-interlacer are
      allocated in such a way that it ensures the same alignment.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      a51cd8f5
  6. 10 12月, 2013 3 次提交
  7. 29 10月, 2013 2 次提交
    • A
      [media] v4l: ti-vpe: Add de-interlacer support in VPE · 585e6f01
      Archit Taneja 提交于
      Add support for the de-interlacer block in VPE. For de-interlacer to
      work, we need to enable 2 more sets of VPE input ports which fetch data
      from the 'last' and 'last to last' fields of the interlaced video. Apart
      from that, we need to enable the Motion vector output and input ports,
      and also allocate DMA buffers for them.
      
      We need to make sure that two most recent fields in the source queue are
      available and in the 'READY' state. Once a mem2mem context gets access
      to the VPE HW(in device_run), it extracts the addresses of the 3
      buffers, and provides it to the data descriptors for the 3 sets of input
      ports((LUMA1, CHROMA1), (LUMA2, CHROMA2), and (LUMA3, CHROMA3))
      respectively for the 3 consecutive fields. The motion vector and output
      port descriptors are configured and the list is submitted to VPDMA.
      
      Once the transaction is done, the v4l2 buffer corresponding to the
      oldest field(the 3rd one) is changed to the state 'DONE', and the
      buffers corresponding to 1st and 2nd fields become the 2nd and 3rd field
      for the next de-interlace operation. This way, for each deinterlace
      operation, we have the 3 most recent fields. After each transaction, we
      also swap the motion vector buffers, the new input motion vector buffer
      contains the resultant motion information of all the previous frames,
      and the new output motion vector buffer will be used to hold the updated
      motion vector to capture the motion changes in the next field. The
      motion vector buffers are allocated using the DMA allocation API.
      
      The de-interlacer is removed from bypass mode, it requires some extra
      default configurations which are now added. The chrominance upsampler
      coefficients are added for interlaced frames. Some VPDMA parameters like
      frame start event and line mode are configured for the 2 extra sets of
      input ports.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NKamil Debski <k.debski@samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      585e6f01
    • A
      [media] v4l: ti-vpe: Add VPE mem to mem driver · 45719127
      Archit Taneja 提交于
      VPE is a block which consists of a single memory to memory path which
      can perform chrominance up/down sampling, de-interlacing, scaling, and
      color space conversion of raster or tiled YUV420 coplanar, YUV422
      coplanar or YUV422 interleaved video formats.
      
      We create a mem2mem driver based primarily on the mem2mem-testdev
      example. The de-interlacer, scaler and color space converter are all
      bypassed for now to keep the driver simple. Chroma up/down sampler
      blocks are implemented, so conversion beteen different YUV formats is
      possible.
      
      Each mem2mem context allocates a buffer for VPE MMR values which it will
      use when it gets access to the VPE HW via the mem2mem queue, it also
      allocates a VPDMA descriptor list to which configuration and data
      descriptors are added.
      
      Based on the information received via v4l2 ioctls for the source and
      destination queues, the driver configures the values for the MMRs, and
      stores them in the buffer. There are also some VPDMA parameters like
      frame start and line mode which needs to be configured, these are
      configured by direct register writes via the VPDMA helper functions.
      
      The driver's device_run() mem2mem op will add each descriptor based on
      how the source and destination queues are set up for the given ctx, once
      the list is prepared, it's submitted to VPDMA, these descriptors when
      parsed by VPDMA will upload MMR registers, start DMA of video buffers on
      the various input and output clients/ports.
      
      When the list is parsed completely(and the DMAs on all the output ports
      done), an interrupt is generated which we use to notify that the source
      and destination buffers are done. The rest of the driver is quite
      similar to other mem2mem drivers, we use the multiplane v4l2 ioctls as
      the HW support coplanar formats.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NKamil Debski <k.debski@samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      45719127