23cd002cfad85087b3269fa33e9f8ecf20fab72f — Simon Ser 2 months ago afa09d6
drmtree: fix empty IN_FORMATS handling

Some drivers expose an empty IN_FORMATS prop (e.g. exynos).
1 files changed, 5 insertions(+), 1 deletions(-)

M drmtree/drmtree.go
M drmtree/drmtree.go => drmtree/drmtree.go +5 -1
@@ 606,7 606,11 @@ func (plane *Plane) Type() drm.PlaneType {
 
 func (plane *Plane) InFormats() []PlaneInFormatsModifier {
 	if inFormats, ok := plane.Properties["IN_FORMATS"]; ok {
-		return inFormats.Data.([]PlaneInFormatsModifier)
+		// Some drivers expose an empty IN_FORMATS property
+		fmts := inFormats.Data.([]PlaneInFormatsModifier)
+		if len(fmts) > 0 {
+			return fmts
+		}
 	}
 
 	return []PlaneInFormatsModifier{