Kernel: Remove bogus VMObject resizing in VirtIOGPU

It is not legal to resize a VMObject after it has been created.
As far as I can tell, this code would never actually run since the
object was already populated with physical pages due to using
AllocationStrategy::AllocateNow.
This commit is contained in:
Andreas Kling 2021-07-11 17:06:13 +02:00
parent 055726ecf5
commit 846685fca2
Notes: sideshowbarker 2024-07-18 09:19:38 +09:00
2 changed files with 2 additions and 13 deletions

View file

@ -127,20 +127,9 @@ VirtIOGPUResourceID VirtIOGPU::create_2d_resource(VirtIOGPURect rect)
return resource_id;
}
void VirtIOGPU::ensure_backing_storage(Region& region, size_t buffer_offset, size_t buffer_length, VirtIOGPUResourceID resource_id)
void VirtIOGPU::ensure_backing_storage(Region const& region, size_t buffer_offset, size_t buffer_length, VirtIOGPUResourceID resource_id)
{
VERIFY(m_operation_lock.is_locked());
// Allocate backing region
auto& vm_object = region.vmobject();
size_t desired_num_pages = page_round_up(buffer_offset + buffer_length);
auto& pages = vm_object.physical_pages();
for (size_t i = pages.size(); i < desired_num_pages / PAGE_SIZE; ++i) {
auto page = MM.allocate_user_physical_page();
// FIXME: Instead of verifying, fail the framebuffer resize operation
VERIFY(!page.is_null());
pages.append(move(page));
}
region.remap();
VERIFY(buffer_offset % PAGE_SIZE == 0);
VERIFY(buffer_length % PAGE_SIZE == 0);

View file

@ -219,7 +219,7 @@ private:
void query_display_information();
VirtIOGPUResourceID create_2d_resource(VirtIOGPURect rect);
void delete_resource(VirtIOGPUResourceID resource_id);
void ensure_backing_storage(Region& region, size_t buffer_offset, size_t buffer_length, VirtIOGPUResourceID resource_id);
void ensure_backing_storage(Region const&, size_t buffer_offset, size_t buffer_length, VirtIOGPUResourceID resource_id);
void detach_backing_storage(VirtIOGPUResourceID resource_id);
void set_scanout_resource(VirtIOGPUScanoutID scanout, VirtIOGPUResourceID resource_id, VirtIOGPURect rect);
void transfer_framebuffer_data_to_host(VirtIOGPUScanoutID scanout, VirtIOGPURect const& rect, VirtIOGPUResourceID resource_id);