After commit
3b24cd911ebf ("drm_hwcomposer: Ensure composer has
master access to DRM/KMS") was merged I started seeing failures
on 5.4 based kernels.
Diggin into it, it seemed on those kernels drmSetMaster() was
always returning -EACCES, due to the following upstream kernel
change not being present:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=
45bc3d26c95a8fc63a7d8668ca9e57ef0883351c
That change landed around 5.6, so for older kernels we need to
make sure older kernels without this patch still work. So this
patch, as suggested by Roman Stratiienko, reworks the logic
so we call drmSetMaster() and then check drmIsMaster(), rather
then failing due to the return value.
With this patch, things are back to working on both hikey960
and db845c with 5.4 based kernels.
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I7f2adba3ddbd36169b6d26baf49299046efcf906
}
#endif
- ret = drmSetMaster(fd());
- if (ret) {
- ALOGE("drmSetMaster() failed with errno: %d", errno);
- return std::make_tuple(ret, 0);
+ drmSetMaster(fd());
+ if (!drmIsMaster(fd())) {
+ ALOGE("DRM/KMS master access required");
+ return std::make_tuple(-EACCES, 0);
}
drmModeResPtr res = drmModeGetResources(fd());