forge
Explore
Log in

Don't you dare go Hollow

tty: Don't store render formats

Browse files at this commit

655fe413fb6d51461519aa77439f745598fa2eefIvan MolodetskikhParent: ac6ff7f
Actually, how did it even fork before? Pretty sure it was storing render
formats, not texture formats, but with render formats
weston-simple-dmabuf-feedback doesn't work?
src/backend/tty.rsmodified+9 -10
@@ -8,16 +8,15 @@ use std::time::Duration;
8 8
9 use anyhow::{anyhow, Context};9 use anyhow::{anyhow, Context};
10 use libc::dev_t;10 use libc::dev_t;
11-use smithay::backend::allocator::dmabuf::Dmabuf;
12 use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice};11 use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice};
13-use smithay::backend::allocator::{Format as DrmFormat, Fourcc};12+use smithay::backend::allocator::Fourcc;
14 use smithay::backend::drm::compositor::{DrmCompositor, PrimaryPlaneElement};13 use smithay::backend::drm::compositor::{DrmCompositor, PrimaryPlaneElement};
15 use smithay::backend::drm::{DrmDevice, DrmDeviceFd, DrmEvent, DrmEventMetadata, DrmEventTime};14 use smithay::backend::drm::{DrmDevice, DrmDeviceFd, DrmEvent, DrmEventMetadata, DrmEventTime};
16 use smithay::backend::egl::context::ContextPriority;15 use smithay::backend::egl::context::ContextPriority;
17 use smithay::backend::egl::{EGLContext, EGLDisplay};16 use smithay::backend::egl::{EGLContext, EGLDisplay};
18 use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface};17 use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface};
19 use smithay::backend::renderer::gles::{Capability, GlesRenderer, GlesTexture};18 use smithay::backend::renderer::gles::{Capability, GlesRenderer, GlesTexture};
20-use smithay::backend::renderer::{Bind, DebugFlags, ImportDma, ImportEgl};19+use smithay::backend::renderer::{DebugFlags, ImportDma, ImportEgl};
21 use smithay::backend::session::libseat::LibSeatSession;20 use smithay::backend::session::libseat::LibSeatSession;
22 use smithay::backend::session::{Event as SessionEvent, Session};21 use smithay::backend::session::{Event as SessionEvent, Session};
23 use smithay::backend::udev::{self, UdevBackend, UdevEvent};22 use smithay::backend::udev::{self, UdevBackend, UdevEvent};
@@ -70,7 +69,6 @@ struct OutputDevice {
70 id: dev_t,69 id: dev_t,
71 token: RegistrationToken,70 token: RegistrationToken,
72 gles: GlesRenderer,71 gles: GlesRenderer,
73- formats: HashSet<DrmFormat>,
74 drm_scanner: DrmScanner,72 drm_scanner: DrmScanner,
75 surfaces: HashMap<crtc::Handle, Surface>,73 surfaces: HashMap<crtc::Handle, Surface>,
76 // SAFETY: drop after all the objects used with them are dropped.74 // SAFETY: drop after all the objects used with them are dropped.
@@ -329,8 +327,6 @@ impl Tty {
329 })327 })
330 .unwrap();328 .unwrap();
331 329
332- let formats = Bind::<Dmabuf>::supported_formats(&gles).unwrap_or_default();
333-
334 let default_feedback = DmabufFeedbackBuilder::new(device_id, gles.dmabuf_formats())330 let default_feedback = DmabufFeedbackBuilder::new(device_id, gles.dmabuf_formats())
335 .build()331 .build()
336 .context("error building default dmabuf feedback")?;332 .context("error building default dmabuf feedback")?;
@@ -344,7 +340,6 @@ impl Tty {
344 drm,340 drm,
345 gbm,341 gbm,
346 gles,342 gles,
347- formats,
348 drm_scanner: DrmScanner::new(),343 drm_scanner: DrmScanner::new(),
349 surfaces: HashMap::new(),344 surfaces: HashMap::new(),
350 });345 });
@@ -576,6 +571,10 @@ impl Tty {
576 planes.overlay.clear();571 planes.overlay.clear();
577 }572 }
578 573
574+ let egl_context = device.gles.egl_context();
575+ let texture_formats = egl_context.dmabuf_texture_formats();
576+ let render_formats = egl_context.dmabuf_render_formats();
577+
579 let scanout_formats = planes578 let scanout_formats = planes
580 .primary579 .primary
581 .formats580 .formats
@@ -583,7 +582,7 @@ impl Tty {
583 .chain(planes.overlay.iter().flat_map(|p| &p.formats))582 .chain(planes.overlay.iter().flat_map(|p| &p.formats))
584 .copied()583 .copied()
585 .collect::<HashSet<_>>();584 .collect::<HashSet<_>>();
586- let scanout_formats = scanout_formats.intersection(&device.formats).copied();585+ let scanout_formats = scanout_formats.intersection(texture_formats).copied();
587 586
588 // Create the compositor.587 // Create the compositor.
589 let compositor = DrmCompositor::new(588 let compositor = DrmCompositor::new(
@@ -593,12 +592,12 @@ impl Tty {
593 allocator,592 allocator,
594 device.gbm.clone(),593 device.gbm.clone(),
595 SUPPORTED_COLOR_FORMATS,594 SUPPORTED_COLOR_FORMATS,
596- device.formats.clone(),595+ render_formats.clone(),
597 device.drm.cursor_size(),596 device.drm.cursor_size(),
598 Some(device.gbm.clone()),597 Some(device.gbm.clone()),
599 )?;598 )?;
600 599
601- let dmabuf_feedback = DmabufFeedbackBuilder::new(device.id, device.formats.clone())600+ let dmabuf_feedback = DmabufFeedbackBuilder::new(device.id, texture_formats.clone())
602 .add_preference_tranche(device.id, Some(TrancheFlags::Scanout), scanout_formats)601 .add_preference_tranche(device.id, Some(TrancheFlags::Scanout), scanout_formats)
603 .build()602 .build()
604 .context("error building dmabuf feedback")?;603 .context("error building dmabuf feedback")?;