1
0
Fork 0
forked from wry/wry

video: prefer non-nvidia devices when selecting render device

This commit is contained in:
Julian Orth 2022-11-13 15:18:50 +01:00
parent 141997d9d6
commit 79ee6900fa
6 changed files with 107 additions and 11 deletions

View file

@ -21,9 +21,9 @@ use {
drm::{
drm_mode_modeinfo, Change, ConnectorStatus, ConnectorType, DrmBlob, DrmConnector,
DrmCrtc, DrmEncoder, DrmError, DrmEvent, DrmFramebuffer, DrmMaster, DrmModeInfo,
DrmObject, DrmPlane, DrmProperty, DrmPropertyDefinition, DrmPropertyType, PropBlob,
DRM_CLIENT_CAP_ATOMIC, DRM_MODE_ATOMIC_ALLOW_MODESET, DRM_MODE_ATOMIC_NONBLOCK,
DRM_MODE_PAGE_FLIP_EVENT,
DrmObject, DrmPlane, DrmProperty, DrmPropertyDefinition, DrmPropertyType,
DrmVersion, PropBlob, DRM_CLIENT_CAP_ATOMIC, DRM_MODE_ATOMIC_ALLOW_MODESET,
DRM_MODE_ATOMIC_NONBLOCK, DRM_MODE_PAGE_FLIP_EVENT,
},
gbm::{GbmDevice, GBM_BO_USE_LINEAR, GBM_BO_USE_RENDERING, GBM_BO_USE_SCANOUT},
ModifiedFormat, INVALID_MODIFIER,
@ -93,6 +93,10 @@ impl BackendDrmDevice for MetalDrmDevice {
fn make_render_device(self: Rc<Self>) {
self.backend.make_render_device(&self, true);
}
fn version(&self) -> Result<DrmVersion, DrmError> {
self.gbm.drm.version()
}
}
pub struct HandleEvents {

View file

@ -17,7 +17,7 @@ use {
queue::AsyncQueue, syncqueue::SyncQueue,
},
video::{
drm::{ConnectorType, Drm, DrmError},
drm::{ConnectorType, Drm, DrmError, DrmVersion},
gbm::{GbmDevice, GbmError, GBM_BO_USE_RENDERING},
ModifiedFormat, INVALID_MODIFIER,
},
@ -291,7 +291,7 @@ impl XBackend {
self.state
.backend_events
.push(BackendEvent::NewDrmDevice(Rc::new(XDrmDevice {
_backend: self.clone(),
backend: self.clone(),
id: self.drm_device_id,
dev: self.drm_dev,
})));
@ -939,7 +939,7 @@ impl XBackend {
}
struct XDrmDevice {
_backend: Rc<XBackend>,
backend: Rc<XBackend>,
id: DrmDeviceId,
dev: dev_t,
}
@ -965,6 +965,10 @@ impl BackendDrmDevice for XDrmDevice {
log::warn!("make_render_device is not supported by the X backend");
// nothing
}
fn version(&self) -> Result<DrmVersion, DrmError> {
self.backend.gbm.drm.version()
}
}
struct XOutput {