intel/gpu: reset framebuffer part of ggtt

on display client close (intel_fb). The former code constructed a
temporary object on the stack, which sets up the scratch pages for the
closed client. However, the scratch page backing store (dma_buffer) gets
freed on destruction of the temporary stack object, which leads to DMA faults
with visual noise on the screen. Instead, use the already in use ggtt object
and add the scratch pages explicitly.

Issue #5180
This commit is contained in:
Alexander Boettcher 2024-04-17 09:05:04 +02:00 committed by Christian Helmuth
parent d52af2ac94
commit b97e549dc4
2 changed files with 21 additions and 8 deletions

View File

@ -165,6 +165,16 @@ class Igd::Ggtt
for (size_t i = fb_entries; i < _num_entries; i++) {
_insert_pte(mmio, _scratch_page.dma_addr(), i);
}
}
void fill_fb_with_scratch_pages(Mmio &mmio, size_t const fb_size)
{
auto const entries = Genode::min(fb_size / PAGE_SIZE, _num_entries);
for (size_t i = 0; i < entries; i++) {
_insert_pte(mmio, _scratch_page.dma_addr(), i);
}
}
/**

View File

@ -285,6 +285,15 @@ struct Igd::Device
fn_error();
}
void reset_reserved_fb_ggtt()
{
with_ggtt([&](auto &ggtt, auto &mmio) {
ggtt.fill_fb_with_scratch_pages(mmio, _resources.aperture_reserved());
}, []() {
Genode::error(__func__, " failed");
});
}
/************
** MEMORY **
************/
@ -2677,14 +2686,8 @@ struct Main : Irq_ack_handler, Gpu_reset_handler
void reset() override
{
_dev.with_mmio([&](auto &mmio) {
_dev.with_platform([&](auto &plat_con) {
auto const base = mmio.base() + (mmio.size() / 2);
Igd::Ggtt(plat_con, mmio, base, _dev.gtt_reserved(), 0, 0);
});
}, []() {
error("reset failed");
});
if (_igd_device.constructed())
_igd_device->reset_reserved_fb_ggtt();
}
};