class RdmaEngine

Defined at line 160 of file ../../src/graphics/display/drivers/amlogic-display/rdma.h

RDMA Operation Design (non-AFBC):

Allocate RdmaRegionSize() of physical contiguous memory. This region will include

kNumberOfTables of RDMA Tables.

RDMA Tables will get populated with

<reg

>

<val

> pairs. The last element will be a unique

stamp for a given configuration. The stamp is used to verify how far the RDMA channel was able

to write at vsync time.

_______________

|

<reg

>

<val

> |

|

<reg

>

<val

> |

|... |

|

<Config

Stamp> |

|_______________|

|

<reg

>

<val

> |

|

<reg

>

<val

> |

|... |

|

<Config

Stamp> |

|_______________|

.

.

.

|

<reg

>

<val

> |

|

<reg

>

<val

> |

|... |

|

<Config

Stamp> |

|_______________|

|

<reg

>

<val

> |

|

<reg

>

<val

> |

|... |

|

<Config

Stamp> |

|_______________|

The physical and virtual addresses of the above tables are stored in rdma_chnl_container_

Each table contains a specific configuration to be applied at Vsync time. RDMA is programmed

to read from [start_index_used_ end_index_used_] inclusive. If more than one configuration is

applied within a vsync period, the new configuration will get added at the

next sequential index and RDMA end_index_used_ will get updated.

rdma_usage_table_ is used to keep track of tables being used by RDMA. rdma_usage_table_ may

contain three possible values:

kRdmaTableReady: This index may be used by RDMA

kRdmaTableUnavailable: This index is unavailble

<config

stamp>: This index includes a valid config. The stored value corresponds to the first

image handle that is contained in the config (we currently assume 1 image per

config).

The client of the Osd instance is expected to call Osd::GetLastConfigStampApplied() on every

vsync interrupt to obtain the most recently applied config. This method checks if a previously

scheduled RDMA (via Osd::FlipOnVsync) has completed, and if so, checks how far the RDMA was able

to write by comparing the "Config Stamp" in a scratch register to rdma_usage_table_. If RDMA did

not apply all the configs, it will re-schedule a new RDMA transaction.

Public Methods

zx::result<std::unique_ptr<RdmaEngine>> Create (fidl::UnownedClientEnd<fuchsia_hardware_platform_device::Device> platform_device, inspect::Node * video_input_unit_node)

Factory method intended for production use.

`platform_device` must be valid.

`video_input_unit_node` must outlive the RdmaEngine instance.

Defined at line 39 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void RdmaEngine (fdf::MmioBuffer vpu_mmio, zx::bti dma_bti, zx::interrupt rdma_done_interrupt, fdf::SynchronizedDispatcher irq_handler_dispatcher, inspect::Node * node)

Production code should prefer the `Create()` factory method.

`vpu_mmio` is the region documented as "VPU" in Section 8.1 "Memory Map"

of the AMLogic A311D datasheet. It must be valid.

`dma_bti` maps to the DMA BTI board resource. It must be valid.

`rdma_done_interrupt` is the interrupt documented as "rdma_done_int" in

Section 8.10.2 "Interrupt Source" of the AMLogic A311D datasheet. It must

be valid.

`irq_handler_dispatcher` must not be null.

`node` must outlive the RdmaEngine.

Defined at line 87 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

zx_status_t SetupRdma ()

This must be called before any other methods.

Defined at line 302 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void Release ()

Drop all hardware resources prior to destruction.

Defined at line 528 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void StopRdma ()

TODO(https://fxbug.dev/42135501): stop all channels for safer reloads.

Defined at line 413 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void ResetRdmaTable ()

Defined at line 214 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void SetRdmaTableValue (uint32_t table_index, uint32_t idx, uint32_t val)

Defined at line 243 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void FlushRdmaTable (uint32_t table_index)

Defined at line 250 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void ExecRdmaTable (uint32_t next_table_idx, display::DriverConfigStamp config_stamp, bool use_afbc)

Defined at line 260 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

int GetNextAvailableRdmaTableIndex ()

Defined at line 203 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

display::DriverConfigStamp GetLastConfigStampApplied ()

Defined at line 140 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void ResetConfigStamp (display::DriverConfigStamp config_stamp)

Defined at line 451 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void TryResolvePendingRdma ()

The following functions move the current RDMA state machine forward. If TryResolvePendingRdma

determines that RDMA has completed, it

- records the image handle of the most recently applied config based on scratch register

content,

- updates the RDMA usage table and reschedules RDMA for remaining configs that the RDMA

engine has not applied,

- writes to the RDMA control registers to clear and/or reschedule the RDMA interrupts.

This method must be called when RDMA is active.

Defined at line 105 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void ProcessRdmaUsageTable ()

Defined at line 148 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void SetAfbcRdmaTableValue (uint32_t val)

Defined at line 392 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void FlushAfbcRdmaTable ()

Defined at line 397 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

int RdmaIrqThread ()
void DumpLocked ()
void DumpRdmaRegisters ()

Defined at line 456 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc

void DumpRdmaState ()

Defined at line 486 of file ../../src/graphics/display/drivers/amlogic-display/rdma.cc