~emersion/drmdb

0b3ed7ec6f2380fd1eb7a83e8aac17e6fb566c38 — Simon Ser 2 years ago 182952a
Use String helpers for modifiers and formats
2 files changed, 4 insertions(+), 15 deletions(-)

M drmtree/drmtree.go
M server.go
M drmtree/drmtree.go => drmtree/drmtree.go +2 -6
@@ 435,14 435,10 @@ func (m *PropertyMap) FormatTree(tf treefmt.Formatter) {
			tf.Printf("%v", s)
			tfc := tf.NewChild()
			for _, mod := range val {
				if mod.Modifier == 0 {
					tfc.Printf("DRM_FORMAT_MOD_LINEAR")
				} else {
					tfc.Printf("%v modifier (0x%X)", mod.Modifier.Vendor(), mod.Modifier)
				}
				tfc.Printf("%v (0x%X)", mod.Modifier, mod.Modifier)
				tfcc := tfc.NewChild()
				for _, fmt := range mod.Formats {
					tfcc.Printf("%v", fmt)
					tfcc.Printf("%v (0x%X)", fmt, fmt)
				}
			}
		case []drm.Format:

M server.go => server.go +2 -9
@@ 154,13 154,6 @@ func loadPCIIDs() (vendors map[uint16]string, devices map[uint32]string, err err
	return vendors, devices, db.Close()
}

func modifierString(mod drm.Modifier) string {
	if mod == 0 {
		return "DRM_FORMAT_MOD_LINEAR"
	}
	return fmt.Sprintf("%v modifier (0x%X)", mod.Vendor(), mod)
}

func New() *echo.Echo {
	e := echo.New()



@@ 412,7 405,7 @@ func New() *echo.Echo {
			fmt drm.Format
		}
		type formatData struct {
			Modifier string
			Modifier drm.Modifier
			Format drm.Format
			Planes map[drm.PlaneType]int
			Drivers map[string]int


@@ 442,7 435,7 @@ func New() *echo.Echo {
						k := modifierAndFormat{mod.Modifier, fmt}
						if _, ok := formats[k]; !ok {
							formats[k] = formatData{
								Modifier: modifierString(mod.Modifier),
								Modifier: mod.Modifier,
								Format: fmt,
								Planes: make(map[drm.PlaneType]int),
								Drivers: make(map[string]int),