@@ -63,7 +63,7 @@ use core::ptr;
63
63
/// and also allows the app to access the in-memory buffer.
64
64
#[ repr( C ) ]
65
65
#[ unsafe_protocol( "9042a9de-23dc-4a38-96fb-7aded080516a" ) ]
66
- pub struct GraphicsOutput < ' boot > {
66
+ pub struct GraphicsOutput {
67
67
query_mode : extern "efiapi" fn (
68
68
& GraphicsOutput ,
69
69
mode : u32 ,
@@ -84,10 +84,10 @@ pub struct GraphicsOutput<'boot> {
84
84
height : usize ,
85
85
stride : usize ,
86
86
) -> Status ,
87
- mode : & ' boot ModeData < ' boot > ,
87
+ mode : * const ModeData ,
88
88
}
89
89
90
- impl < ' boot > GraphicsOutput < ' boot > {
90
+ impl GraphicsOutput {
91
91
/// Returns information for an available graphics mode that the graphics
92
92
/// device and the set of active video output devices supports.
93
93
pub fn query_mode ( & self , index : u32 ) -> Result < Mode > {
@@ -110,7 +110,7 @@ impl<'boot> GraphicsOutput<'boot> {
110
110
ModeIter {
111
111
gop : self ,
112
112
current : 0 ,
113
- max : self . mode . max_mode ,
113
+ max : self . mode ( ) . max_mode ,
114
114
}
115
115
}
116
116
@@ -293,34 +293,38 @@ impl<'boot> GraphicsOutput<'boot> {
293
293
/// Returns the frame buffer information for the current mode.
294
294
#[ must_use]
295
295
pub const fn current_mode_info ( & self ) -> ModeInfo {
296
- * self . mode . info
296
+ * self . mode ( ) . info ( )
297
297
}
298
298
299
299
/// Access the frame buffer directly
300
300
pub fn frame_buffer ( & mut self ) -> FrameBuffer {
301
301
assert ! (
302
- self . mode. info. format != PixelFormat :: BltOnly ,
302
+ self . mode( ) . info( ) . format != PixelFormat :: BltOnly ,
303
303
"Cannot access the framebuffer in a Blt-only mode"
304
304
) ;
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 ;
307
307
308
308
FrameBuffer {
309
309
base,
310
310
size,
311
311
_lifetime : PhantomData ,
312
312
}
313
313
}
314
+
315
+ const fn mode ( & self ) -> & ModeData {
316
+ unsafe { & * self . mode }
317
+ }
314
318
}
315
319
316
320
#[ repr( C ) ]
317
- struct ModeData < ' info > {
321
+ struct ModeData {
318
322
// Number of modes which the GOP supports.
319
323
max_mode : u32 ,
320
324
// Current mode.
321
325
mode : u32 ,
322
326
// Information about the current mode.
323
- info : & ' info ModeInfo ,
327
+ info : * const ModeInfo ,
324
328
// Size of the above structure.
325
329
info_sz : usize ,
326
330
// Physical address of the frame buffer.
@@ -329,6 +333,12 @@ struct ModeData<'info> {
329
333
fb_size : usize ,
330
334
}
331
335
336
+ impl ModeData {
337
+ const fn info ( & self ) -> & ModeInfo {
338
+ unsafe { & * self . info }
339
+ }
340
+ }
341
+
332
342
/// Represents the format of the pixels in a frame buffer.
333
343
#[ derive( Debug , Copy , Clone , Eq , PartialEq ) ]
334
344
#[ repr( u32 ) ]
@@ -436,7 +446,7 @@ impl ModeInfo {
436
446
437
447
/// Iterator for [`Mode`]s of the [`GraphicsOutput`] protocol.
438
448
pub struct ModeIter < ' gop > {
439
- gop : & ' gop GraphicsOutput < ' gop > ,
449
+ gop : & ' gop GraphicsOutput ,
440
450
current : u32 ,
441
451
max : u32 ,
442
452
}
0 commit comments