CUDA hw acceleration works for x264 but x265/HEVC gives me "no CUDA-capable device is detected"

I’m building FFMPEG from the latest GitHub master and all seems to be working well. CUDA hardware acceleration is detected and added.
./ffmpeg -decoders | grep cuvid
yields

ffmpeg version N-81991-gea86303 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.2) 20160609
  configuration: --prefix=/home/torstein/mpv-build/build_libs --enable-static --disable-shared --enable-gpl --disable-debug --disable-doc --enable-vdpau --enable-libass --enable-nonfree --enable-cuda --enable-cuvid --enable-nvenc --enable-gnutls
  libavutil      55. 32.101 / 55. 32.101
  libavcodec     57. 61.103 / 57. 61.103
  libavformat    57. 52.100 / 57. 52.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 63.100 /  6. 63.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  2.100 /  2.  2.100
  libpostproc    54.  0.100 / 54.  0.100
 V..... h263_cuvid           Nvidia CUVID H263 decoder (codec h263)
 V..... h264_cuvid           Nvidia CUVID H264 decoder (codec h264)
 V..... hevc_cuvid           Nvidia CUVID HEVC decoder (codec hevc)
 V..... mjpeg_cuvid          Nvidia CUVID MJPEG decoder (codec mjpeg)
 V..... mpeg1_cuvid          Nvidia CUVID MPEG1VIDEO decoder (codec mpeg1video)
 V..... mpeg2_cuvid          Nvidia CUVID MPEG2VIDEO decoder (codec mpeg2video)
 V..... mpeg4_cuvid          Nvidia CUVID MPEG4 decoder (codec mpeg4)
 V..... vc1_cuvid            Nvidia CUVID VC1 decoder (codec vc1)
 V..... vp8_cuvid            Nvidia CUVID VP8 decoder (codec vp8)
 V..... vp9_cuvid            Nvidia CUVID VP9 decoder (codec vp9)

and
./ffmpeg -hwaccels
yields

Hardware acceleration methods:
vdpau
vaapi
cuvid

Running the CUDA samples from ‘/usr/local/cuda/samples’ works as well:

sudo make && ./1_Utilities/deviceQuery/deviceQuery

Result = PASS

For the mpv video player I use

mpv --no-config --vo=opengl --hwdec=cuda myfile.mkv

Playing x264 files using CUDA hwaccel works fine:
http://pastebin.com/VKdHuigS

But when I try x265/HEVC files I get the error:

[ffmpeg/video] hevc_cuvid: ctx->cvdl->cuvidCreateDecoder(&cudec, &cuinfo) failed -> CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
[vd] Could not open codec.

HEVC play log: http://pastebin.com/VKdHuigS

FFMpeg config.log: http://pastebin.com/ent6DNHg

System information:
GTX 770
Driver: 370.28-1
Cuda: 8.0.44-1
Other packages: http://pastebin.com/34zsDJPQ
Linux Mint 18 x64 Cinnamon

Please tell me if you need any other information.

This may sound stupid, but did you reboot after you installed the CUDA driver?

Yes I have

The 770 doesn’t support hevc.

Doesn’t matter, since we’re talking about HW accel through CUDA. HEVC accel is supported and does work on Windows through CUDA on the 770.

No, it does matter and you are missing a few details.

The GTX 770 does NOT support H.265/HEVC. See here if you are having a hard time believing it: https://developer.nvidia.com/nvidia-video-codec-sdk

Anything before the Maxwell GM20x series does not have hardware support for it.

CUDA is the compute architecture and gets used for a lot of things, including image and video processing. This is however not the same as the recent addition of hardware decoding and encoding on the GPUs.

One can in fact use the newer cards such as the 9xx and 10xx series to encode videos and to run CUDA applications in parallel independently. Furthermore do some applications use CUDA together with the hardware decoder/encoder, i.e. for colour space conversions and video resizing during transcoding. It can go as far as playing 3D video games with physics run in CUDA and streaming live with hardware encoding, all done in parallel and on the graphics card.

FFmpeg supports hardware decoding with the cuvid codecs (i.e. “h264_cuvid” & “hevc_cuvid”) and hardware encoding with the nvenc codecs (i.e. “h264_nvenc” and “hevc_cuvid”). It can also use CUDA to scale videos with a filter (i.e. “scale_npp”).

However, the GTX 770 has no support for H.265/HEVC but only H.264/AVC and can therefore NOT use “hevc_cuvid”.