mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:42:44 +00:00 
			
		
		
		
	 016fedbd20
			
		
	
	
		016fedbd20
		
	
	
	
	
		
			
			Instead of doing that on the IntelDisplayPlane class, let's have this in derived classes so these classes can decide how to use the settings that were provided before calling the enable method.
		
			
				
	
	
		
			70 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <Kernel/Graphics/Intel/Plane/DisplayPlane.h>
 | |
| #include <Kernel/PhysicalAddress.h>
 | |
| 
 | |
| namespace Kernel {
 | |
| 
 | |
| IntelDisplayPlane::IntelDisplayPlane(Memory::TypedMapping<PlaneRegisters volatile> plane_registers_mapping)
 | |
|     : m_plane_registers(move(plane_registers_mapping))
 | |
| {
 | |
| }
 | |
| 
 | |
| IntelDisplayPlane::ShadowRegisters IntelDisplayPlane::shadow_registers() const
 | |
| {
 | |
|     SpinlockLocker locker(m_access_lock);
 | |
|     return m_shadow_registers;
 | |
| }
 | |
| 
 | |
| ErrorOr<void> IntelDisplayPlane::set_horizontal_active_pixels_count(Badge<IntelDisplayConnectorGroup>, size_t horizontal_active_pixels_count)
 | |
| {
 | |
|     SpinlockLocker locker(m_access_lock);
 | |
|     m_horizontal_active_pixels_count = horizontal_active_pixels_count;
 | |
|     return {};
 | |
| }
 | |
| ErrorOr<void> IntelDisplayPlane::set_vertical_active_pixels_count(Badge<IntelDisplayConnectorGroup>, size_t vertical_active_pixels_count)
 | |
| {
 | |
|     SpinlockLocker locker(m_access_lock);
 | |
|     m_vertical_active_pixels_count = vertical_active_pixels_count;
 | |
|     return {};
 | |
| }
 | |
| ErrorOr<void> IntelDisplayPlane::set_horizontal_stride(Badge<IntelDisplayConnectorGroup>, size_t horizontal_stride)
 | |
| {
 | |
|     SpinlockLocker locker(m_access_lock);
 | |
|     m_horizontal_stride = horizontal_stride;
 | |
|     return {};
 | |
| }
 | |
| ErrorOr<void> IntelDisplayPlane::set_aperture_base(Badge<IntelDisplayConnectorGroup>, PhysicalAddress aperture_start)
 | |
| {
 | |
|     SpinlockLocker locker(m_access_lock);
 | |
|     m_aperture_start.set(aperture_start.get());
 | |
|     return {};
 | |
| }
 | |
| ErrorOr<void> IntelDisplayPlane::set_pipe(Badge<IntelDisplayConnectorGroup>, PipeSelect pipe_select)
 | |
| {
 | |
|     SpinlockLocker locker(m_access_lock);
 | |
|     m_pipe_select = pipe_select;
 | |
|     return {};
 | |
| }
 | |
| 
 | |
| bool IntelDisplayPlane::is_enabled(Badge<IntelDisplayConnectorGroup>)
 | |
| {
 | |
|     SpinlockLocker locker(m_access_lock);
 | |
|     return m_shadow_registers.control & (1 << 31);
 | |
| }
 | |
| 
 | |
| ErrorOr<void> IntelDisplayPlane::disable(Badge<IntelDisplayConnectorGroup>)
 | |
| {
 | |
|     SpinlockLocker locker(m_access_lock);
 | |
|     // Note: We use the shadow register so we don't have the already set
 | |
|     // settings being lost.
 | |
|     m_shadow_registers.control &= ~(1 << 31);
 | |
|     m_plane_registers->control = m_shadow_registers.control;
 | |
|     return {};
 | |
| }
 | |
| 
 | |
| }
 |