Skip to content

Commit

Permalink
Don't restrict modifiers to GBM_MAX_PLANES
Browse files Browse the repository at this point in the history
The modifiers argument doesn't seem to be modifiers for each plane.
Rather, it's a set of modifiers that the driver will choose a
preference out of. So it doesn't make sense to limit this.
  • Loading branch information
ids1024 authored and Drakulix committed Feb 6, 2024
1 parent 18eb2b7 commit 9662afd
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ impl<T: AsFd> Device<T> {
format: Format,
modifiers: impl Iterator<Item = Modifier>,
) -> IoResult<Surface<U>> {
let mods = modifiers
.take(ffi::GBM_MAX_PLANES as usize)
.map(|m| m.into())
.collect::<Vec<u64>>();
let mods = modifiers.map(|m| m.into()).collect::<Vec<u64>>();
let ptr = unsafe {
ffi::gbm_surface_create_with_modifiers(
*self.ffi,
Expand All @@ -159,10 +156,7 @@ impl<T: AsFd> Device<T> {
modifiers: impl Iterator<Item = Modifier>,
usage: BufferObjectFlags,
) -> IoResult<Surface<U>> {
let mods = modifiers
.take(ffi::GBM_MAX_PLANES as usize)
.map(|m| m.into())
.collect::<Vec<u64>>();
let mods = modifiers.map(|m| m.into()).collect::<Vec<u64>>();
let ptr = unsafe {
ffi::gbm_surface_create_with_modifiers2(
*self.ffi,
Expand Down Expand Up @@ -206,10 +200,7 @@ impl<T: AsFd> Device<T> {
format: Format,
modifiers: impl Iterator<Item = Modifier>,
) -> IoResult<BufferObject<U>> {
let mods = modifiers
.take(ffi::GBM_MAX_PLANES as usize)
.map(|m| m.into())
.collect::<Vec<u64>>();
let mods = modifiers.map(|m| m.into()).collect::<Vec<u64>>();
let ptr = unsafe {
ffi::gbm_bo_create_with_modifiers(
*self.ffi,
Expand All @@ -236,10 +227,7 @@ impl<T: AsFd> Device<T> {
modifiers: impl Iterator<Item = Modifier>,
usage: BufferObjectFlags,
) -> IoResult<BufferObject<U>> {
let mods = modifiers
.take(ffi::GBM_MAX_PLANES as usize)
.map(|m| m.into())
.collect::<Vec<u64>>();
let mods = modifiers.map(|m| m.into()).collect::<Vec<u64>>();
let ptr = unsafe {
ffi::gbm_bo_create_with_modifiers2(
*self.ffi,
Expand Down

0 comments on commit 9662afd

Please sign in to comment.