Skip to content

Commit

Permalink
intel/gpu: reset framebuffer part of ggtt
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alex-ab committed Apr 17, 2024
1 parent 4959f66 commit a903486
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
10 changes: 10 additions & 0 deletions repos/os/src/drivers/gpu/intel/ggtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/**
Expand Down
19 changes: 11 additions & 8 deletions repos/os/src/drivers/gpu/intel/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
************/
Expand Down Expand Up @@ -2668,14 +2677,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();
}
};

Expand Down

0 comments on commit a903486

Please sign in to comment.