Skip to content

iris: Hack around gbm_gralloc stride restrictions

Kenneth Graunke requested to merge kwg/mesa:android-stride-hack into main

gbm_bo_map returns a stride for the mapping, which may differ from the stride of the underlying BO. Drivers may implement mappings via staging blits, returning a map of a temporary resource instead. That temporary may have fewer stride restrictions (i.e. it isn't used for display), and thus be more tightly packed, saving memory.

However, gbm_gralloc has a design flaw where after calling gbm_bo_map, it asserts that the stride exactly matches the original BO's stride:

   assert(stride == gbm_bo_get_stride(bo));

This is a bad assumption, as the GBM API returns a stride explicitly precisely because it -can- differ. But, this would require significant changes to gbm_gralloc to fix. So, to work around it, we add a driver hack for Android-only that forces staging maps of any external BO to use the original resource's stride.

This should fix issues with mapping cursor planes and SW media codec uploads on Android-x86.

Closes: #7974 (closed)

Edited by Kenneth Graunke

Merge request reports