NVENC fails to encode with nv_enc_err_out_of_memory since driver V372.90

We are experiencing very weird behavior when encoding with NVENC on Windows 10 64bit.The GPU tested :GeForce GTX970 and GeForce GTX960M .
The problem happens on both.
When NvEncEncodePicture() being called it returns the error nv_enc_err_out_of_memory
Initially we used NVENC V5. Then we assumed that the new driver requires the latest NVENC version.
We upgraded to V7.0.But it didn’t solve the problem
To narrow the problem we ran the sample projects that accompany the SDK.The tests WORK ok.
The difference between our application and NVENC samples is that we use OpenGL texture buffer object as the data source which we register using nvEncRegisterResource().We triple checked everything.Sizes ,formats ,strides.All is 100%.We believe this is some sort of driver bug.Once we roll back to the driver V368.0 the encoder works again.

Can you please retest with the latest driver and let us know if the problem persists?
If the problem is still present in the latest driver and it is working in an older driver please provide as many details as you can with regards to driver version, hardware configuration and API version so we can reproduce the issue.