50
50
//! You will have to implement your own double buffering if you want to
51
51
//! avoid tearing with animations.
52
52
53
- use crate :: prelude:: BootServices ;
54
53
use crate :: proto:: unsafe_protocol;
55
54
use crate :: util:: usize_from_u32;
56
- use crate :: { Result , StatusExt } ;
55
+ use crate :: { boot , Result , StatusExt } ;
57
56
use core:: fmt:: { Debug , Formatter } ;
58
57
use core:: marker:: PhantomData ;
59
- use core:: { mem, ptr} ;
58
+ use core:: mem;
59
+ use core:: ptr:: { self , NonNull } ;
60
60
use uefi_raw:: protocol:: console:: {
61
61
GraphicsOutputBltOperation , GraphicsOutputModeInformation , GraphicsOutputProtocol ,
62
62
GraphicsOutputProtocolMode ,
@@ -76,7 +76,7 @@ pub struct GraphicsOutput(GraphicsOutputProtocol);
76
76
impl GraphicsOutput {
77
77
/// Returns information for an available graphics mode that the graphics
78
78
/// device and the set of active video output devices supports.
79
- fn query_mode ( & self , index : u32 , bs : & BootServices ) -> Result < Mode > {
79
+ fn query_mode ( & self , index : u32 ) -> Result < Mode > {
80
80
let mut info_sz = 0 ;
81
81
let mut info_heap_ptr = ptr:: null ( ) ;
82
82
// query_mode allocates a buffer and stores the heap ptr in the provided
@@ -90,7 +90,8 @@ impl GraphicsOutput {
90
90
91
91
// User has no benefit from propagating this error. If this
92
92
// fails, it is an error of the UEFI implementation.
93
- unsafe { bs. free_pool ( info_heap_ptr) } . expect ( "buffer should be deallocatable" ) ;
93
+ unsafe { boot:: free_pool ( NonNull :: new ( info_heap_ptr) . unwrap ( ) ) }
94
+ . expect ( "buffer should be deallocatable" ) ;
94
95
95
96
Mode {
96
97
index,
@@ -102,10 +103,9 @@ impl GraphicsOutput {
102
103
103
104
/// Returns a [`ModeIter`].
104
105
#[ must_use]
105
- pub const fn modes < ' a > ( & ' a self , bs : & ' a BootServices ) -> ModeIter {
106
+ pub const fn modes ( & self ) -> ModeIter {
106
107
ModeIter {
107
108
gop : self ,
108
- bs,
109
109
current : 0 ,
110
110
max : self . mode ( ) . max_mode ,
111
111
}
@@ -410,7 +410,6 @@ impl ModeInfo {
410
410
/// Iterator for [`Mode`]s of the [`GraphicsOutput`] protocol.
411
411
pub struct ModeIter < ' gop > {
412
412
gop : & ' gop GraphicsOutput ,
413
- bs : & ' gop BootServices ,
414
413
current : u32 ,
415
414
max : u32 ,
416
415
}
@@ -421,7 +420,7 @@ impl<'gop> Iterator for ModeIter<'gop> {
421
420
fn next ( & mut self ) -> Option < Self :: Item > {
422
421
let index = self . current ;
423
422
if index < self . max {
424
- let m = self . gop . query_mode ( index, self . bs ) ;
423
+ let m = self . gop . query_mode ( index) ;
425
424
self . current += 1 ;
426
425
427
426
m. ok ( ) . or_else ( || self . next ( ) )
0 commit comments