mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 03:06:39 +00:00
gpu_session: add PPGTT address query function
Using the 'query_buffer_ppgtt()' function allows for retrieving the virtual address of the buffer in the PPGTT. This is for components that manage the GPU virtual addresses rather than the client as is the case with the lima driver. Issue #4559.
This commit is contained in:
parent
757fdba9fd
commit
b6cfb5a8fe
@ -76,6 +76,9 @@ class Gpu::Session_client : public Genode::Rpc_client<Session>
|
||||
void unmap_buffer_ppgtt(Buffer_id id, Gpu::addr_t va) override {
|
||||
call<Rpc_unmap_buffer_ppgtt>(id, va); }
|
||||
|
||||
Gpu::addr_t query_buffer_ppgtt(Gpu::Buffer_id id) override {
|
||||
return call<Rpc_query_buffer_ppgtt>(id); }
|
||||
|
||||
bool set_tiling(Buffer_id id, unsigned mode) override {
|
||||
return call<Rpc_set_tiling>(id, mode); }
|
||||
};
|
||||
|
@ -197,7 +197,14 @@ struct Gpu::Session : public Genode::Session
|
||||
*
|
||||
* \param id buffer id
|
||||
*/
|
||||
virtual void unmap_buffer_ppgtt(Buffer_id id, Gpu::addr_t) = 0;
|
||||
virtual void unmap_buffer_ppgtt(Buffer_id id, Gpu::addr_t va) = 0;
|
||||
|
||||
/**
|
||||
* Get virtual address of buffer in the PPGTT
|
||||
*
|
||||
* \param id buffer id to be associated with the buffer
|
||||
*/
|
||||
virtual Gpu::addr_t query_buffer_ppgtt(Buffer_id) = 0;
|
||||
|
||||
/**
|
||||
* Set tiling for buffer
|
||||
@ -237,6 +244,7 @@ struct Gpu::Session : public Genode::Session
|
||||
Gpu::Buffer_id, Gpu::addr_t);
|
||||
GENODE_RPC(Rpc_unmap_buffer_ppgtt, void, unmap_buffer_ppgtt,
|
||||
Gpu::Buffer_id, Gpu::addr_t);
|
||||
GENODE_RPC(Rpc_query_buffer_ppgtt, Gpu::addr_t, query_buffer_ppgtt, Gpu::Buffer_id);
|
||||
GENODE_RPC(Rpc_set_tiling, bool, set_tiling,
|
||||
Gpu::Buffer_id, unsigned);
|
||||
|
||||
@ -244,7 +252,7 @@ struct Gpu::Session : public Genode::Session
|
||||
Rpc_complete, Rpc_completion_sigh, Rpc_alloc_buffer,
|
||||
Rpc_free_buffer, Rpc_export_buffer, Rpc_import_buffer,
|
||||
Rpc_map_buffer, Rpc_unmap_buffer,
|
||||
Rpc_map_buffer_ppgtt, Rpc_unmap_buffer_ppgtt,
|
||||
Rpc_map_buffer_ppgtt, Rpc_unmap_buffer_ppgtt, Rpc_query_buffer_ppgtt,
|
||||
Rpc_set_tiling);
|
||||
};
|
||||
|
||||
|
@ -2016,6 +2016,23 @@ class Gpu::Session_component : public Genode::Session_object<Gpu::Session>
|
||||
_apply_buffer_local(id, lookup_and_unmap);
|
||||
}
|
||||
|
||||
Gpu::addr_t query_buffer_ppgtt(Gpu::Buffer_id id) override
|
||||
{
|
||||
Gpu::addr_t result = (Gpu::addr_t)-1;
|
||||
|
||||
auto lookup_va = [&] (Buffer_local &buffer_local) {
|
||||
|
||||
if (!buffer_local.ppgtt_va_valid) {
|
||||
Genode::error("buffer not mapped");
|
||||
return;
|
||||
}
|
||||
|
||||
result = buffer_local.ppgtt_va;
|
||||
};
|
||||
_apply_buffer_local(id, lookup_va);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool set_tiling(Gpu::Buffer_id id,
|
||||
Genode::uint32_t const mode) override
|
||||
{
|
||||
|
@ -113,6 +113,11 @@ class Black_hole::Gpu_session : public Session_object<Gpu::Session>
|
||||
Gpu::addr_t /* va */) override
|
||||
{ }
|
||||
|
||||
Gpu::addr_t query_buffer_ppgtt(Buffer_id /* id */) override
|
||||
{
|
||||
return (Gpu::addr_t)-1;
|
||||
}
|
||||
|
||||
bool set_tiling(Buffer_id /* id */,
|
||||
uint32_t const /* mode */) override
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user