backends/drm: zero metadata for unused planes

The kernel may fail requests if data for unused planes is non-zero.
This commit is contained in:
Xaver Hugl 2022-05-06 18:30:19 +02:00
parent 14cf7524b6
commit 788ae5891a

View file

@ -32,27 +32,39 @@ namespace KWin
static std::array<uint32_t, 4> getHandles(gbm_bo *bo)
{
std::array<uint32_t, 4> ret;
for (int i = 0; i < gbm_bo_get_plane_count(bo); i++) {
int i = 0;
for (; i < gbm_bo_get_plane_count(bo); i++) {
ret[i] = gbm_bo_get_handle(bo).u32;
}
for (; i < 4; i++) {
ret[i] = 0;
}
return ret;
}
static std::array<uint32_t, 4> getStrides(gbm_bo *bo)
{
std::array<uint32_t, 4> ret;
for (int i = 0; i < gbm_bo_get_plane_count(bo); i++) {
int i = 0;
for (; i < gbm_bo_get_plane_count(bo); i++) {
ret[i] = gbm_bo_get_stride_for_plane(bo, i);
}
for (; i < 4; i++) {
ret[i] = 0;
}
return ret;
}
static std::array<uint32_t, 4> getOffsets(gbm_bo *bo)
{
std::array<uint32_t, 4> ret;
for (int i = 0; i < gbm_bo_get_plane_count(bo); i++) {
int i = 0;
for (; i < gbm_bo_get_plane_count(bo); i++) {
ret[i] = gbm_bo_get_offset(bo, i);
}
for (; i < 4; i++) {
ret[i] = 0;
}
return ret;
}