backends/drm: Guard gbm_bo_get_fd_for_plane in dmaBufAttributesForBo
It is guarded elsewhere but not here. Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
This commit is contained in:
parent
701bfc71be
commit
1878ba0e10
1 changed files with 12 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "config-kwin.h"
|
||||
#include "dmabuftexture.h"
|
||||
|
||||
#include <gbm.h>
|
||||
|
@ -21,12 +22,23 @@ inline DmaBufAttributes dmaBufAttributesForBo(gbm_bo *bo)
|
|||
attributes.height = gbm_bo_get_height(bo);
|
||||
attributes.format = gbm_bo_get_format(bo);
|
||||
|
||||
#if HAVE_GBM_BO_GET_FD_FOR_PLANE
|
||||
for (int i = 0; i < attributes.planeCount; ++i) {
|
||||
attributes.fd[i] = gbm_bo_get_fd_for_plane(bo, i);
|
||||
attributes.offset[i] = gbm_bo_get_offset(bo, i);
|
||||
attributes.pitch[i] = gbm_bo_get_stride_for_plane(bo, i);
|
||||
attributes.modifier[i] = gbm_bo_get_modifier(bo);
|
||||
}
|
||||
#else
|
||||
if (attributes.planeCount > 1) {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
attributes.fd[0] = gbm_bo_get_fd(bo);
|
||||
attributes.offset[0] = gbm_bo_get_offset(bo, 0);
|
||||
attributes.pitch[0] = gbm_bo_get_stride_for_plane(bo, 0);
|
||||
attributes.modifier[0] = gbm_bo_get_modifier(bo);
|
||||
#endif
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue