blob: 874be1c8f8af815ff1846964c79a752cf22390c3 [file] [log] [blame]
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package graphics
import (
// dpPlusModels are models that have DP++ support in BIOS.
// This list contains models that have wrong bios setting as of 2020/10.
// Please contact chromeos-gfx@ team to edit the list if new device exposes dp++ support on purpose.
var dpPlusModels = []string{
// drallion family
"drallion", "drallion360",
// fizz family
"fizz", "jax", "kench", "sion", "teemo",
// nautilus family
"nautilus", "nautiluslte",
// nami family
"akali", "akali360", "bard", "ekko", "pantheon", "sona", "syndra", "vayne",
// octopus family
// puff family
"duffy", "faffy", "kaisa", "noibat", "puff", "wyvern",
// rammus family
"leona", "shyvana",
// sarien family
"arcada", "sarien",
// volteer family
"delbin", "volteer", "volteer2",
func init() {
Func: Connector,
Desc: "Checks the validity of display connector configurations",
Contacts: []string{
Attr: []string{"group:mainline"},
SoftwareDeps: []string{"no_qemu"},
Params: []testing.Param{
Name: "",
ExtraHardwareDeps: hwdep.D(hwdep.SkipOnModel(dpPlusModels...)),
}, {
Name: "bad_bios",
ExtraHardwareDeps: hwdep.D(hwdep.Model(dpPlusModels...)),
ExtraAttr: []string{"informational"},
// Connector checks various attributes of the connectors settings via modetest.
func Connector(ctx context.Context, s *testing.State) {
connectors, err := graphics.ModetestConnectors(ctx)
if err != nil {
s.Fatal("Failed to get connectors: ", err)
defer graphics.DumpModetestOnError(ctx, s.OutDir(), s.HasError)
if err := checkUniqueEncoders(ctx, connectors); err != nil {
s.Error("Failed to have check unique encoders: ", err)
// checkUniqueEncoders checks if every connector can be assigned a unique encoder concurrently.
func checkUniqueEncoders(ctx context.Context, connectors []*graphics.Connector) error {
g := graph.NewBipartite()
for _, connector := range connectors {
for _, encoder := range connector.Encoders {
g.AddEdge(connector.Cid, encoder)
maxMatch := g.MaxMatching()
if maxMatch != len(connectors) {
return errors.Errorf("not all connector has a unqiue encoder matching (expect %d but got %d)", len(connectors), maxMatch)
return nil