[PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes

classic Classic list List threaded Threaded
60 messages Options
123
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 00/49] DaVinci: vpif: upgrade with v4l helpers and v4l compliance fixes

Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

Hi,

This patch series upgrades the vpif capture & display
driver with the all the helpers provided by v4l, this makes
the driver much simpler and cleaner. This also includes few
checkpatch issues.

Changes for v2:
a> Added a copyright.
b> Dropped buf_init() callback from vb2_ops.
c> Fixed enabling & disabling of interrupts in case of HD formats.

Changes for v3:
a> Fixed review comments pointed by Hans.

Changes for v4: Rebased the patches on media tree.

Changes for v5: Split up the patches

Following is the output of v4l-compliance for capture:
------------------------------------------------------

./v4l2-compliance -d /dev/video0 -i 0 -s -v --expbuf-device=2

Driver Info:
        Driver name   : vpif_capture
        Card type     : DA850/OMAP-L138 Video Capture
        Bus info      : platform:vpif_capture
        Driver version: 3.15.0
        Capabilities  : 0x84000001
                Video Capture
                Streaming
                Device Capabilities
        Device Caps   : 0x04000001
                Video Capture
                Streaming

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
        test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
        test second video open: OK
        test VIDIOC_QUERYCAP: OK
        test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
        test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
        test VIDIOC_LOG_STATUS: OK

Input ioctls:
        test VIDIOC_G/S_TUNER: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
        test VIDIOC_ENUMAUDIO: OK (Not Supported)
        test VIDIOC_G/S/ENUMINPUT: OK
        test VIDIOC_G/S_AUDIO: OK (Not Supported)
        Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
        test VIDIOC_G/S_MODULATOR: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_ENUMAUDOUT: OK (Not Supported)
        test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
        test VIDIOC_G/S_AUDOUT: OK (Not Supported)
        Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
        test VIDIOC_ENUM/G/S/QUERY_STD: OK
        test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
        test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
        test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

        Control ioctls:
                test VIDIOC_QUERYCTRL/MENU: OK (Not Supported)
                test VIDIOC_G/S_CTRL: OK (Not Supported)
                test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
                test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
                test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
                Standard Controls: 0 Private Controls: 0

        Format ioctls:
                info: found 1 formats for buftype 1
                test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
                fail: v4l2-test-formats.cpp(1003): cap->readbuffers
                test VIDIOC_G/S_PARM: FAIL
                test VIDIOC_G_FBUF: OK (Not Supported)
                test VIDIOC_G_FMT: OK
                test VIDIOC_TRY_FMT: OK
                test VIDIOC_S_FMT: OK
                test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)

        Codec ioctls:
                test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
                test VIDIOC_G_ENC_INDEX: OK (Not Supported)
                test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
                info: test buftype Video Capture
        test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
        test VIDIOC_EXPBUF: OK
        test read/write: OK (Not Supported)
            Video Capture:
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.509130s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.549125s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.589148s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.629106s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.669110s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.709102s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.749099s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.789128s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.829116s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 145.869105s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 145.909100s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 145.949098s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 145.989086s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.029083s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.069083s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.109074s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.149074s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.189100s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.229077s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.269078s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.309075s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.349070s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.389060s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.429052s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.469053s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.509047s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.549045s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.589072s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.629047s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.669051s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.709046s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.749043s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.789033s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.829023s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 146.869025s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 146.909018s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 146.949029s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 146.989046s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.029021s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.069024s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.109019s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.149004s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.189006s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.228998s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.268996s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.308996s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.349004s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.389019s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.429000s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.468999s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.509004s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.548979s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.588982s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.628973s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.668976s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.708968s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.748979s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.788991s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.828972s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 147.868969s
            Video Capture (polling):
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 147.908969s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 147.948952s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 147.988955s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.028946s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.068946s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.108954s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.148955s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.188973s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.228948s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.268943s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.308949s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.348928s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.388927s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.428918s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.468918s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.508923s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.548919s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.588946s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.628923s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.668917s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.708902s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.748899s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.788901s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.828895s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 148.868892s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 148.908897s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 148.948898s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 148.988920s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.028892s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.068893s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.108876s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.148873s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.188875s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.228867s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.268875s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.308870s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.348870s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.388870s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.428891s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.468893s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.508849s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.548845s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.588849s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.628842s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.668855s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.708844s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.748846s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.788868s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.828842s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 149.868826s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 149.908823s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 149.948821s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 149.988821s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 150.028817s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 150.068824s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 150.108818s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 150.148818s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 150.188839s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 150.228808s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 150.268798s
        test MMAP: OK
                fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
                fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
        test USERPTR: FAIL
            Video Output:
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.234735s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.268098s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.301503s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.334846s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.368202s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.401594s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.434960s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.468320s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.501709s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.535041s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.568428s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.601811s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.635146s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.668514s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.701913s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.735260s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.768617s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.802007s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.835367s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.868732s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 165.902120s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 165.935451s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 165.968837s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.002223s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.035566s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.068923s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.102327s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.135667s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.169023s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.202423s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.235785s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.269146s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.302535s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.335862s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.369252s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.402637s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.435978s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.469335s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.502705s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.536087s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.569454s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.602817s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.636177s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.669557s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.702934s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.736280s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.769648s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.803053s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.836396s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.869753s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 166.903122s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 166.936499s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 166.969870s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.003251s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.036591s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.069975s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.103363s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.136702s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.170112s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.203462s
            Video Output (polling):
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.236804s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.270175s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.303533s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.336914s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.370269s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.403661s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.436999s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.470388s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.503774s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.537117s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.570511s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.603874s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.637222s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.670603s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.703944s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.737326s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.770694s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.804083s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.837412s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.870809s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 167.904185s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 167.937526s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 167.970900s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.004285s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.037632s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.070993s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.104382s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.137735s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.171104s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.204492s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.237822s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.271190s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.304596s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.337941s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.371310s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.404665s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.438046s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.471408s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.504794s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.538130s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.571517s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.604904s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.638234s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.671610s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.704984s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.738352s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.771725s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.805080s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.838459s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.871822s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 168.905165s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 168.938547s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 168.971931s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.005319s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 169.038649s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 169.072021s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.105420s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 169.138776s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 169.172136s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 169.205492s
        test DMABUF: OK

Total: 41, Succeeded: 40, Failed: 1, Warnings: 0

Following is the output of v4l-compliance for display:
------------------------------------------------------

./v4l2-compliance -d /dev/video2 -o 0 -s -v --expbuf-device=0

Driver Info:
        Driver name   : vpif_capture
        Card type     : DA850/OMAP-L138 Video Capture
        Bus info      : platform:vpif_capture
        Driver version: 3.15.0
        Capabilities  : 0x84000001
                Video Capture
                Streaming
                Device Capabilities
        Device Caps   : 0x04000001
                Video Capture
                Streaming

Compliance test for device /dev/video2 (not using libv4l2):

Required ioctls:
        test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
        test second video open: OK
        test VIDIOC_QUERYCAP: OK
        test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
        test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
        test VIDIOC_LOG_STATUS: OK

Input ioctls:
        test VIDIOC_G/S_TUNER: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
        test VIDIOC_ENUMAUDIO: OK (Not Supported)
        test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
        test VIDIOC_G/S_AUDIO: OK (Not Supported)
        Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
        test VIDIOC_G/S_MODULATOR: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_ENUMAUDOUT: OK (Not Supported)
        test VIDIOC_G/S/ENUMOUTPUT: OK
        test VIDIOC_G/S_AUDOUT: OK (Not Supported)
        Outputs: 2 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
        test VIDIOC_ENUM/G/S/QUERY_STD: OK
        test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
        test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
        test VIDIOC_G/S_EDID: OK (Not Supported)

Test output 0:

        Control ioctls:
                test VIDIOC_QUERYCTRL/MENU: OK (Not Supported)
                test VIDIOC_G/S_CTRL: OK (Not Supported)
                test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
                test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
                test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
                Standard Controls: 0 Private Controls: 0

        Format ioctls:
                info: found 1 formats for buftype 2
                test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
                test VIDIOC_G/S_PARM: OK (Not Supported)
                test VIDIOC_G_FBUF: OK (Not Supported)
                test VIDIOC_G_FMT: OK
                test VIDIOC_TRY_FMT: OK
                test VIDIOC_S_FMT: OK
                test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)

        Codec ioctls:
                test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
                test VIDIOC_G_ENC_INDEX: OK (Not Supported)
                test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Test output 1:

        Control ioctls:
                test VIDIOC_QUERYCTRL/MENU: OK (Not Supported)
                test VIDIOC_G/S_CTRL: OK (Not Supported)
                test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
                test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
                test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
                Standard Controls: 0 Private Controls: 0

        Format ioctls:
                info: found 1 formats for buftype 2
                test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
                test VIDIOC_G/S_PARM: OK (Not Supported)
                test VIDIOC_G_FBUF: OK (Not Supported)
                test VIDIOC_G_FMT: OK
                test VIDIOC_TRY_FMT: OK
                test VIDIOC_S_FMT: OK
                test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)

        Codec ioctls:
                test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
                test VIDIOC_G_ENC_INDEX: OK (Not Supported)
                test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
                info: test buftype Video Output
        test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
        test VIDIOC_EXPBUF: OK
        test read/write: OK (Not Supported)
            Video Output:
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.197959s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.231346s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.264708s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.298071s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.331432s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.364827s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.398174s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.431543s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.464898s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.498277s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.531648s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.565008s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.598379s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.631754s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.665121s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.698489s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.731843s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.765230s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.798587s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.831955s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.865314s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 203.898690s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 203.932065s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 203.965425s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 203.998793s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.032169s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.065534s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.098897s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.132256s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.165643s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.199000s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.232370s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.265725s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.299103s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.332478s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.365837s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.399207s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.432567s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.465951s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.499312s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.532670s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.566036s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.599414s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.632785s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.666143s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.699509s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.732891s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.766253s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.799620s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.832980s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.866362s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 204.899722s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 204.933083s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 204.966449s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 204.999826s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.033190s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.066552s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.099920s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.133306s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.166665s
            Video Output (polling):
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.200056s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.233388s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.266772s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.300162s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.333497s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.366859s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.400264s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.433608s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.466982s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.500359s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.533717s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.567082s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.600470s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.633800s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.667186s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.700572s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.733906s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.767270s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.800678s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.834022s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 205.867391s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 205.900772s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 205.934129s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 205.967494s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.000884s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.034215s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.067607s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.100983s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.134329s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.167684s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.201087s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.234435s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.267799s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.301192s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.334523s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.367906s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.401293s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.434627s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.467992s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.501374s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.534744s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.568099s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.601470s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.634852s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.668215s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.701605s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.734935s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.768322s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.801707s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.835041s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 206.868407s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 206.901811s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 206.935166s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 206.968509s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.001907s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 207.035265s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.068628s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.102016s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.135349s
                Buffer: 3 Sequence: 0 Field: Interlaced Timestamp: 207.168734s
        test MMAP: OK
                fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
                fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
        test USERPTR: FAIL
            Video Output:
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.234735s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.268098s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.301503s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.334846s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.368202s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.401594s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.434960s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.468320s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.501709s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.535041s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.568428s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.601811s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.635146s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.668514s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.701913s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.735260s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.768617s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.802007s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.835367s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.868732s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 207.902120s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 207.935451s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 207.968837s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.002223s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.035566s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.068923s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.102327s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.135667s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.169023s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.202423s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.235785s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.269146s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.302535s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.335862s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.369252s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.402637s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.435978s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.469335s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.502705s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.536087s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.569454s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.602817s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.636177s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.669557s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.702934s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.736280s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.769648s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.803053s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.836396s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.869753s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 208.903122s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 208.936499s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 208.969870s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.003251s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.036591s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.069975s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.103363s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.136702s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.170112s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.203462s
            Video Output (polling):
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.236804s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.270175s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.303533s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.336914s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.370269s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.403661s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.436999s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.470388s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.503774s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.537117s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.570511s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.603874s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.637222s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.670603s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.703944s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.737326s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.770694s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.804083s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.837412s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.870809s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 209.904185s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 209.937526s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 209.970900s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.004285s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.037632s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.070993s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.104382s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.137735s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.171104s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.204492s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.237822s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.271190s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.304596s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.337941s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.371310s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.404665s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.438046s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.471408s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.504794s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.538130s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.571517s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.604904s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.638234s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.671610s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.704984s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.738352s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.771725s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.805080s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.838459s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.871822s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 210.905207s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 210.938547s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 210.971931s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.005319s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 211.038649s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 211.072021s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.105420s
                Buffer: 0 Sequence: 0 Field: Interlaced Timestamp: 211.138776s
                Buffer: 1 Sequence: 0 Field: Interlaced Timestamp: 211.172136s
                Buffer: 2 Sequence: 0 Field: Interlaced Timestamp: 211.205492s
        test DMABUF: OK

Total: 57, Succeeded: 56, Failed: 1, Warnings: 0



Lad, Prabhakar (49):
  media: davinci: vpif_display: initialize vb2 queue and DMA context
    during probe
  media: davinci: vpif_display: drop buf_init() callback
  media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper
    functions
  media: davinci: vpif_display: release buffers in case
    start_streaming() call back fails
  media: davinci: vpif_display: drop buf_cleanup() callback
  media: davinci: vpif_display: improve vpif_buffer_prepare() callback
  media: davinci: vpif_display: improve vpif_buffer_queue_setup()
    function
  media: davinci: vpif_display: improve start/stop_streaming callbacks
  media: davinci: vpif_display: use vb2_fop_mmap/poll
  media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release
  media: davinci: vpif_display: use vb2_ioctl_* helpers
  media: davinci: vpif_display: drop unused member fbuffers
  media: davinci: vpif_display: drop reserving memory for device
  media: davinci: vpif_display: drop unnecessary field memory
  media: davinci: vpif_display: drop numbuffers field from common_obj
  media: davinic: vpif_display: drop started member from struct
    common_obj
  media: davinci: vpif_display: initialize the video device in single
    place
  media: davinci: vpif_display: drop unneeded module params
  media: davinci: vpif_display: drop cropcap
  media: davinci: vpif_display: group v4l2_ioctl_ops
  media: davinci: vpif_display: use SIMPLE_DEV_PM_OPS
  media: davinci: vpif_display: return -ENODATA for *dv_timings calls
  media: davinci: vpif_display: return -ENODATA for *std calls
  media: davinci; vpif_display: fix checkpatch error
  media: davinci: vpif_display: fix v4l-complinace issues
  media: davinci: vpif_capture: initalize vb2 queue and DMA context
    during probe
  media: davinci: vpif_capture: drop buf_init() callback
  media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper
    functions
  media: davinci: vpif_capture: release buffers in case
    start_streaming() call back fails
  media: davinci: vpif_capture: drop buf_cleanup() callback
  media: davinci: vpif_capture: improve vpif_buffer_prepare() callback
  media: davinci: vpif_capture: improve vpif_buffer_queue_setup()
    function
  media: davinci: vpif_capture: improve start/stop_streaming callbacks
  media: davinci: vpif_capture: use vb2_fop_mmap/poll
  media: davinci: vpif_capture: use v4l2_fh_open and vb2_fop_release
  media: davinci: vpif_capture: use vb2_ioctl_* helpers
  media: davinci: vpif_capture: drop reserving memory for device
  media: davinci: vpif_capture: drop unnecessary field memory
  media: davinic: vpif_capture: drop started member from struct
    common_obj
  media: davinci: vpif_capture: initialize the video device in single
    place
  media: davinci: vpif_capture: drop unneeded module params
  media: davinci: vpif_capture: drop cropcap
  media: davinci: vpif_capture: group v4l2_ioctl_ops
  media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS
  media: davinci: vpif_capture: return -ENODATA for *dv_timings calls
  media: davinci: vpif_capture: return -ENODATA for *std calls
  media: davinci: vpif_capture: drop check __KERNEL__
  media: davinci: vpif_capture: fix v4l-complinace issues
  media: davinci: vpif: add Copyright message

 drivers/media/platform/davinci/vpif_capture.c | 1420 +++++++------------------
 drivers/media/platform/davinci/vpif_capture.h |   39 -
 drivers/media/platform/davinci/vpif_display.c | 1196 ++++++---------------
 drivers/media/platform/davinci/vpif_display.h |   44 +-
 4 files changed, 746 insertions(+), 1953 deletions(-)

--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 01/49] media: davinci: vpif_display: initalize vb2 queue and DMA context during probe

Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

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

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   86 ++++++++++++-------------
 1 file changed, 41 insertions(+), 45 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index d03487f..dbd4f0f 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -74,12 +74,12 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode);
  */
 static int vpif_buffer_prepare(struct vb2_buffer *vb)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
  struct vb2_queue *q = vb->vb2_queue;
+ struct channel_obj *ch = vb2_get_drv_priv(q);
  struct common_obj *common;
  unsigned long addr;
 
- common = &fh->channel->common[VPIF_VIDEO_INDEX];
+ common = &ch->common[VPIF_VIDEO_INDEX];
  if (vb->state != VB2_BUF_STATE_ACTIVE &&
  vb->state != VB2_BUF_STATE_PREPARED) {
  vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage);
@@ -112,8 +112,7 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  unsigned int *nbuffers, unsigned int *nplanes,
  unsigned int sizes[], void *alloc_ctxs[])
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vq);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
  unsigned long size;
 
@@ -154,10 +153,9 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  */
 static void vpif_buffer_queue(struct vb2_buffer *vb)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
  struct vpif_disp_buffer *buf = container_of(vb,
  struct vpif_disp_buffer, vb);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
  struct common_obj *common;
  unsigned long flags;
 
@@ -175,10 +173,9 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
  */
 static void vpif_buf_cleanup(struct vb2_buffer *vb)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
  struct vpif_disp_buffer *buf = container_of(vb,
  struct vpif_disp_buffer, vb);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
  struct common_obj *common;
  unsigned long flags;
 
@@ -192,8 +189,7 @@ static void vpif_buf_cleanup(struct vb2_buffer *vb)
 
 static void vpif_wait_prepare(struct vb2_queue *vq)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vq);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common;
 
  common = &ch->common[VPIF_VIDEO_INDEX];
@@ -202,8 +198,7 @@ static void vpif_wait_prepare(struct vb2_queue *vq)
 
 static void vpif_wait_finish(struct vb2_queue *vq)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vq);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common;
 
  common = &ch->common[VPIF_VIDEO_INDEX];
@@ -226,8 +221,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
  struct vpif_display_config *vpif_config_data =
  vpif_dev->platform_data;
- struct vpif_fh *fh = vb2_get_drv_priv(vq);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
  struct vpif_params *vpif = &ch->vpifparams;
  unsigned long addr = 0;
@@ -310,8 +304,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 /* abort streaming and wait for last buffer */
 static void vpif_stop_streaming(struct vb2_queue *vq)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vq);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common;
  unsigned long flags;
 
@@ -794,10 +787,6 @@ static int vpif_release(struct file *filep)
  if (fh->io_allowed[VPIF_VIDEO_INDEX]) {
  /* Reset io_usrs member of channel object */
  common->io_usrs = 0;
- /* Free buffers allocated */
- vb2_queue_release(&common->buffer_queue);
- vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
-
  common->numbuffers =
     config_params.numbuffers[ch->channel_id];
  }
@@ -939,9 +928,7 @@ static int vpif_reqbufs(struct file *file, void *priv,
  struct channel_obj *ch = fh->channel;
  struct common_obj *common;
  enum v4l2_field field;
- struct vb2_queue *q;
  u8 index = 0;
- int ret;
 
  /* This file handle has not initialized the channel,
    It is not allowed to do settings */
@@ -973,35 +960,12 @@ static int vpif_reqbufs(struct file *file, void *priv,
  } else {
  field = V4L2_VBI_INTERLACED;
  }
- /* Initialize videobuf2 queue as per the buffer type */
- common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
- if (IS_ERR(common->alloc_ctx)) {
- vpif_err("Failed to get the context\n");
- return PTR_ERR(common->alloc_ctx);
- }
- q = &common->buffer_queue;
- q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
- q->io_modes = VB2_MMAP | VB2_USERPTR;
- q->drv_priv = fh;
- q->ops = &video_qops;
- q->mem_ops = &vb2_dma_contig_memops;
- q->buf_struct_size = sizeof(struct vpif_disp_buffer);
- q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
- q->min_buffers_needed = 1;
-
- ret = vb2_queue_init(q);
- if (ret) {
- vpif_err("vpif_display: vb2_queue_init() failed\n");
- vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
- return ret;
- }
  /* Set io allowed member of file handle to TRUE */
  fh->io_allowed[index] = 1;
  /* Increment io usrs member of channel object to 1 */
  common->io_usrs = 1;
  /* Store type of memory requested in channel object */
  common->memory = reqbuf->memory;
- INIT_LIST_HEAD(&common->dma_queue);
  /* Allocate buffers */
  return vb2_reqbufs(&common->buffer_queue, reqbuf);
 }
@@ -1637,6 +1601,7 @@ static int vpif_probe_complete(void)
 {
  struct common_obj *common;
  struct channel_obj *ch;
+ struct vb2_queue *q;
  int j, err, k;
 
  for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
@@ -1685,6 +1650,32 @@ static int vpif_probe_complete(void)
  if (err)
  goto probe_out;
 
+ /* Initialize vb2 queue */
+ q = &common->buffer_queue;
+ q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+ q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
+ q->drv_priv = ch;
+ q->ops = &video_qops;
+ q->mem_ops = &vb2_dma_contig_memops;
+ q->buf_struct_size = sizeof(struct vpif_disp_buffer);
+ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+ q->min_buffers_needed = 1;
+
+ err = vb2_queue_init(q);
+ if (err) {
+ vpif_err("vpif_display: vb2_queue_init() failed\n");
+ goto probe_out;
+ }
+
+ common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
+ if (IS_ERR(common->alloc_ctx)) {
+ vpif_err("Failed to get the context\n");
+ err = PTR_ERR(common->alloc_ctx);
+ goto probe_out;
+ }
+
+ INIT_LIST_HEAD(&common->dma_queue);
+
  /* register video device */
  vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n",
  (int)ch, (int)&ch->video_dev);
@@ -1700,6 +1691,8 @@ static int vpif_probe_complete(void)
 probe_out:
  for (k = 0; k < j; k++) {
  ch = vpif_obj.dev[k];
+ common = &ch->common[k];
+ vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
  video_unregister_device(ch->video_dev);
  video_device_release(ch->video_dev);
  ch->video_dev = NULL;
@@ -1865,6 +1858,7 @@ vpif_unregister:
  */
 static int vpif_remove(struct platform_device *device)
 {
+ struct common_obj *common;
  struct channel_obj *ch;
  int i;
 
@@ -1875,6 +1869,8 @@ static int vpif_remove(struct platform_device *device)
  for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
  /* Get the pointer to the channel object */
  ch = vpif_obj.dev[i];
+ common = &ch->common[i];
+ vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
  /* Unregister video device */
  video_unregister_device(ch->video_dev);
 
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 01/49] media: davinci: vpif_display: initialize vb2 queue and DMA context during probe

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

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

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   86 ++++++++++++-------------
 1 file changed, 41 insertions(+), 45 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index d03487f..dbd4f0f 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -74,12 +74,12 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode);
  */
 static int vpif_buffer_prepare(struct vb2_buffer *vb)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
  struct vb2_queue *q = vb->vb2_queue;
+ struct channel_obj *ch = vb2_get_drv_priv(q);
  struct common_obj *common;
  unsigned long addr;
 
- common = &fh->channel->common[VPIF_VIDEO_INDEX];
+ common = &ch->common[VPIF_VIDEO_INDEX];
  if (vb->state != VB2_BUF_STATE_ACTIVE &&
  vb->state != VB2_BUF_STATE_PREPARED) {
  vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage);
@@ -112,8 +112,7 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  unsigned int *nbuffers, unsigned int *nplanes,
  unsigned int sizes[], void *alloc_ctxs[])
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vq);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
  unsigned long size;
 
@@ -154,10 +153,9 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  */
 static void vpif_buffer_queue(struct vb2_buffer *vb)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
  struct vpif_disp_buffer *buf = container_of(vb,
  struct vpif_disp_buffer, vb);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
  struct common_obj *common;
  unsigned long flags;
 
@@ -175,10 +173,9 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
  */
 static void vpif_buf_cleanup(struct vb2_buffer *vb)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vb->vb2_queue);
  struct vpif_disp_buffer *buf = container_of(vb,
  struct vpif_disp_buffer, vb);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
  struct common_obj *common;
  unsigned long flags;
 
@@ -192,8 +189,7 @@ static void vpif_buf_cleanup(struct vb2_buffer *vb)
 
 static void vpif_wait_prepare(struct vb2_queue *vq)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vq);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common;
 
  common = &ch->common[VPIF_VIDEO_INDEX];
@@ -202,8 +198,7 @@ static void vpif_wait_prepare(struct vb2_queue *vq)
 
 static void vpif_wait_finish(struct vb2_queue *vq)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vq);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common;
 
  common = &ch->common[VPIF_VIDEO_INDEX];
@@ -226,8 +221,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
  struct vpif_display_config *vpif_config_data =
  vpif_dev->platform_data;
- struct vpif_fh *fh = vb2_get_drv_priv(vq);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
  struct vpif_params *vpif = &ch->vpifparams;
  unsigned long addr = 0;
@@ -310,8 +304,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 /* abort streaming and wait for last buffer */
 static void vpif_stop_streaming(struct vb2_queue *vq)
 {
- struct vpif_fh *fh = vb2_get_drv_priv(vq);
- struct channel_obj *ch = fh->channel;
+ struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common;
  unsigned long flags;
 
@@ -794,10 +787,6 @@ static int vpif_release(struct file *filep)
  if (fh->io_allowed[VPIF_VIDEO_INDEX]) {
  /* Reset io_usrs member of channel object */
  common->io_usrs = 0;
- /* Free buffers allocated */
- vb2_queue_release(&common->buffer_queue);
- vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
-
  common->numbuffers =
     config_params.numbuffers[ch->channel_id];
  }
@@ -939,9 +928,7 @@ static int vpif_reqbufs(struct file *file, void *priv,
  struct channel_obj *ch = fh->channel;
  struct common_obj *common;
  enum v4l2_field field;
- struct vb2_queue *q;
  u8 index = 0;
- int ret;
 
  /* This file handle has not initialized the channel,
    It is not allowed to do settings */
@@ -973,35 +960,12 @@ static int vpif_reqbufs(struct file *file, void *priv,
  } else {
  field = V4L2_VBI_INTERLACED;
  }
- /* Initialize videobuf2 queue as per the buffer type */
- common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
- if (IS_ERR(common->alloc_ctx)) {
- vpif_err("Failed to get the context\n");
- return PTR_ERR(common->alloc_ctx);
- }
- q = &common->buffer_queue;
- q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
- q->io_modes = VB2_MMAP | VB2_USERPTR;
- q->drv_priv = fh;
- q->ops = &video_qops;
- q->mem_ops = &vb2_dma_contig_memops;
- q->buf_struct_size = sizeof(struct vpif_disp_buffer);
- q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
- q->min_buffers_needed = 1;
-
- ret = vb2_queue_init(q);
- if (ret) {
- vpif_err("vpif_display: vb2_queue_init() failed\n");
- vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
- return ret;
- }
  /* Set io allowed member of file handle to TRUE */
  fh->io_allowed[index] = 1;
  /* Increment io usrs member of channel object to 1 */
  common->io_usrs = 1;
  /* Store type of memory requested in channel object */
  common->memory = reqbuf->memory;
- INIT_LIST_HEAD(&common->dma_queue);
  /* Allocate buffers */
  return vb2_reqbufs(&common->buffer_queue, reqbuf);
 }
@@ -1637,6 +1601,7 @@ static int vpif_probe_complete(void)
 {
  struct common_obj *common;
  struct channel_obj *ch;
+ struct vb2_queue *q;
  int j, err, k;
 
  for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
@@ -1685,6 +1650,32 @@ static int vpif_probe_complete(void)
  if (err)
  goto probe_out;
 
+ /* Initialize vb2 queue */
+ q = &common->buffer_queue;
+ q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+ q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
+ q->drv_priv = ch;
+ q->ops = &video_qops;
+ q->mem_ops = &vb2_dma_contig_memops;
+ q->buf_struct_size = sizeof(struct vpif_disp_buffer);
+ q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+ q->min_buffers_needed = 1;
+
+ err = vb2_queue_init(q);
+ if (err) {
+ vpif_err("vpif_display: vb2_queue_init() failed\n");
+ goto probe_out;
+ }
+
+ common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev);
+ if (IS_ERR(common->alloc_ctx)) {
+ vpif_err("Failed to get the context\n");
+ err = PTR_ERR(common->alloc_ctx);
+ goto probe_out;
+ }
+
+ INIT_LIST_HEAD(&common->dma_queue);
+
  /* register video device */
  vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n",
  (int)ch, (int)&ch->video_dev);
@@ -1700,6 +1691,8 @@ static int vpif_probe_complete(void)
 probe_out:
  for (k = 0; k < j; k++) {
  ch = vpif_obj.dev[k];
+ common = &ch->common[k];
+ vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
  video_unregister_device(ch->video_dev);
  video_device_release(ch->video_dev);
  ch->video_dev = NULL;
@@ -1865,6 +1858,7 @@ vpif_unregister:
  */
 static int vpif_remove(struct platform_device *device)
 {
+ struct common_obj *common;
  struct channel_obj *ch;
  int i;
 
@@ -1875,6 +1869,8 @@ static int vpif_remove(struct platform_device *device)
  for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
  /* Get the pointer to the channel object */
  ch = vpif_obj.dev[i];
+ common = &ch->common[i];
+ vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
  /* Unregister video device */
  video_unregister_device(ch->video_dev);
 
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 02/49] media: davinci: vpif_display: drop buf_init() callback

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

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

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index dbd4f0f..e2102ea 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -205,16 +205,6 @@ static void vpif_wait_finish(struct vb2_queue *vq)
  mutex_lock(&common->lock);
 }
 
-static int vpif_buffer_init(struct vb2_buffer *vb)
-{
- struct vpif_disp_buffer *buf = container_of(vb,
- struct vpif_disp_buffer, vb);
-
- INIT_LIST_HEAD(&buf->list);
-
- return 0;
-}
-
 static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
 
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
@@ -351,7 +341,6 @@ static struct vb2_ops video_qops = {
  .queue_setup = vpif_buffer_queue_setup,
  .wait_prepare = vpif_wait_prepare,
  .wait_finish = vpif_wait_finish,
- .buf_init = vpif_buffer_init,
  .buf_prepare = vpif_buffer_prepare,
  .start_streaming = vpif_start_streaming,
  .stop_streaming = vpif_stop_streaming,
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 03/49] media: davinci: vpif_display: use vb2_ops_wait_prepare/finish helper functions

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this patch makes use of vb2_ops_wait_prepare/finish helper functions.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index e2102ea..8bb9f02 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -187,24 +187,6 @@ static void vpif_buf_cleanup(struct vb2_buffer *vb)
  spin_unlock_irqrestore(&common->irqlock, flags);
 }
 
-static void vpif_wait_prepare(struct vb2_queue *vq)
-{
- struct channel_obj *ch = vb2_get_drv_priv(vq);
- struct common_obj *common;
-
- common = &ch->common[VPIF_VIDEO_INDEX];
- mutex_unlock(&common->lock);
-}
-
-static void vpif_wait_finish(struct vb2_queue *vq)
-{
- struct channel_obj *ch = vb2_get_drv_priv(vq);
- struct common_obj *common;
-
- common = &ch->common[VPIF_VIDEO_INDEX];
- mutex_lock(&common->lock);
-}
-
 static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
 
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
@@ -339,8 +321,8 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
 
 static struct vb2_ops video_qops = {
  .queue_setup = vpif_buffer_queue_setup,
- .wait_prepare = vpif_wait_prepare,
- .wait_finish = vpif_wait_finish,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
  .buf_prepare = vpif_buffer_prepare,
  .start_streaming = vpif_start_streaming,
  .stop_streaming = vpif_stop_streaming,
@@ -1649,6 +1631,7 @@ static int vpif_probe_complete(void)
  q->buf_struct_size = sizeof(struct vpif_disp_buffer);
  q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
  q->min_buffers_needed = 1;
+ q->lock = &common->lock;
 
  err = vb2_queue_init(q);
  if (err) {
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 04/49] media: davinci: vpif_display: release buffers in case start_streaming() call back fails

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this patch adds support to release the buffer by calling
vb2_buffer_done(), with state marked as VB2_BUF_STATE_QUEUED
if start_streaming() call back fails.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   42 +++++++++++++++----------
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 8bb9f02..1a17a45 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -196,26 +196,16 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
  struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
  struct vpif_params *vpif = &ch->vpifparams;
- unsigned long addr = 0;
- unsigned long flags;
+ struct vpif_disp_buffer *buf, *tmp;
+ unsigned long addr, flags;
  int ret;
 
  spin_lock_irqsave(&common->irqlock, flags);
 
- /* Get the next frame from the buffer queue */
- common->next_frm = common->cur_frm =
-    list_entry(common->dma_queue.next,
-       struct vpif_disp_buffer, list);
-
- list_del(&common->cur_frm->list);
- spin_unlock_irqrestore(&common->irqlock, flags);
- /* Mark state of the current frame to active */
- common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
-
  /* Initialize field_id and started member */
  ch->field_id = 0;
  common->started = 1;
- addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
+
  /* Calculate the offset for Y and C data  in the buffer */
  vpif_calculate_offsets(ch);
 
@@ -225,7 +215,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
  || (!ch->vpifparams.std_info.frm_fmt
  && (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) {
  vpif_err("conflict in field format and std format\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto err;
  }
 
  /* clock settings */
@@ -234,17 +225,28 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
  ycmux_mode, ch->vpifparams.std_info.hd_sd);
  if (ret < 0) {
  vpif_err("can't set clock\n");
- return ret;
+ goto err;
  }
  }
 
  /* set the parameters and addresses */
  ret = vpif_set_video_params(vpif, ch->channel_id + 2);
  if (ret < 0)
- return ret;
+ goto err;
 
  common->started = ret;
  vpif_config_addr(ch, ret);
+ /* Get the next frame from the buffer queue */
+ common->next_frm = common->cur_frm =
+    list_entry(common->dma_queue.next,
+       struct vpif_disp_buffer, list);
+
+ list_del(&common->cur_frm->list);
+ spin_unlock_irqrestore(&common->irqlock, flags);
+ /* Mark state of the current frame to active */
+ common->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
+
+ addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
  common->set_addr((addr + common->ytop_off),
     (addr + common->ybtm_off),
     (addr + common->ctop_off),
@@ -271,6 +273,14 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
  }
 
  return 0;
+
+err:
+ list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) {
+ list_del(&buf->list);
+ vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+ }
+
+ return ret;
 }
 
 /* abort streaming and wait for last buffer */
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 05/49] media: davinci: vpif_display: drop buf_cleanup() callback

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

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

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 1a17a45..9999b9c 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -167,26 +167,6 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
  spin_unlock_irqrestore(&common->irqlock, flags);
 }
 
-/*
- * vpif_buf_cleanup: This function is called from the videobuf2 layer to
- * free memory allocated to the buffers
- */
-static void vpif_buf_cleanup(struct vb2_buffer *vb)
-{
- struct vpif_disp_buffer *buf = container_of(vb,
- struct vpif_disp_buffer, vb);
- struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
- struct common_obj *common;
- unsigned long flags;
-
- common = &ch->common[VPIF_VIDEO_INDEX];
-
- spin_lock_irqsave(&common->irqlock, flags);
- if (vb->state == VB2_BUF_STATE_ACTIVE)
- list_del_init(&buf->list);
- spin_unlock_irqrestore(&common->irqlock, flags);
-}
-
 static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
 
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
@@ -336,7 +316,6 @@ static struct vb2_ops video_qops = {
  .buf_prepare = vpif_buffer_prepare,
  .start_streaming = vpif_start_streaming,
  .stop_streaming = vpif_stop_streaming,
- .buf_cleanup = vpif_buf_cleanup,
  .buf_queue = vpif_buffer_queue,
 };
 
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 06/49] media: davinci: vpif_display: improve vpif_buffer_prepare() callback

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this patch improve vpif_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 <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   47 ++++++++++++-------------
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 9999b9c..1c518de 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -67,41 +67,40 @@ static struct device *vpif_dev;
 static void vpif_calculate_offsets(struct channel_obj *ch);
 static void vpif_config_addr(struct channel_obj *ch, int muxmode);
 
-/*
- * buffer_prepare: This is the callback function called from vb2_qbuf()
- * function the buffer is prepared and user space virtual address is converted
- * into physical address
+/**
+ * vpif_buffer_prepare :  callback function for buffer prepare
+ * @vb: ptr to vb2_buffer
+ *
+ * This is the callback function for buffer prepare when vb2_qbuf()
+ * function is called. The buffer is prepared and user space virtual address
+ * or user address is converted into  physical address
  */
 static int vpif_buffer_prepare(struct vb2_buffer *vb)
 {
- struct vb2_queue *q = vb->vb2_queue;
- struct channel_obj *ch = vb2_get_drv_priv(q);
+ struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
  struct common_obj *common;
- unsigned long addr;
 
  common = &ch->common[VPIF_VIDEO_INDEX];
- if (vb->state != VB2_BUF_STATE_ACTIVE &&
- vb->state != VB2_BUF_STATE_PREPARED) {
- vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage);
- if (vb2_plane_vaddr(vb, 0) &&
- vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
- goto buf_align_exit;
-
- addr = vb2_dma_contig_plane_dma_addr(vb, 0);
- if (q->streaming &&
- (V4L2_BUF_TYPE_SLICED_VBI_OUTPUT != q->type)) {
- if (!ISALIGNED(addr + common->ytop_off) ||
+
+ vb2_set_plane_payload(vb, 0, common->fmt.fmt.pix.sizeimage);
+ if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
+ return -EINVAL;
+
+ vb->v4l2_buf.field = common->fmt.fmt.pix.field;
+
+ if (vb->vb2_queue->type != V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) {
+ unsigned long addr = vb2_dma_contig_plane_dma_addr(vb, 0);
+
+ if (!ISALIGNED(addr + common->ytop_off) ||
  !ISALIGNED(addr + common->ybtm_off) ||
  !ISALIGNED(addr + common->ctop_off) ||
- !ISALIGNED(addr + common->cbtm_off))
- goto buf_align_exit;
+ !ISALIGNED(addr + common->cbtm_off)) {
+ vpif_err("buffer offset not aligned to 8 bytes\n");
+ return -EINVAL;
  }
  }
- return 0;
 
-buf_align_exit:
- vpif_err("buffer offset not aligned to 8 bytes\n");
- return -EINVAL;
+ return 0;
 }
 
 /*
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 07/49] media: davinci: vpif_display: improve vpif_buffer_queue_setup() function

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this patch sets the sizes[0] of plane according to the fmt passed
or which is being set in the channel, in both MMAP and USERPTR buffer
type.

This patch also move the calculation of offests(vpif_calculate_offsets())
to queue_setup() callback as after queue_setup() callback the
application is no longer allowed to change format, and prepares to
removal of config_params.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   53 ++++++++++---------------
 1 file changed, 21 insertions(+), 32 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 1c518de..1b6cbe8 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -103,8 +103,17 @@ static int vpif_buffer_prepare(struct vb2_buffer *vb)
  return 0;
 }
 
-/*
- * vpif_buffer_queue_setup: This function allocates memory for the buffers
+/**
+ * vpif_buffer_queue_setup : Callback function for buffer setup.
+ * @vq: vb2_queue ptr
+ * @fmt: v4l2 format
+ * @nbuffers: ptr to number of buffers requested by application
+ * @nplanes:: contains number of distinct video planes needed to hold a frame
+ * @sizes[]: contains the size (in bytes) of each plane.
+ * @alloc_ctxs: ptr to allocation context
+ *
+ * This callback function is called when reqbuf() is called to adjust
+ * the buffer count and buffer size
  */
 static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  const struct v4l2_format *fmt,
@@ -113,37 +122,20 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
 {
  struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
- unsigned long size;
-
- if (V4L2_MEMORY_MMAP == common->memory) {
- size = config_params.channel_bufsize[ch->channel_id];
- /*
- * Checking if the buffer size exceeds the available buffer
- * ycmux_mode = 0 means 1 channel mode HD and
- * ycmux_mode = 1 means 2 channels mode SD
- */
- if (ch->vpifparams.std_info.ycmux_mode == 0) {
- if (config_params.video_limit[ch->channel_id])
- while (size * *nbuffers >
- (config_params.video_limit[0]
- + config_params.video_limit[1]))
- (*nbuffers)--;
- } else {
- if (config_params.video_limit[ch->channel_id])
- while (size * *nbuffers >
- config_params.video_limit[ch->channel_id])
- (*nbuffers)--;
- }
- } else {
- size = common->fmt.fmt.pix.sizeimage;
- }
 
- if (*nbuffers < config_params.min_numbuffers)
- *nbuffers = config_params.min_numbuffers;
+ if (fmt && fmt->fmt.pix.sizeimage < common->fmt.fmt.pix.sizeimage)
+ return -EINVAL;
+
+ if (vq->num_buffers + *nbuffers < 3)
+ *nbuffers = 3 - vq->num_buffers;
 
  *nplanes = 1;
- sizes[0] = size;
+ sizes[0] = fmt ? fmt->fmt.pix.sizeimage : common->fmt.fmt.pix.sizeimage;
  alloc_ctxs[0] = common->alloc_ctx;
+
+ /* Calculate the offset for Y and C data  in the buffer */
+ vpif_calculate_offsets(ch);
+
  return 0;
 }
 
@@ -185,9 +177,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
  ch->field_id = 0;
  common->started = 1;
 
- /* Calculate the offset for Y and C data  in the buffer */
- vpif_calculate_offsets(ch);
-
  if ((ch->vpifparams.std_info.frm_fmt &&
  ((common->fmt.fmt.pix.field != V4L2_FIELD_NONE)
  && (common->fmt.fmt.pix.field != V4L2_FIELD_ANY)))
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 08/49] media: davinci: vpif_display: improve start/stop_streaming callbacks

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this patch drops unnecessary check from start_streaming() callback
as this is already done in try/s_fmt and some minor code cleanups,
drops check for vb2_is_streaming() as this check is done by vb2
itself before calling this callback.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   59 ++++++++++++++-----------
 1 file changed, 33 insertions(+), 26 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 1b6cbe8..933d28f 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -62,11 +62,18 @@ static struct vpif_config_params config_params = {
  .channel_bufsize[1] = 720 * 576 * 2,
 };
 
+static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
+
 static struct vpif_device vpif_obj = { {NULL} };
 static struct device *vpif_dev;
 static void vpif_calculate_offsets(struct channel_obj *ch);
 static void vpif_config_addr(struct channel_obj *ch, int muxmode);
 
+static inline struct vpif_disp_buffer *to_vpif_buffer(struct vb2_buffer *vb)
+{
+ return container_of(vb, struct vpif_disp_buffer, vb);
+}
+
 /**
  * vpif_buffer_prepare :  callback function for buffer prepare
  * @vb: ptr to vb2_buffer
@@ -139,13 +146,15 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  return 0;
 }
 
-/*
- * vpif_buffer_queue: This function adds the buffer to DMA queue
+/**
+ * vpif_buffer_queue : Callback function to add buffer to DMA queue
+ * @vb: ptr to vb2_buffer
+ *
+ * This callback fucntion queues the buffer to DMA engine
  */
 static void vpif_buffer_queue(struct vb2_buffer *vb)
 {
- struct vpif_disp_buffer *buf = container_of(vb,
- struct vpif_disp_buffer, vb);
+ struct vpif_disp_buffer *buf = to_vpif_buffer(vb);
  struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
  struct common_obj *common;
  unsigned long flags;
@@ -158,8 +167,11 @@ static void vpif_buffer_queue(struct vb2_buffer *vb)
  spin_unlock_irqrestore(&common->irqlock, flags);
 }
 
-static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
-
+/**
+ * vpif_start_streaming : Starts the DMA engine for streaming
+ * @vb: ptr to vb2_buffer
+ * @count: number of buffers
+ */
 static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
  struct vpif_display_config *vpif_config_data =
@@ -177,16 +189,6 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
  ch->field_id = 0;
  common->started = 1;
 
- if ((ch->vpifparams.std_info.frm_fmt &&
- ((common->fmt.fmt.pix.field != V4L2_FIELD_NONE)
- && (common->fmt.fmt.pix.field != V4L2_FIELD_ANY)))
- || (!ch->vpifparams.std_info.frm_fmt
- && (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) {
- vpif_err("conflict in field format and std format\n");
- ret = -EINVAL;
- goto err;
- }
-
  /* clock settings */
  if (vpif_config_data->set_clock) {
  ret = vpif_config_data->set_clock(ch->vpifparams.std_info.
@@ -220,8 +222,10 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
     (addr + common->ctop_off),
     (addr + common->cbtm_off));
 
- /* Set interrupt for both the fields in VPIF
-    Register enable channel in VPIF register */
+ /*
+ * Set interrupt for both the fields in VPIF
+ * Register enable channel in VPIF register
+ */
  channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1;
  if (VPIF_CHANNEL2_VIDEO == ch->channel_id) {
  channel2_intr_assert();
@@ -231,8 +235,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
  channel2_clipping_enable(1);
  }
 
- if ((VPIF_CHANNEL3_VIDEO == ch->channel_id)
- || (common->started == 2)) {
+ if (VPIF_CHANNEL3_VIDEO == ch->channel_id ||
+ common->started == 2) {
  channel3_intr_assert();
  channel3_intr_enable(1);
  enable_channel3(1);
@@ -251,16 +255,19 @@ err:
  return ret;
 }
 
-/* abort streaming and wait for last buffer */
+/**
+ * vpif_stop_streaming : Stop the DMA engine
+ * @vq: ptr to vb2_queue
+ *
+ * This callback stops the DMA engine and any remaining buffers
+ * in the DMA queue are released.
+ */
 static void vpif_stop_streaming(struct vb2_queue *vq)
 {
  struct channel_obj *ch = vb2_get_drv_priv(vq);
  struct common_obj *common;
  unsigned long flags;
 
- if (!vb2_is_streaming(vq))
- return;
-
  common = &ch->common[VPIF_VIDEO_INDEX];
 
  /* Disable channel */
@@ -268,8 +275,8 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
  enable_channel2(0);
  channel2_intr_enable(0);
  }
- if ((VPIF_CHANNEL3_VIDEO == ch->channel_id) ||
- (2 == common->started)) {
+ if (VPIF_CHANNEL3_VIDEO == ch->channel_id ||
+ 2 == common->started) {
  enable_channel3(0);
  channel3_intr_enable(0);
  }
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 09/49] media: davinci: vpif_display: use vb2_fop_mmap/poll

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   49 ++++---------------------
 1 file changed, 7 insertions(+), 42 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 933d28f..cea526b 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -646,44 +646,6 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
 }
 
 /*
- * vpif_mmap: It is used to map kernel space buffers into user spaces
- */
-static int vpif_mmap(struct file *filep, struct vm_area_struct *vma)
-{
- struct vpif_fh *fh = filep->private_data;
- struct channel_obj *ch = fh->channel;
- struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]);
- int ret;
-
- vpif_dbg(2, debug, "vpif_mmap\n");
-
- if (mutex_lock_interruptible(&common->lock))
- return -ERESTARTSYS;
- ret = vb2_mmap(&common->buffer_queue, vma);
- mutex_unlock(&common->lock);
- return ret;
-}
-
-/*
- * vpif_poll: It is used for select/poll system call
- */
-static unsigned int vpif_poll(struct file *filep, poll_table *wait)
-{
- struct vpif_fh *fh = filep->private_data;
- struct channel_obj *ch = fh->channel;
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
- unsigned int res = 0;
-
- if (common->started) {
- mutex_lock(&common->lock);
- res = vb2_poll(&common->buffer_queue, filep, wait);
- mutex_unlock(&common->lock);
- }
-
- return res;
-}
-
-/*
  * vpif_open: It creates object of file handle structure and stores it in
  * private_data member of filepointer
  */
@@ -1463,8 +1425,8 @@ static const struct v4l2_file_operations vpif_fops = {
  .open = vpif_open,
  .release = vpif_release,
  .unlocked_ioctl = video_ioctl2,
- .mmap = vpif_mmap,
- .poll = vpif_poll
+ .mmap = vb2_fop_mmap,
+ .poll = vb2_fop_poll
 };
 
 static struct video_device vpif_video_template = {
@@ -1555,6 +1517,7 @@ static int vpif_async_bound(struct v4l2_async_notifier *notifier,
 static int vpif_probe_complete(void)
 {
  struct common_obj *common;
+ struct video_device *vdev;
  struct channel_obj *ch;
  struct vb2_queue *q;
  int j, err, k;
@@ -1636,8 +1599,10 @@ static int vpif_probe_complete(void)
  vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n",
  (int)ch, (int)&ch->video_dev);
 
- err = video_register_device(ch->video_dev,
-  VFL_TYPE_GRABBER, (j ? 3 : 2));
+ vdev = ch->video_dev;
+ vdev->queue = q;
+ err = video_register_device(vdev, VFL_TYPE_GRABBER,
+    (j ? 3 : 2));
  if (err < 0)
  goto probe_out;
  }
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 10/49] media: davinci: vpif_display: use v4l2_fh_open and vb2_fop_release

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this patch adds support to use v4l2_fh_open() and vb2_fop_release,
which allows to drop driver specific struct vpif_fh, as this is handeled
by core. This patch also drops vpif_g/s_priority as this handeled
by core.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |  228 +++++--------------------
 drivers/media/platform/davinci/vpif_display.h |   15 --
 2 files changed, 43 insertions(+), 200 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index cea526b..5fc1256 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -645,85 +645,6 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
  }
 }
 
-/*
- * vpif_open: It creates object of file handle structure and stores it in
- * private_data member of filepointer
- */
-static int vpif_open(struct file *filep)
-{
- struct video_device *vdev = video_devdata(filep);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
- struct vpif_fh *fh;
-
- /* Allocate memory for the file handle object */
- fh = kzalloc(sizeof(struct vpif_fh), GFP_KERNEL);
- if (fh == NULL) {
- vpif_err("unable to allocate memory for file handle object\n");
- return -ENOMEM;
- }
-
- if (mutex_lock_interruptible(&common->lock)) {
- kfree(fh);
- return -ERESTARTSYS;
- }
- /* store pointer to fh in private_data member of filep */
- filep->private_data = fh;
- fh->channel = ch;
- fh->initialized = 0;
- if (!ch->initialized) {
- fh->initialized = 1;
- ch->initialized = 1;
- memset(&ch->vpifparams, 0, sizeof(ch->vpifparams));
- }
-
- /* Increment channel usrs counter */
- atomic_inc(&ch->usrs);
- /* Set io_allowed[VPIF_VIDEO_INDEX] member to false */
- fh->io_allowed[VPIF_VIDEO_INDEX] = 0;
- /* Initialize priority of this instance to default priority */
- fh->prio = V4L2_PRIORITY_UNSET;
- v4l2_prio_open(&ch->prio, &fh->prio);
- mutex_unlock(&common->lock);
-
- return 0;
-}
-
-/*
- * vpif_release: This function deletes buffer queue, frees the buffers and
- * the vpif file handle
- */
-static int vpif_release(struct file *filep)
-{
- struct vpif_fh *fh = filep->private_data;
- struct channel_obj *ch = fh->channel;
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
- mutex_lock(&common->lock);
- /* if this instance is doing IO */
- if (fh->io_allowed[VPIF_VIDEO_INDEX]) {
- /* Reset io_usrs member of channel object */
- common->io_usrs = 0;
- common->numbuffers =
-    config_params.numbuffers[ch->channel_id];
- }
-
- /* Decrement channel usrs counter */
- atomic_dec(&ch->usrs);
- /* If this file handle has initialize encoder device, reset it */
- if (fh->initialized)
- ch->initialized = 0;
-
- /* Close the priority */
- v4l2_prio_close(&ch->prio, fh->prio);
- filep->private_data = NULL;
- fh->initialized = 0;
- mutex_unlock(&common->lock);
- kfree(fh);
-
- return 0;
-}
-
 /* functions implementing ioctls */
 /**
  * vpif_querycap() - QUERYCAP handler
@@ -765,8 +686,8 @@ static int vpif_enum_fmt_vid_out(struct file *file, void  *priv,
 static int vpif_g_fmt_vid_out(struct file *file, void *priv,
  struct v4l2_format *fmt)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
  /* Check the validity of the buffer type */
@@ -782,26 +703,12 @@ static int vpif_g_fmt_vid_out(struct file *file, void *priv,
 static int vpif_s_fmt_vid_out(struct file *file, void *priv,
  struct v4l2_format *fmt)
 {
- struct vpif_fh *fh = priv;
- struct v4l2_pix_format *pixfmt;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
+ struct v4l2_pix_format *pixfmt;
  int ret = 0;
 
- if ((VPIF_CHANNEL2_VIDEO == ch->channel_id)
-    || (VPIF_CHANNEL3_VIDEO == ch->channel_id)) {
- if (!fh->initialized) {
- vpif_dbg(1, debug, "Channel Busy\n");
- return -EBUSY;
- }
-
- /* Check for the priority */
- ret = v4l2_prio_check(&ch->prio, fh->prio);
- if (0 != ret)
- return ret;
- fh->initialized = 1;
- }
-
  if (common->started) {
  vpif_dbg(1, debug, "Streaming in progress\n");
  return -EBUSY;
@@ -823,8 +730,8 @@ static int vpif_s_fmt_vid_out(struct file *file, void *priv,
 static int vpif_try_fmt_vid_out(struct file *file, void *priv,
  struct v4l2_format *fmt)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
  struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
  int ret = 0;
@@ -841,22 +748,12 @@ static int vpif_try_fmt_vid_out(struct file *file, void *priv,
 static int vpif_reqbufs(struct file *file, void *priv,
  struct v4l2_requestbuffers *reqbuf)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common;
  enum v4l2_field field;
  u8 index = 0;
 
- /* This file handle has not initialized the channel,
-   It is not allowed to do settings */
- if ((VPIF_CHANNEL2_VIDEO == ch->channel_id)
-    || (VPIF_CHANNEL3_VIDEO == ch->channel_id)) {
- if (!fh->initialized) {
- vpif_err("Channel Busy\n");
- return -EBUSY;
- }
- }
-
  if (V4L2_BUF_TYPE_VIDEO_OUTPUT != reqbuf->type)
  return -EINVAL;
 
@@ -877,8 +774,6 @@ static int vpif_reqbufs(struct file *file, void *priv,
  } else {
  field = V4L2_VBI_INTERLACED;
  }
- /* Set io allowed member of file handle to TRUE */
- fh->io_allowed[index] = 1;
  /* Increment io usrs member of channel object to 1 */
  common->io_usrs = 1;
  /* Store type of memory requested in channel object */
@@ -890,8 +785,8 @@ static int vpif_reqbufs(struct file *file, void *priv,
 static int vpif_querybuf(struct file *file, void *priv,
  struct v4l2_buffer *tbuf)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
  if (common->fmt.type != tbuf->type)
@@ -902,15 +797,13 @@ static int vpif_querybuf(struct file *file, void *priv,
 
 static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
 {
- struct vpif_fh *fh = NULL;
- struct channel_obj *ch = NULL;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common = NULL;
 
  if (!buf || !priv)
  return -EINVAL;
 
- fh = priv;
- ch = fh->channel;
  if (!ch)
  return -EINVAL;
 
@@ -918,18 +811,13 @@ static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
  if (common->fmt.type != buf->type)
  return -EINVAL;
 
- if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
- vpif_err("fh->io_allowed\n");
- return -EACCES;
- }
-
  return vb2_qbuf(&common->buffer_queue, buf);
 }
 
 static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
  int ret = 0;
 
@@ -975,8 +863,8 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 
 static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
 
  *std = ch->video.stdid;
  return 0;
@@ -984,8 +872,8 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
 
 static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
  return vb2_dqbuf(&common->buffer_queue, p,
@@ -995,8 +883,8 @@ static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
 static int vpif_streamon(struct file *file, void *priv,
  enum v4l2_buf_type buftype)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
  struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id];
  int ret = 0;
@@ -1006,11 +894,6 @@ static int vpif_streamon(struct file *file, void *priv,
  return -EINVAL;
  }
 
- if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
- vpif_err("fh->io_allowed\n");
- return -EACCES;
- }
-
  /* If Streaming is already started, return error */
  if (common->started) {
  vpif_err("channel->started\n");
@@ -1043,8 +926,8 @@ static int vpif_streamon(struct file *file, void *priv,
 static int vpif_streamoff(struct file *file, void *priv,
  enum v4l2_buf_type buftype)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
  struct vpif_display_config *vpif_config_data =
  vpif_dev->platform_data;
@@ -1054,11 +937,6 @@ static int vpif_streamoff(struct file *file, void *priv,
  return -EINVAL;
  }
 
- if (!fh->io_allowed[VPIF_VIDEO_INDEX]) {
- vpif_err("fh->io_allowed\n");
- return -EACCES;
- }
-
  if (!common->started) {
  vpif_err("channel->started\n");
  return -EINVAL;
@@ -1090,9 +968,10 @@ static int vpif_streamoff(struct file *file, void *priv,
 static int vpif_cropcap(struct file *file, void *priv,
  struct v4l2_cropcap *crop)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
+
  if (V4L2_BUF_TYPE_VIDEO_OUTPUT != crop->type)
  return -EINVAL;
 
@@ -1109,9 +988,9 @@ static int vpif_enum_output(struct file *file, void *fh,
 {
 
  struct vpif_display_config *config = vpif_dev->platform_data;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct vpif_display_chan_config *chan_cfg;
- struct vpif_fh *vpif_handler = fh;
- struct channel_obj *ch = vpif_handler->channel;
 
  chan_cfg = &config->chan_config[ch->channel_id];
  if (output->index >= chan_cfg->output_count) {
@@ -1205,9 +1084,9 @@ static int vpif_set_output(struct vpif_display_config *vpif_cfg,
 static int vpif_s_output(struct file *file, void *priv, unsigned int i)
 {
  struct vpif_display_config *config = vpif_dev->platform_data;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct vpif_display_chan_config *chan_cfg;
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
  chan_cfg = &config->chan_config[ch->channel_id];
@@ -1225,32 +1104,14 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i)
 
 static int vpif_g_output(struct file *file, void *priv, unsigned int *i)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
 
  *i = ch->output_idx;
 
  return 0;
 }
 
-static int vpif_g_priority(struct file *file, void *priv, enum v4l2_priority *p)
-{
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
-
- *p = v4l2_prio_max(&ch->prio);
-
- return 0;
-}
-
-static int vpif_s_priority(struct file *file, void *priv, enum v4l2_priority p)
-{
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
-
- return v4l2_prio_change(&ch->prio, &fh->prio, p);
-}
-
 /**
  * vpif_enum_dv_timings() - ENUM_DV_TIMINGS handler
  * @file: file ptr
@@ -1261,8 +1122,8 @@ static int
 vpif_enum_dv_timings(struct file *file, void *priv,
      struct v4l2_enum_dv_timings *timings)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  int ret;
 
  ret = v4l2_subdev_call(ch->sd, video, enum_dv_timings, timings);
@@ -1280,8 +1141,8 @@ vpif_enum_dv_timings(struct file *file, void *priv,
 static int vpif_s_dv_timings(struct file *file, void *priv,
  struct v4l2_dv_timings *timings)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct vpif_params *vpifparams = &ch->vpifparams;
  struct vpif_channel_config_params *std_info = &vpifparams->std_info;
  struct video_obj *vid_ch = &ch->video;
@@ -1369,8 +1230,8 @@ static int vpif_s_dv_timings(struct file *file, void *priv,
 static int vpif_g_dv_timings(struct file *file, void *priv,
  struct v4l2_dv_timings *timings)
 {
- struct vpif_fh *fh = priv;
- struct channel_obj *ch = fh->channel;
+ struct video_device *vdev = video_devdata(file);
+ struct channel_obj *ch = video_get_drvdata(vdev);
  struct video_obj *vid_ch = &ch->video;
 
  *timings = vid_ch->dv_timings;
@@ -1396,8 +1257,6 @@ static int vpif_log_status(struct file *filep, void *priv)
 /* vpif display ioctl operations */
 static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
  .vidioc_querycap         = vpif_querycap,
- .vidioc_g_priority = vpif_g_priority,
- .vidioc_s_priority = vpif_s_priority,
  .vidioc_enum_fmt_vid_out = vpif_enum_fmt_vid_out,
  .vidioc_g_fmt_vid_out   = vpif_g_fmt_vid_out,
  .vidioc_s_fmt_vid_out   = vpif_s_fmt_vid_out,
@@ -1422,8 +1281,8 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
 
 static const struct v4l2_file_operations vpif_fops = {
  .owner = THIS_MODULE,
- .open = vpif_open,
- .release = vpif_release,
+ .open = v4l2_fh_open,
+ .release = vb2_fop_release,
  .unlocked_ioctl = video_ioctl2,
  .mmap = vb2_fop_mmap,
  .poll = vb2_fop_poll
@@ -1556,12 +1415,8 @@ static int vpif_probe_complete(void)
 
  memset(&ch->vpifparams, 0, sizeof(ch->vpifparams));
 
- /* Initialize prio member of channel object */
- v4l2_prio_init(&ch->prio);
  ch->common[VPIF_VIDEO_INDEX].fmt.type =
  V4L2_BUF_TYPE_VIDEO_OUTPUT;
- ch->video_dev->lock = &common->lock;
- video_set_drvdata(ch->video_dev, ch);
 
  /* select output 0 */
  err = vpif_set_output(vpif_obj.config, ch, 0);
@@ -1601,6 +1456,9 @@ static int vpif_probe_complete(void)
 
  vdev = ch->video_dev;
  vdev->queue = q;
+ vdev->lock = &common->lock;
+ set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
+ video_set_drvdata(ch->video_dev, ch);
  err = video_register_device(vdev, VFL_TYPE_GRABBER,
     (j ? 3 : 2));
  if (err < 0)
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 4d0485b..18c7bd5 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -113,8 +113,6 @@ struct channel_obj {
  /* V4l2 specific parameters */
  struct video_device *video_dev; /* Identifies video device for
  * this channel */
- struct v4l2_prio_state prio; /* Used to keep track of state of
- * the priority */
  atomic_t usrs; /* number of open instances of
  * the channel */
  u32 field_id; /* Indicates id of the field
@@ -130,19 +128,6 @@ struct channel_obj {
  struct video_obj video;
 };
 
-/* File handle structure */
-struct vpif_fh {
- struct channel_obj *channel; /* pointer to channel object for
- * opened device */
- u8 io_allowed[VPIF_NUMOBJECTS]; /* Indicates whether this file handle
- * is doing IO */
- enum v4l2_priority prio; /* Used to keep track priority of
- * this instance */
- u8 initialized; /* Used to keep track of whether this
- * file handle has initialized
- * channel or not */
-};
-
 /* vpif device structure */
 struct vpif_device {
  struct v4l2_device v4l2_dev;
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 11/49] media: davinci: vpif_display: use vb2_ioctl_* helpers

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |  180 ++-----------------------
 1 file changed, 10 insertions(+), 170 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 5fc1256..8bd3794 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -745,75 +745,6 @@ static int vpif_try_fmt_vid_out(struct file *file, void *priv,
  return ret;
 }
 
-static int vpif_reqbufs(struct file *file, void *priv,
- struct v4l2_requestbuffers *reqbuf)
-{
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common;
- enum v4l2_field field;
- u8 index = 0;
-
- if (V4L2_BUF_TYPE_VIDEO_OUTPUT != reqbuf->type)
- return -EINVAL;
-
- index = VPIF_VIDEO_INDEX;
-
- common = &ch->common[index];
-
- if (common->fmt.type != reqbuf->type || !vpif_dev)
- return -EINVAL;
- if (0 != common->io_usrs)
- return -EBUSY;
-
- if (reqbuf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
- if (common->fmt.fmt.pix.field == V4L2_FIELD_ANY)
- field = V4L2_FIELD_INTERLACED;
- else
- field = common->fmt.fmt.pix.field;
- } else {
- field = V4L2_VBI_INTERLACED;
- }
- /* Increment io usrs member of channel object to 1 */
- common->io_usrs = 1;
- /* Store type of memory requested in channel object */
- common->memory = reqbuf->memory;
- /* Allocate buffers */
- return vb2_reqbufs(&common->buffer_queue, reqbuf);
-}
-
-static int vpif_querybuf(struct file *file, void *priv,
- struct v4l2_buffer *tbuf)
-{
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
- if (common->fmt.type != tbuf->type)
- return -EINVAL;
-
- return vb2_querybuf(&common->buffer_queue, tbuf);
-}
-
-static int vpif_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
-{
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = NULL;
-
- if (!buf || !priv)
- return -EINVAL;
-
- if (!ch)
- return -EINVAL;
-
- common = &(ch->common[VPIF_VIDEO_INDEX]);
- if (common->fmt.type != buf->type)
- return -EINVAL;
-
- return vb2_qbuf(&common->buffer_queue, buf);
-}
-
 static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
 {
  struct video_device *vdev = video_devdata(file);
@@ -870,101 +801,6 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std)
  return 0;
 }
 
-static int vpif_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
-{
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-
- return vb2_dqbuf(&common->buffer_queue, p,
- (file->f_flags & O_NONBLOCK));
-}
-
-static int vpif_streamon(struct file *file, void *priv,
- enum v4l2_buf_type buftype)
-{
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
- struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id];
- int ret = 0;
-
- if (buftype != V4L2_BUF_TYPE_VIDEO_OUTPUT) {
- vpif_err("buffer type not supported\n");
- return -EINVAL;
- }
-
- /* If Streaming is already started, return error */
- if (common->started) {
- vpif_err("channel->started\n");
- return -EBUSY;
- }
-
- if ((ch->channel_id == VPIF_CHANNEL2_VIDEO
- && oth_ch->common[VPIF_VIDEO_INDEX].started &&
- ch->vpifparams.std_info.ycmux_mode == 0)
- || ((ch->channel_id == VPIF_CHANNEL3_VIDEO)
- && (2 == oth_ch->common[VPIF_VIDEO_INDEX].started))) {
- vpif_err("other channel is using\n");
- return -EBUSY;
- }
-
- ret = vpif_check_format(ch, &common->fmt.fmt.pix);
- if (ret < 0)
- return ret;
-
- /* Call vb2_streamon to start streaming in videobuf2 */
- ret = vb2_streamon(&common->buffer_queue, buftype);
- if (ret < 0) {
- vpif_err("vb2_streamon\n");
- return ret;
- }
-
- return ret;
-}
-
-static int vpif_streamoff(struct file *file, void *priv,
- enum v4l2_buf_type buftype)
-{
- struct video_device *vdev = video_devdata(file);
- struct channel_obj *ch = video_get_drvdata(vdev);
- struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
- struct vpif_display_config *vpif_config_data =
- vpif_dev->platform_data;
-
- if (buftype != V4L2_BUF_TYPE_VIDEO_OUTPUT) {
- vpif_err("buffer type not supported\n");
- return -EINVAL;
- }
-
- if (!common->started) {
- vpif_err("channel->started\n");
- return -EINVAL;
- }
-
- if (buftype == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
- /* disable channel */
- if (VPIF_CHANNEL2_VIDEO == ch->channel_id) {
- if (vpif_config_data->
- chan_config[VPIF_CHANNEL2_VIDEO].clip_en)
- channel2_clipping_enable(0);
- enable_channel2(0);
- channel2_intr_enable(0);
- }
- if ((VPIF_CHANNEL3_VIDEO == ch->channel_id) ||
- (2 == common->started)) {
- if (vpif_config_data->
- chan_config[VPIF_CHANNEL3_VIDEO].clip_en)
- channel3_clipping_enable(0);
- enable_channel3(0);
- channel3_intr_enable(0);
- }
- }
-
- common->started = 0;
- return vb2_streamoff(&common->buffer_queue, buftype);
-}
-
 static int vpif_cropcap(struct file *file, void *priv,
  struct v4l2_cropcap *crop)
 {
@@ -1261,12 +1097,16 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
  .vidioc_g_fmt_vid_out   = vpif_g_fmt_vid_out,
  .vidioc_s_fmt_vid_out   = vpif_s_fmt_vid_out,
  .vidioc_try_fmt_vid_out = vpif_try_fmt_vid_out,
- .vidioc_reqbufs         = vpif_reqbufs,
- .vidioc_querybuf         = vpif_querybuf,
- .vidioc_qbuf             = vpif_qbuf,
- .vidioc_dqbuf           = vpif_dqbuf,
- .vidioc_streamon         = vpif_streamon,
- .vidioc_streamoff       = vpif_streamoff,
+
+ .vidioc_reqbufs = vb2_ioctl_reqbufs,
+ .vidioc_create_bufs = vb2_ioctl_create_bufs,
+ .vidioc_querybuf = vb2_ioctl_querybuf,
+ .vidioc_qbuf = vb2_ioctl_qbuf,
+ .vidioc_dqbuf = vb2_ioctl_dqbuf,
+ .vidioc_expbuf = vb2_ioctl_expbuf,
+ .vidioc_streamon = vb2_ioctl_streamon,
+ .vidioc_streamoff = vb2_ioctl_streamoff,
+
  .vidioc_s_std           = vpif_s_std,
  .vidioc_g_std = vpif_g_std,
  .vidioc_enum_output = vpif_enum_output,
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 12/49] media: davinci: vpif_display: drop unused member fbuffers

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.h |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 18c7bd5..b22bb33 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -67,9 +67,6 @@ struct vpif_disp_buffer {
 };
 
 struct common_obj {
- /* Buffer specific parameters */
- u8 *fbuffers[VIDEO_MAX_FRAME]; /* List of buffer pointers for
- * storing frames */
  u32 numbuffers; /* number of buffers */
  struct vpif_disp_buffer *cur_frm; /* Pointer pointing to current
  * vb2_buffer */
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 13/49] media: davinci: vpif_display: drop reserving memory for device

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this patch drops reserving contigiuos memory for the device,
as now with CMA support there is no need of this.
This patch also prepares to removal of config_params.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 8bd3794..bfe1e50 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1338,7 +1338,6 @@ static __init int vpif_probe(struct platform_device *pdev)
  struct video_device *vfd;
  struct resource *res;
  int subdev_count;
- size_t size;
 
  vpif_dev = &pdev->dev;
  err = initialize_vpif();
@@ -1395,23 +1394,6 @@ static __init int vpif_probe(struct platform_device *pdev)
  ch->video_dev = vfd;
  }
 
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res) {
- size = resource_size(res);
- /* The resources are divided into two equal memory and when
- * we have HD output we can add them together
- */
- for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
- ch = vpif_obj.dev[j];
- ch->channel_id = j;
-
- /* only enabled if second resource exists */
- config_params.video_limit[ch->channel_id] = 0;
- if (size)
- config_params.video_limit[ch->channel_id] =
- size/2;
- }
- }
  vpif_obj.config = pdev->dev.platform_data;
  subdev_count = vpif_obj.config->subdev_count;
  subdevdata = vpif_obj.config->subdevinfo;
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 14/49] media: davinci: vpif_display: drop unnecessary field memory

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |    5 -----
 drivers/media/platform/davinci/vpif_display.h |    3 ---
 2 files changed, 8 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index bfe1e50..ab097ce 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -572,11 +572,6 @@ static void vpif_config_format(struct channel_obj *ch)
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
  common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
- if (config_params.numbuffers[ch->channel_id] == 0)
- common->memory = V4L2_MEMORY_USERPTR;
- else
- common->memory = V4L2_MEMORY_MMAP;
-
  common->fmt.fmt.pix.sizeimage =
  config_params.channel_bufsize[ch->channel_id];
  common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index b22bb33..06b8d24 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -72,9 +72,6 @@ struct common_obj {
  * vb2_buffer */
  struct vpif_disp_buffer *next_frm; /* Pointer pointing to next
  * vb2_buffer */
- enum v4l2_memory memory; /* This field keeps track of
- * type of buffer exchange
- * method user has selected */
  struct v4l2_format fmt; /* Used to store the format */
  struct vb2_queue buffer_queue; /* Buffer queue used in
  * video-buf */
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 15/49] media: davinci: vpif_display: drop numbuffers field from common_obj

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this patch drops numbuffers member from struct common_obj
as this was not required.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |    8 --------
 drivers/media/platform/davinci/vpif_display.h |    1 -
 2 files changed, 9 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index ab097ce..5ea2db8 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1221,13 +1221,11 @@ static int vpif_probe_complete(void)
  /* Initialize field of the channel objects */
  atomic_set(&ch->usrs, 0);
  for (k = 0; k < VPIF_NUMOBJECTS; k++) {
- ch->common[k].numbuffers = 0;
  common = &ch->common[k];
  common->io_usrs = 0;
  common->started = 0;
  spin_lock_init(&common->irqlock);
  mutex_init(&common->lock);
- common->numbuffers = 0;
  common->set_addr = NULL;
  common->ytop_off = 0;
  common->ybtm_off = 0;
@@ -1236,17 +1234,11 @@ static int vpif_probe_complete(void)
  common->cur_frm = NULL;
  common->next_frm = NULL;
  memset(&common->fmt, 0, sizeof(common->fmt));
- common->numbuffers = config_params.numbuffers[k];
  }
  ch->initialized = 0;
  if (vpif_obj.config->subdev_count)
  ch->sd = vpif_obj.sd[0];
  ch->channel_id = j;
- if (j < 2)
- ch->common[VPIF_VIDEO_INDEX].numbuffers =
-    config_params.numbuffers[ch->channel_id];
- else
- ch->common[VPIF_VIDEO_INDEX].numbuffers = 0;
 
  memset(&ch->vpifparams, 0, sizeof(ch->vpifparams));
 
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 06b8d24..e21a343 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -67,7 +67,6 @@ struct vpif_disp_buffer {
 };
 
 struct common_obj {
- u32 numbuffers; /* number of buffers */
  struct vpif_disp_buffer *cur_frm; /* Pointer pointing to current
  * vb2_buffer */
  struct vpif_disp_buffer *next_frm; /* Pointer pointing to next
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 16/49] media: davinic: vpif_display: drop started member from struct common_obj

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

the started member was indicating whether streaming was started
or not, this can be determined by vb2 offering, this patch replaces
the started member from struct common_obj with appropriate vb2 calls.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   42 ++++++++++---------------
 drivers/media/platform/davinci/vpif_display.h |    2 --
 2 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 5ea2db8..aa487a6 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -62,6 +62,10 @@ static struct vpif_config_params config_params = {
  .channel_bufsize[1] = 720 * 576 * 2,
 };
 
+
+/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
+static int ycmux_mode;
+
 static u8 channel_first_int[VPIF_NUMOBJECTS][2] = { {1, 1} };
 
 static struct vpif_device vpif_obj = { {NULL} };
@@ -185,9 +189,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 
  spin_lock_irqsave(&common->irqlock, flags);
 
- /* Initialize field_id and started member */
+ /* Initialize field_id */
  ch->field_id = 0;
- common->started = 1;
 
  /* clock settings */
  if (vpif_config_data->set_clock) {
@@ -204,7 +207,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
  if (ret < 0)
  goto err;
 
- common->started = ret;
+ ycmux_mode = ret;
  vpif_config_addr(ch, ret);
  /* Get the next frame from the buffer queue */
  common->next_frm = common->cur_frm =
@@ -235,8 +238,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
  channel2_clipping_enable(1);
  }
 
- if (VPIF_CHANNEL3_VIDEO == ch->channel_id ||
- common->started == 2) {
+ if (VPIF_CHANNEL3_VIDEO == ch->channel_id || ycmux_mode == 2) {
  channel3_intr_assert();
  channel3_intr_enable(1);
  enable_channel3(1);
@@ -275,12 +277,10 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
  enable_channel2(0);
  channel2_intr_enable(0);
  }
- if (VPIF_CHANNEL3_VIDEO == ch->channel_id ||
- 2 == common->started) {
+ if (VPIF_CHANNEL3_VIDEO == ch->channel_id || ycmux_mode == 2) {
  enable_channel3(0);
  channel3_intr_enable(0);
  }
- common->started = 0;
 
  /* release all active buffers */
  spin_lock_irqsave(&common->irqlock, flags);
@@ -392,8 +392,6 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
  for (i = 0; i < VPIF_NUMOBJECTS; i++) {
  common = &ch->common[i];
  /* If streaming is started in this channel */
- if (0 == common->started)
- continue;
 
  if (1 == ch->vpifparams.std_info.frm_fmt) {
  spin_lock(&common->irqlock);
@@ -704,10 +702,8 @@ static int vpif_s_fmt_vid_out(struct file *file, void *priv,
  struct v4l2_pix_format *pixfmt;
  int ret = 0;
 
- if (common->started) {
- vpif_dbg(1, debug, "Streaming in progress\n");
+ if (vb2_is_busy(&common->buffer_queue))
  return -EBUSY;
- }
 
  pixfmt = &fmt->fmt.pix;
  /* Check for valid field format */
@@ -747,13 +743,12 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
  int ret = 0;
 
+ if (vb2_is_busy(&common->buffer_queue))
+ return -EBUSY;
+
  if (!(std_id & VPIF_V4L2_STD))
  return -EINVAL;
 
- if (common->started) {
- vpif_err("streaming in progress\n");
- return -EBUSY;
- }
 
  /* Call encoder subdevice function to set the standard */
  ch->video.stdid = std_id;
@@ -920,16 +915,14 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i)
  struct vpif_display_chan_config *chan_cfg;
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
+ if (vb2_is_busy(&common->buffer_queue))
+ return -EBUSY;
+
  chan_cfg = &config->chan_config[ch->channel_id];
 
  if (i >= chan_cfg->output_count)
  return -EINVAL;
 
- if (common->started) {
- vpif_err("Streaming in progress\n");
- return -EBUSY;
- }
-
  return vpif_set_output(config, ch, i);
 }
 
@@ -1223,7 +1216,6 @@ static int vpif_probe_complete(void)
  for (k = 0; k < VPIF_NUMOBJECTS; k++) {
  common = &ch->common[k];
  common->io_usrs = 0;
- common->started = 0;
  spin_lock_init(&common->irqlock);
  mutex_init(&common->lock);
  common->set_addr = NULL;
@@ -1488,7 +1480,7 @@ static int vpif_suspend(struct device *dev)
  channel2_intr_enable(0);
  }
  if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
- common->started == 2) {
+ ycmux_mode == 2) {
  enable_channel3(0);
  channel3_intr_enable(0);
  }
@@ -1518,7 +1510,7 @@ static int vpif_resume(struct device *dev)
  channel2_intr_enable(1);
  }
  if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
- common->started == 2) {
+ ycmux_mode == 2) {
  enable_channel3(1);
  channel3_intr_enable(1);
  }
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index e21a343..029e0c5 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -85,8 +85,6 @@ struct common_obj {
  * structure */
  u32 io_usrs; /* number of users performing
  * IO */
- u8 started; /* Indicates whether streaming
- * started */
  u32 ytop_off; /* offset of Y top from the
  * starting of the buffer */
  u32 ybtm_off; /* offset of Y bottom from the
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 17/49] media: davinci: vpif_display: initialize the video device in single place

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this patch moves the initalization of video device to a
single place and uses macro to define the driver name and
use it appropraitely in required places.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   29 ++++++++++---------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index aa487a6..1e0a162 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -62,6 +62,7 @@ static struct vpif_config_params config_params = {
  .channel_bufsize[1] = 720 * 576 * 2,
 };
 
+#define VPIF_DRIVER_NAME "vpif_display"
 
 /* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
 static int ycmux_mode;
@@ -652,7 +653,7 @@ static int vpif_querycap(struct file *file, void  *priv,
 
  cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
  cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
- snprintf(cap->driver, sizeof(cap->driver), "%s", dev_name(vpif_dev));
+ strlcpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver));
  snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
  dev_name(vpif_dev));
  strlcpy(cap->card, config->card_name, sizeof(cap->card));
@@ -1116,12 +1117,6 @@ static const struct v4l2_file_operations vpif_fops = {
  .poll = vb2_fop_poll
 };
 
-static struct video_device vpif_video_template = {
- .name = "vpif",
- .fops = &vpif_fops,
- .ioctl_ops = &vpif_ioctl_ops,
-};
-
 /*Configure the channels, buffer sizei, request irq */
 static int initialize_vpif(void)
 {
@@ -1273,7 +1268,14 @@ static int vpif_probe_complete(void)
  vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n",
  (int)ch, (int)&ch->video_dev);
 
+ /* Initialize the video_device structure */
  vdev = ch->video_dev;
+ strlcpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name));
+ vdev->release = video_device_release;
+ vdev->fops = &vpif_fops;
+ vdev->ioctl_ops = &vpif_ioctl_ops;
+ vdev->v4l2_dev = &vpif_obj.v4l2_dev;
+ vdev->vfl_dir = VFL_DIR_TX;
  vdev->queue = q;
  vdev->lock = &common->lock;
  set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
@@ -1334,7 +1336,7 @@ static __init int vpif_probe(struct platform_device *pdev)
 
  while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) {
  err = devm_request_irq(&pdev->dev, res->start, vpif_channel_isr,
- IRQF_SHARED, "VPIF_Display",
+ IRQF_SHARED, VPIF_DRIVER_NAME,
  (void *)(&vpif_obj.dev[res_idx]->
  channel_id));
  if (err) {
@@ -1360,15 +1362,6 @@ static __init int vpif_probe(struct platform_device *pdev)
  goto vpif_unregister;
  }
 
- /* Initialize field of video device */
- *vfd = vpif_video_template;
- vfd->v4l2_dev = &vpif_obj.v4l2_dev;
- vfd->release = video_device_release;
- vfd->vfl_dir = VFL_DIR_TX;
- snprintf(vfd->name, sizeof(vfd->name),
- "VPIF_Display_DRIVER_V%s",
- VPIF_DISPLAY_VERSION);
-
  /* Set video_dev to the video device */
  ch->video_dev = vfd;
  }
@@ -1533,7 +1526,7 @@ static const struct dev_pm_ops vpif_pm = {
 
 static __refdata struct platform_driver vpif_driver = {
  .driver = {
- .name = "vpif_display",
+ .name = VPIF_DRIVER_NAME,
  .owner = THIS_MODULE,
  .pm = vpif_pm_ops,
  },
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH v5 18/49] media: davinci: vpif_display: drop unneeded module params

Lad, Prabhakar
In reply to this post by Lad, Prabhakar
From: "Lad, Prabhakar" <[hidden email]>

this pacth drops unneeded module params and vpif_config_params.

Signed-off-by: Lad, Prabhakar <[hidden email]>
---
 drivers/media/platform/davinci/vpif_display.c |   69 +------------------------
 drivers/media/platform/davinci/vpif_display.h |    8 ---
 2 files changed, 1 insertion(+), 76 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 1e0a162..fef03be 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -35,32 +35,10 @@ MODULE_VERSION(VPIF_DISPLAY_VERSION);
  v4l2_dbg(level, debug, &vpif_obj.v4l2_dev, fmt, ## arg)
 
 static int debug = 1;
-static u32 ch2_numbuffers = 3;
-static u32 ch3_numbuffers = 3;
-static u32 ch2_bufsize = 1920 * 1080 * 2;
-static u32 ch3_bufsize = 720 * 576 * 2;
 
 module_param(debug, int, 0644);
-module_param(ch2_numbuffers, uint, S_IRUGO);
-module_param(ch3_numbuffers, uint, S_IRUGO);
-module_param(ch2_bufsize, uint, S_IRUGO);
-module_param(ch3_bufsize, uint, S_IRUGO);
 
 MODULE_PARM_DESC(debug, "Debug level 0-1");
-MODULE_PARM_DESC(ch2_numbuffers, "Channel2 buffer count (default:3)");
-MODULE_PARM_DESC(ch3_numbuffers, "Channel3 buffer count (default:3)");
-MODULE_PARM_DESC(ch2_bufsize, "Channel2 buffer size (default:1920 x 1080 x 2)");
-MODULE_PARM_DESC(ch3_bufsize, "Channel3 buffer size (default:720 x 576 x 2)");
-
-static struct vpif_config_params config_params = {
- .min_numbuffers = 3,
- .numbuffers[0] = 3,
- .numbuffers[1] = 3,
- .min_bufsize[0] = 720 * 480 * 2,
- .min_bufsize[1] = 720 * 480 * 2,
- .channel_bufsize[0] = 1920 * 1080 * 2,
- .channel_bufsize[1] = 720 * 576 * 2,
-};
 
 #define VPIF_DRIVER_NAME "vpif_display"
 
@@ -571,8 +549,6 @@ static void vpif_config_format(struct channel_obj *ch)
  struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
 
  common->fmt.fmt.pix.field = V4L2_FIELD_ANY;
- common->fmt.fmt.pix.sizeimage =
- config_params.channel_bufsize[ch->channel_id];
  common->fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV422P;
  common->fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
 }
@@ -758,13 +734,6 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
  if (vpif_update_resolution(ch))
  return -EINVAL;
 
- if ((ch->vpifparams.std_info.width *
- ch->vpifparams.std_info.height * 2) >
- config_params.channel_bufsize[ch->channel_id]) {
- vpif_err("invalid std for this size\n");
- return -EINVAL;
- }
-
  common->fmt.fmt.pix.bytesperline = common->fmt.fmt.pix.width;
  /* Configure the default format information */
  vpif_config_format(ch);
@@ -1121,39 +1090,7 @@ static const struct v4l2_file_operations vpif_fops = {
 static int initialize_vpif(void)
 {
  int free_channel_objects_index;
- int free_buffer_channel_index;
- int free_buffer_index;
- int err = 0, i, j;
-
- /* Default number of buffers should be 3 */
- if ((ch2_numbuffers > 0) &&
-    (ch2_numbuffers < config_params.min_numbuffers))
- ch2_numbuffers = config_params.min_numbuffers;
- if ((ch3_numbuffers > 0) &&
-    (ch3_numbuffers < config_params.min_numbuffers))
- ch3_numbuffers = config_params.min_numbuffers;
-
- /* Set buffer size to min buffers size if invalid buffer size is
- * given */
- if (ch2_bufsize < config_params.min_bufsize[VPIF_CHANNEL2_VIDEO])
- ch2_bufsize =
-    config_params.min_bufsize[VPIF_CHANNEL2_VIDEO];
- if (ch3_bufsize < config_params.min_bufsize[VPIF_CHANNEL3_VIDEO])
- ch3_bufsize =
-    config_params.min_bufsize[VPIF_CHANNEL3_VIDEO];
-
- config_params.numbuffers[VPIF_CHANNEL2_VIDEO] = ch2_numbuffers;
-
- if (ch2_numbuffers) {
- config_params.channel_bufsize[VPIF_CHANNEL2_VIDEO] =
- ch2_bufsize;
- }
- config_params.numbuffers[VPIF_CHANNEL3_VIDEO] = ch3_numbuffers;
-
- if (ch3_numbuffers) {
- config_params.channel_bufsize[VPIF_CHANNEL3_VIDEO] =
- ch3_bufsize;
- }
+ int err, i, j;
 
  /* Allocate memory for six channel objects */
  for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
@@ -1167,10 +1104,6 @@ static int initialize_vpif(void)
  }
  }
 
- free_channel_objects_index = VPIF_DISPLAY_MAX_DEVICES;
- free_buffer_channel_index = VPIF_DISPLAY_NUM_CHANNELS;
- free_buffer_index = config_params.numbuffers[i - 1];
-
  return 0;
 
 vpif_init_free_channel_objects:
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 029e0c5..089e860 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -128,12 +128,4 @@ struct vpif_device {
  struct vpif_display_config *config;
 };
 
-struct vpif_config_params {
- u32 min_bufsize[VPIF_DISPLAY_NUM_CHANNELS];
- u32 channel_bufsize[VPIF_DISPLAY_NUM_CHANNELS];
- u8 numbuffers[VPIF_DISPLAY_NUM_CHANNELS];
- u32 video_limit[VPIF_DISPLAY_NUM_CHANNELS];
- u8 min_numbuffers;
-};
-
 #endif /* DAVINCIHD_DISPLAY_H */
--
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
[hidden email]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
123
Loading...