mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:57:34 +00:00
Kernel: Fix crash when opening GPU3DDevice without creating a context
This commit is contained in:
parent
3bbb5734af
commit
8601f74d5f
2 changed files with 2 additions and 3 deletions
|
@ -62,8 +62,7 @@ ErrorOr<void> GPU3DDevice::ioctl(OpenFileDescription& description, unsigned requ
|
||||||
// TODO: Delete the context if it fails to be set in m_context_state_lookup
|
// TODO: Delete the context if it fails to be set in m_context_state_lookup
|
||||||
auto context_id = m_graphics_adapter.create_context();
|
auto context_id = m_graphics_adapter.create_context();
|
||||||
RefPtr<PerContextState> per_context_state = TRY(PerContextState::try_create(context_id));
|
RefPtr<PerContextState> per_context_state = TRY(PerContextState::try_create(context_id));
|
||||||
auto ref = RefPtr(description);
|
TRY(m_context_state_lookup.try_set(&description, per_context_state));
|
||||||
TRY(m_context_state_lookup.try_set(ref, per_context_state));
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
case VIRGL_IOCTL_TRANSFER_DATA: {
|
case VIRGL_IOCTL_TRANSFER_DATA: {
|
||||||
|
|
|
@ -127,7 +127,7 @@ private:
|
||||||
Kernel::Graphics::VirtIOGPU::GraphicsAdapter& m_graphics_adapter;
|
Kernel::Graphics::VirtIOGPU::GraphicsAdapter& m_graphics_adapter;
|
||||||
// Context used for kernel operations (e.g. flushing resources to scanout)
|
// Context used for kernel operations (e.g. flushing resources to scanout)
|
||||||
ContextID m_kernel_context_id;
|
ContextID m_kernel_context_id;
|
||||||
HashMap<RefPtr<OpenFileDescription>, RefPtr<PerContextState>> m_context_state_lookup;
|
HashMap<OpenFileDescription*, RefPtr<PerContextState>> m_context_state_lookup;
|
||||||
// Memory management for backing buffers
|
// Memory management for backing buffers
|
||||||
OwnPtr<Memory::Region> m_transfer_buffer_region;
|
OwnPtr<Memory::Region> m_transfer_buffer_region;
|
||||||
constexpr static size_t NUM_TRANSFER_REGION_PAGES = 256;
|
constexpr static size_t NUM_TRANSFER_REGION_PAGES = 256;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue