This repository has been archived by the owner on Nov 30, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gbm_gralloc: Add feature to search for KMS DRI card
Most modern SOCs have separate IP cores for GPU and Display Unit (KMS). To work properly mesa requires initialize gbm interface using KMS card. Mesa uses it to allocate buffers with SCANOUT flag and does not require fd or pathname explicitly specified for GPU. Mesa will search for GPU and load the proper driver. Also, there is no warranty that the KMS card will always have /dev/dri/card0 path and GPU - /dev/dri/card1. Order can depend on many factors. For example: on the rpi4 board, it was observed that enabling the WIFI kernel module swapping the card order. Therefore searching for the KMS card is the only efficient solution. The is_kms_dev function returns true when the libdrm function is returned resources and the target device has at least one CTRC, connector, and encoder. The open_first_kms_dev function returns opened file descriptor on success using the previous function to check for each device. It also returns zeroed value for the case of KMS absence, or the -EINVAL on glob function error. In the case of absence of the "hwc.drm.device" system property the first KMS device or the default path /dev/dri/renderD128 will be used to open. Signed-off-by: Matvii Zorin <[email protected]> Reviewed-by: Roman Stratiienko <[email protected]>
- Loading branch information
4ffe6ef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this change be submitted upstream to robherring/gbm_gralloc?
4ffe6ef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnstultz-work
Yes, GloDroid folks have already opened a PR and that's actually where I picked this up. robherring#16