mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:42:44 +00:00 
			
		
		
		
	Kernel: Turn VirtIOGPU operation lock from mutex into spinlock
This commit is contained in:
		
							parent
							
								
									ca42621be1
								
							
						
					
					
						commit
						200589ba27
					
				
					 3 changed files with 7 additions and 7 deletions
				
			
		|  | @ -83,7 +83,7 @@ ErrorOr<void> FramebufferDevice::set_head_resolution(size_t head, size_t width, | |||
| 
 | ||||
|     auto& info = display_info(); | ||||
| 
 | ||||
|     MutexLocker locker(adapter()->operation_lock()); | ||||
|     SpinlockLocker locker(adapter()->operation_lock()); | ||||
| 
 | ||||
|     info.rect = { | ||||
|         .x = 0, | ||||
|  | @ -109,7 +109,7 @@ ErrorOr<void> FramebufferDevice::flush_head_buffer(size_t) | |||
| } | ||||
| ErrorOr<void> FramebufferDevice::flush_rectangle(size_t buffer_index, FBRect const& rect) | ||||
| { | ||||
|     MutexLocker locker(adapter()->operation_lock()); | ||||
|     SpinlockLocker locker(adapter()->operation_lock()); | ||||
|     Protocol::Rect dirty_rect { | ||||
|         .x = rect.x, | ||||
|         .y = rect.y, | ||||
|  | @ -184,7 +184,7 @@ ErrorOr<void> FramebufferDevice::create_framebuffer() | |||
|     } | ||||
|     m_framebuffer_sink_vmobject = TRY(Memory::AnonymousVMObject::try_create_with_physical_pages(pages.span())); | ||||
| 
 | ||||
|     MutexLocker locker(adapter()->operation_lock()); | ||||
|     SpinlockLocker locker(adapter()->operation_lock()); | ||||
|     m_current_buffer = &buffer_from_index(m_last_set_buffer_index.load()); | ||||
|     create_buffer(m_main_buffer, 0, m_buffer_size); | ||||
|     create_buffer(m_back_buffer, m_buffer_size, m_buffer_size); | ||||
|  | @ -256,7 +256,7 @@ void FramebufferDevice::flush_displayed_image(Protocol::Rect const& dirty_rect, | |||
| void FramebufferDevice::set_buffer(int buffer_index) | ||||
| { | ||||
|     auto& buffer = buffer_index == 0 ? m_main_buffer : m_back_buffer; | ||||
|     MutexLocker locker(adapter()->operation_lock()); | ||||
|     SpinlockLocker locker(adapter()->operation_lock()); | ||||
|     if (&buffer == m_current_buffer) | ||||
|         return; | ||||
|     m_current_buffer = &buffer; | ||||
|  |  | |||
|  | @ -90,7 +90,7 @@ void GraphicsAdapter::initialize() | |||
|         } | ||||
|         VERIFY(success); | ||||
|         finish_init(); | ||||
|         MutexLocker locker(m_operation_lock); | ||||
|         SpinlockLocker locker(m_operation_lock); | ||||
|         // Get display information using VIRTIO_GPU_CMD_GET_DISPLAY_INFO
 | ||||
|         query_display_information(); | ||||
|         query_display_edid({}); | ||||
|  | @ -396,7 +396,7 @@ void GraphicsAdapter::populate_virtio_gpu_request_header(Protocol::ControlHeader | |||
| 
 | ||||
| void GraphicsAdapter::flush_dirty_rectangle(ScanoutID scanout_id, ResourceID resource_id, Protocol::Rect const& dirty_rect) | ||||
| { | ||||
|     MutexLocker locker(m_operation_lock); | ||||
|     SpinlockLocker locker(m_operation_lock); | ||||
|     transfer_framebuffer_data_to_host(scanout_id, resource_id, dirty_rect); | ||||
|     flush_displayed_image(resource_id, dirty_rect); | ||||
| } | ||||
|  |  | |||
|  | @ -141,7 +141,7 @@ private: | |||
| 
 | ||||
|     // Synchronous commands
 | ||||
|     WaitQueue m_outstanding_request; | ||||
|     Mutex m_operation_lock; | ||||
|     Spinlock m_operation_lock; | ||||
|     OwnPtr<Memory::Region> m_scratch_space; | ||||
| }; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling