Fix minigbm against older kernel DRM versions.

In 4.4, the DRM implementation only allowed DRM_CLOEXEC to be specified to
drmPrimeHandleToFD(), but it gave you a read/write mapping when mmap'ed.

In newer kernels the DRM_RDWR flag needs to be specified to get a
read/write mapping.

Try the new way, and if that fails, try the old way. If the handle
conversion fails for any reason other than this flag check, it'll
still fail.

Change-Id: I7fabb6a0d23e7b9b70f970aad0bc243a76583e33
Reviewed-on: https://chromium-review.googlesource.com/971461
Commit-Ready: Alistair Strachan <astrachan@google.com>
Tested-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
1 file changed