Re: [RFC PATCH v6 6/9] media: tegra: Add Tegra210 Video input driver

From: Dmitry Osipenko
Date: Mon Apr 06 2020 - 12:05:38 EST


06.04.2020 18:35, Sowjanya Komatineni ÐÐÑÐÑ:
...
>>> +ÂÂÂÂ /* wait for syncpt counter to reach frame start event threshold */
>>> +ÂÂÂÂ err = host1x_syncpt_wait(chan->frame_start_sp, thresh,
>>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ TEGRA_VI_SYNCPT_WAIT_TIMEOUT, &value);
>>> +ÂÂÂÂ if (err) {
>>> +ÂÂÂÂÂÂÂÂÂÂÂÂ dev_err(&chan->video.dev,
>>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ "frame start syncpt timeout: %d\n", err);
>>> +ÂÂÂÂÂÂÂÂÂÂÂÂ /* increment syncpoint counter for timedout events */
>>> +ÂÂÂÂÂÂÂÂÂÂÂÂ host1x_syncpt_incr(chan->frame_start_sp);
>> Why incrementing is done while hardware is still active?
>>
>> The sync point's state needs to be completely reset after resetting
>> hardware. But I don't think that the current upstream host1x driver
>> supports doing that, it's one of the known-long-standing problems of the
>> host1x driver.
>>
>> At least the sp->max_val incrementing should be done based on the actual
>> syncpoint value and this should be done after resetting hardware.
>
> upstream host1x driver don't have API to reset or to equalize max value
> with min/load value.
>
> So to synchronize missed event, incrementing HW syncpt counter.
>
> This should not impact as we increment this in case of missed events only.

It's wrong to touch sync point while hardware is active and it's active
until being reset.

You should re-check the timeout after hw resetting and manually put the
syncpoint counter back into sync only if needed.