kms: Fix shaders for offscreen rendering
This commit is contained in:
parent
952f73dcc4
commit
800e01a484
1 changed files with 16 additions and 11 deletions
|
|
@ -36,6 +36,7 @@ use smithay::{
|
||||||
use tracing::{error, info, trace, warn};
|
use tracing::{error, info, trace, warn};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
borrow::BorrowMut,
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
path::Path,
|
path::Path,
|
||||||
sync::{Arc, Condvar, Mutex, RwLock},
|
sync::{Arc, Condvar, Mutex, RwLock},
|
||||||
|
|
@ -50,6 +51,8 @@ mod surface;
|
||||||
use device::*;
|
use device::*;
|
||||||
pub use surface::Timings;
|
pub use surface::Timings;
|
||||||
|
|
||||||
|
use super::render::init_shaders;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct KmsState {
|
pub struct KmsState {
|
||||||
pub drm_devices: HashMap<DrmNode, Device>,
|
pub drm_devices: HashMap<DrmNode, Device>,
|
||||||
|
|
@ -386,6 +389,18 @@ impl KmsState {
|
||||||
if device.in_use(self.primary_node.as_ref()) {
|
if device.in_use(self.primary_node.as_ref()) {
|
||||||
if device.egl.is_none() {
|
if device.egl.is_none() {
|
||||||
let egl = init_egl(&device.gbm).context("Failed to create EGL context")?;
|
let egl = init_egl(&device.gbm).context("Failed to create EGL context")?;
|
||||||
|
let mut renderer = unsafe {
|
||||||
|
GlowRenderer::new(
|
||||||
|
EGLContext::new_shared_with_priority(
|
||||||
|
&egl.display,
|
||||||
|
&egl.context,
|
||||||
|
ContextPriority::High,
|
||||||
|
)
|
||||||
|
.context("Failed to create shared EGL context")?,
|
||||||
|
)
|
||||||
|
.context("Failed to create GL renderer")?
|
||||||
|
};
|
||||||
|
init_shaders(renderer.borrow_mut()).context("Failed to compile shaders")?;
|
||||||
self.api.as_mut().add_node(
|
self.api.as_mut().add_node(
|
||||||
device.render_node,
|
device.render_node,
|
||||||
GbmAllocator::new(
|
GbmAllocator::new(
|
||||||
|
|
@ -393,17 +408,7 @@ impl KmsState {
|
||||||
// SCANOUT because stride bugs
|
// SCANOUT because stride bugs
|
||||||
GbmBufferFlags::RENDERING | GbmBufferFlags::SCANOUT,
|
GbmBufferFlags::RENDERING | GbmBufferFlags::SCANOUT,
|
||||||
),
|
),
|
||||||
unsafe {
|
renderer,
|
||||||
GlowRenderer::new(
|
|
||||||
EGLContext::new_shared_with_priority(
|
|
||||||
&egl.display,
|
|
||||||
&egl.context,
|
|
||||||
ContextPriority::High,
|
|
||||||
)
|
|
||||||
.context("Failed to create shared EGL context")?,
|
|
||||||
)
|
|
||||||
.context("Failed to create GL renderer")?
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
device.egl = Some(egl);
|
device.egl = Some(egl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue