@@ -63,7 +63,7 @@ use core::ptr;
6363/// and also allows the app to access the in-memory buffer.
6464#[ repr( C ) ]
6565#[ unsafe_protocol( "9042a9de-23dc-4a38-96fb-7aded080516a" ) ]
66- pub struct GraphicsOutput < ' boot > {
66+ pub struct GraphicsOutput {
6767 query_mode : extern "efiapi" fn (
6868 & GraphicsOutput ,
6969 mode : u32 ,
@@ -84,10 +84,10 @@ pub struct GraphicsOutput<'boot> {
8484 height : usize ,
8585 stride : usize ,
8686 ) -> Status ,
87- mode : & ' boot ModeData < ' boot > ,
87+ mode : * const ModeData ,
8888}
8989
90- impl < ' boot > GraphicsOutput < ' boot > {
90+ impl GraphicsOutput {
9191 /// Returns information for an available graphics mode that the graphics
9292 /// device and the set of active video output devices supports.
9393 pub fn query_mode ( & self , index : u32 ) -> Result < Mode > {
@@ -110,7 +110,7 @@ impl<'boot> GraphicsOutput<'boot> {
110110 ModeIter {
111111 gop : self ,
112112 current : 0 ,
113- max : self . mode . max_mode ,
113+ max : self . mode ( ) . max_mode ,
114114 }
115115 }
116116
@@ -293,34 +293,38 @@ impl<'boot> GraphicsOutput<'boot> {
293293 /// Returns the frame buffer information for the current mode.
294294 #[ must_use]
295295 pub const fn current_mode_info ( & self ) -> ModeInfo {
296- * self . mode . info
296+ * self . mode ( ) . info ( )
297297 }
298298
299299 /// Access the frame buffer directly
300300 pub fn frame_buffer ( & mut self ) -> FrameBuffer {
301301 assert ! (
302- self . mode. info. format != PixelFormat :: BltOnly ,
302+ self . mode( ) . info( ) . format != PixelFormat :: BltOnly ,
303303 "Cannot access the framebuffer in a Blt-only mode"
304304 ) ;
305- let base = self . mode . fb_address as * mut u8 ;
306- let size = self . mode . fb_size ;
305+ let base = self . mode ( ) . fb_address as * mut u8 ;
306+ let size = self . mode ( ) . fb_size ;
307307
308308 FrameBuffer {
309309 base,
310310 size,
311311 _lifetime : PhantomData ,
312312 }
313313 }
314+
315+ const fn mode ( & self ) -> & ModeData {
316+ unsafe { & * self . mode }
317+ }
314318}
315319
316320#[ repr( C ) ]
317- struct ModeData < ' info > {
321+ struct ModeData {
318322 // Number of modes which the GOP supports.
319323 max_mode : u32 ,
320324 // Current mode.
321325 mode : u32 ,
322326 // Information about the current mode.
323- info : & ' info ModeInfo ,
327+ info : * const ModeInfo ,
324328 // Size of the above structure.
325329 info_sz : usize ,
326330 // Physical address of the frame buffer.
@@ -329,6 +333,12 @@ struct ModeData<'info> {
329333 fb_size : usize ,
330334}
331335
336+ impl ModeData {
337+ const fn info ( & self ) -> & ModeInfo {
338+ unsafe { & * self . info }
339+ }
340+ }
341+
332342/// Represents the format of the pixels in a frame buffer.
333343#[ derive( Debug , Copy , Clone , Eq , PartialEq ) ]
334344#[ repr( u32 ) ]
@@ -436,7 +446,7 @@ impl ModeInfo {
436446
437447/// Iterator for [`Mode`]s of the [`GraphicsOutput`] protocol.
438448pub struct ModeIter < ' gop > {
439- gop : & ' gop GraphicsOutput < ' gop > ,
449+ gop : & ' gop GraphicsOutput ,
440450 current : u32 ,
441451 max : u32 ,
442452}
0 commit comments