Compare commits
68 Commits
v0.4.4
..
bfd922fde3
| Author | SHA1 | Date | |
|---|---|---|---|
|
bfd922fde3
|
|||
|
b121f74b4e
|
|||
|
9be165d6ee
|
|||
|
1c55e7c772
|
|||
|
a981d185cf
|
|||
|
d91951ca97
|
|||
|
09a2ffc3bc
|
|||
|
a6444658da
|
|||
|
ed5615033c
|
|||
|
d1319a497c
|
|||
|
cf7c34555c
|
|||
|
d96eecded0
|
|||
|
6863bcafd1
|
|||
|
39f023d0e5
|
|||
|
a8a2f692e7
|
|||
|
19f24c7206
|
|||
|
320432774a
|
|||
|
0721b0fe6d
|
|||
|
418e4a874d
|
|||
|
8378e7a2c9
|
|||
|
6210c9f272
|
|||
|
c2038fa925
|
|||
|
d797cca1f2
|
|||
|
2a51b433c8
|
|||
|
e5ce36532b
|
|||
|
4c647388b0
|
|||
|
3a5f4af114
|
|||
|
6195260480
|
|||
|
21044d5a60
|
|||
|
025810bf0f
|
|||
|
20354c0411
|
|||
|
9fbcd0daf2
|
|||
|
248f44a5a7
|
|||
|
401dd57cbc
|
|||
|
854bcc998b
|
|||
|
358247be5b
|
|||
|
f517a8ef07
|
|||
|
973218f91f
|
|||
|
0ea195837b
|
|||
|
1348991634
|
|||
|
14b445fde5
|
|||
|
218f7fa345
|
|||
|
cd493fd95f
|
|||
|
9db70c83e3
|
|||
|
4e09241e5f
|
|||
|
bd4b300ea6
|
|||
|
6dc8214a1a
|
|||
|
cada5a46ad
|
|||
|
e747942829
|
|||
|
33b855123e
|
|||
|
58ce134718
|
|||
|
2066093343
|
|||
|
07509b3ba2
|
|||
|
a7485d587a
|
|||
|
4892beefc1
|
|||
|
7ab54b8c94
|
|||
|
a4fab67811
|
|||
|
ed5cdd38a4
|
|||
|
f6318304ee
|
|||
|
cb618093d5
|
|||
|
b0b2471c0c
|
|||
|
344d2b8207
|
|||
|
3938e8bce5
|
|||
|
aee15b4f2a
|
|||
|
18b1103fdc
|
|||
|
c5a02da0f0
|
|||
|
c0c2f3233a
|
|||
|
bda00ac90e
|
+91
-18
@@ -8,6 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"hakurei.app/check"
|
"hakurei.app/check"
|
||||||
|
"hakurei.app/ext"
|
||||||
"hakurei.app/fhs"
|
"hakurei.app/fhs"
|
||||||
"hakurei.app/hst"
|
"hakurei.app/hst"
|
||||||
)
|
)
|
||||||
@@ -31,10 +32,19 @@ func parsePair(s string) (source, target *check.Absolute, err error) {
|
|||||||
|
|
||||||
// parse decodes a high-level configuration stream and returns its
|
// parse decodes a high-level configuration stream and returns its
|
||||||
// corresponding [hst.Config].
|
// corresponding [hst.Config].
|
||||||
func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) {
|
func parse(
|
||||||
|
id string,
|
||||||
|
base *check.Absolute,
|
||||||
|
r io.Reader,
|
||||||
|
templateP *string,
|
||||||
|
) (*hst.Config, error) {
|
||||||
shell := fhs.AbsRoot.Append("bin", "zsh")
|
shell := fhs.AbsRoot.Append("bin", "zsh")
|
||||||
home := hst.AbsPrivateTmp.Append("home")
|
home := hst.AbsPrivateTmp.Append("home")
|
||||||
|
|
||||||
|
root := hst.FSOverlay{
|
||||||
|
Target: fhs.AbsRoot,
|
||||||
|
Lower: []*check.Absolute{base.Append("initial")},
|
||||||
|
}
|
||||||
c := hst.Config{
|
c := hst.Config{
|
||||||
ID: id,
|
ID: id,
|
||||||
Enablements: new(hst.Enablements),
|
Enablements: new(hst.Enablements),
|
||||||
@@ -51,13 +61,7 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) {
|
|||||||
Container: &hst.ContainerConfig{
|
Container: &hst.ContainerConfig{
|
||||||
Env: make(map[string]string),
|
Env: make(map[string]string),
|
||||||
Filesystem: []hst.FilesystemConfigJSON{
|
Filesystem: []hst.FilesystemConfigJSON{
|
||||||
{FilesystemConfig: &hst.FSOverlay{
|
{FilesystemConfig: &root},
|
||||||
Target: fhs.AbsRoot,
|
|
||||||
Lower: []*check.Absolute{
|
|
||||||
base.Append("template", "initial"),
|
|
||||||
},
|
|
||||||
Upper: base.Append("template", "upper"),
|
|
||||||
}},
|
|
||||||
{FilesystemConfig: &hst.FSBind{
|
{FilesystemConfig: &hst.FSBind{
|
||||||
Target: home,
|
Target: home,
|
||||||
Source: base.Append("state", id),
|
Source: base.Append("state", id),
|
||||||
@@ -70,12 +74,6 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) {
|
|||||||
Write: true,
|
Write: true,
|
||||||
Perm: 01777,
|
Perm: 01777,
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{FilesystemConfig: &hst.FSBind{Source: fhs.AbsSys.Append("block")}},
|
|
||||||
{FilesystemConfig: &hst.FSBind{Source: fhs.AbsSys.Append("bus")}},
|
|
||||||
{FilesystemConfig: &hst.FSBind{Source: fhs.AbsSys.Append("class")}},
|
|
||||||
{FilesystemConfig: &hst.FSBind{Source: fhs.AbsSys.Append("dev")}},
|
|
||||||
{FilesystemConfig: &hst.FSBind{Source: fhs.AbsSys.Append("devices")}},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Username: "chronos",
|
Username: "chronos",
|
||||||
@@ -102,19 +100,26 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) {
|
|||||||
if err := scanOnce(); err != nil {
|
if err := scanOnce(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if v, err := strconv.Atoi(s.Text()); err != nil {
|
if template, identity, ok := strings.Cut(s.Text(), ":"); !ok {
|
||||||
|
return nil, io.ErrUnexpectedEOF
|
||||||
|
} else if v, err := strconv.Atoi(identity); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
|
if templateP != nil {
|
||||||
|
*templateP = template
|
||||||
|
}
|
||||||
c.Identity = v
|
c.Identity = v
|
||||||
|
root.Upper = base.Append("template", template)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := scanOnce(); err != nil {
|
if err := scanOnce(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
c.Container.Args = append(c.Container.Args, s.Text())
|
c.Container.Args = append(c.Container.Args, s.Text(), "")
|
||||||
|
|
||||||
var flagGPU, flagSystemBus bool
|
var flagInteractive, flagGPU, flagSystemBus bool
|
||||||
flags := map[string]*bool{
|
flags := map[string]*bool{
|
||||||
|
"interactive": &flagInteractive,
|
||||||
"gpu": &flagGPU,
|
"gpu": &flagGPU,
|
||||||
"system_bus": &flagSystemBus,
|
"system_bus": &flagSystemBus,
|
||||||
}
|
}
|
||||||
@@ -176,10 +181,43 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch key {
|
switch key {
|
||||||
|
case "username":
|
||||||
|
c.Container.Username = value
|
||||||
|
continue
|
||||||
|
|
||||||
|
case "hostname":
|
||||||
|
c.Container.Hostname = value
|
||||||
|
continue
|
||||||
|
|
||||||
case "group":
|
case "group":
|
||||||
c.Groups = append(c.Groups, value)
|
c.Groups = append(c.Groups, value)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
case "sched_policy":
|
||||||
|
if err := c.SchedPolicy.UnmarshalText([]byte(value)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
|
||||||
|
case "sched_priority":
|
||||||
|
v, err := strconv.Atoi(value)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
c.SchedPriority = ext.Int(v)
|
||||||
|
continue
|
||||||
|
|
||||||
|
case "insecure":
|
||||||
|
switch value {
|
||||||
|
case "pipewire":
|
||||||
|
*c.Enablements |= hst.EPipeWire
|
||||||
|
c.DirectPipeWire = true
|
||||||
|
continue
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("invalid insecure flag %q", value)
|
||||||
|
}
|
||||||
|
|
||||||
case "env":
|
case "env":
|
||||||
if key, value, ok = strings.Cut(value, "="); !ok {
|
if key, value, ok = strings.Cut(value, "="); !ok {
|
||||||
return nil, fmt.Errorf("invalid environment %q", key)
|
return nil, fmt.Errorf("invalid environment %q", key)
|
||||||
@@ -200,6 +238,20 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) {
|
|||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
case "ro+":
|
||||||
|
source, target, err := parsePair(value)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
c.Container.Filesystem = append(c.Container.Filesystem,
|
||||||
|
hst.FilesystemConfigJSON{FilesystemConfig: &hst.FSBind{
|
||||||
|
Target: target,
|
||||||
|
Source: source,
|
||||||
|
Optional: true,
|
||||||
|
}},
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
|
||||||
case "rw":
|
case "rw":
|
||||||
source, target, err := parsePair(value)
|
source, target, err := parsePair(value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -214,6 +266,20 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) {
|
|||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
case "dev":
|
||||||
|
source, target, err := parsePair(value)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
c.Container.Filesystem = append(c.Container.Filesystem,
|
||||||
|
hst.FilesystemConfigJSON{FilesystemConfig: &hst.FSBind{
|
||||||
|
Target: target,
|
||||||
|
Source: source,
|
||||||
|
Device: true,
|
||||||
|
}},
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
|
||||||
case "own":
|
case "own":
|
||||||
c.SessionBus.Own = append(c.SessionBus.Own, value)
|
c.SessionBus.Own = append(c.SessionBus.Own, value)
|
||||||
continue
|
continue
|
||||||
@@ -236,6 +302,10 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if flagInteractive {
|
||||||
|
c.Container.Args[1] += "i"
|
||||||
|
}
|
||||||
|
|
||||||
if flagGPU {
|
if flagGPU {
|
||||||
c.Container.Filesystem = append(c.Container.Filesystem, []hst.FilesystemConfigJSON{
|
c.Container.Filesystem = append(c.Container.Filesystem, []hst.FilesystemConfigJSON{
|
||||||
{FilesystemConfig: &hst.FSBind{
|
{FilesystemConfig: &hst.FSBind{
|
||||||
@@ -250,7 +320,10 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) {
|
|||||||
c.SystemBus = nil
|
c.SystemBus = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Container.Flags&hst.FShareTmpdir == 0 {
|
if c.Container.Flags&hst.FShareTmpdir == 0 &&
|
||||||
|
(c.Enablements.Unwrap()&hst.EX11 == 0 ||
|
||||||
|
c.Container.Flags&(hst.FHostNet|hst.FHostAbstract) ==
|
||||||
|
hst.FHostNet|hst.FHostAbstract) {
|
||||||
c.Container.Filesystem = append(c.Container.Filesystem,
|
c.Container.Filesystem = append(c.Container.Filesystem,
|
||||||
hst.FilesystemConfigJSON{FilesystemConfig: &hst.FSEphemeral{
|
hst.FilesystemConfigJSON{FilesystemConfig: &hst.FSEphemeral{
|
||||||
Target: fhs.AbsTmp,
|
Target: fhs.AbsTmp,
|
||||||
|
|||||||
+5
-9
@@ -20,7 +20,7 @@ func TestParse(t *testing.T) {
|
|||||||
want *hst.Config
|
want *hst.Config
|
||||||
err error
|
err error
|
||||||
}{
|
}{
|
||||||
{"com.discordapp.Discord", `8
|
{"com.discordapp.Discord", `nonfree:8
|
||||||
exec Discord --ozone-platform-hint=wayland
|
exec Discord --ozone-platform-hint=wayland
|
||||||
|
|
||||||
gpu
|
gpu
|
||||||
@@ -74,9 +74,9 @@ talk com.canonical.Unity
|
|||||||
{FilesystemConfig: &hst.FSOverlay{
|
{FilesystemConfig: &hst.FSOverlay{
|
||||||
Target: fhs.AbsRoot,
|
Target: fhs.AbsRoot,
|
||||||
Lower: []*check.Absolute{
|
Lower: []*check.Absolute{
|
||||||
base.Append("template", "initial"),
|
base.Append("initial"),
|
||||||
},
|
},
|
||||||
Upper: base.Append("template", "upper"),
|
Upper: base.Append("template", "nonfree"),
|
||||||
}},
|
}},
|
||||||
{FilesystemConfig: &hst.FSBind{
|
{FilesystemConfig: &hst.FSBind{
|
||||||
Target: hst.AbsPrivateTmp.Append("home"),
|
Target: hst.AbsPrivateTmp.Append("home"),
|
||||||
@@ -91,12 +91,6 @@ talk com.canonical.Unity
|
|||||||
Perm: 01777,
|
Perm: 01777,
|
||||||
}},
|
}},
|
||||||
|
|
||||||
{FilesystemConfig: &hst.FSBind{Source: fhs.AbsSys.Append("block")}},
|
|
||||||
{FilesystemConfig: &hst.FSBind{Source: fhs.AbsSys.Append("bus")}},
|
|
||||||
{FilesystemConfig: &hst.FSBind{Source: fhs.AbsSys.Append("class")}},
|
|
||||||
{FilesystemConfig: &hst.FSBind{Source: fhs.AbsSys.Append("dev")}},
|
|
||||||
{FilesystemConfig: &hst.FSBind{Source: fhs.AbsSys.Append("devices")}},
|
|
||||||
|
|
||||||
{FilesystemConfig: &hst.FSBind{
|
{FilesystemConfig: &hst.FSBind{
|
||||||
Source: check.MustAbs("/sdcard"),
|
Source: check.MustAbs("/sdcard"),
|
||||||
Write: true,
|
Write: true,
|
||||||
@@ -120,6 +114,7 @@ talk com.canonical.Unity
|
|||||||
Args: []string{
|
Args: []string{
|
||||||
"zsh", "-c",
|
"zsh", "-c",
|
||||||
"exec Discord --ozone-platform-hint=wayland",
|
"exec Discord --ozone-platform-hint=wayland",
|
||||||
|
"",
|
||||||
},
|
},
|
||||||
|
|
||||||
Flags: hst.FCoverRun | hst.FUserns | hst.FHostNet | hst.FMapRealUID |
|
Flags: hst.FCoverRun | hst.FUserns | hst.FHostNet | hst.FMapRealUID |
|
||||||
@@ -135,6 +130,7 @@ talk com.canonical.Unity
|
|||||||
tc.name,
|
tc.name,
|
||||||
base,
|
base,
|
||||||
strings.NewReader(tc.data),
|
strings.NewReader(tc.data),
|
||||||
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
if !reflect.DeepEqual(err, tc.err) {
|
if !reflect.DeepEqual(err, tc.err) {
|
||||||
|
|||||||
+112
@@ -0,0 +1,112 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"hakurei.app/check"
|
||||||
|
"hakurei.app/fhs"
|
||||||
|
"hakurei.app/hst"
|
||||||
|
"hakurei.app/internal/env"
|
||||||
|
"hakurei.app/internal/lockedfile"
|
||||||
|
"hakurei.app/internal/outcome"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MutationConflictError describes an active mutable instance.
|
||||||
|
type MutationConflictError string
|
||||||
|
|
||||||
|
func (e MutationConflictError) Error() string {
|
||||||
|
return "mutable instance active at " + string(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
// informTemplate guards intention of a template or its derivatives.
|
||||||
|
func informTemplate(base *check.Absolute, name string, mutable bool) (func() error, error) {
|
||||||
|
mu := lockedfile.MutexAt(base.Append("lock", name).String())
|
||||||
|
if unlock, err := mu.Lock(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
defer unlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
marker := base.Append("lock", "."+name)
|
||||||
|
if p, err := os.ReadFile(marker.String()); err == nil {
|
||||||
|
if _, err = os.Stat(fhs.AbsProc.Append(string(p)).String()); err == nil {
|
||||||
|
return nil, MutationConflictError(p)
|
||||||
|
} else if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Printf("removing stale marker by %s", string(p))
|
||||||
|
if err = os.Remove(marker.String()); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if !mutable {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var active []hst.ID
|
||||||
|
var sc hst.Paths
|
||||||
|
env.CopyPaths().Copy(&sc, new(outcome.Hsu).MustID(nil))
|
||||||
|
entries, copyError := outcome.NewStore(&sc).All()
|
||||||
|
var s hst.State
|
||||||
|
for eh := range entries {
|
||||||
|
s = hst.State{}
|
||||||
|
if _, err := eh.Load(&s); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.Validate(0) != nil || len(s.Container.Filesystem) < 1 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
root, ok := s.Container.Filesystem[0].FilesystemConfig.(*hst.FSOverlay)
|
||||||
|
if !ok || root == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if !root.Target.Is(fhs.AbsRoot) ||
|
||||||
|
len(root.Lower) != 1 ||
|
||||||
|
!root.Lower[0].Is(base.Append("initial")) ||
|
||||||
|
!root.Upper.Is(base.Append("template", name)) ||
|
||||||
|
root.Work != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
active = append(active, s.ID)
|
||||||
|
}
|
||||||
|
if err := copyError(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(active) != 0 {
|
||||||
|
var buf strings.Builder
|
||||||
|
buf.WriteString("derivative instances still active:")
|
||||||
|
for _, id := range active {
|
||||||
|
buf.WriteString("\n\t")
|
||||||
|
buf.WriteString(id.String())
|
||||||
|
}
|
||||||
|
return nil, errors.New(buf.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
return func() error { return os.RemoveAll(marker.String()) }, os.WriteFile(
|
||||||
|
marker.String(),
|
||||||
|
[]byte(strconv.Itoa(os.Getpid())),
|
||||||
|
0400,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// acquireTemplate obtains exclusivity of a template.
|
||||||
|
func acquireTemplate(base *check.Absolute, name string) (remove func() error, err error) {
|
||||||
|
return informTemplate(base, name, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// enterTemplate checks against exclusivity of a template.
|
||||||
|
func enterTemplate(base *check.Absolute, name string) error {
|
||||||
|
_, err := informTemplate(base, name, false)
|
||||||
|
return err
|
||||||
|
}
|
||||||
+93
-16
@@ -7,6 +7,8 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@@ -33,8 +35,9 @@ func main() {
|
|||||||
var (
|
var (
|
||||||
flagVerbose bool
|
flagVerbose bool
|
||||||
flagBase string
|
flagBase string
|
||||||
|
flagInsecure bool
|
||||||
|
|
||||||
base, template, initial, upper, work *check.Absolute
|
base, template, initial *check.Absolute
|
||||||
)
|
)
|
||||||
c := command.New(os.Stderr, log.Printf, "app", func([]string) (err error) {
|
c := command.New(os.Stderr, log.Printf, "app", func([]string) (err error) {
|
||||||
msg.SwapVerbose(flagVerbose)
|
msg.SwapVerbose(flagVerbose)
|
||||||
@@ -49,9 +52,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template = base.Append("template")
|
template = base.Append("template")
|
||||||
initial = template.Append("initial")
|
initial = base.Append("initial")
|
||||||
upper = template.Append("upper")
|
|
||||||
work = template.Append("work")
|
|
||||||
return
|
return
|
||||||
}).Flag(
|
}).Flag(
|
||||||
&flagVerbose,
|
&flagVerbose,
|
||||||
@@ -59,8 +60,12 @@ func main() {
|
|||||||
"Increase log verbosity",
|
"Increase log verbosity",
|
||||||
).Flag(
|
).Flag(
|
||||||
&flagBase,
|
&flagBase,
|
||||||
"d", command.StringFlag("$HAKUREI_APP_PATH"),
|
"d", command.StringFlag("$ROSA_APP_PATH"),
|
||||||
"Configuration and state directory",
|
"Configuration and state directory",
|
||||||
|
).Flag(
|
||||||
|
&flagInsecure,
|
||||||
|
"insecure", command.BoolFlag(false),
|
||||||
|
"Allow use of insecure compatibility options",
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -70,17 +75,31 @@ func main() {
|
|||||||
)
|
)
|
||||||
c.NewCommand(
|
c.NewCommand(
|
||||||
"enter", "Enter mutable state template",
|
"enter", "Enter mutable state template",
|
||||||
func([]string) error {
|
func(args []string) error {
|
||||||
|
if len(args) != 1 {
|
||||||
|
dents, err := os.ReadDir(template.String())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, dent := range dents {
|
||||||
|
if !dent.IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fmt.Println(dent.Name())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
config := hst.Config{
|
config := hst.Config{
|
||||||
ID: "app.hakurei.mutable",
|
ID: "app.hakurei.mutable." + args[0],
|
||||||
Container: &hst.ContainerConfig{
|
Container: &hst.ContainerConfig{
|
||||||
Hostname: "mutable",
|
Hostname: args[0] + "-mutable",
|
||||||
Filesystem: []hst.FilesystemConfigJSON{
|
Filesystem: []hst.FilesystemConfigJSON{
|
||||||
{FilesystemConfig: &hst.FSOverlay{
|
{FilesystemConfig: &hst.FSOverlay{
|
||||||
Target: fhs.AbsRoot,
|
Target: fhs.AbsRoot,
|
||||||
Lower: []*check.Absolute{initial},
|
Lower: []*check.Absolute{initial},
|
||||||
Upper: upper,
|
Upper: template.Append(args[0]),
|
||||||
Work: work,
|
Work: base.Append("work", args[0]),
|
||||||
}},
|
}},
|
||||||
{FilesystemConfig: &hst.FSEphemeral{
|
{FilesystemConfig: &hst.FSEphemeral{
|
||||||
Target: fhs.AbsTmp,
|
Target: fhs.AbsTmp,
|
||||||
@@ -89,7 +108,8 @@ func main() {
|
|||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
Username: "chronos",
|
Username: "chronos",
|
||||||
Flags: hst.FMultiarch |
|
Flags: hst.FNoPlace |
|
||||||
|
hst.FMultiarch |
|
||||||
hst.FDevel |
|
hst.FDevel |
|
||||||
hst.FUserns |
|
hst.FUserns |
|
||||||
hst.FHostNet |
|
hst.FHostNet |
|
||||||
@@ -113,7 +133,12 @@ func main() {
|
|||||||
config.Container.Home = a
|
config.Container.Home = a
|
||||||
}
|
}
|
||||||
|
|
||||||
return run(ctx, msg, &config)
|
remove, err := acquireTemplate(base, args[0])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = run(ctx, msg, false, &config)
|
||||||
|
return errors.Join(err, remove())
|
||||||
},
|
},
|
||||||
).Flag(
|
).Flag(
|
||||||
&flagShell,
|
&flagShell,
|
||||||
@@ -126,29 +151,75 @@ func main() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
var (
|
||||||
|
flagCommand string
|
||||||
|
)
|
||||||
c.NewCommand(
|
c.NewCommand(
|
||||||
"run", "Start the named application",
|
"run", "Start the named application",
|
||||||
func(args []string) error {
|
func(args []string) error {
|
||||||
if len(args) != 1 {
|
if len(args) < 1 {
|
||||||
return errors.New("run requires 1 argument")
|
dents, err := os.ReadDir(base.Append("app").String())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, dent := range dents {
|
||||||
|
if dent.IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fmt.Println(dent.Name())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var config *hst.Config
|
var config *hst.Config
|
||||||
|
var r io.Reader
|
||||||
f, err := os.Open(base.Append("app", args[0]).String())
|
f, err := os.Open(base.Append("app", args[0]).String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
config, err = parse(args[0], base, f)
|
r = f
|
||||||
|
|
||||||
|
var common *os.File
|
||||||
|
if common, err = os.Open(base.Append("common").String()); err != nil {
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
_ = f.Close()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
r = io.MultiReader(f, common)
|
||||||
|
}
|
||||||
|
|
||||||
|
var name string
|
||||||
|
config, err = parse(args[0], base, r, &name)
|
||||||
if closeErr := f.Close(); err == nil {
|
if closeErr := f.Close(); err == nil {
|
||||||
err = closeErr
|
err = closeErr
|
||||||
}
|
}
|
||||||
|
if common != nil {
|
||||||
|
if closeErr := common.Close(); err == nil {
|
||||||
|
err = closeErr
|
||||||
|
}
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return run(ctx, msg, config)
|
if flagCommand != "" {
|
||||||
|
config.Container.Args[2] = flagCommand
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = enterTemplate(base, name); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return run(ctx, msg, flagInsecure, config, args[1:]...)
|
||||||
},
|
},
|
||||||
|
).
|
||||||
|
Flag(
|
||||||
|
&flagCommand,
|
||||||
|
"command", command.StringFlag(""),
|
||||||
|
"Override configured command",
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
c.MustParse(os.Args[1:], func(err error) {
|
c.MustParse(os.Args[1:], func(err error) {
|
||||||
if e, ok := errors.AsType[*exec.ExitError](err); ok && e != nil {
|
if e, ok := errors.AsType[*exec.ExitError](err); ok && e != nil {
|
||||||
@@ -156,7 +227,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if w, ok := err.(interface{ Unwrap() []error }); !ok {
|
if w, ok := err.(interface{ Unwrap() []error }); !ok {
|
||||||
|
var m string
|
||||||
|
m, ok = message.GetMessage(err)
|
||||||
|
if !ok {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Fatal(m)
|
||||||
} else {
|
} else {
|
||||||
errs := w.Unwrap()
|
errs := w.Unwrap()
|
||||||
for i, e := range errs {
|
for i, e := range errs {
|
||||||
|
|||||||
+11
-1
@@ -12,7 +12,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// run starts a container via cmd/hakurei and returns after it terminates.
|
// run starts a container via cmd/hakurei and returns after it terminates.
|
||||||
func run(ctx context.Context, msg message.Msg, config *hst.Config) error {
|
func run(
|
||||||
|
ctx context.Context,
|
||||||
|
msg message.Msg,
|
||||||
|
insecure bool,
|
||||||
|
config *hst.Config,
|
||||||
|
args ...string,
|
||||||
|
) error {
|
||||||
c, cancel := context.WithCancel(ctx)
|
c, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@@ -24,7 +30,11 @@ func run(ctx context.Context, msg message.Msg, config *hst.Config) error {
|
|||||||
if msg.IsVerbose() {
|
if msg.IsVerbose() {
|
||||||
cmd.Args = append(cmd.Args, "-v")
|
cmd.Args = append(cmd.Args, "-v")
|
||||||
}
|
}
|
||||||
|
if insecure {
|
||||||
|
cmd.Args = append(cmd.Args, "--insecure")
|
||||||
|
}
|
||||||
cmd.Args = append(cmd.Args, "run", "3")
|
cmd.Args = append(cmd.Args, "run", "3")
|
||||||
|
cmd.Args = append(cmd.Args, args...)
|
||||||
|
|
||||||
r, w, err := os.Pipe()
|
r, w, err := os.Pipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
v0.4.4
|
v0.4.5
|
||||||
|
|||||||
Vendored
+24
-9
@@ -35,8 +35,11 @@ func getenv(key, fallback string) string {
|
|||||||
|
|
||||||
// mustRun runs a command with the current process's environment and panics
|
// mustRun runs a command with the current process's environment and panics
|
||||||
// on error or non-zero exit code.
|
// on error or non-zero exit code.
|
||||||
func mustRun(ctx context.Context, name string, arg ...string) {
|
func mustRun(ctx context.Context, env []string, name string, arg ...string) {
|
||||||
cmd := exec.CommandContext(ctx, name, arg...)
|
cmd := exec.CommandContext(ctx, name, arg...)
|
||||||
|
if env != nil {
|
||||||
|
cmd.Env = append(cmd.Environ(), env...)
|
||||||
|
}
|
||||||
cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
|
cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@@ -49,6 +52,7 @@ var comp []byte
|
|||||||
func main() {
|
func main() {
|
||||||
log.SetFlags(0)
|
log.SetFlags(0)
|
||||||
log.SetPrefix("")
|
log.SetPrefix("")
|
||||||
|
log.SetOutput(os.Stdout)
|
||||||
|
|
||||||
verbose := os.Getenv("VERBOSE") != ""
|
verbose := os.Getenv("VERBOSE") != ""
|
||||||
runTests := os.Getenv("HAKUREI_DIST_MAKE") == ""
|
runTests := os.Getenv("HAKUREI_DIST_MAKE") == ""
|
||||||
@@ -91,26 +95,37 @@ func main() {
|
|||||||
verboseFlag = "-buildvcs=false"
|
verboseFlag = "-buildvcs=false"
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("Building hakurei for %s/%s.", runtime.GOOS, runtime.GOARCH)
|
log.Printf("Building hakurei %s for %s/%s.", version, runtime.GOOS, runtime.GOARCH)
|
||||||
mustRun(ctx, "go", "generate", "./...")
|
mustRun(ctx, nil, "go", "generate", "./...")
|
||||||
mustRun(
|
mustRun(
|
||||||
ctx, "go", "build",
|
ctx, nil, "go", "build",
|
||||||
"-trimpath",
|
"-trimpath",
|
||||||
verboseFlag, "-o", s,
|
verboseFlag, "-o", s,
|
||||||
"-ldflags=-s -w "+
|
"-ldflags=-s -w "+
|
||||||
"-buildid= -linkmode external -extldflags=-static "+
|
"-buildid= -linkmode external -extldflags=-static "+
|
||||||
"-X hakurei.app/internal/info.buildVersion="+version+" "+
|
"-X hakurei.app/internal/info.buildVersion="+version+" "+
|
||||||
"-X hakurei.app/internal/info.hakureiPath="+prefix+"/bin/hakurei "+
|
"-X hakurei.app/internal/info.hakureiPath="+prefix+"/bin/hakurei "+
|
||||||
"-X hakurei.app/internal/info.hsuPath="+prefix+"/bin/hsu "+
|
"-X hakurei.app/internal/info.hsuPath="+prefix+"/bin/hsu",
|
||||||
"-X main.hakureiPath="+prefix+"/bin/hakurei",
|
"./cmd/hakurei",
|
||||||
"./...",
|
"./cmd/sharefs",
|
||||||
)
|
)
|
||||||
log.Println()
|
|
||||||
|
|
||||||
|
log.Printf("Building cmd/hsu for %s/%s.", runtime.GOOS, runtime.GOARCH)
|
||||||
|
mustRun(
|
||||||
|
ctx, []string{"CGO_ENABLED=0"}, "go", "build",
|
||||||
|
"-trimpath",
|
||||||
|
verboseFlag, "-o", s,
|
||||||
|
"-ldflags=-s -w "+
|
||||||
|
"-buildid= "+
|
||||||
|
"-X main.hakureiPath="+prefix+"/bin/hakurei",
|
||||||
|
"./cmd/hsu",
|
||||||
|
)
|
||||||
|
|
||||||
|
log.Println()
|
||||||
if runTests {
|
if runTests {
|
||||||
log.Println("##### Testing Hakurei.")
|
log.Println("##### Testing Hakurei.")
|
||||||
mustRun(
|
mustRun(
|
||||||
ctx, "go", "test",
|
ctx, nil, "go", "test",
|
||||||
"-ldflags=-buildid= -linkmode external -extldflags=-static",
|
"-ldflags=-buildid= -linkmode external -extldflags=-static",
|
||||||
"./...",
|
"./...",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@@ -51,13 +52,14 @@ func init() {
|
|||||||
func fatal(v ...any) {
|
func fatal(v ...any) {
|
||||||
log.Println(v...)
|
log.Println(v...)
|
||||||
log.Println("unable to continue, please reboot and resolve the problem manually")
|
log.Println("unable to continue, please reboot and resolve the problem manually")
|
||||||
|
log.SetOutput(io.Discard)
|
||||||
select {}
|
select {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// must calls fatal with err if it is non-nil.
|
// must calls fatal with err if it is non-nil.
|
||||||
func must(err error) {
|
func must(err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
fatal(err)
|
||||||
select {}
|
select {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,9 @@ var _ report.RepresentableError = ModprobeError{}
|
|||||||
func (ModprobeError) Representable() {}
|
func (ModprobeError) Representable() {}
|
||||||
func (e ModprobeError) Error() string {
|
func (e ModprobeError) Error() string {
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"modprobe exit status %d: %s",
|
"%s (exit status %d)",
|
||||||
e.ExitCode, strings.TrimSpace(e.Stderr),
|
strings.TrimPrefix(strings.TrimSpace(e.Stderr), "modprobe: "),
|
||||||
|
e.ExitCode,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ func TestPrintShowInstance(t *testing.T) {
|
|||||||
Identity: 9 (org.chromium.Chromium)
|
Identity: 9 (org.chromium.Chromium)
|
||||||
Enablements: wayland, dbus, pipewire
|
Enablements: wayland, dbus, pipewire
|
||||||
Groups: video, dialout, plugdev
|
Groups: video, dialout, plugdev
|
||||||
Flags: multiarch, compat, devel, userns, net, abstract, tty, mapuid, device, cover_run, runtime, tmpdir
|
Flags: multiarch, compat, devel, userns, net, abstract, tty, mapuid, noplace, device, cover_run, runtime, tmpdir
|
||||||
Home: /data/data/org.chromium.Chromium
|
Home: /data/data/org.chromium.Chromium
|
||||||
Hostname: localhost
|
Hostname: localhost
|
||||||
Path: /run/current-system/sw/bin/chromium
|
Path: /run/current-system/sw/bin/chromium
|
||||||
@@ -161,7 +161,7 @@ App
|
|||||||
Identity: 9 (org.chromium.Chromium)
|
Identity: 9 (org.chromium.Chromium)
|
||||||
Enablements: wayland, dbus, pipewire
|
Enablements: wayland, dbus, pipewire
|
||||||
Groups: video, dialout, plugdev
|
Groups: video, dialout, plugdev
|
||||||
Flags: multiarch, compat, devel, userns, net, abstract, tty, mapuid, device, cover_run, runtime, tmpdir
|
Flags: multiarch, compat, devel, userns, net, abstract, tty, mapuid, noplace, device, cover_run, runtime, tmpdir
|
||||||
Home: /data/data/org.chromium.Chromium
|
Home: /data/data/org.chromium.Chromium
|
||||||
Hostname: localhost
|
Hostname: localhost
|
||||||
Path: /run/current-system/sw/bin/chromium
|
Path: /run/current-system/sw/bin/chromium
|
||||||
@@ -354,6 +354,7 @@ App
|
|||||||
"tty": true,
|
"tty": true,
|
||||||
"multiarch": true,
|
"multiarch": true,
|
||||||
"map_real_uid": true,
|
"map_real_uid": true,
|
||||||
|
"noplace": true,
|
||||||
"device": true,
|
"device": true,
|
||||||
"cover_run": true,
|
"cover_run": true,
|
||||||
"share_runtime": true,
|
"share_runtime": true,
|
||||||
@@ -506,6 +507,7 @@ App
|
|||||||
"tty": true,
|
"tty": true,
|
||||||
"multiarch": true,
|
"multiarch": true,
|
||||||
"map_real_uid": true,
|
"map_real_uid": true,
|
||||||
|
"noplace": true,
|
||||||
"device": true,
|
"device": true,
|
||||||
"cover_run": true,
|
"cover_run": true,
|
||||||
"share_runtime": true,
|
"share_runtime": true,
|
||||||
@@ -705,6 +707,7 @@ func TestPrintPs(t *testing.T) {
|
|||||||
"tty": true,
|
"tty": true,
|
||||||
"multiarch": true,
|
"multiarch": true,
|
||||||
"map_real_uid": true,
|
"map_real_uid": true,
|
||||||
|
"noplace": true,
|
||||||
"device": true,
|
"device": true,
|
||||||
"cover_run": true,
|
"cover_run": true,
|
||||||
"share_runtime": true,
|
"share_runtime": true,
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ const (
|
|||||||
// Some programs fail to connect to dbus session running as a different uid,
|
// Some programs fail to connect to dbus session running as a different uid,
|
||||||
// this option works around it by mapping priv-side caller uid in container.
|
// this option works around it by mapping priv-side caller uid in container.
|
||||||
FMapRealUID
|
FMapRealUID
|
||||||
|
// FNoPlace disables placement of /etc/passwd and /etc/group.
|
||||||
|
FNoPlace
|
||||||
|
|
||||||
// FDevice mount /dev/ from the init mount namespace as is in the container
|
// FDevice mount /dev/ from the init mount namespace as is in the container
|
||||||
// mount namespace.
|
// mount namespace.
|
||||||
@@ -101,6 +103,8 @@ func (flags Flags) String() string {
|
|||||||
return "tty"
|
return "tty"
|
||||||
case FMapRealUID:
|
case FMapRealUID:
|
||||||
return "mapuid"
|
return "mapuid"
|
||||||
|
case FNoPlace:
|
||||||
|
return "noplace"
|
||||||
case FDevice:
|
case FDevice:
|
||||||
return "device"
|
return "device"
|
||||||
case FCoverRun:
|
case FCoverRun:
|
||||||
@@ -197,6 +201,8 @@ type containerConfigJSON = struct {
|
|||||||
|
|
||||||
// Corresponds to [FMapRealUID].
|
// Corresponds to [FMapRealUID].
|
||||||
MapRealUID bool `json:"map_real_uid"`
|
MapRealUID bool `json:"map_real_uid"`
|
||||||
|
// Corresponds to [FNoPlace].
|
||||||
|
NoPlace bool `json:"noplace,omitempty"`
|
||||||
|
|
||||||
// Corresponds to [FDevice].
|
// Corresponds to [FDevice].
|
||||||
Device bool `json:"device,omitempty"`
|
Device bool `json:"device,omitempty"`
|
||||||
@@ -224,6 +230,7 @@ func (c *ContainerConfig) MarshalJSON() ([]byte, error) {
|
|||||||
Tty: c.Flags&FTty != 0,
|
Tty: c.Flags&FTty != 0,
|
||||||
Multiarch: c.Flags&FMultiarch != 0,
|
Multiarch: c.Flags&FMultiarch != 0,
|
||||||
MapRealUID: c.Flags&FMapRealUID != 0,
|
MapRealUID: c.Flags&FMapRealUID != 0,
|
||||||
|
NoPlace: c.Flags&FNoPlace != 0,
|
||||||
Device: c.Flags&FDevice != 0,
|
Device: c.Flags&FDevice != 0,
|
||||||
CoverRun: c.Flags&FCoverRun != 0,
|
CoverRun: c.Flags&FCoverRun != 0,
|
||||||
ShareRuntime: c.Flags&FShareRuntime != 0,
|
ShareRuntime: c.Flags&FShareRuntime != 0,
|
||||||
@@ -266,6 +273,9 @@ func (c *ContainerConfig) UnmarshalJSON(data []byte) error {
|
|||||||
if v.MapRealUID {
|
if v.MapRealUID {
|
||||||
c.Flags |= FMapRealUID
|
c.Flags |= FMapRealUID
|
||||||
}
|
}
|
||||||
|
if v.NoPlace {
|
||||||
|
c.Flags |= FNoPlace
|
||||||
|
}
|
||||||
if v.Device {
|
if v.Device {
|
||||||
c.Flags |= FDevice
|
c.Flags |= FDevice
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ func TestFlagsString(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{"none", 0, "none"},
|
{"none", 0, "none"},
|
||||||
{"none high", hst.FAll + 1, "none"},
|
{"none high", hst.FAll + 1, "none"},
|
||||||
{"all", hst.FAll, "multiarch, compat, devel, userns, net, abstract, tty, mapuid, device, cover_run, runtime, tmpdir"},
|
{"all", hst.FAll, "multiarch, compat, devel, userns, net, abstract, tty, mapuid, noplace, device, cover_run, runtime, tmpdir"},
|
||||||
{"all high", math.MaxUint, "multiarch, compat, devel, userns, net, abstract, tty, mapuid, device, cover_run, runtime, tmpdir"},
|
{"all high", math.MaxUint, "multiarch, compat, devel, userns, net, abstract, tty, mapuid, noplace, device, cover_run, runtime, tmpdir"},
|
||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
@@ -53,7 +53,7 @@ func TestContainerConfig(t *testing.T) {
|
|||||||
{"hostnet hostabstract mapuid", &hst.ContainerConfig{Flags: hst.FHostNet | hst.FHostAbstract | hst.FMapRealUID},
|
{"hostnet hostabstract mapuid", &hst.ContainerConfig{Flags: hst.FHostNet | hst.FHostAbstract | hst.FMapRealUID},
|
||||||
`{"env":null,"filesystem":null,"shell":null,"home":null,"args":null,"host_net":true,"host_abstract":true,"map_real_uid":true}`},
|
`{"env":null,"filesystem":null,"shell":null,"home":null,"args":null,"host_net":true,"host_abstract":true,"map_real_uid":true}`},
|
||||||
{"all", &hst.ContainerConfig{Flags: hst.FAll},
|
{"all", &hst.ContainerConfig{Flags: hst.FAll},
|
||||||
`{"env":null,"filesystem":null,"shell":null,"home":null,"args":null,"seccomp_compat":true,"devel":true,"userns":true,"host_net":true,"host_abstract":true,"tty":true,"multiarch":true,"map_real_uid":true,"device":true,"cover_run":true,"share_runtime":true,"share_tmpdir":true}`},
|
`{"env":null,"filesystem":null,"shell":null,"home":null,"args":null,"seccomp_compat":true,"devel":true,"userns":true,"host_net":true,"host_abstract":true,"tty":true,"multiarch":true,"map_real_uid":true,"noplace":true,"device":true,"cover_run":true,"share_runtime":true,"share_tmpdir":true}`},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
|||||||
+2
-2
@@ -82,9 +82,9 @@ func (o *FSOverlay) Apply(z *ApplyState) {
|
|||||||
z.Overlay(o.Target, o.Upper, o.Work, o.Lower...)
|
z.Overlay(o.Target, o.Upper, o.Work, o.Lower...)
|
||||||
} else {
|
} else {
|
||||||
z.OverlayEphemeral(o.Target, slices.Concat(
|
z.OverlayEphemeral(o.Target, slices.Concat(
|
||||||
|
[]*check.Absolute{o.Upper},
|
||||||
o.Lower,
|
o.Lower,
|
||||||
[]*check.Absolute{o.Upper})...,
|
)...)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
z.OverlayReadonly(o.Target, o.Lower...)
|
z.OverlayReadonly(o.Target, o.Lower...)
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ func TestFSOverlay(t *testing.T) {
|
|||||||
Upper: m("/tmp/upper"),
|
Upper: m("/tmp/upper"),
|
||||||
}, true, container.Ops{&container.MountOverlayOp{
|
}, true, container.Ops{&container.MountOverlayOp{
|
||||||
Target: m("/"),
|
Target: m("/"),
|
||||||
Lower: ms("/tmp/.src0", "/tmp/.src1", "/tmp/upper"),
|
Lower: ms("/tmp/upper", "/tmp/.src0", "/tmp/.src1"),
|
||||||
Upper: fhs.AbsRoot,
|
Upper: fhs.AbsRoot,
|
||||||
}}, m("/"), ms("/tmp/upper", "/tmp/.src0", "/tmp/.src1"),
|
}}, m("/"), ms("/tmp/upper", "/tmp/.src0", "/tmp/.src1"),
|
||||||
"e*/:/tmp/upper:/tmp/.src0:/tmp/.src1"},
|
"e*/:/tmp/upper:/tmp/.src0:/tmp/.src1"},
|
||||||
|
|||||||
@@ -244,6 +244,7 @@ func TestTemplate(t *testing.T) {
|
|||||||
"tty": true,
|
"tty": true,
|
||||||
"multiarch": true,
|
"multiarch": true,
|
||||||
"map_real_uid": true,
|
"map_real_uid": true,
|
||||||
|
"noplace": true,
|
||||||
"device": true,
|
"device": true,
|
||||||
"cover_run": true,
|
"cover_run": true,
|
||||||
"share_runtime": true,
|
"share_runtime": true,
|
||||||
|
|||||||
Vendored
+24
-4
@@ -1,21 +1,29 @@
|
|||||||
// Package env provides the [Paths] struct for efficiently building paths from the environment.
|
// Package env provides the [Paths] struct for efficiently building paths from
|
||||||
|
// the environment.
|
||||||
package env
|
package env
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"io/fs"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"hakurei.app/check"
|
"hakurei.app/check"
|
||||||
|
"hakurei.app/fhs"
|
||||||
"hakurei.app/hst"
|
"hakurei.app/hst"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const VarRunNscd = fhs.Var + "run/nscd"
|
||||||
|
|
||||||
// Paths holds paths copied from the environment and is used to create [hst.Paths].
|
// Paths holds paths copied from the environment and is used to create [hst.Paths].
|
||||||
type Paths struct {
|
type Paths struct {
|
||||||
// TempDir is returned by [os.TempDir].
|
// TempDir is returned by [os.TempDir].
|
||||||
TempDir *check.Absolute
|
TempDir *check.Absolute
|
||||||
// RuntimePath is copied from $XDG_RUNTIME_DIR.
|
// RuntimePath is copied from $XDG_RUNTIME_DIR.
|
||||||
RuntimePath *check.Absolute
|
RuntimePath *check.Absolute
|
||||||
|
// Whether [VarRunNscd] is a directory.
|
||||||
|
HasNscd bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy expands [Paths] into [hst.Paths].
|
// Copy expands [Paths] into [hst.Paths].
|
||||||
@@ -37,14 +45,17 @@ func (env *Paths) Copy(v *hst.Paths, userid int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CopyPaths returns a populated [Paths].
|
// CopyPaths returns a populated [Paths].
|
||||||
func CopyPaths() *Paths { return CopyPathsFunc(log.Fatalf, os.TempDir, os.Getenv) }
|
func CopyPaths() *Paths {
|
||||||
|
return CopyPathsFunc(log.Fatalf, os.TempDir, os.Getenv, os.Stat)
|
||||||
|
}
|
||||||
|
|
||||||
// CopyPathsFunc returns a populated [Paths],
|
// CopyPathsFunc returns a populated [Paths], using the provided [log.Fatalf],
|
||||||
// using the provided [log.Fatalf], [os.TempDir], [os.Getenv] functions.
|
// [os.TempDir], [os.Getenv] functions.
|
||||||
func CopyPathsFunc(
|
func CopyPathsFunc(
|
||||||
fatalf func(format string, v ...any),
|
fatalf func(format string, v ...any),
|
||||||
tempdir func() string,
|
tempdir func() string,
|
||||||
getenv func(key string) string,
|
getenv func(key string) string,
|
||||||
|
stat func(name string) (fs.FileInfo, error),
|
||||||
) *Paths {
|
) *Paths {
|
||||||
const xdgRuntimeDir = "XDG_RUNTIME_DIR"
|
const xdgRuntimeDir = "XDG_RUNTIME_DIR"
|
||||||
|
|
||||||
@@ -61,5 +72,14 @@ func CopyPathsFunc(
|
|||||||
env.RuntimePath = a
|
env.RuntimePath = a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fi, err := stat(VarRunNscd); err != nil {
|
||||||
|
if !errors.Is(err, fs.ErrNotExist) {
|
||||||
|
fatalf("%v", err)
|
||||||
|
panic("unreachable")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
env.HasNscd = fi.IsDir()
|
||||||
|
}
|
||||||
|
|
||||||
return &env
|
return &env
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+4
-1
@@ -2,6 +2,7 @@ package env_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -104,7 +105,9 @@ func TestCopyPaths(t *testing.T) {
|
|||||||
t.Fatalf("fatalf: %q, want %q", got, tc.fatal)
|
t.Fatalf("fatalf: %q, want %q", got, tc.fatal)
|
||||||
}
|
}
|
||||||
panic(stub.PanicExit)
|
panic(stub.PanicExit)
|
||||||
}, func() string { return tc.tmp }, func(key string) string { return tc.env[key] })
|
}, func() string { return tc.tmp }, func(key string) string { return tc.env[key] }, func(name string) (fs.FileInfo, error) {
|
||||||
|
return nil, fs.ErrNotExist
|
||||||
|
})
|
||||||
|
|
||||||
if tc.fatal != "" {
|
if tc.fatal != "" {
|
||||||
t.Fatalf("copyPaths: expected fatal %q", tc.fatal)
|
t.Fatalf("copyPaths: expected fatal %q", tc.fatal)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import (
|
|||||||
"hakurei.app/container/seccomp"
|
"hakurei.app/container/seccomp"
|
||||||
"hakurei.app/container/std"
|
"hakurei.app/container/std"
|
||||||
"hakurei.app/hst"
|
"hakurei.app/hst"
|
||||||
|
"hakurei.app/internal/env"
|
||||||
"hakurei.app/internal/stub"
|
"hakurei.app/internal/stub"
|
||||||
"hakurei.app/internal/system"
|
"hakurei.app/internal/system"
|
||||||
"hakurei.app/message"
|
"hakurei.app/message"
|
||||||
@@ -174,6 +175,7 @@ func checkOpBehaviour(t *testing.T, testCases []opBehaviourTestCase) {
|
|||||||
call("cmdOutput", stub.ExpectArgs{container.Nonexistent, os.Stderr, []string{}, "/"}, []byte("0"), nil),
|
call("cmdOutput", stub.ExpectArgs{container.Nonexistent, os.Stderr, []string{}, "/"}, []byte("0"), nil),
|
||||||
call("tempdir", stub.ExpectArgs{}, container.Nonexistent+"/tmp", nil),
|
call("tempdir", stub.ExpectArgs{}, container.Nonexistent+"/tmp", nil),
|
||||||
call("lookupEnv", stub.ExpectArgs{"XDG_RUNTIME_DIR"}, wantRuntimePath, nil),
|
call("lookupEnv", stub.ExpectArgs{"XDG_RUNTIME_DIR"}, wantRuntimePath, nil),
|
||||||
|
call("stat", stub.ExpectArgs{env.VarRunNscd}, stubFileInfoIsDir(true), nil),
|
||||||
call("getuid", stub.ExpectArgs{}, 1000, nil),
|
call("getuid", stub.ExpectArgs{}, 1000, nil),
|
||||||
call("getgid", stub.ExpectArgs{}, 100, nil),
|
call("getgid", stub.ExpectArgs{}, 100, nil),
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ func newOutcomeState(k syscallDispatcher, msg message.Msg, id *hst.ID, config *h
|
|||||||
Paths: env.CopyPathsFunc(k.fatalf, k.tempdir, func(key string) string {
|
Paths: env.CopyPathsFunc(k.fatalf, k.tempdir, func(key string) string {
|
||||||
v, _ := k.lookupEnv(key)
|
v, _ := k.lookupEnv(key)
|
||||||
return v
|
return v
|
||||||
}),
|
}, k.stat),
|
||||||
Container: config.Container,
|
Container: config.Container,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,10 +143,6 @@ func TestOutcomeRun(t *testing.T) {
|
|||||||
// spTmpdirOp
|
// spTmpdirOp
|
||||||
Bind(m("/tmp/hakurei.0/tmpdir/9"), fhs.AbsTmp, std.BindWritable).
|
Bind(m("/tmp/hakurei.0/tmpdir/9"), fhs.AbsTmp, std.BindWritable).
|
||||||
|
|
||||||
// spAccountOp
|
|
||||||
Place(m("/etc/passwd"), []byte("chronos:x:1971:100:Hakurei:/data/data/org.chromium.Chromium:/run/current-system/sw/bin/zsh\n")).
|
|
||||||
Place(m("/etc/group"), []byte("hakurei:x:100:\n")).
|
|
||||||
|
|
||||||
// spWaylandOp
|
// spWaylandOp
|
||||||
Bind(m("/tmp/hakurei.0/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/wayland"), m("/run/user/1971/wayland-0"), 0).
|
Bind(m("/tmp/hakurei.0/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/wayland"), m("/run/user/1971/wayland-0"), 0).
|
||||||
|
|
||||||
@@ -453,7 +449,7 @@ func TestOutcomeRun(t *testing.T) {
|
|||||||
|
|
||||||
Path: m("/nix/store/yqivzpzzn7z5x0lq9hmbzygh45d8rhqd-chromium-start"),
|
Path: m("/nix/store/yqivzpzzn7z5x0lq9hmbzygh45d8rhqd-chromium-start"),
|
||||||
|
|
||||||
Flags: hst.FUserns | hst.FHostNet | hst.FMapRealUID | hst.FShareRuntime | hst.FShareTmpdir,
|
Flags: hst.FUserns | hst.FHostNet | hst.FMapRealUID | hst.FNoPlace | hst.FShareRuntime | hst.FShareTmpdir,
|
||||||
},
|
},
|
||||||
SystemBus: &hst.BusConfig{
|
SystemBus: &hst.BusConfig{
|
||||||
Talk: []string{"org.bluez", "org.freedesktop.Avahi", "org.freedesktop.UPower"},
|
Talk: []string{"org.bluez", "org.freedesktop.Avahi", "org.freedesktop.UPower"},
|
||||||
@@ -548,8 +544,6 @@ func TestOutcomeRun(t *testing.T) {
|
|||||||
Tmpfs(m("/run/user/"), xdgRuntimeDirSize, 0755).
|
Tmpfs(m("/run/user/"), xdgRuntimeDirSize, 0755).
|
||||||
Bind(m("/tmp/hakurei.0/runtime/1"), m("/run/user/1971"), std.BindWritable).
|
Bind(m("/tmp/hakurei.0/runtime/1"), m("/run/user/1971"), std.BindWritable).
|
||||||
Bind(m("/tmp/hakurei.0/tmpdir/1"), m("/tmp/"), std.BindWritable).
|
Bind(m("/tmp/hakurei.0/tmpdir/1"), m("/tmp/"), std.BindWritable).
|
||||||
Place(m("/etc/passwd"), []byte("u0_a1:x:1971:100:Hakurei:/var/lib/persist/module/hakurei/0/1:/run/current-system/sw/bin/zsh\n")).
|
|
||||||
Place(m("/etc/group"), []byte("hakurei:x:100:\n")).
|
|
||||||
Bind(m("/run/user/1971/wayland-0"), m("/run/user/1971/wayland-0"), 0).
|
Bind(m("/run/user/1971/wayland-0"), m("/run/user/1971/wayland-0"), 0).
|
||||||
Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/pipewire"), m("/run/user/1971/pipewire-0"), 0).
|
Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/pipewire"), m("/run/user/1971/pipewire-0"), 0).
|
||||||
Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/bus"), m("/run/user/1971/bus"), 0).
|
Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/bus"), m("/run/user/1971/bus"), 0).
|
||||||
@@ -716,7 +710,7 @@ func (k *stubNixOS) lookupEnv(key string) (string, bool) {
|
|||||||
func (k *stubNixOS) stat(name string) (fs.FileInfo, error) {
|
func (k *stubNixOS) stat(name string) (fs.FileInfo, error) {
|
||||||
switch name {
|
switch name {
|
||||||
case "/var/run/nscd":
|
case "/var/run/nscd":
|
||||||
return nil, nil
|
return stubFileInfoIsDir(true), nil
|
||||||
case "/run/user/1971/pulse":
|
case "/run/user/1971/pulse":
|
||||||
return nil, nil
|
return nil, nil
|
||||||
case "/run/user/1971/pulse/native":
|
case "/run/user/1971/pulse/native":
|
||||||
|
|||||||
@@ -78,10 +78,6 @@ func TestShimEntrypoint(t *testing.T) {
|
|||||||
// spTmpdirOp
|
// spTmpdirOp
|
||||||
Bind(m("/tmp/hakurei.10/tmpdir/9999"), fhs.AbsTmp, std.BindWritable).
|
Bind(m("/tmp/hakurei.10/tmpdir/9999"), fhs.AbsTmp, std.BindWritable).
|
||||||
|
|
||||||
// spAccountOp
|
|
||||||
Place(m("/etc/passwd"), []byte("chronos:x:1000:100:Hakurei:/data/data/org.chromium.Chromium:/run/current-system/sw/bin/zsh\n")).
|
|
||||||
Place(m("/etc/group"), []byte("hakurei:x:100:\n")).
|
|
||||||
|
|
||||||
// spWaylandOp
|
// spWaylandOp
|
||||||
Bind(m("/tmp/hakurei.10/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/wayland"), m("/run/user/1000/wayland-0"), 0).
|
Bind(m("/tmp/hakurei.10/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/wayland"), m("/run/user/1000/wayland-0"), 0).
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"hakurei.app/fhs"
|
"hakurei.app/fhs"
|
||||||
|
"hakurei.app/hst"
|
||||||
"hakurei.app/internal/validate"
|
"hakurei.app/internal/validate"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ func (s spAccountOp) toContainer(state *outcomeStateParams) error {
|
|||||||
state.env["USER"] = username
|
state.env["USER"] = username
|
||||||
state.env["SHELL"] = state.Container.Shell.String()
|
state.env["SHELL"] = state.Container.Shell.String()
|
||||||
|
|
||||||
|
if state.Container.Flags&hst.FNoPlace == 0 {
|
||||||
state.params.
|
state.params.
|
||||||
Place(fhs.AbsEtc.Append("passwd"),
|
Place(fhs.AbsEtc.Append("passwd"),
|
||||||
[]byte(username+":x:"+
|
[]byte(username+":x:"+
|
||||||
@@ -51,6 +53,7 @@ func (s spAccountOp) toContainer(state *outcomeStateParams) error {
|
|||||||
state.Container.Shell.String()+"\n")).
|
state.Container.Shell.String()+"\n")).
|
||||||
Place(fhs.AbsEtc.Append("group"),
|
Place(fhs.AbsEtc.Append("group"),
|
||||||
[]byte("hakurei:x:"+state.mapgid.String()+":\n"))
|
[]byte("hakurei:x:"+state.mapgid.String()+":\n"))
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ func TestSpAccountOp(t *testing.T) {
|
|||||||
{"success fallback username", func(bool, bool) outcomeOp { return spAccountOp{} }, func() *hst.Config {
|
{"success fallback username", func(bool, bool) outcomeOp { return spAccountOp{} }, func() *hst.Config {
|
||||||
c := hst.Template()
|
c := hst.Template()
|
||||||
c.Container.Username = ""
|
c.Container.Username = ""
|
||||||
|
c.Container.Flags = hst.FMapRealUID
|
||||||
return c
|
return c
|
||||||
}, nil, []stub.Call{
|
}, nil, []stub.Call{
|
||||||
// this op performs basic validation and does not make calls during toSystem
|
// this op performs basic validation and does not make calls during toSystem
|
||||||
@@ -60,9 +61,7 @@ func TestSpAccountOp(t *testing.T) {
|
|||||||
// this op configures the container state and does not make calls during toContainer
|
// this op configures the container state and does not make calls during toContainer
|
||||||
}, &container.Params{
|
}, &container.Params{
|
||||||
Dir: config.Container.Home,
|
Dir: config.Container.Home,
|
||||||
Ops: new(container.Ops).
|
Ops: new(container.Ops),
|
||||||
Place(m("/etc/passwd"), []byte("chronos:x:1000:100:Hakurei:/data/data/org.chromium.Chromium:/run/current-system/sw/bin/zsh\n")).
|
|
||||||
Place(m("/etc/group"), []byte("hakurei:x:100:\n")),
|
|
||||||
}, paramsWantEnv(config, map[string]string{
|
}, paramsWantEnv(config, map[string]string{
|
||||||
"HOME": config.Container.Home.String(),
|
"HOME": config.Container.Home.String(),
|
||||||
"USER": config.Container.Username,
|
"USER": config.Container.Username,
|
||||||
|
|||||||
@@ -18,13 +18,12 @@ import (
|
|||||||
"hakurei.app/hst"
|
"hakurei.app/hst"
|
||||||
"hakurei.app/internal/acl"
|
"hakurei.app/internal/acl"
|
||||||
"hakurei.app/internal/dbus"
|
"hakurei.app/internal/dbus"
|
||||||
|
"hakurei.app/internal/env"
|
||||||
"hakurei.app/internal/system"
|
"hakurei.app/internal/system"
|
||||||
"hakurei.app/internal/validate"
|
"hakurei.app/internal/validate"
|
||||||
"hakurei.app/message"
|
"hakurei.app/message"
|
||||||
)
|
)
|
||||||
|
|
||||||
const varRunNscd = fhs.Var + "run/nscd"
|
|
||||||
|
|
||||||
func init() { gob.Register(new(spParamsOp)) }
|
func init() { gob.Register(new(spParamsOp)) }
|
||||||
|
|
||||||
// spParamsOp initialises unordered fields of [container.Params] and the
|
// spParamsOp initialises unordered fields of [container.Params] and the
|
||||||
@@ -136,17 +135,23 @@ type spFilesystemOp struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *spFilesystemOp) toSystem(state *outcomeStateSys) error {
|
func (s *spFilesystemOp) toSystem(state *outcomeStateSys) error {
|
||||||
/* retrieve paths and hide them if they're made available in the sandbox;
|
// retrieve paths and hide them if they're made available in the sandbox
|
||||||
|
//
|
||||||
this feature tries to improve user experience of permissive defaults, and
|
// this feature tries to improve user experience of permissive defaults, and
|
||||||
to warn about issues in custom configuration; it is NOT a security feature
|
// to warn about issues in custom configuration; it is NOT a security feature
|
||||||
and should not be treated as such, ALWAYS be careful with what you bind */
|
// and should not be treated as such, ALWAYS be careful with what you bind
|
||||||
hidePaths := []string{
|
hidePaths := []string{
|
||||||
state.sc.RuntimePath.String(),
|
state.sc.RuntimePath.String(),
|
||||||
state.sc.SharePath.String(),
|
state.sc.SharePath.String(),
|
||||||
|
}
|
||||||
|
|
||||||
// this causes emulated passwd database to be bypassed on some /etc/ setups
|
if state.Paths == nil || state.HasNscd {
|
||||||
varRunNscd,
|
hidePaths = append(hidePaths,
|
||||||
|
// this causes emulated passwd database to be bypassed on some /etc/
|
||||||
|
// setups, made optional to avoid needlessly creating it on
|
||||||
|
// non-glibc systems when invoking permissive defaults
|
||||||
|
env.VarRunNscd,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// dbus.Address does not go through syscallDispatcher
|
// dbus.Address does not go through syscallDispatcher
|
||||||
|
|||||||
@@ -278,6 +278,8 @@ type archiveArtifact struct {
|
|||||||
f Artifact
|
f Artifact
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ CuresExempt = archiveArtifact{}
|
||||||
|
|
||||||
// NewArchive returns a new [Artifact] backed by the supplied [Artifact]. The
|
// NewArchive returns a new [Artifact] backed by the supplied [Artifact]. The
|
||||||
// source [Artifact] must be a [FileArtifact] and produce a stream compatible
|
// source [Artifact] must be a [FileArtifact] and produce a stream compatible
|
||||||
// with [Reader].
|
// with [Reader].
|
||||||
@@ -403,3 +405,7 @@ func (a archiveArtifact) Cure(t *TContext) (err error) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CuresExempt exempts the cheap [KindArchive] implementation often found at
|
||||||
|
// the end of a [FileArtifact] pipeline.
|
||||||
|
func (archiveArtifact) CuresExempt() {}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ type decompressArtifact struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var _ FileArtifact = new(decompressArtifact)
|
var _ FileArtifact = new(decompressArtifact)
|
||||||
|
var _ CuresExempt = new(decompressArtifact)
|
||||||
|
|
||||||
// decompressArtifactNamed embeds decompressArtifact for a [fmt.Stringer] stream.
|
// decompressArtifactNamed embeds decompressArtifact for a [fmt.Stringer] stream.
|
||||||
type decompressArtifactNamed struct {
|
type decompressArtifactNamed struct {
|
||||||
@@ -117,3 +118,7 @@ func (a *decompressArtifact) Cure(r *RContext) (io.ReadCloser, error) {
|
|||||||
return nil, os.ErrInvalid
|
return nil, os.ErrInvalid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CuresExempt exempts the cheap [KindDecompress] implementation often part of
|
||||||
|
// a [FileArtifact] pipeline.
|
||||||
|
func (*decompressArtifact) CuresExempt() {}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
type fileArtifact []byte
|
type fileArtifact []byte
|
||||||
|
|
||||||
var _ KnownChecksum = new(fileArtifact)
|
var _ KnownChecksum = new(fileArtifact)
|
||||||
|
var _ CuresExempt = new(fileArtifact)
|
||||||
|
|
||||||
// fileArtifactNamed embeds fileArtifact alongside a caller-supplied name.
|
// fileArtifactNamed embeds fileArtifact alongside a caller-supplied name.
|
||||||
type fileArtifactNamed struct {
|
type fileArtifactNamed struct {
|
||||||
@@ -79,3 +80,6 @@ func (a *fileArtifact) Checksum() Checksum {
|
|||||||
func (a *fileArtifact) Cure(*RContext) (io.ReadCloser, error) {
|
func (a *fileArtifact) Cure(*RContext) (io.ReadCloser, error) {
|
||||||
return io.NopCloser(bytes.NewReader(*a)), nil
|
return io.NopCloser(bytes.NewReader(*a)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CuresExempt exempts the cheap [KindFile] implementation.
|
||||||
|
func (*fileArtifact) CuresExempt() {}
|
||||||
|
|||||||
@@ -485,6 +485,16 @@ type KnownChecksum interface {
|
|||||||
Checksum() Checksum
|
Checksum() Checksum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CuresExempt is optionally implemented for an artifact exempt to the
|
||||||
|
// cache-wide cures counter and limit.
|
||||||
|
type CuresExempt interface {
|
||||||
|
Artifact
|
||||||
|
|
||||||
|
// CuresExempt is a no-op function but serves to distinguish implementations
|
||||||
|
// that are cures-exempt.
|
||||||
|
CuresExempt()
|
||||||
|
}
|
||||||
|
|
||||||
// FileArtifact refers to an [Artifact] backed by a single file.
|
// FileArtifact refers to an [Artifact] backed by a single file.
|
||||||
//
|
//
|
||||||
// FileArtifact does not support fine-grained cancellation. Its context is
|
// FileArtifact does not support fine-grained cancellation. Its context is
|
||||||
@@ -1892,6 +1902,10 @@ func (c *Cache) cure(a Artifact, curesExempt bool) (
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
if _, ok := a.(CuresExempt); ok {
|
||||||
|
curesExempt = true
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
done chan<- struct{}
|
done chan<- struct{}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ type tarArtifact struct {
|
|||||||
f Artifact
|
f Artifact
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ CuresExempt = new(tarArtifact)
|
||||||
|
|
||||||
// tarArtifactNamed embeds tarArtifact for a [fmt.Stringer] tarball.
|
// tarArtifactNamed embeds tarArtifact for a [fmt.Stringer] tarball.
|
||||||
type tarArtifactNamed struct {
|
type tarArtifactNamed struct {
|
||||||
tarArtifact
|
tarArtifact
|
||||||
@@ -211,3 +213,7 @@ func (a *tarArtifact) Cure(t *TContext) (err error) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CuresExempt exempts the cheap [KindTar] implementation often at the end of a
|
||||||
|
// [FileArtifact] pipeline.
|
||||||
|
func (*tarArtifact) CuresExempt() {}
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ ln -s \
|
|||||||
})
|
})
|
||||||
|
|
||||||
const (
|
const (
|
||||||
version = "22.1.7"
|
version = "22.1.8"
|
||||||
checksum = "GFjsoTzJ72YWQuAaNmlO67IIkoZ8Z12u3n0dOEMSpltmyXUJp8e3cccWDrscXILZ"
|
checksum = "_QzoDE0W6cv0vfIWeLPDvqG_vKhz6IGWl1nqUUvhlKWiRzf5dMGqeC3tyS2XgI6j"
|
||||||
)
|
)
|
||||||
|
|
||||||
native.MustRegister("llvm-project", func(t Toolchain) (*Metadata, pkg.Artifact) {
|
native.MustRegister("llvm-project", func(t Toolchain) (*Metadata, pkg.Artifact) {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ type MesonHelper struct {
|
|||||||
|
|
||||||
// Flags passed to the setup command.
|
// Flags passed to the setup command.
|
||||||
Setup []KV
|
Setup []KV
|
||||||
|
// Test suites to skip.
|
||||||
|
SkipTests []string
|
||||||
// Whether to skip meson test.
|
// Whether to skip meson test.
|
||||||
SkipTest bool
|
SkipTest bool
|
||||||
// Run tests with interactive input/output.
|
// Run tests with interactive input/output.
|
||||||
@@ -61,6 +63,9 @@ meson test \
|
|||||||
scriptTest += ` \
|
scriptTest += ` \
|
||||||
--interactive`
|
--interactive`
|
||||||
}
|
}
|
||||||
|
for _, suite := range attr.SkipTests {
|
||||||
|
scriptTest += " \\\n\t--no-suite='" + suite + "'"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return `
|
return `
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
From 8a80d895dfd779373363c3a4b62ecce5a549efb2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
|
|
||||||
Date: Sat, 30 Mar 2024 10:17:10 +0100
|
|
||||||
Subject: tools/attr.c: Add missing libgen.h include for basename(3)
|
|
||||||
|
|
||||||
Fixes compilation issue with musl and modern C99 compilers.
|
|
||||||
|
|
||||||
See: https://bugs.gentoo.org/926294
|
|
||||||
---
|
|
||||||
tools/attr.c | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/tools/attr.c b/tools/attr.c
|
|
||||||
index f12e4af..6a3c1e9 100644
|
|
||||||
--- a/tools/attr.c
|
|
||||||
+++ b/tools/attr.c
|
|
||||||
@@ -28,6 +28,7 @@
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <locale.h>
|
|
||||||
+#include <libgen.h>
|
|
||||||
|
|
||||||
#include <attr/attributes.h>
|
|
||||||
|
|
||||||
--
|
|
||||||
cgit v1.1
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
diff --git a/test/attr.test b/test/attr.test
|
diff --git a/test/attr.run b/test/attr.run
|
||||||
index 6ce2f9b..e9bde92 100644
|
index 27d17f6..a4d60c0 100644
|
||||||
--- a/test/attr.test
|
--- a/test/attr.run
|
||||||
+++ b/test/attr.test
|
+++ b/test/attr.run
|
||||||
@@ -11,7 +11,7 @@ Try various valid and invalid names
|
@@ -11,7 +11,7 @@ Try various valid and invalid names
|
||||||
|
|
||||||
$ touch f
|
$ touch f
|
||||||
|
|||||||
@@ -3,17 +3,15 @@ package attr {
|
|||||||
website = "https://savannah.nongnu.org/projects/attr";
|
website = "https://savannah.nongnu.org/projects/attr";
|
||||||
anitya = 137;
|
anitya = 137;
|
||||||
|
|
||||||
version# = "2.5.2";
|
version# = "2.6.0";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://download.savannah.nongnu.org/releases/attr/"+
|
url = "https://download.savannah.nongnu.org/releases/attr/"+
|
||||||
"attr-"+version+".tar.gz";
|
"attr-"+version+".tar.gz";
|
||||||
checksum = "YWEphrz6vg1sUMmHHVr1CRo53pFXRhq_pjN-AlG8UgwZK1y6m7zuDhxqJhD0SV0l";
|
checksum = "pp-NvD1cMIwZycNwZGW2ez-PbTEpHxrRnVH27csj9QdN4oEBkEbJOZX1IIvKnTWS";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
patches = [
|
|
||||||
"libgen-basename.patch",
|
patches = [ "musl-errno.patch" ];
|
||||||
"musl-errno.patch",
|
|
||||||
];
|
|
||||||
|
|
||||||
early = `
|
early = `
|
||||||
ln -s ../../system/bin/perl /usr/bin
|
ln -s ../../system/bin/perl /usr/bin
|
||||||
@@ -21,7 +19,11 @@ ln -s ../../system/bin/perl /usr/bin
|
|||||||
|
|
||||||
exec = make {};
|
exec = make {};
|
||||||
|
|
||||||
inputs = [ perl ];
|
inputs = [
|
||||||
|
perl,
|
||||||
|
|
||||||
|
kernel-headers,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
package acl {
|
package acl {
|
||||||
@@ -29,11 +31,11 @@ package acl {
|
|||||||
website = "https://savannah.nongnu.org/projects/acl";
|
website = "https://savannah.nongnu.org/projects/acl";
|
||||||
anitya = 16;
|
anitya = 16;
|
||||||
|
|
||||||
version# = "2.3.2";
|
version# = "2.4.0";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://download.savannah.nongnu.org/releases/acl/"+
|
url = "https://download.savannah.nongnu.org/releases/acl/"+
|
||||||
"acl-"+version+".tar.gz";
|
"acl-"+version+".tar.gz";
|
||||||
checksum = "-fY5nwH4K8ZHBCRXrzLdguPkqjKI6WIiGu4dBtrZ1o0t6AIU73w8wwJz_UyjIS0P";
|
checksum = "U2eaAsWrhhzEfhyprwHQQG55bFPZxtsHk1Usnd9Jb_g-H__pJod4H3RTrL4ipXDw";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,6 +44,6 @@ package acl {
|
|||||||
skipCheck = true;
|
skipCheck = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [ attr ];
|
inputs = [ attr, kernel-headers ];
|
||||||
runtime = [ attr ];
|
runtime = [ attr ];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package cmake {
|
|||||||
website = "https://cmake.org";
|
website = "https://cmake.org";
|
||||||
anitya = 306;
|
anitya = 306;
|
||||||
|
|
||||||
version# = "4.3.3";
|
version# = "4.3.4";
|
||||||
source = remoteGitHubRelease {
|
source = remoteGitHubRelease {
|
||||||
suffix = "Kitware/CMake";
|
suffix = "Kitware/CMake";
|
||||||
tag = "v"+version;
|
tag = "v"+version;
|
||||||
name = "cmake-"+version+".tar.gz";
|
name = "cmake-"+version+".tar.gz";
|
||||||
checksum = "VS-b6cN4S9hfNv3JOUAbAfI9nh3EeuVwY_IVgUdgq6VKwvfchhXwvvFAUcpZG6Ez";
|
checksum = "6A50pqarKDXKOCv7ffKMvWJWmNTVp_ep8KoaWwNdg-RYQRddgKbxayHveTo6jZ_7";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
patches = [
|
patches = [
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package curl {
|
|||||||
website = "https://curl.se";
|
website = "https://curl.se";
|
||||||
anitya = 381;
|
anitya = 381;
|
||||||
|
|
||||||
version# = "8.20.0";
|
version# = "8.21.0";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://curl.se/download/curl-"+version+".tar.bz2";
|
url = "https://curl.se/download/curl-"+version+".tar.bz2";
|
||||||
checksum = "xyHXwrngIRGMasuzhn-I5MSCOhktwINbsWt1f_LuR-5jRVvyx_g6U1EQfDLEbr9r";
|
checksum = "lJSm8bVjS0OmsarEdbvejdQdvXsb7yGarlr6oMtA9FW1EXOga8zZxa1LPtfaq_qX";
|
||||||
compress = bzip2;
|
compress = bzip2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package firmware {
|
|||||||
website = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
|
website = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git";
|
||||||
anitya = 141464;
|
anitya = 141464;
|
||||||
|
|
||||||
version# = "20260519";
|
version# = "20260622";
|
||||||
source = remoteGitLab {
|
source = remoteGitLab {
|
||||||
domain = "gitlab.com";
|
domain = "gitlab.com";
|
||||||
suffix = "kernel-firmware/linux-firmware";
|
suffix = "kernel-firmware/linux-firmware";
|
||||||
ref = version;
|
ref = version;
|
||||||
checksum = "l-wBRTWclYnJsgV4qtUV1-UL5Y4nknAPre8CMe0dH7PxtAqbaeudEIM_Fnuj0TCV";
|
checksum = "gpytkDM58EVjaUuryOekcekh_rWsfuv3S7LQxopHlNlVGmMsuqNwfug4BjgTgizE";
|
||||||
};
|
};
|
||||||
|
|
||||||
// dedup creates temporary file
|
// dedup creates temporary file
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package git {
|
|||||||
website = "https://www.git-scm.com";
|
website = "https://www.git-scm.com";
|
||||||
anitya = 5350;
|
anitya = 5350;
|
||||||
|
|
||||||
version# = "2.54.0";
|
version# = "2.55.0";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://www.kernel.org/pub/software/scm/git/"+
|
url = "https://www.kernel.org/pub/software/scm/git/"+
|
||||||
"git-"+version+".tar.gz";
|
"git-"+version+".tar.gz";
|
||||||
checksum = "7vGKtFOJGqY8DO4e8UMRax7dLgImXKQz5MMalec6MlgYrsarffSJjgOughwRFpSH";
|
checksum = "lOer6jb8vZQk6Nd1rLZIgsYys8whLvjJq8XbmCdTATcPFAYuQcK1Rgj1Jj6a00W8";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@ rm -f /system/bin/httpd
|
|||||||
|
|
||||||
// uses source tree as scratch space
|
// uses source tree as scratch space
|
||||||
enterSource = true;
|
enterSource = true;
|
||||||
|
env = [ "NO_RUST=YesPlease" ];
|
||||||
|
|
||||||
exec = make {
|
exec = make {
|
||||||
inPlace = true;
|
inPlace = true;
|
||||||
@@ -85,6 +86,7 @@ disable_test t5515-fetch-merge-logic
|
|||||||
zlib,
|
zlib,
|
||||||
curl,
|
curl,
|
||||||
libexpat,
|
libexpat,
|
||||||
|
kernel-headers,
|
||||||
];
|
];
|
||||||
|
|
||||||
runtime = [
|
runtime = [
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package glib {
|
|||||||
website = "https://developer.gnome.org/glib";
|
website = "https://developer.gnome.org/glib";
|
||||||
anitya = 10024;
|
anitya = 10024;
|
||||||
|
|
||||||
version# = "2.89.0";
|
version# = "2.89.1";
|
||||||
source = remoteGit {
|
source = remoteGit {
|
||||||
url = "https://gitlab.gnome.org/GNOME/glib.git";
|
url = "https://gitlab.gnome.org/GNOME/glib.git";
|
||||||
tag = version;
|
tag = version;
|
||||||
checksum = "4FXKhdS3pC98LevYa_h7piRylG86cZ_c9zAtGr78oHodU1ob8rBxGU0hoIZ4nzcA";
|
checksum = "9_6Eew2KIwa1AHopjU7CqC13_nur5FPJMu-iGUd7sD_1gAM1pa_HVUuAtqExJoYU";
|
||||||
};
|
};
|
||||||
|
|
||||||
files = {
|
files = {
|
||||||
@@ -19,6 +19,8 @@ package glib {
|
|||||||
setup = {
|
setup = {
|
||||||
"Ddefault_library": "both";
|
"Ddefault_library": "both";
|
||||||
};
|
};
|
||||||
|
// fails with ipv6 disabled
|
||||||
|
skipTests = [ "gio" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
|
|||||||
@@ -504,10 +504,10 @@ package parallel {
|
|||||||
website = "https://www.gnu.org/software/parallel";
|
website = "https://www.gnu.org/software/parallel";
|
||||||
anitya = 5448;
|
anitya = 5448;
|
||||||
|
|
||||||
version# = "20260522";
|
version# = "20260622";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://ftpmirror.gnu.org/gnu/parallel/parallel-"+version+".tar.bz2";
|
url = "https://ftpmirror.gnu.org/gnu/parallel/parallel-"+version+".tar.bz2";
|
||||||
checksum = "ezg3NZMlY-q-478YXmjWmDrDlaL55T7aBCuv3B7Z3DkAlfZRQEKO8eumqbcxTIy6";
|
checksum = "pEkZ_J18AvKCMoPfxEprC0Smw7zP6qXASmC1uFf_HVD_jc95H06LvzGi40-mtCUo";
|
||||||
compress = bzip2;
|
compress = bzip2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package hakurei-source {
|
|||||||
description = "hakurei source tree";
|
description = "hakurei source tree";
|
||||||
exclude = true;
|
exclude = true;
|
||||||
|
|
||||||
version# = "0.4.3";
|
version# = "0.4.5";
|
||||||
output = remoteTar {
|
output = remoteTar {
|
||||||
url = "https://git.gensokyo.uk/rosa/hakurei/archive/"+
|
url = "https://git.gensokyo.uk/rosa/hakurei/archive/"+
|
||||||
"v"+version+".tar.gz";
|
"v"+version+".tar.gz";
|
||||||
checksum = "1LqBJIcYcAFTVfydCahOm4hjjKhY953X9ars0eQj32hnpNncWFefuT6OJpZzIlZv";
|
checksum = "5bvbuIRcDIrtijogwqXn3y8h5f3rVS4ZSVhOig6Galfzt3g-O3Ufb-tHL1kQCQWK";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -48,8 +48,13 @@ go build -trimpath -tags=rosa -o /work/system/libexec/hakurei -ldflags="-s -w
|
|||||||
-X hakurei.app/internal/info.buildVersion=$(cat cmd/dist/VERSION)
|
-X hakurei.app/internal/info.buildVersion=$(cat cmd/dist/VERSION)
|
||||||
-X hakurei.app/internal/info.hakureiPath=/system/bin/hakurei
|
-X hakurei.app/internal/info.hakureiPath=/system/bin/hakurei
|
||||||
-X hakurei.app/internal/info.hsuPath=/system/bin/hsu
|
-X hakurei.app/internal/info.hsuPath=/system/bin/hsu
|
||||||
|
" ./cmd/hakurei ./cmd/sharefs
|
||||||
|
|
||||||
|
echo "Building hsu for $(go env GOOS)/$(go env GOARCH)."
|
||||||
|
CGO_ENABLED=0 go build -trimpath -tags=rosa -o /work/system/libexec/hakurei -ldflags="-s -w
|
||||||
|
-buildid=
|
||||||
-X main.hakureiPath=/system/bin/hakurei
|
-X main.hakureiPath=/system/bin/hakurei
|
||||||
" ./...
|
" ./cmd/hsu
|
||||||
echo`;
|
echo`;
|
||||||
check = `
|
check = `
|
||||||
echo '##### Testing hakurei.'
|
echo '##### Testing hakurei.'
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ package system-image {
|
|||||||
version = unversioned;
|
version = unversioned;
|
||||||
exclude = true;
|
exclude = true;
|
||||||
|
|
||||||
source = earlyinit;
|
|
||||||
extra = [
|
extra = [
|
||||||
musl,
|
musl,
|
||||||
mksh,
|
mksh,
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package json-c {
|
|||||||
website = "https://json-c.github.io/json-c";
|
website = "https://json-c.github.io/json-c";
|
||||||
anitya = 390279;
|
anitya = 390279;
|
||||||
|
|
||||||
version# = "0.18-20240915";
|
version# = "0.19-20260627";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "json-c/json-c";
|
suffix = "json-c/json-c";
|
||||||
tag = "json-c-"+version;
|
tag = "json-c-"+version;
|
||||||
checksum = "LXY6AqXtavysCqcWrniSkgV8fv54iDowsrQ7RXM-upH-ZoJr2R34ff7coFRvOr-k";
|
checksum = "_yfWLtcd185xgLJaWC63pByFpROncoX7z1kHA02sCqYv2EEKG4YhJqc-8zdgtZ0c";
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = cmake {
|
exec = cmake {
|
||||||
|
|||||||
@@ -1,493 +0,0 @@
|
|||||||
From 6ce6fbfddc5b127e4f57c3b5bfdcf40239a4fc2f Mon Sep 17 00:00:00 2001
|
|
||||||
From: Nathan Chancellor <nathan@kernel.org>
|
|
||||||
Date: Sat, 13 Dec 2025 19:58:11 +0900
|
|
||||||
Subject: drm/amd/display: Reduce number of arguments of dcn30's
|
|
||||||
CalculateWatermarksAndDRAMSpeedChangeSupport()
|
|
||||||
|
|
||||||
CalculateWatermarksAndDRAMSpeedChangeSupport() has a large number of
|
|
||||||
parameters, which must be passed on the stack. Most of the parameters
|
|
||||||
between the two callsites are the same, so they can be accessed through
|
|
||||||
the existing mode_lib pointer, instead of being passed as explicit
|
|
||||||
arguments. Doing this reduces the stack size of
|
|
||||||
dml30_ModeSupportAndSystemConfigurationFull() from 1912 bytes to 1840
|
|
||||||
bytes building for x86_64 with clang-22, helping stay under the 2048
|
|
||||||
byte limit for display_mode_vba_30.c.
|
|
||||||
|
|
||||||
Additionally, now that there is a pointer to mode_lib->vba available,
|
|
||||||
use 'v' consistently throughout the entire function.
|
|
||||||
|
|
||||||
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
|
|
||||||
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
|
|
||||||
(cherry picked from commit 563dfbefdf633c8d958398ddfa3955f9f40e47d9)
|
|
||||||
---
|
|
||||||
.../amd/display/dc/dml/dcn30/display_mode_vba_30.c | 287 +++++----------------
|
|
||||||
1 file changed, 66 insertions(+), 221 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
|
|
||||||
index 2d19bb8de59c84..1df3412be3465d 100644
|
|
||||||
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
|
|
||||||
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
|
|
||||||
@@ -265,62 +265,23 @@ static void CalculateDynamicMetadataParameters(
|
|
||||||
static void CalculateWatermarksAndDRAMSpeedChangeSupport(
|
|
||||||
struct display_mode_lib *mode_lib,
|
|
||||||
unsigned int PrefetchMode,
|
|
||||||
- unsigned int NumberOfActivePlanes,
|
|
||||||
- unsigned int MaxLineBufferLines,
|
|
||||||
- unsigned int LineBufferSize,
|
|
||||||
- unsigned int DPPOutputBufferPixels,
|
|
||||||
- unsigned int DETBufferSizeInKByte,
|
|
||||||
- unsigned int WritebackInterfaceBufferSize,
|
|
||||||
double DCFCLK,
|
|
||||||
double ReturnBW,
|
|
||||||
- bool GPUVMEnable,
|
|
||||||
- unsigned int dpte_group_bytes[],
|
|
||||||
- unsigned int MetaChunkSize,
|
|
||||||
double UrgentLatency,
|
|
||||||
double ExtraLatency,
|
|
||||||
- double WritebackLatency,
|
|
||||||
- double WritebackChunkSize,
|
|
||||||
double SOCCLK,
|
|
||||||
- double DRAMClockChangeLatency,
|
|
||||||
- double SRExitTime,
|
|
||||||
- double SREnterPlusExitTime,
|
|
||||||
double DCFCLKDeepSleep,
|
|
||||||
unsigned int DPPPerPlane[],
|
|
||||||
- bool DCCEnable[],
|
|
||||||
double DPPCLK[],
|
|
||||||
unsigned int DETBufferSizeY[],
|
|
||||||
unsigned int DETBufferSizeC[],
|
|
||||||
unsigned int SwathHeightY[],
|
|
||||||
unsigned int SwathHeightC[],
|
|
||||||
- unsigned int LBBitPerPixel[],
|
|
||||||
double SwathWidthY[],
|
|
||||||
double SwathWidthC[],
|
|
||||||
- double HRatio[],
|
|
||||||
- double HRatioChroma[],
|
|
||||||
- unsigned int vtaps[],
|
|
||||||
- unsigned int VTAPsChroma[],
|
|
||||||
- double VRatio[],
|
|
||||||
- double VRatioChroma[],
|
|
||||||
- unsigned int HTotal[],
|
|
||||||
- double PixelClock[],
|
|
||||||
- unsigned int BlendingAndTiming[],
|
|
||||||
double BytePerPixelDETY[],
|
|
||||||
double BytePerPixelDETC[],
|
|
||||||
- double DSTXAfterScaler[],
|
|
||||||
- double DSTYAfterScaler[],
|
|
||||||
- bool WritebackEnable[],
|
|
||||||
- enum source_format_class WritebackPixelFormat[],
|
|
||||||
- double WritebackDestinationWidth[],
|
|
||||||
- double WritebackDestinationHeight[],
|
|
||||||
- double WritebackSourceHeight[],
|
|
||||||
- enum clock_change_support *DRAMClockChangeSupport,
|
|
||||||
- double *UrgentWatermark,
|
|
||||||
- double *WritebackUrgentWatermark,
|
|
||||||
- double *DRAMClockChangeWatermark,
|
|
||||||
- double *WritebackDRAMClockChangeWatermark,
|
|
||||||
- double *StutterExitWatermark,
|
|
||||||
- double *StutterEnterPlusExitWatermark,
|
|
||||||
- double *MinActiveDRAMClockChangeLatencySupported);
|
|
||||||
+ enum clock_change_support *DRAMClockChangeSupport);
|
|
||||||
static void CalculateDCFCLKDeepSleep(
|
|
||||||
struct display_mode_lib *mode_lib,
|
|
||||||
unsigned int NumberOfActivePlanes,
|
|
||||||
@@ -2646,62 +2607,23 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
|
|
||||||
CalculateWatermarksAndDRAMSpeedChangeSupport(
|
|
||||||
mode_lib,
|
|
||||||
PrefetchMode,
|
|
||||||
- v->NumberOfActivePlanes,
|
|
||||||
- v->MaxLineBufferLines,
|
|
||||||
- v->LineBufferSize,
|
|
||||||
- v->DPPOutputBufferPixels,
|
|
||||||
- v->DETBufferSizeInKByte[0],
|
|
||||||
- v->WritebackInterfaceBufferSize,
|
|
||||||
v->DCFCLK,
|
|
||||||
v->ReturnBW,
|
|
||||||
- v->GPUVMEnable,
|
|
||||||
- v->dpte_group_bytes,
|
|
||||||
- v->MetaChunkSize,
|
|
||||||
v->UrgentLatency,
|
|
||||||
v->UrgentExtraLatency,
|
|
||||||
- v->WritebackLatency,
|
|
||||||
- v->WritebackChunkSize,
|
|
||||||
v->SOCCLK,
|
|
||||||
- v->FinalDRAMClockChangeLatency,
|
|
||||||
- v->SRExitTime,
|
|
||||||
- v->SREnterPlusExitTime,
|
|
||||||
v->DCFCLKDeepSleep,
|
|
||||||
v->DPPPerPlane,
|
|
||||||
- v->DCCEnable,
|
|
||||||
v->DPPCLK,
|
|
||||||
v->DETBufferSizeY,
|
|
||||||
v->DETBufferSizeC,
|
|
||||||
v->SwathHeightY,
|
|
||||||
v->SwathHeightC,
|
|
||||||
- v->LBBitPerPixel,
|
|
||||||
v->SwathWidthY,
|
|
||||||
v->SwathWidthC,
|
|
||||||
- v->HRatio,
|
|
||||||
- v->HRatioChroma,
|
|
||||||
- v->vtaps,
|
|
||||||
- v->VTAPsChroma,
|
|
||||||
- v->VRatio,
|
|
||||||
- v->VRatioChroma,
|
|
||||||
- v->HTotal,
|
|
||||||
- v->PixelClock,
|
|
||||||
- v->BlendingAndTiming,
|
|
||||||
v->BytePerPixelDETY,
|
|
||||||
v->BytePerPixelDETC,
|
|
||||||
- v->DSTXAfterScaler,
|
|
||||||
- v->DSTYAfterScaler,
|
|
||||||
- v->WritebackEnable,
|
|
||||||
- v->WritebackPixelFormat,
|
|
||||||
- v->WritebackDestinationWidth,
|
|
||||||
- v->WritebackDestinationHeight,
|
|
||||||
- v->WritebackSourceHeight,
|
|
||||||
- &DRAMClockChangeSupport,
|
|
||||||
- &v->UrgentWatermark,
|
|
||||||
- &v->WritebackUrgentWatermark,
|
|
||||||
- &v->DRAMClockChangeWatermark,
|
|
||||||
- &v->WritebackDRAMClockChangeWatermark,
|
|
||||||
- &v->StutterExitWatermark,
|
|
||||||
- &v->StutterEnterPlusExitWatermark,
|
|
||||||
- &v->MinActiveDRAMClockChangeLatencySupported);
|
|
||||||
+ &DRAMClockChangeSupport);
|
|
||||||
|
|
||||||
for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
|
||||||
if (v->WritebackEnable[k] == true) {
|
|
||||||
@@ -4895,62 +4817,23 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
|
||||||
CalculateWatermarksAndDRAMSpeedChangeSupport(
|
|
||||||
mode_lib,
|
|
||||||
v->PrefetchModePerState[i][j],
|
|
||||||
- v->NumberOfActivePlanes,
|
|
||||||
- v->MaxLineBufferLines,
|
|
||||||
- v->LineBufferSize,
|
|
||||||
- v->DPPOutputBufferPixels,
|
|
||||||
- v->DETBufferSizeInKByte[0],
|
|
||||||
- v->WritebackInterfaceBufferSize,
|
|
||||||
v->DCFCLKState[i][j],
|
|
||||||
v->ReturnBWPerState[i][j],
|
|
||||||
- v->GPUVMEnable,
|
|
||||||
- v->dpte_group_bytes,
|
|
||||||
- v->MetaChunkSize,
|
|
||||||
v->UrgLatency[i],
|
|
||||||
v->ExtraLatency,
|
|
||||||
- v->WritebackLatency,
|
|
||||||
- v->WritebackChunkSize,
|
|
||||||
v->SOCCLKPerState[i],
|
|
||||||
- v->FinalDRAMClockChangeLatency,
|
|
||||||
- v->SRExitTime,
|
|
||||||
- v->SREnterPlusExitTime,
|
|
||||||
v->ProjectedDCFCLKDeepSleep[i][j],
|
|
||||||
v->NoOfDPPThisState,
|
|
||||||
- v->DCCEnable,
|
|
||||||
v->RequiredDPPCLKThisState,
|
|
||||||
v->DETBufferSizeYThisState,
|
|
||||||
v->DETBufferSizeCThisState,
|
|
||||||
v->SwathHeightYThisState,
|
|
||||||
v->SwathHeightCThisState,
|
|
||||||
- v->LBBitPerPixel,
|
|
||||||
v->SwathWidthYThisState,
|
|
||||||
v->SwathWidthCThisState,
|
|
||||||
- v->HRatio,
|
|
||||||
- v->HRatioChroma,
|
|
||||||
- v->vtaps,
|
|
||||||
- v->VTAPsChroma,
|
|
||||||
- v->VRatio,
|
|
||||||
- v->VRatioChroma,
|
|
||||||
- v->HTotal,
|
|
||||||
- v->PixelClock,
|
|
||||||
- v->BlendingAndTiming,
|
|
||||||
v->BytePerPixelInDETY,
|
|
||||||
v->BytePerPixelInDETC,
|
|
||||||
- v->DSTXAfterScaler,
|
|
||||||
- v->DSTYAfterScaler,
|
|
||||||
- v->WritebackEnable,
|
|
||||||
- v->WritebackPixelFormat,
|
|
||||||
- v->WritebackDestinationWidth,
|
|
||||||
- v->WritebackDestinationHeight,
|
|
||||||
- v->WritebackSourceHeight,
|
|
||||||
- &v->DRAMClockChangeSupport[i][j],
|
|
||||||
- &v->UrgentWatermark,
|
|
||||||
- &v->WritebackUrgentWatermark,
|
|
||||||
- &v->DRAMClockChangeWatermark,
|
|
||||||
- &v->WritebackDRAMClockChangeWatermark,
|
|
||||||
- &v->StutterExitWatermark,
|
|
||||||
- &v->StutterEnterPlusExitWatermark,
|
|
||||||
- &v->MinActiveDRAMClockChangeLatencySupported);
|
|
||||||
+ &v->DRAMClockChangeSupport[i][j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -5067,63 +4950,25 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
|
||||||
static void CalculateWatermarksAndDRAMSpeedChangeSupport(
|
|
||||||
struct display_mode_lib *mode_lib,
|
|
||||||
unsigned int PrefetchMode,
|
|
||||||
- unsigned int NumberOfActivePlanes,
|
|
||||||
- unsigned int MaxLineBufferLines,
|
|
||||||
- unsigned int LineBufferSize,
|
|
||||||
- unsigned int DPPOutputBufferPixels,
|
|
||||||
- unsigned int DETBufferSizeInKByte,
|
|
||||||
- unsigned int WritebackInterfaceBufferSize,
|
|
||||||
double DCFCLK,
|
|
||||||
double ReturnBW,
|
|
||||||
- bool GPUVMEnable,
|
|
||||||
- unsigned int dpte_group_bytes[],
|
|
||||||
- unsigned int MetaChunkSize,
|
|
||||||
double UrgentLatency,
|
|
||||||
double ExtraLatency,
|
|
||||||
- double WritebackLatency,
|
|
||||||
- double WritebackChunkSize,
|
|
||||||
double SOCCLK,
|
|
||||||
- double DRAMClockChangeLatency,
|
|
||||||
- double SRExitTime,
|
|
||||||
- double SREnterPlusExitTime,
|
|
||||||
double DCFCLKDeepSleep,
|
|
||||||
unsigned int DPPPerPlane[],
|
|
||||||
- bool DCCEnable[],
|
|
||||||
double DPPCLK[],
|
|
||||||
unsigned int DETBufferSizeY[],
|
|
||||||
unsigned int DETBufferSizeC[],
|
|
||||||
unsigned int SwathHeightY[],
|
|
||||||
unsigned int SwathHeightC[],
|
|
||||||
- unsigned int LBBitPerPixel[],
|
|
||||||
double SwathWidthY[],
|
|
||||||
double SwathWidthC[],
|
|
||||||
- double HRatio[],
|
|
||||||
- double HRatioChroma[],
|
|
||||||
- unsigned int vtaps[],
|
|
||||||
- unsigned int VTAPsChroma[],
|
|
||||||
- double VRatio[],
|
|
||||||
- double VRatioChroma[],
|
|
||||||
- unsigned int HTotal[],
|
|
||||||
- double PixelClock[],
|
|
||||||
- unsigned int BlendingAndTiming[],
|
|
||||||
double BytePerPixelDETY[],
|
|
||||||
double BytePerPixelDETC[],
|
|
||||||
- double DSTXAfterScaler[],
|
|
||||||
- double DSTYAfterScaler[],
|
|
||||||
- bool WritebackEnable[],
|
|
||||||
- enum source_format_class WritebackPixelFormat[],
|
|
||||||
- double WritebackDestinationWidth[],
|
|
||||||
- double WritebackDestinationHeight[],
|
|
||||||
- double WritebackSourceHeight[],
|
|
||||||
- enum clock_change_support *DRAMClockChangeSupport,
|
|
||||||
- double *UrgentWatermark,
|
|
||||||
- double *WritebackUrgentWatermark,
|
|
||||||
- double *DRAMClockChangeWatermark,
|
|
||||||
- double *WritebackDRAMClockChangeWatermark,
|
|
||||||
- double *StutterExitWatermark,
|
|
||||||
- double *StutterEnterPlusExitWatermark,
|
|
||||||
- double *MinActiveDRAMClockChangeLatencySupported)
|
|
||||||
+ enum clock_change_support *DRAMClockChangeSupport)
|
|
||||||
{
|
|
||||||
+ struct vba_vars_st *v = &mode_lib->vba;
|
|
||||||
double EffectiveLBLatencyHidingY = 0;
|
|
||||||
double EffectiveLBLatencyHidingC = 0;
|
|
||||||
double LinesInDETY[DC__NUM_DPP__MAX] = { 0 };
|
|
||||||
@@ -5142,101 +4987,101 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
|
|
||||||
double WritebackDRAMClockChangeLatencyHiding = 0;
|
|
||||||
unsigned int k, j;
|
|
||||||
|
|
||||||
- mode_lib->vba.TotalActiveDPP = 0;
|
|
||||||
- mode_lib->vba.TotalDCCActiveDPP = 0;
|
|
||||||
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
|
||||||
- mode_lib->vba.TotalActiveDPP = mode_lib->vba.TotalActiveDPP + DPPPerPlane[k];
|
|
||||||
- if (DCCEnable[k] == true) {
|
|
||||||
- mode_lib->vba.TotalDCCActiveDPP = mode_lib->vba.TotalDCCActiveDPP + DPPPerPlane[k];
|
|
||||||
+ v->TotalActiveDPP = 0;
|
|
||||||
+ v->TotalDCCActiveDPP = 0;
|
|
||||||
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
|
||||||
+ v->TotalActiveDPP = v->TotalActiveDPP + DPPPerPlane[k];
|
|
||||||
+ if (v->DCCEnable[k] == true) {
|
|
||||||
+ v->TotalDCCActiveDPP = v->TotalDCCActiveDPP + DPPPerPlane[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- *UrgentWatermark = UrgentLatency + ExtraLatency;
|
|
||||||
+ v->UrgentWatermark = UrgentLatency + ExtraLatency;
|
|
||||||
|
|
||||||
- *DRAMClockChangeWatermark = DRAMClockChangeLatency + *UrgentWatermark;
|
|
||||||
+ v->DRAMClockChangeWatermark = v->FinalDRAMClockChangeLatency + v->UrgentWatermark;
|
|
||||||
|
|
||||||
- mode_lib->vba.TotalActiveWriteback = 0;
|
|
||||||
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
|
||||||
- if (WritebackEnable[k] == true) {
|
|
||||||
- mode_lib->vba.TotalActiveWriteback = mode_lib->vba.TotalActiveWriteback + 1;
|
|
||||||
+ v->TotalActiveWriteback = 0;
|
|
||||||
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
|
||||||
+ if (v->WritebackEnable[k] == true) {
|
|
||||||
+ v->TotalActiveWriteback = v->TotalActiveWriteback + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (mode_lib->vba.TotalActiveWriteback <= 1) {
|
|
||||||
- *WritebackUrgentWatermark = WritebackLatency;
|
|
||||||
+ if (v->TotalActiveWriteback <= 1) {
|
|
||||||
+ v->WritebackUrgentWatermark = v->WritebackLatency;
|
|
||||||
} else {
|
|
||||||
- *WritebackUrgentWatermark = WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
|
|
||||||
+ v->WritebackUrgentWatermark = v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (mode_lib->vba.TotalActiveWriteback <= 1) {
|
|
||||||
- *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency;
|
|
||||||
+ if (v->TotalActiveWriteback <= 1) {
|
|
||||||
+ v->WritebackDRAMClockChangeWatermark = v->FinalDRAMClockChangeLatency + v->WritebackLatency;
|
|
||||||
} else {
|
|
||||||
- *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
|
|
||||||
+ v->WritebackDRAMClockChangeWatermark = v->FinalDRAMClockChangeLatency + v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
|
|
||||||
}
|
|
||||||
|
|
||||||
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
|
||||||
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
|
||||||
|
|
||||||
- mode_lib->vba.LBLatencyHidingSourceLinesY = dml_min((double) MaxLineBufferLines, dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(HRatio[k], 1.0)), 1)) - (vtaps[k] - 1);
|
|
||||||
+ v->LBLatencyHidingSourceLinesY = dml_min((double) v->MaxLineBufferLines, dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1);
|
|
||||||
|
|
||||||
- mode_lib->vba.LBLatencyHidingSourceLinesC = dml_min((double) MaxLineBufferLines, dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(HRatioChroma[k], 1.0)), 1)) - (VTAPsChroma[k] - 1);
|
|
||||||
+ v->LBLatencyHidingSourceLinesC = dml_min((double) v->MaxLineBufferLines, dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1);
|
|
||||||
|
|
||||||
- EffectiveLBLatencyHidingY = mode_lib->vba.LBLatencyHidingSourceLinesY / VRatio[k] * (HTotal[k] / PixelClock[k]);
|
|
||||||
+ EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / v->VRatio[k] * (v->HTotal[k] / v->PixelClock[k]);
|
|
||||||
|
|
||||||
- EffectiveLBLatencyHidingC = mode_lib->vba.LBLatencyHidingSourceLinesC / VRatioChroma[k] * (HTotal[k] / PixelClock[k]);
|
|
||||||
+ EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / v->VRatioChroma[k] * (v->HTotal[k] / v->PixelClock[k]);
|
|
||||||
|
|
||||||
LinesInDETY[k] = (double) DETBufferSizeY[k] / BytePerPixelDETY[k] / SwathWidthY[k];
|
|
||||||
LinesInDETYRoundedDownToSwath[k] = dml_floor(LinesInDETY[k], SwathHeightY[k]);
|
|
||||||
- FullDETBufferingTimeY[k] = LinesInDETYRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) / VRatio[k];
|
|
||||||
+ FullDETBufferingTimeY[k] = LinesInDETYRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k];
|
|
||||||
if (BytePerPixelDETC[k] > 0) {
|
|
||||||
- LinesInDETC = mode_lib->vba.DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k];
|
|
||||||
+ LinesInDETC = v->DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k];
|
|
||||||
LinesInDETCRoundedDownToSwath = dml_floor(LinesInDETC, SwathHeightC[k]);
|
|
||||||
- FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (HTotal[k] / PixelClock[k]) / VRatioChroma[k];
|
|
||||||
+ FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (v->HTotal[k] / v->PixelClock[k]) / v->VRatioChroma[k];
|
|
||||||
} else {
|
|
||||||
LinesInDETC = 0;
|
|
||||||
FullDETBufferingTimeC = 999999;
|
|
||||||
}
|
|
||||||
|
|
||||||
- ActiveDRAMClockChangeLatencyMarginY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY[k] - *UrgentWatermark - (HTotal[k] / PixelClock[k]) * (DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) - *DRAMClockChangeWatermark;
|
|
||||||
+ ActiveDRAMClockChangeLatencyMarginY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY[k] - v->UrgentWatermark - (v->HTotal[k] / v->PixelClock[k]) * (v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) - v->DRAMClockChangeWatermark;
|
|
||||||
|
|
||||||
- if (NumberOfActivePlanes > 1) {
|
|
||||||
- ActiveDRAMClockChangeLatencyMarginY = ActiveDRAMClockChangeLatencyMarginY - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightY[k] * HTotal[k] / PixelClock[k] / VRatio[k];
|
|
||||||
+ if (v->NumberOfActivePlanes > 1) {
|
|
||||||
+ ActiveDRAMClockChangeLatencyMarginY = ActiveDRAMClockChangeLatencyMarginY - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightY[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatio[k];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BytePerPixelDETC[k] > 0) {
|
|
||||||
- ActiveDRAMClockChangeLatencyMarginC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC - *UrgentWatermark - (HTotal[k] / PixelClock[k]) * (DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) - *DRAMClockChangeWatermark;
|
|
||||||
+ ActiveDRAMClockChangeLatencyMarginC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC - v->UrgentWatermark - (v->HTotal[k] / v->PixelClock[k]) * (v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) - v->DRAMClockChangeWatermark;
|
|
||||||
|
|
||||||
- if (NumberOfActivePlanes > 1) {
|
|
||||||
- ActiveDRAMClockChangeLatencyMarginC = ActiveDRAMClockChangeLatencyMarginC - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightC[k] * HTotal[k] / PixelClock[k] / VRatioChroma[k];
|
|
||||||
+ if (v->NumberOfActivePlanes > 1) {
|
|
||||||
+ ActiveDRAMClockChangeLatencyMarginC = ActiveDRAMClockChangeLatencyMarginC - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightC[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatioChroma[k];
|
|
||||||
}
|
|
||||||
- mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC);
|
|
||||||
+ v->ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC);
|
|
||||||
} else {
|
|
||||||
- mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k] = ActiveDRAMClockChangeLatencyMarginY;
|
|
||||||
+ v->ActiveDRAMClockChangeLatencyMargin[k] = ActiveDRAMClockChangeLatencyMarginY;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (WritebackEnable[k] == true) {
|
|
||||||
+ if (v->WritebackEnable[k] == true) {
|
|
||||||
|
|
||||||
- WritebackDRAMClockChangeLatencyHiding = WritebackInterfaceBufferSize * 1024 / (WritebackDestinationWidth[k] * WritebackDestinationHeight[k] / (WritebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4);
|
|
||||||
- if (WritebackPixelFormat[k] == dm_444_64) {
|
|
||||||
+ WritebackDRAMClockChangeLatencyHiding = v->WritebackInterfaceBufferSize * 1024 / (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k] / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4);
|
|
||||||
+ if (v->WritebackPixelFormat[k] == dm_444_64) {
|
|
||||||
WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding / 2;
|
|
||||||
}
|
|
||||||
- if (mode_lib->vba.WritebackConfiguration == dm_whole_buffer_for_single_stream_interleave) {
|
|
||||||
+ if (v->WritebackConfiguration == dm_whole_buffer_for_single_stream_interleave) {
|
|
||||||
WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding * 2;
|
|
||||||
}
|
|
||||||
- WritebackDRAMClockChangeLatencyMargin = WritebackDRAMClockChangeLatencyHiding - mode_lib->vba.WritebackDRAMClockChangeWatermark;
|
|
||||||
- mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k] = dml_min(mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k], WritebackDRAMClockChangeLatencyMargin);
|
|
||||||
+ WritebackDRAMClockChangeLatencyMargin = WritebackDRAMClockChangeLatencyHiding - v->WritebackDRAMClockChangeWatermark;
|
|
||||||
+ v->ActiveDRAMClockChangeLatencyMargin[k] = dml_min(v->ActiveDRAMClockChangeLatencyMargin[k], WritebackDRAMClockChangeLatencyMargin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- mode_lib->vba.MinActiveDRAMClockChangeMargin = 999999;
|
|
||||||
+ v->MinActiveDRAMClockChangeMargin = 999999;
|
|
||||||
PlaneWithMinActiveDRAMClockChangeMargin = 0;
|
|
||||||
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
|
||||||
- if (mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k] < mode_lib->vba.MinActiveDRAMClockChangeMargin) {
|
|
||||||
- mode_lib->vba.MinActiveDRAMClockChangeMargin = mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k];
|
|
||||||
- if (BlendingAndTiming[k] == k) {
|
|
||||||
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
|
||||||
+ if (v->ActiveDRAMClockChangeLatencyMargin[k] < v->MinActiveDRAMClockChangeMargin) {
|
|
||||||
+ v->MinActiveDRAMClockChangeMargin = v->ActiveDRAMClockChangeLatencyMargin[k];
|
|
||||||
+ if (v->BlendingAndTiming[k] == k) {
|
|
||||||
PlaneWithMinActiveDRAMClockChangeMargin = k;
|
|
||||||
} else {
|
|
||||||
- for (j = 0; j < NumberOfActivePlanes; ++j) {
|
|
||||||
- if (BlendingAndTiming[k] == j) {
|
|
||||||
+ for (j = 0; j < v->NumberOfActivePlanes; ++j) {
|
|
||||||
+ if (v->BlendingAndTiming[k] == j) {
|
|
||||||
PlaneWithMinActiveDRAMClockChangeMargin = j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5244,40 +5089,40 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- *MinActiveDRAMClockChangeLatencySupported = mode_lib->vba.MinActiveDRAMClockChangeMargin + DRAMClockChangeLatency;
|
|
||||||
+ v->MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + v->FinalDRAMClockChangeLatency;
|
|
||||||
|
|
||||||
SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = 999999;
|
|
||||||
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
|
||||||
- if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (BlendingAndTiming[k] == k)) && !(BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin) && mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank) {
|
|
||||||
- SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = mode_lib->vba.ActiveDRAMClockChangeLatencyMargin[k];
|
|
||||||
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
|
||||||
+ if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (v->BlendingAndTiming[k] == k)) && !(v->BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin) && v->ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank) {
|
|
||||||
+ SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = v->ActiveDRAMClockChangeLatencyMargin[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- mode_lib->vba.TotalNumberOfActiveOTG = 0;
|
|
||||||
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
|
||||||
- if (BlendingAndTiming[k] == k) {
|
|
||||||
- mode_lib->vba.TotalNumberOfActiveOTG = mode_lib->vba.TotalNumberOfActiveOTG + 1;
|
|
||||||
+ v->TotalNumberOfActiveOTG = 0;
|
|
||||||
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
|
||||||
+ if (v->BlendingAndTiming[k] == k) {
|
|
||||||
+ v->TotalNumberOfActiveOTG = v->TotalNumberOfActiveOTG + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (mode_lib->vba.MinActiveDRAMClockChangeMargin > 0) {
|
|
||||||
+ if (v->MinActiveDRAMClockChangeMargin > 0) {
|
|
||||||
*DRAMClockChangeSupport = dm_dram_clock_change_vactive;
|
|
||||||
- } else if (((mode_lib->vba.SynchronizedVBlank == true || mode_lib->vba.TotalNumberOfActiveOTG == 1 || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0)) {
|
|
||||||
+ } else if (((v->SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1 || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0)) {
|
|
||||||
*DRAMClockChangeSupport = dm_dram_clock_change_vblank;
|
|
||||||
} else {
|
|
||||||
*DRAMClockChangeSupport = dm_dram_clock_change_unsupported;
|
|
||||||
}
|
|
||||||
|
|
||||||
FullDETBufferingTimeYStutterCriticalPlane = FullDETBufferingTimeY[0];
|
|
||||||
- for (k = 0; k < NumberOfActivePlanes; ++k) {
|
|
||||||
+ for (k = 0; k < v->NumberOfActivePlanes; ++k) {
|
|
||||||
if (FullDETBufferingTimeY[k] <= FullDETBufferingTimeYStutterCriticalPlane) {
|
|
||||||
FullDETBufferingTimeYStutterCriticalPlane = FullDETBufferingTimeY[k];
|
|
||||||
- TimeToFinishSwathTransferStutterCriticalPlane = (SwathHeightY[k] - (LinesInDETY[k] - LinesInDETYRoundedDownToSwath[k])) * (HTotal[k] / PixelClock[k]) / VRatio[k];
|
|
||||||
+ TimeToFinishSwathTransferStutterCriticalPlane = (SwathHeightY[k] - (LinesInDETY[k] - LinesInDETYRoundedDownToSwath[k])) * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- *StutterExitWatermark = SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep;
|
|
||||||
- *StutterEnterPlusExitWatermark = dml_max(SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep, TimeToFinishSwathTransferStutterCriticalPlane);
|
|
||||||
+ v->StutterExitWatermark = v->SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep;
|
|
||||||
+ v->StutterEnterPlusExitWatermark = dml_max(v->SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep, TimeToFinishSwathTransferStutterCriticalPlane);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
cgit 1.2.3-korg
|
|
||||||
@@ -1,606 +0,0 @@
|
|||||||
From f54a91f5337cd918eb86cf600320d25b6cfd8209 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Nathan Chancellor <nathan@kernel.org>
|
|
||||||
Date: Sat, 13 Dec 2025 19:58:10 +0900
|
|
||||||
Subject: drm/amd/display: Reduce number of arguments of dcn30's
|
|
||||||
CalculatePrefetchSchedule()
|
|
||||||
|
|
||||||
After an innocuous optimization change in clang-22,
|
|
||||||
dml30_ModeSupportAndSystemConfigurationFull() is over the 2048 byte
|
|
||||||
stack limit for display_mode_vba_30.c.
|
|
||||||
|
|
||||||
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3529:6: warning: stack frame size (2096) exceeds limit (2048) in 'dml30_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than]
|
|
||||||
3529 | void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
|
|
||||||
| ^
|
|
||||||
|
|
||||||
With clang-21, this function was already close to the limit:
|
|
||||||
|
|
||||||
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3529:6: warning: stack frame size (1912) exceeds limit (1586) in 'dml30_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than]
|
|
||||||
3529 | void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
|
|
||||||
| ^
|
|
||||||
|
|
||||||
CalculatePrefetchSchedule() has a large number of parameters, which must
|
|
||||||
be passed on the stack. Most of the parameters between the two callsites
|
|
||||||
are the same, so they can be accessed through the existing mode_lib
|
|
||||||
pointer, instead of being passed as explicit arguments. Doing this
|
|
||||||
reduces the stack size of dml30_ModeSupportAndSystemConfigurationFull()
|
|
||||||
from 2096 bytes to 1912 bytes with clang-22.
|
|
||||||
|
|
||||||
Closes: https://github.com/ClangBuiltLinux/linux/issues/2117
|
|
||||||
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
|
|
||||||
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
|
|
||||||
(cherry picked from commit b20b3fc4210f83089f835cdb91deec4b0778761a)
|
|
||||||
---
|
|
||||||
.../amd/display/dc/dml/dcn30/display_mode_vba_30.c | 258 ++++++---------------
|
|
||||||
1 file changed, 73 insertions(+), 185 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
|
|
||||||
index abe51cf3aab2..a244504cc1f2 100644
|
|
||||||
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
|
|
||||||
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
|
|
||||||
@@ -77,32 +77,14 @@ static unsigned int dscceComputeDelay(
|
|
||||||
static unsigned int dscComputeDelay(
|
|
||||||
enum output_format_class pixelFormat,
|
|
||||||
enum output_encoder_class Output);
|
|
||||||
-// Super monster function with some 45 argument
|
|
||||||
static bool CalculatePrefetchSchedule(
|
|
||||||
struct display_mode_lib *mode_lib,
|
|
||||||
- double PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData,
|
|
||||||
- double PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly,
|
|
||||||
+ unsigned int k,
|
|
||||||
Pipe *myPipe,
|
|
||||||
unsigned int DSCDelay,
|
|
||||||
- double DPPCLKDelaySubtotalPlusCNVCFormater,
|
|
||||||
- double DPPCLKDelaySCL,
|
|
||||||
- double DPPCLKDelaySCLLBOnly,
|
|
||||||
- double DPPCLKDelayCNVCCursor,
|
|
||||||
- double DISPCLKDelaySubtotal,
|
|
||||||
unsigned int DPP_RECOUT_WIDTH,
|
|
||||||
- enum output_format_class OutputFormat,
|
|
||||||
- unsigned int MaxInterDCNTileRepeaters,
|
|
||||||
unsigned int VStartup,
|
|
||||||
unsigned int MaxVStartup,
|
|
||||||
- unsigned int GPUVMPageTableLevels,
|
|
||||||
- bool GPUVMEnable,
|
|
||||||
- bool HostVMEnable,
|
|
||||||
- unsigned int HostVMMaxNonCachedPageTableLevels,
|
|
||||||
- double HostVMMinPageSize,
|
|
||||||
- bool DynamicMetadataEnable,
|
|
||||||
- bool DynamicMetadataVMEnabled,
|
|
||||||
- int DynamicMetadataLinesBeforeActiveRequired,
|
|
||||||
- unsigned int DynamicMetadataTransmittedBytes,
|
|
||||||
double UrgentLatency,
|
|
||||||
double UrgentExtraLatency,
|
|
||||||
double TCalc,
|
|
||||||
@@ -116,7 +98,6 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
unsigned int MaxNumSwathY,
|
|
||||||
double PrefetchSourceLinesC,
|
|
||||||
unsigned int SwathWidthC,
|
|
||||||
- int BytePerPixelC,
|
|
||||||
double VInitPreFillC,
|
|
||||||
unsigned int MaxNumSwathC,
|
|
||||||
long swath_width_luma_ub,
|
|
||||||
@@ -124,9 +105,6 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
unsigned int SwathHeightY,
|
|
||||||
unsigned int SwathHeightC,
|
|
||||||
double TWait,
|
|
||||||
- bool ProgressiveToInterlaceUnitInOPP,
|
|
||||||
- double *DSTXAfterScaler,
|
|
||||||
- double *DSTYAfterScaler,
|
|
||||||
double *DestinationLinesForPrefetch,
|
|
||||||
double *PrefetchBandwidth,
|
|
||||||
double *DestinationLinesToRequestVMInVBlank,
|
|
||||||
@@ -135,14 +113,7 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
double *VRatioPrefetchC,
|
|
||||||
double *RequiredPrefetchPixDataBWLuma,
|
|
||||||
double *RequiredPrefetchPixDataBWChroma,
|
|
||||||
- bool *NotEnoughTimeForDynamicMetadata,
|
|
||||||
- double *Tno_bw,
|
|
||||||
- double *prefetch_vmrow_bw,
|
|
||||||
- double *Tdmdl_vm,
|
|
||||||
- double *Tdmdl,
|
|
||||||
- unsigned int *VUpdateOffsetPix,
|
|
||||||
- double *VUpdateWidthPix,
|
|
||||||
- double *VReadyOffsetPix);
|
|
||||||
+ bool *NotEnoughTimeForDynamicMetadata);
|
|
||||||
static double RoundToDFSGranularityUp(double Clock, double VCOSpeed);
|
|
||||||
static double RoundToDFSGranularityDown(double Clock, double VCOSpeed);
|
|
||||||
static void CalculateDCCConfiguration(
|
|
||||||
@@ -810,29 +781,12 @@ static unsigned int dscComputeDelay(enum output_format_class pixelFormat, enum o
|
|
||||||
|
|
||||||
static bool CalculatePrefetchSchedule(
|
|
||||||
struct display_mode_lib *mode_lib,
|
|
||||||
- double PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData,
|
|
||||||
- double PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly,
|
|
||||||
+ unsigned int k,
|
|
||||||
Pipe *myPipe,
|
|
||||||
unsigned int DSCDelay,
|
|
||||||
- double DPPCLKDelaySubtotalPlusCNVCFormater,
|
|
||||||
- double DPPCLKDelaySCL,
|
|
||||||
- double DPPCLKDelaySCLLBOnly,
|
|
||||||
- double DPPCLKDelayCNVCCursor,
|
|
||||||
- double DISPCLKDelaySubtotal,
|
|
||||||
unsigned int DPP_RECOUT_WIDTH,
|
|
||||||
- enum output_format_class OutputFormat,
|
|
||||||
- unsigned int MaxInterDCNTileRepeaters,
|
|
||||||
unsigned int VStartup,
|
|
||||||
unsigned int MaxVStartup,
|
|
||||||
- unsigned int GPUVMPageTableLevels,
|
|
||||||
- bool GPUVMEnable,
|
|
||||||
- bool HostVMEnable,
|
|
||||||
- unsigned int HostVMMaxNonCachedPageTableLevels,
|
|
||||||
- double HostVMMinPageSize,
|
|
||||||
- bool DynamicMetadataEnable,
|
|
||||||
- bool DynamicMetadataVMEnabled,
|
|
||||||
- int DynamicMetadataLinesBeforeActiveRequired,
|
|
||||||
- unsigned int DynamicMetadataTransmittedBytes,
|
|
||||||
double UrgentLatency,
|
|
||||||
double UrgentExtraLatency,
|
|
||||||
double TCalc,
|
|
||||||
@@ -846,7 +800,6 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
unsigned int MaxNumSwathY,
|
|
||||||
double PrefetchSourceLinesC,
|
|
||||||
unsigned int SwathWidthC,
|
|
||||||
- int BytePerPixelC,
|
|
||||||
double VInitPreFillC,
|
|
||||||
unsigned int MaxNumSwathC,
|
|
||||||
long swath_width_luma_ub,
|
|
||||||
@@ -854,9 +807,6 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
unsigned int SwathHeightY,
|
|
||||||
unsigned int SwathHeightC,
|
|
||||||
double TWait,
|
|
||||||
- bool ProgressiveToInterlaceUnitInOPP,
|
|
||||||
- double *DSTXAfterScaler,
|
|
||||||
- double *DSTYAfterScaler,
|
|
||||||
double *DestinationLinesForPrefetch,
|
|
||||||
double *PrefetchBandwidth,
|
|
||||||
double *DestinationLinesToRequestVMInVBlank,
|
|
||||||
@@ -865,15 +815,10 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
double *VRatioPrefetchC,
|
|
||||||
double *RequiredPrefetchPixDataBWLuma,
|
|
||||||
double *RequiredPrefetchPixDataBWChroma,
|
|
||||||
- bool *NotEnoughTimeForDynamicMetadata,
|
|
||||||
- double *Tno_bw,
|
|
||||||
- double *prefetch_vmrow_bw,
|
|
||||||
- double *Tdmdl_vm,
|
|
||||||
- double *Tdmdl,
|
|
||||||
- unsigned int *VUpdateOffsetPix,
|
|
||||||
- double *VUpdateWidthPix,
|
|
||||||
- double *VReadyOffsetPix)
|
|
||||||
+ bool *NotEnoughTimeForDynamicMetadata)
|
|
||||||
{
|
|
||||||
+ struct vba_vars_st *v = &mode_lib->vba;
|
|
||||||
+ double DPPCLKDelaySubtotalPlusCNVCFormater = v->DPPCLKDelaySubtotal + v->DPPCLKDelayCNVCFormater;
|
|
||||||
bool MyError = false;
|
|
||||||
unsigned int DPPCycles = 0, DISPCLKCycles = 0;
|
|
||||||
double DSTTotalPixelsAfterScaler = 0;
|
|
||||||
@@ -905,26 +850,26 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
double Tdmec = 0;
|
|
||||||
double Tdmsks = 0;
|
|
||||||
|
|
||||||
- if (GPUVMEnable == true && HostVMEnable == true) {
|
|
||||||
- HostVMInefficiencyFactor = PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData / PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly;
|
|
||||||
- HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels;
|
|
||||||
+ if (v->GPUVMEnable == true && v->HostVMEnable == true) {
|
|
||||||
+ HostVMInefficiencyFactor = v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData / v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly;
|
|
||||||
+ HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels;
|
|
||||||
} else {
|
|
||||||
HostVMInefficiencyFactor = 1;
|
|
||||||
HostVMDynamicLevelsTrips = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CalculateDynamicMetadataParameters(
|
|
||||||
- MaxInterDCNTileRepeaters,
|
|
||||||
+ v->MaxInterDCNTileRepeaters,
|
|
||||||
myPipe->DPPCLK,
|
|
||||||
myPipe->DISPCLK,
|
|
||||||
myPipe->DCFCLKDeepSleep,
|
|
||||||
myPipe->PixelClock,
|
|
||||||
myPipe->HTotal,
|
|
||||||
myPipe->VBlank,
|
|
||||||
- DynamicMetadataTransmittedBytes,
|
|
||||||
- DynamicMetadataLinesBeforeActiveRequired,
|
|
||||||
+ v->DynamicMetadataTransmittedBytes[k],
|
|
||||||
+ v->DynamicMetadataLinesBeforeActiveRequired[k],
|
|
||||||
myPipe->InterlaceEnable,
|
|
||||||
- ProgressiveToInterlaceUnitInOPP,
|
|
||||||
+ v->ProgressiveToInterlaceUnitInOPP,
|
|
||||||
&Tsetup,
|
|
||||||
&Tdmbf,
|
|
||||||
&Tdmec,
|
|
||||||
@@ -932,16 +877,16 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
|
|
||||||
LineTime = myPipe->HTotal / myPipe->PixelClock;
|
|
||||||
trip_to_mem = UrgentLatency;
|
|
||||||
- Tvm_trips = UrgentExtraLatency + trip_to_mem * (GPUVMPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1);
|
|
||||||
+ Tvm_trips = UrgentExtraLatency + trip_to_mem * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1);
|
|
||||||
|
|
||||||
- if (DynamicMetadataVMEnabled == true && GPUVMEnable == true) {
|
|
||||||
- *Tdmdl = TWait + Tvm_trips + trip_to_mem;
|
|
||||||
+ if (v->DynamicMetadataVMEnabled == true && v->GPUVMEnable == true) {
|
|
||||||
+ v->Tdmdl[k] = TWait + Tvm_trips + trip_to_mem;
|
|
||||||
} else {
|
|
||||||
- *Tdmdl = TWait + UrgentExtraLatency;
|
|
||||||
+ v->Tdmdl[k] = TWait + UrgentExtraLatency;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (DynamicMetadataEnable == true) {
|
|
||||||
- if (VStartup * LineTime < Tsetup + *Tdmdl + Tdmbf + Tdmec + Tdmsks) {
|
|
||||||
+ if (v->DynamicMetadataEnable[k] == true) {
|
|
||||||
+ if (VStartup * LineTime < Tsetup + v->Tdmdl[k] + Tdmbf + Tdmec + Tdmsks) {
|
|
||||||
*NotEnoughTimeForDynamicMetadata = true;
|
|
||||||
} else {
|
|
||||||
*NotEnoughTimeForDynamicMetadata = false;
|
|
||||||
@@ -949,39 +894,39 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
dml_print("DML: Tdmbf: %fus - time for dmd transfer from dchub to dio output buffer\n", Tdmbf);
|
|
||||||
dml_print("DML: Tdmec: %fus - time dio takes to transfer dmd\n", Tdmec);
|
|
||||||
dml_print("DML: Tdmsks: %fus - time before active dmd must complete transmission at dio\n", Tdmsks);
|
|
||||||
- dml_print("DML: Tdmdl: %fus - time for fabric to become ready and fetch dmd \n", *Tdmdl);
|
|
||||||
+ dml_print("DML: Tdmdl: %fus - time for fabric to become ready and fetch dmd \n", v->Tdmdl[k]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
*NotEnoughTimeForDynamicMetadata = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- *Tdmdl_vm = (DynamicMetadataEnable == true && DynamicMetadataVMEnabled == true && GPUVMEnable == true ? TWait + Tvm_trips : 0);
|
|
||||||
+ v->Tdmdl_vm[k] = (v->DynamicMetadataEnable[k] == true && v->DynamicMetadataVMEnabled == true && v->GPUVMEnable == true ? TWait + Tvm_trips : 0);
|
|
||||||
|
|
||||||
if (myPipe->ScalerEnabled)
|
|
||||||
- DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + DPPCLKDelaySCL;
|
|
||||||
+ DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + v->DPPCLKDelaySCL;
|
|
||||||
else
|
|
||||||
- DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + DPPCLKDelaySCLLBOnly;
|
|
||||||
+ DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + v->DPPCLKDelaySCLLBOnly;
|
|
||||||
|
|
||||||
- DPPCycles = DPPCycles + myPipe->NumberOfCursors * DPPCLKDelayCNVCCursor;
|
|
||||||
+ DPPCycles = DPPCycles + myPipe->NumberOfCursors * v->DPPCLKDelayCNVCCursor;
|
|
||||||
|
|
||||||
- DISPCLKCycles = DISPCLKDelaySubtotal;
|
|
||||||
+ DISPCLKCycles = v->DISPCLKDelaySubtotal;
|
|
||||||
|
|
||||||
if (myPipe->DPPCLK == 0.0 || myPipe->DISPCLK == 0.0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
- *DSTXAfterScaler = DPPCycles * myPipe->PixelClock / myPipe->DPPCLK + DISPCLKCycles * myPipe->PixelClock / myPipe->DISPCLK
|
|
||||||
+ v->DSTXAfterScaler[k] = DPPCycles * myPipe->PixelClock / myPipe->DPPCLK + DISPCLKCycles * myPipe->PixelClock / myPipe->DISPCLK
|
|
||||||
+ DSCDelay;
|
|
||||||
|
|
||||||
- *DSTXAfterScaler = *DSTXAfterScaler + ((myPipe->ODMCombineEnabled)?18:0) + (myPipe->DPPPerPlane - 1) * DPP_RECOUT_WIDTH;
|
|
||||||
+ v->DSTXAfterScaler[k] = v->DSTXAfterScaler[k] + ((myPipe->ODMCombineEnabled)?18:0) + (myPipe->DPPPerPlane - 1) * DPP_RECOUT_WIDTH;
|
|
||||||
|
|
||||||
- if (OutputFormat == dm_420 || (myPipe->InterlaceEnable && ProgressiveToInterlaceUnitInOPP))
|
|
||||||
- *DSTYAfterScaler = 1;
|
|
||||||
+ if (v->OutputFormat[k] == dm_420 || (myPipe->InterlaceEnable && v->ProgressiveToInterlaceUnitInOPP))
|
|
||||||
+ v->DSTYAfterScaler[k] = 1;
|
|
||||||
else
|
|
||||||
- *DSTYAfterScaler = 0;
|
|
||||||
+ v->DSTYAfterScaler[k] = 0;
|
|
||||||
|
|
||||||
- DSTTotalPixelsAfterScaler = *DSTYAfterScaler * myPipe->HTotal + *DSTXAfterScaler;
|
|
||||||
- *DSTYAfterScaler = dml_floor(DSTTotalPixelsAfterScaler / myPipe->HTotal, 1);
|
|
||||||
- *DSTXAfterScaler = DSTTotalPixelsAfterScaler - ((double) (*DSTYAfterScaler * myPipe->HTotal));
|
|
||||||
+ DSTTotalPixelsAfterScaler = v->DSTYAfterScaler[k] * myPipe->HTotal + v->DSTXAfterScaler[k];
|
|
||||||
+ v->DSTYAfterScaler[k] = dml_floor(DSTTotalPixelsAfterScaler / myPipe->HTotal, 1);
|
|
||||||
+ v->DSTXAfterScaler[k] = DSTTotalPixelsAfterScaler - ((double) (v->DSTYAfterScaler[k] * myPipe->HTotal));
|
|
||||||
|
|
||||||
MyError = false;
|
|
||||||
|
|
||||||
@@ -990,32 +935,32 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
Tvm_trips_rounded = dml_ceil(4.0 * Tvm_trips / LineTime, 1) / 4 * LineTime;
|
|
||||||
Tr0_trips_rounded = dml_ceil(4.0 * Tr0_trips / LineTime, 1) / 4 * LineTime;
|
|
||||||
|
|
||||||
- if (GPUVMEnable) {
|
|
||||||
- if (GPUVMPageTableLevels >= 3) {
|
|
||||||
- *Tno_bw = UrgentExtraLatency + trip_to_mem * ((GPUVMPageTableLevels - 2) - 1);
|
|
||||||
+ if (v->GPUVMEnable) {
|
|
||||||
+ if (v->GPUVMMaxPageTableLevels >= 3) {
|
|
||||||
+ v->Tno_bw[k] = UrgentExtraLatency + trip_to_mem * ((v->GPUVMMaxPageTableLevels - 2) - 1);
|
|
||||||
} else
|
|
||||||
- *Tno_bw = 0;
|
|
||||||
+ v->Tno_bw[k] = 0;
|
|
||||||
} else if (!myPipe->DCCEnable)
|
|
||||||
- *Tno_bw = LineTime;
|
|
||||||
+ v->Tno_bw[k] = LineTime;
|
|
||||||
else
|
|
||||||
- *Tno_bw = LineTime / 4;
|
|
||||||
+ v->Tno_bw[k] = LineTime / 4;
|
|
||||||
|
|
||||||
- dst_y_prefetch_equ = VStartup - (Tsetup + dml_max(TWait + TCalc, *Tdmdl)) / LineTime
|
|
||||||
- - (*DSTYAfterScaler + *DSTXAfterScaler / myPipe->HTotal);
|
|
||||||
+ dst_y_prefetch_equ = VStartup - (Tsetup + dml_max(TWait + TCalc, v->Tdmdl[k])) / LineTime
|
|
||||||
+ - (v->DSTYAfterScaler[k] + v->DSTXAfterScaler[k] / myPipe->HTotal);
|
|
||||||
|
|
||||||
Lsw_oto = dml_max(PrefetchSourceLinesY, PrefetchSourceLinesC);
|
|
||||||
Tsw_oto = Lsw_oto * LineTime;
|
|
||||||
|
|
||||||
- prefetch_bw_oto = (PrefetchSourceLinesY * swath_width_luma_ub * BytePerPixelY + PrefetchSourceLinesC * swath_width_chroma_ub * BytePerPixelC) / Tsw_oto;
|
|
||||||
+ prefetch_bw_oto = (PrefetchSourceLinesY * swath_width_luma_ub * BytePerPixelY + PrefetchSourceLinesC * swath_width_chroma_ub * v->BytePerPixelC[k]) / Tsw_oto;
|
|
||||||
|
|
||||||
- if (GPUVMEnable == true) {
|
|
||||||
- Tvm_oto = dml_max3(*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / prefetch_bw_oto,
|
|
||||||
+ if (v->GPUVMEnable == true) {
|
|
||||||
+ Tvm_oto = dml_max3(v->Tno_bw[k] + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / prefetch_bw_oto,
|
|
||||||
Tvm_trips,
|
|
||||||
LineTime / 4.0);
|
|
||||||
} else
|
|
||||||
Tvm_oto = LineTime / 4.0;
|
|
||||||
|
|
||||||
- if ((GPUVMEnable == true || myPipe->DCCEnable == true)) {
|
|
||||||
+ if ((v->GPUVMEnable == true || myPipe->DCCEnable == true)) {
|
|
||||||
Tr0_oto = dml_max3(
|
|
||||||
(MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / prefetch_bw_oto,
|
|
||||||
LineTime - Tvm_oto, LineTime / 4);
|
|
||||||
@@ -1041,10 +986,10 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
dml_print("DML: Tdmbf: %fus - time for dmd transfer from dchub to dio output buffer\n", Tdmbf);
|
|
||||||
dml_print("DML: Tdmec: %fus - time dio takes to transfer dmd\n", Tdmec);
|
|
||||||
dml_print("DML: Tdmsks: %fus - time before active dmd must complete transmission at dio\n", Tdmsks);
|
|
||||||
- dml_print("DML: Tdmdl_vm: %fus - time for vm stages of dmd \n", *Tdmdl_vm);
|
|
||||||
- dml_print("DML: Tdmdl: %fus - time for fabric to become ready and fetch dmd \n", *Tdmdl);
|
|
||||||
- dml_print("DML: dst_x_after_scl: %f pixels - number of pixel clocks pipeline and buffer delay after scaler \n", *DSTXAfterScaler);
|
|
||||||
- dml_print("DML: dst_y_after_scl: %d lines - number of lines of pipeline and buffer delay after scaler \n", (int)*DSTYAfterScaler);
|
|
||||||
+ dml_print("DML: Tdmdl_vm: %fus - time for vm stages of dmd \n", v->Tdmdl_vm[k]);
|
|
||||||
+ dml_print("DML: Tdmdl: %fus - time for fabric to become ready and fetch dmd \n", v->Tdmdl[k]);
|
|
||||||
+ dml_print("DML: dst_x_after_scl: %f pixels - number of pixel clocks pipeline and buffer delay after scaler \n", v->DSTXAfterScaler[k]);
|
|
||||||
+ dml_print("DML: dst_y_after_scl: %d lines - number of lines of pipeline and buffer delay after scaler \n", (int)v->DSTYAfterScaler[k]);
|
|
||||||
|
|
||||||
*PrefetchBandwidth = 0;
|
|
||||||
*DestinationLinesToRequestVMInVBlank = 0;
|
|
||||||
@@ -1058,26 +1003,26 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
double PrefetchBandwidth3 = 0;
|
|
||||||
double PrefetchBandwidth4 = 0;
|
|
||||||
|
|
||||||
- if (Tpre_rounded - *Tno_bw > 0)
|
|
||||||
+ if (Tpre_rounded - v->Tno_bw[k] > 0)
|
|
||||||
PrefetchBandwidth1 = (PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor + 2 * MetaRowByte
|
|
||||||
+ 2 * PixelPTEBytesPerRow * HostVMInefficiencyFactor
|
|
||||||
+ PrefetchSourceLinesY * swath_width_luma_ub * BytePerPixelY
|
|
||||||
- + PrefetchSourceLinesC * swath_width_chroma_ub * BytePerPixelC)
|
|
||||||
- / (Tpre_rounded - *Tno_bw);
|
|
||||||
+ + PrefetchSourceLinesC * swath_width_chroma_ub * v->BytePerPixelC[k])
|
|
||||||
+ / (Tpre_rounded - v->Tno_bw[k]);
|
|
||||||
else
|
|
||||||
PrefetchBandwidth1 = 0;
|
|
||||||
|
|
||||||
- if (VStartup == MaxVStartup && (PrefetchBandwidth1 > 4 * prefetch_bw_oto) && (Tpre_rounded - Tsw_oto / 4 - 0.75 * LineTime - *Tno_bw) > 0) {
|
|
||||||
- PrefetchBandwidth1 = (PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor + 2 * MetaRowByte + 2 * PixelPTEBytesPerRow * HostVMInefficiencyFactor) / (Tpre_rounded - Tsw_oto / 4 - 0.75 * LineTime - *Tno_bw);
|
|
||||||
+ if (VStartup == MaxVStartup && (PrefetchBandwidth1 > 4 * prefetch_bw_oto) && (Tpre_rounded - Tsw_oto / 4 - 0.75 * LineTime - v->Tno_bw[k]) > 0) {
|
|
||||||
+ PrefetchBandwidth1 = (PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor + 2 * MetaRowByte + 2 * PixelPTEBytesPerRow * HostVMInefficiencyFactor) / (Tpre_rounded - Tsw_oto / 4 - 0.75 * LineTime - v->Tno_bw[k]);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (Tpre_rounded - *Tno_bw - 2 * Tr0_trips_rounded > 0)
|
|
||||||
+ if (Tpre_rounded - v->Tno_bw[k] - 2 * Tr0_trips_rounded > 0)
|
|
||||||
PrefetchBandwidth2 = (PDEAndMetaPTEBytesFrame *
|
|
||||||
HostVMInefficiencyFactor + PrefetchSourceLinesY *
|
|
||||||
swath_width_luma_ub * BytePerPixelY +
|
|
||||||
PrefetchSourceLinesC * swath_width_chroma_ub *
|
|
||||||
- BytePerPixelC) /
|
|
||||||
- (Tpre_rounded - *Tno_bw - 2 * Tr0_trips_rounded);
|
|
||||||
+ v->BytePerPixelC[k]) /
|
|
||||||
+ (Tpre_rounded - v->Tno_bw[k] - 2 * Tr0_trips_rounded);
|
|
||||||
else
|
|
||||||
PrefetchBandwidth2 = 0;
|
|
||||||
|
|
||||||
@@ -1085,7 +1030,7 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
PrefetchBandwidth3 = (2 * MetaRowByte + 2 * PixelPTEBytesPerRow *
|
|
||||||
HostVMInefficiencyFactor + PrefetchSourceLinesY *
|
|
||||||
swath_width_luma_ub * BytePerPixelY + PrefetchSourceLinesC *
|
|
||||||
- swath_width_chroma_ub * BytePerPixelC) / (Tpre_rounded -
|
|
||||||
+ swath_width_chroma_ub * v->BytePerPixelC[k]) / (Tpre_rounded -
|
|
||||||
Tvm_trips_rounded);
|
|
||||||
else
|
|
||||||
PrefetchBandwidth3 = 0;
|
|
||||||
@@ -1095,7 +1040,7 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Tpre_rounded - Tvm_trips_rounded - 2 * Tr0_trips_rounded > 0)
|
|
||||||
- PrefetchBandwidth4 = (PrefetchSourceLinesY * swath_width_luma_ub * BytePerPixelY + PrefetchSourceLinesC * swath_width_chroma_ub * BytePerPixelC)
|
|
||||||
+ PrefetchBandwidth4 = (PrefetchSourceLinesY * swath_width_luma_ub * BytePerPixelY + PrefetchSourceLinesC * swath_width_chroma_ub * v->BytePerPixelC[k])
|
|
||||||
/ (Tpre_rounded - Tvm_trips_rounded - 2 * Tr0_trips_rounded);
|
|
||||||
else
|
|
||||||
PrefetchBandwidth4 = 0;
|
|
||||||
@@ -1106,7 +1051,7 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
bool Case3OK;
|
|
||||||
|
|
||||||
if (PrefetchBandwidth1 > 0) {
|
|
||||||
- if (*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / PrefetchBandwidth1
|
|
||||||
+ if (v->Tno_bw[k] + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / PrefetchBandwidth1
|
|
||||||
>= Tvm_trips_rounded && (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / PrefetchBandwidth1 >= Tr0_trips_rounded) {
|
|
||||||
Case1OK = true;
|
|
||||||
} else {
|
|
||||||
@@ -1117,7 +1062,7 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PrefetchBandwidth2 > 0) {
|
|
||||||
- if (*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / PrefetchBandwidth2
|
|
||||||
+ if (v->Tno_bw[k] + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / PrefetchBandwidth2
|
|
||||||
>= Tvm_trips_rounded && (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / PrefetchBandwidth2 < Tr0_trips_rounded) {
|
|
||||||
Case2OK = true;
|
|
||||||
} else {
|
|
||||||
@@ -1128,7 +1073,7 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PrefetchBandwidth3 > 0) {
|
|
||||||
- if (*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / PrefetchBandwidth3
|
|
||||||
+ if (v->Tno_bw[k] + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / PrefetchBandwidth3
|
|
||||||
< Tvm_trips_rounded && (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / PrefetchBandwidth3 >= Tr0_trips_rounded) {
|
|
||||||
Case3OK = true;
|
|
||||||
} else {
|
|
||||||
@@ -1151,13 +1096,13 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
dml_print("DML: prefetch_bw_equ: %f\n", prefetch_bw_equ);
|
|
||||||
|
|
||||||
if (prefetch_bw_equ > 0) {
|
|
||||||
- if (GPUVMEnable) {
|
|
||||||
- Tvm_equ = dml_max3(*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / prefetch_bw_equ, Tvm_trips, LineTime / 4);
|
|
||||||
+ if (v->GPUVMEnable) {
|
|
||||||
+ Tvm_equ = dml_max3(v->Tno_bw[k] + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / prefetch_bw_equ, Tvm_trips, LineTime / 4);
|
|
||||||
} else {
|
|
||||||
Tvm_equ = LineTime / 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if ((GPUVMEnable || myPipe->DCCEnable)) {
|
|
||||||
+ if ((v->GPUVMEnable || myPipe->DCCEnable)) {
|
|
||||||
Tr0_equ = dml_max4(
|
|
||||||
(MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / prefetch_bw_equ,
|
|
||||||
Tr0_trips,
|
|
||||||
@@ -1226,7 +1171,7 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
}
|
|
||||||
|
|
||||||
*RequiredPrefetchPixDataBWLuma = (double) PrefetchSourceLinesY / LinesToRequestPrefetchPixelData * BytePerPixelY * swath_width_luma_ub / LineTime;
|
|
||||||
- *RequiredPrefetchPixDataBWChroma = (double) PrefetchSourceLinesC / LinesToRequestPrefetchPixelData * BytePerPixelC * swath_width_chroma_ub / LineTime;
|
|
||||||
+ *RequiredPrefetchPixDataBWChroma = (double) PrefetchSourceLinesC / LinesToRequestPrefetchPixelData * v->BytePerPixelC[k] * swath_width_chroma_ub / LineTime;
|
|
||||||
} else {
|
|
||||||
MyError = true;
|
|
||||||
dml_print("DML: MyErr set %s:%d\n", __FILE__, __LINE__);
|
|
||||||
@@ -1242,9 +1187,9 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
dml_print("DML: Tr0: %fus - time to fetch first row of data pagetables and first row of meta data (done in parallel)\n", TimeForFetchingRowInVBlank);
|
|
||||||
dml_print("DML: Tr1: %fus - time to fetch second row of data pagetables and second row of meta data (done in parallel)\n", TimeForFetchingRowInVBlank);
|
|
||||||
dml_print("DML: Tsw: %fus = time to fetch enough pixel data and cursor data to feed the scalers init position and detile\n", (double)LinesToRequestPrefetchPixelData * LineTime);
|
|
||||||
- dml_print("DML: To: %fus - time for propagation from scaler to optc\n", (*DSTYAfterScaler + ((*DSTXAfterScaler) / (double) myPipe->HTotal)) * LineTime);
|
|
||||||
+ dml_print("DML: To: %fus - time for propagation from scaler to optc\n", (v->DSTYAfterScaler[k] + ((v->DSTXAfterScaler[k]) / (double) myPipe->HTotal)) * LineTime);
|
|
||||||
dml_print("DML: Tvstartup - Tsetup - Tcalc - Twait - Tpre - To > 0\n");
|
|
||||||
- dml_print("DML: Tslack(pre): %fus - time left over in schedule\n", VStartup * LineTime - TimeForFetchingMetaPTE - 2 * TimeForFetchingRowInVBlank - (*DSTYAfterScaler + ((*DSTXAfterScaler) / (double) myPipe->HTotal)) * LineTime - TWait - TCalc - Tsetup);
|
|
||||||
+ dml_print("DML: Tslack(pre): %fus - time left over in schedule\n", VStartup * LineTime - TimeForFetchingMetaPTE - 2 * TimeForFetchingRowInVBlank - (v->DSTYAfterScaler[k] + ((v->DSTXAfterScaler[k]) / (double) myPipe->HTotal)) * LineTime - TWait - TCalc - Tsetup);
|
|
||||||
dml_print("DML: row_bytes = dpte_row_bytes (per_pipe) = PixelPTEBytesPerRow = : %d\n", PixelPTEBytesPerRow);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
@@ -1275,7 +1220,7 @@ static bool CalculatePrefetchSchedule(
|
|
||||||
dml_print("DML: MyErr set %s:%d\n", __FILE__, __LINE__);
|
|
||||||
}
|
|
||||||
|
|
||||||
- *prefetch_vmrow_bw = dml_max(prefetch_vm_bw, prefetch_row_bw);
|
|
||||||
+ v->prefetch_vmrow_bw[k] = dml_max(prefetch_vm_bw, prefetch_row_bw);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MyError) {
|
|
||||||
@@ -2448,30 +2393,12 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
|
|
||||||
|
|
||||||
v->ErrorResult[k] = CalculatePrefetchSchedule(
|
|
||||||
mode_lib,
|
|
||||||
- v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData,
|
|
||||||
- v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly,
|
|
||||||
+ k,
|
|
||||||
&myPipe,
|
|
||||||
v->DSCDelay[k],
|
|
||||||
- v->DPPCLKDelaySubtotal
|
|
||||||
- + v->DPPCLKDelayCNVCFormater,
|
|
||||||
- v->DPPCLKDelaySCL,
|
|
||||||
- v->DPPCLKDelaySCLLBOnly,
|
|
||||||
- v->DPPCLKDelayCNVCCursor,
|
|
||||||
- v->DISPCLKDelaySubtotal,
|
|
||||||
(unsigned int) (v->SwathWidthY[k] / v->HRatio[k]),
|
|
||||||
- v->OutputFormat[k],
|
|
||||||
- v->MaxInterDCNTileRepeaters,
|
|
||||||
dml_min(v->VStartupLines, v->MaxVStartupLines[k]),
|
|
||||||
v->MaxVStartupLines[k],
|
|
||||||
- v->GPUVMMaxPageTableLevels,
|
|
||||||
- v->GPUVMEnable,
|
|
||||||
- v->HostVMEnable,
|
|
||||||
- v->HostVMMaxNonCachedPageTableLevels,
|
|
||||||
- v->HostVMMinPageSize,
|
|
||||||
- v->DynamicMetadataEnable[k],
|
|
||||||
- v->DynamicMetadataVMEnabled,
|
|
||||||
- v->DynamicMetadataLinesBeforeActiveRequired[k],
|
|
||||||
- v->DynamicMetadataTransmittedBytes[k],
|
|
||||||
v->UrgentLatency,
|
|
||||||
v->UrgentExtraLatency,
|
|
||||||
v->TCalc,
|
|
||||||
@@ -2485,7 +2412,6 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
|
|
||||||
v->MaxNumSwathY[k],
|
|
||||||
v->PrefetchSourceLinesC[k],
|
|
||||||
v->SwathWidthC[k],
|
|
||||||
- v->BytePerPixelC[k],
|
|
||||||
v->VInitPreFillC[k],
|
|
||||||
v->MaxNumSwathC[k],
|
|
||||||
v->swath_width_luma_ub[k],
|
|
||||||
@@ -2493,9 +2419,6 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
|
|
||||||
v->SwathHeightY[k],
|
|
||||||
v->SwathHeightC[k],
|
|
||||||
TWait,
|
|
||||||
- v->ProgressiveToInterlaceUnitInOPP,
|
|
||||||
- &v->DSTXAfterScaler[k],
|
|
||||||
- &v->DSTYAfterScaler[k],
|
|
||||||
&v->DestinationLinesForPrefetch[k],
|
|
||||||
&v->PrefetchBandwidth[k],
|
|
||||||
&v->DestinationLinesToRequestVMInVBlank[k],
|
|
||||||
@@ -2504,14 +2427,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
|
|
||||||
&v->VRatioPrefetchC[k],
|
|
||||||
&v->RequiredPrefetchPixDataBWLuma[k],
|
|
||||||
&v->RequiredPrefetchPixDataBWChroma[k],
|
|
||||||
- &v->NotEnoughTimeForDynamicMetadata[k],
|
|
||||||
- &v->Tno_bw[k],
|
|
||||||
- &v->prefetch_vmrow_bw[k],
|
|
||||||
- &v->Tdmdl_vm[k],
|
|
||||||
- &v->Tdmdl[k],
|
|
||||||
- &v->VUpdateOffsetPix[k],
|
|
||||||
- &v->VUpdateWidthPix[k],
|
|
||||||
- &v->VReadyOffsetPix[k]);
|
|
||||||
+ &v->NotEnoughTimeForDynamicMetadata[k]);
|
|
||||||
if (v->BlendingAndTiming[k] == k) {
|
|
||||||
double TotalRepeaterDelayTime = v->MaxInterDCNTileRepeaters * (2 / v->DPPCLK[k] + 3 / v->DISPCLK);
|
|
||||||
v->VUpdateWidthPix[k] = (14 / v->DCFCLKDeepSleep + 12 / v->DPPCLK[k] + TotalRepeaterDelayTime) * v->PixelClock[k];
|
|
||||||
@@ -4781,29 +4697,12 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
|
||||||
|
|
||||||
v->NoTimeForPrefetch[i][j][k] = CalculatePrefetchSchedule(
|
|
||||||
mode_lib,
|
|
||||||
- v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData,
|
|
||||||
- v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly,
|
|
||||||
+ k,
|
|
||||||
&myPipe,
|
|
||||||
v->DSCDelayPerState[i][k],
|
|
||||||
- v->DPPCLKDelaySubtotal + v->DPPCLKDelayCNVCFormater,
|
|
||||||
- v->DPPCLKDelaySCL,
|
|
||||||
- v->DPPCLKDelaySCLLBOnly,
|
|
||||||
- v->DPPCLKDelayCNVCCursor,
|
|
||||||
- v->DISPCLKDelaySubtotal,
|
|
||||||
v->SwathWidthYThisState[k] / v->HRatio[k],
|
|
||||||
- v->OutputFormat[k],
|
|
||||||
- v->MaxInterDCNTileRepeaters,
|
|
||||||
dml_min(v->MaxVStartup, v->MaximumVStartup[i][j][k]),
|
|
||||||
v->MaximumVStartup[i][j][k],
|
|
||||||
- v->GPUVMMaxPageTableLevels,
|
|
||||||
- v->GPUVMEnable,
|
|
||||||
- v->HostVMEnable,
|
|
||||||
- v->HostVMMaxNonCachedPageTableLevels,
|
|
||||||
- v->HostVMMinPageSize,
|
|
||||||
- v->DynamicMetadataEnable[k],
|
|
||||||
- v->DynamicMetadataVMEnabled,
|
|
||||||
- v->DynamicMetadataLinesBeforeActiveRequired[k],
|
|
||||||
- v->DynamicMetadataTransmittedBytes[k],
|
|
||||||
v->UrgLatency[i],
|
|
||||||
v->ExtraLatency,
|
|
||||||
v->TimeCalc,
|
|
||||||
@@ -4817,7 +4716,6 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
|
||||||
v->MaxNumSwY[k],
|
|
||||||
v->PrefetchLinesC[i][j][k],
|
|
||||||
v->SwathWidthCThisState[k],
|
|
||||||
- v->BytePerPixelC[k],
|
|
||||||
v->PrefillC[k],
|
|
||||||
v->MaxNumSwC[k],
|
|
||||||
v->swath_width_luma_ub_this_state[k],
|
|
||||||
@@ -4825,9 +4723,6 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
|
||||||
v->SwathHeightYThisState[k],
|
|
||||||
v->SwathHeightCThisState[k],
|
|
||||||
v->TWait,
|
|
||||||
- v->ProgressiveToInterlaceUnitInOPP,
|
|
||||||
- &v->DSTXAfterScaler[k],
|
|
||||||
- &v->DSTYAfterScaler[k],
|
|
||||||
&v->LineTimesForPrefetch[k],
|
|
||||||
&v->PrefetchBW[k],
|
|
||||||
&v->LinesForMetaPTE[k],
|
|
||||||
@@ -4836,14 +4731,7 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
|
||||||
&v->VRatioPreC[i][j][k],
|
|
||||||
&v->RequiredPrefetchPixelDataBWLuma[i][j][k],
|
|
||||||
&v->RequiredPrefetchPixelDataBWChroma[i][j][k],
|
|
||||||
- &v->NoTimeForDynamicMetadata[i][j][k],
|
|
||||||
- &v->Tno_bw[k],
|
|
||||||
- &v->prefetch_vmrow_bw[k],
|
|
||||||
- &v->Tdmdl_vm[k],
|
|
||||||
- &v->Tdmdl[k],
|
|
||||||
- &v->VUpdateOffsetPix[k],
|
|
||||||
- &v->VUpdateWidthPix[k],
|
|
||||||
- &v->VReadyOffsetPix[k]);
|
|
||||||
+ &v->NoTimeForDynamicMetadata[i][j][k]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
|
|
||||||
--
|
|
||||||
cgit 1.2.3-korg
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3,11 +3,11 @@ package kernel-source {
|
|||||||
website = "https://kernel.org";
|
website = "https://kernel.org";
|
||||||
exclude = true;
|
exclude = true;
|
||||||
|
|
||||||
version# = "6.12.93";
|
version# = "6.18.37";
|
||||||
output = remoteTar {
|
output = remoteTar {
|
||||||
url = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+
|
url = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/"+
|
||||||
"snapshot/linux-"+version+".tar.gz";
|
"snapshot/linux-"+version+".tar.gz";
|
||||||
checksum = "cGFcgR-h4Vwv2BU78jV4HmU-3yU_ER8l8LyKF0MibEsB-kUbbrIgqxMedXZ1j8Xw";
|
checksum = "ndD7_0aU1EP5PubcCX_p8j1OLlszTVx1NoCHPdbhy2yvRcecHcULQQdZNDw-_YOc";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -45,9 +45,9 @@ cat \
|
|||||||
checksum = arch {
|
checksum = arch {
|
||||||
default = "";
|
default = "";
|
||||||
|
|
||||||
amd64 = "Oy3soh5GNJr4JU7lk85J49LgNw-44SGpNB6NVlPp_mFUaXxvIGt1KLPnlpU3JYcB";
|
amd64 = "UscduTw49AOk4CL6gLS6yORPFiHO79h1kFZKXKDaUI9j0x5CySi7P2Ywf29gYBsM";
|
||||||
arm64 = "GKHHQepUpwQjsSiq47-HV1G_aRR12oasaO5dV2bjc3D-4UzE9-Mb92ptplQQhSEc";
|
arm64 = "FM5-YFUbkOiux1KMxU29pecCoq6kPUfSL_4JlfqRHe4ZxIiT1AELGt7liD6df3-K";
|
||||||
riscv64 = "YwNZiSwm6EnTyCmKe-RMLhFHD7VuJoVjD6XnqywaB3e-Vk0rEWxsAxoNkCvxbXz9";
|
riscv64 = "Z1jR7S3nnGYOJtOR3sOMznfmkD_TirHP7-f3tVcgkVzWzHvMXS7ElHLT1NExqcqa";
|
||||||
};
|
};
|
||||||
inputs = [ rsync ];
|
inputs = [ rsync ];
|
||||||
}
|
}
|
||||||
@@ -55,13 +55,9 @@ cat \
|
|||||||
package kernel {
|
package kernel {
|
||||||
description = "the generic Rosa OS linux kernel";
|
description = "the generic Rosa OS linux kernel";
|
||||||
website = "https://kernel.org";
|
website = "https://kernel.org";
|
||||||
anitya = 375621;
|
anitya = 389470;
|
||||||
|
|
||||||
source = kernel-source;
|
source = kernel-source;
|
||||||
patches = [
|
|
||||||
"f54a91f5337cd918eb86cf600320d25b6cfd8209.patch",
|
|
||||||
"6ce6fbfddc5b127e4f57c3b5bfdcf40239a4fc2f.patch",
|
|
||||||
];
|
|
||||||
files = {
|
files = {
|
||||||
".config": arch {
|
".config": arch {
|
||||||
amd64 = "kernel_amd64.config";
|
amd64 = "kernel_amd64.config";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#define LINUX_VERSION_CODE 396378
|
#define LINUX_VERSION_CODE 397861
|
||||||
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
|
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
|
||||||
#define LINUX_VERSION_MAJOR 6
|
#define LINUX_VERSION_MAJOR 6
|
||||||
#define LINUX_VERSION_PATCHLEVEL 12
|
#define LINUX_VERSION_PATCHLEVEL 18
|
||||||
#define LINUX_VERSION_SUBLEVEL 90
|
#define LINUX_VERSION_SUBLEVEL 37
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package libarchive {
|
|||||||
website = "https://www.libarchive.org";
|
website = "https://www.libarchive.org";
|
||||||
anitya = 1558;
|
anitya = 1558;
|
||||||
|
|
||||||
version# = "3.8.7";
|
version# = "3.8.8";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "libarchive/libarchive";
|
suffix = "libarchive/libarchive";
|
||||||
tag = "v"+version;
|
tag = "v"+version;
|
||||||
checksum = "CUJK4MDQmZmATClgQBH2Wt-7Ts4iiSUlg1J_TVb6-5IK3rVUgVLIMc5k-bnWB9w3";
|
checksum = "MYlQdlxHX14rFL_zEYvDArKgGVIueTPzSEDgCzaZkmi0_N7WsaEpogGO3qnHpfTc";
|
||||||
};
|
};
|
||||||
|
|
||||||
files = { "CTestCustom.cmake"; };
|
files = { "CTestCustom.cmake"; };
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package libexpat {
|
|||||||
website = "https://libexpat.github.io";
|
website = "https://libexpat.github.io";
|
||||||
anitya = 770;
|
anitya = 770;
|
||||||
|
|
||||||
version# = "2.8.1";
|
version# = "2.8.2";
|
||||||
source = remoteGitHubRelease {
|
source = remoteGitHubRelease {
|
||||||
suffix = "libexpat/libexpat";
|
suffix = "libexpat/libexpat";
|
||||||
tag = "R_"+replace {
|
tag = "R_"+replace {
|
||||||
@@ -12,7 +12,7 @@ package libexpat {
|
|||||||
new = "_";
|
new = "_";
|
||||||
};
|
};
|
||||||
name = "expat-"+version+".tar.bz2";
|
name = "expat-"+version+".tar.bz2";
|
||||||
checksum = "iMEtbOJhQfGof2GxSlxffQSI1va_NDDQ9VIuqcPbNZ0291Dr8wttD5QecYyjIQap";
|
checksum = "98Pdyj5QtO7QRtNFXTWsCNCixQDx701ZGql2B-JIrTDkw49J5WXXUwnS4AdMlM4L";
|
||||||
compress = bzip2;
|
compress = bzip2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package libffi {
|
|||||||
website = "https://sourceware.org/libffi";
|
website = "https://sourceware.org/libffi";
|
||||||
anitya = 1611;
|
anitya = 1611;
|
||||||
|
|
||||||
version# = "3.5.2";
|
version# = "3.6.0";
|
||||||
source = remoteGitHubRelease {
|
source = remoteGitHubRelease {
|
||||||
suffix = "libffi/libffi";
|
suffix = "libffi/libffi";
|
||||||
tag = "v"+version;
|
tag = "v"+version;
|
||||||
name = "libffi-"+version+".tar.gz";
|
name = "libffi-"+version+".tar.gz";
|
||||||
checksum = "2_Q-ZNBBbVhltfL5zEr0wljxPegUimTK4VeMSiwJEGksls3n4gj3lV0Ly3vviSFH";
|
checksum = "y3H_jP_eoByznlztjvni3wDfGA4CIJoOh3eRnzjnE3G3Ms3AWk53oOZxkbruvLxM";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package libpsl {
|
|||||||
website = "https://rockdaboot.github.io/libpsl";
|
website = "https://rockdaboot.github.io/libpsl";
|
||||||
anitya = 7305;
|
anitya = 7305;
|
||||||
|
|
||||||
version# = "0.21.5";
|
version# = "0.22.0";
|
||||||
source = remoteGitHubRelease {
|
source = remoteGitHubRelease {
|
||||||
suffix = "rockdaboot/libpsl";
|
suffix = "rockdaboot/libpsl";
|
||||||
tag = version;
|
tag = version;
|
||||||
name = "libpsl-"+version+".tar.gz";
|
name = "libpsl-"+version+".tar.gz";
|
||||||
checksum = "XjfxSzh7peG2Vg4vJlL8z4JZJLcXqbuP6pLWkrGCmRxlnYUFTKNBqWGHCxEOlCad";
|
checksum = "sYrq75kNAJvU5gA2gv2tFYIFbFFit6PuYuW1tYSgcsJsIUzwMJTodofsaEGq3iGf";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -21,5 +21,8 @@ test_disable 'int main(){return 0;}' tests/test-is-public-builtin.c
|
|||||||
|
|
||||||
exec = make {};
|
exec = make {};
|
||||||
|
|
||||||
inputs = [ python ];
|
inputs = [
|
||||||
|
pkg-config,
|
||||||
|
python,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ package mesa {
|
|||||||
anitya = 1970;
|
anitya = 1970;
|
||||||
latest = anityaFallback;
|
latest = anityaFallback;
|
||||||
|
|
||||||
version# = "26.1.2";
|
version# = "26.1.3";
|
||||||
source = remoteGitLab {
|
source = remoteGitLab {
|
||||||
domain = "gitlab.freedesktop.org";
|
domain = "gitlab.freedesktop.org";
|
||||||
suffix = "mesa/mesa";
|
suffix = "mesa/mesa";
|
||||||
ref = "mesa-"+version;
|
ref = "mesa-"+version;
|
||||||
checksum = "EcY_vsm4rjUzVj7jQraWb9i3y0I2F0oH3Tav01QszQMxNzjLbSWHrQYR1mPRU-J4";
|
checksum = "3Uk4-DVrqPhTb4NrLVSOvqpzzSI0kyAwDFgrP5RMzRZdnnGpnJ111llBTUYPlQGj";
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = meson {
|
exec = meson {
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package noto {
|
||||||
|
description = "a typeface for the world";
|
||||||
|
website = "https://fonts.google.com/noto";
|
||||||
|
anitya = 10671;
|
||||||
|
|
||||||
|
version# = "2026.06.01";
|
||||||
|
source = remoteGitHub {
|
||||||
|
suffix = "notofonts/notofonts.github.io";
|
||||||
|
tag = "noto-monthly-release-"+version;
|
||||||
|
checksum = "QpCYYssOY-OIFKn0_K_7JG7Ij2VDbIkccWrWTC4db1ZPPE1yZnLrf7Kja-IuB4XS";
|
||||||
|
};
|
||||||
|
|
||||||
|
enterSource = true;
|
||||||
|
exec = generic {
|
||||||
|
inPlace = true;
|
||||||
|
install = `
|
||||||
|
DEST=/work/system/share/fonts/noto
|
||||||
|
for font in $(ls -d fonts/*/); do
|
||||||
|
if [[ -d "$font"unhinted/variable-ttf ]]; then
|
||||||
|
install -m444 -vDt "$DEST" "$font"unhinted/variable-ttf/*.ttf
|
||||||
|
elif [[ -d "$font"unhinted/otf ]]; then
|
||||||
|
install -m444 -vDt "$DEST" "$font"unhinted/otf/*.otf
|
||||||
|
else
|
||||||
|
install -m444 -vDt "$DEST" "$font"unhinted/ttf/*.ttf
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
rename -v 's/\[.*\]//' $DEST/*
|
||||||
|
`;
|
||||||
|
};
|
||||||
|
|
||||||
|
inputs = [ rename ];
|
||||||
|
}
|
||||||
@@ -33,6 +33,7 @@ package openssl {
|
|||||||
|
|
||||||
check = [
|
check = [
|
||||||
"HARNESS_JOBS=" + jobsE,
|
"HARNESS_JOBS=" + jobsE,
|
||||||
|
"TESTS='-test_bio_dgram'",
|
||||||
"test",
|
"test",
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package pango {
|
|||||||
website = "https://www.pango.org";
|
website = "https://www.pango.org";
|
||||||
anitya = 11783;
|
anitya = 11783;
|
||||||
|
|
||||||
version# = "1.57.1";
|
version# = "1.58.0";
|
||||||
source = remoteGitLab {
|
source = remoteGitLab {
|
||||||
domain = "gitlab.gnome.org";
|
domain = "gitlab.gnome.org";
|
||||||
suffix = "GNOME/pango";
|
suffix = "GNOME/pango";
|
||||||
ref = version;
|
ref = version;
|
||||||
checksum = "BzfdEym2eIyL5ownJ1LfqQwZkY3yH71YAsQF5R-sRV2pIOmc_CULAcfqVQki_Ose";
|
checksum = "k-Jcw7ys4-Q5gS0Y3WCb1MzIWauweIdknf61hRXJmQFfszw7sM7v0dItOoHMZLQJ";
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = meson {
|
exec = meson {
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package python {
|
|||||||
website = "https://www.python.org";
|
website = "https://www.python.org";
|
||||||
anitya = 13254;
|
anitya = 13254;
|
||||||
|
|
||||||
version# = "3.14.5";
|
version# = "3.14.6";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://www.python.org/ftp/python/"+version+
|
url = "https://www.python.org/ftp/python/"+version+
|
||||||
"/Python-"+version+".tgz";
|
"/Python-"+version+".tgz";
|
||||||
checksum = "zYIpDlk2ftZ-UVGCQS1rthle2OHoyXV653ztWiopKV1NhmIJf1K2hHbkwM4DozQ9";
|
checksum = "yynwXnElUvlAweA_RkBKQY35P59Gu5YU6ickJs6Z-blIoHgw5KgKXROY1gq2w0ez";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
patches = [ "zipfile-no-default-strict_timestamps.patch" ];
|
patches = [ "zipfile-no-default-strict_timestamps.patch" ];
|
||||||
@@ -124,15 +124,15 @@ package python-vcs-versioning {
|
|||||||
website = "https://setuptools-scm.readthedocs.io/en/latest";
|
website = "https://setuptools-scm.readthedocs.io/en/latest";
|
||||||
anitya = 389421;
|
anitya = 389421;
|
||||||
|
|
||||||
version# = "1.1.1";
|
version# = "2.2.2";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "pypa/setuptools-scm";
|
suffix = "pypa/setuptools-scm";
|
||||||
tag = "vcs-versioning-v"+version;
|
tag = "vcs-versioning-v"+version;
|
||||||
checksum = "rXZixTsZcRcIoUC1LvWrjySsiXSv5uhW6ng2P-yXZrbdj7FrSrDeJLCfC2b-ladV";
|
checksum = "dqKZGEjxWZ5xo4BjcpFOHxlEZfqrVWM79cRWa8OhGZY7VDSdOxrg7QVIhA6jsPcB";
|
||||||
};
|
};
|
||||||
|
|
||||||
env = [
|
env = [
|
||||||
"SETUPTOOLS_SCM_PRETEND_VERSION=" + version,
|
"VCS_VERSIONING_PRETEND_VERSION=" + version,
|
||||||
];
|
];
|
||||||
|
|
||||||
exec = pip {
|
exec = pip {
|
||||||
@@ -158,11 +158,11 @@ package python-setuptools-scm {
|
|||||||
website = "https://setuptools-scm.readthedocs.io/en/latest";
|
website = "https://setuptools-scm.readthedocs.io/en/latest";
|
||||||
anitya = 7874;
|
anitya = 7874;
|
||||||
|
|
||||||
version# = "10.0.5";
|
version# = "10.2.0";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "pypa/setuptools-scm";
|
suffix = "pypa/setuptools-scm";
|
||||||
tag = "setuptools-scm-v"+version;
|
tag = "setuptools-scm-v"+version;
|
||||||
checksum = "vTN_TPd-b4Wbsw5WmAcsWjrs-FNXXznOeVTDnb54NtXve9Oy-eb2HPy-RG3FzNqp";
|
checksum = "vbZMqPbhScSE5gQXHIvG3pPNw7Iqsi9sEpI13wPdTNQQYOI2skfCvwSTXLq9Ncq8";
|
||||||
};
|
};
|
||||||
|
|
||||||
env = [
|
env = [
|
||||||
@@ -382,11 +382,11 @@ package python-pytest {
|
|||||||
website = "https://pytest.org";
|
website = "https://pytest.org";
|
||||||
anitya = 3765;
|
anitya = 3765;
|
||||||
|
|
||||||
version# = "9.1.0";
|
version# = "9.1.1";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "pytest-dev/pytest";
|
suffix = "pytest-dev/pytest";
|
||||||
tag = version;
|
tag = version;
|
||||||
checksum = "UNd_5ArXTfdGROVW5a0Z22FE4uOLfCMW4NeAnAp9SKHLGja9Db2Xc3BF48x7Hr_l";
|
checksum = "PnsF2mxJDF1d1MeYfMmlrSa_OlI92F8OPlSVA-lqsh4ggRZiAHjbTdO_jfNox065";
|
||||||
};
|
};
|
||||||
|
|
||||||
env = [
|
env = [
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py
|
diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py
|
||||||
index 19aea290b58..51603ba9510 100644
|
index 2b6e6163b96..180b1bdb42a 100644
|
||||||
--- a/Lib/zipfile/__init__.py
|
--- a/Lib/zipfile/__init__.py
|
||||||
+++ b/Lib/zipfile/__init__.py
|
+++ b/Lib/zipfile/__init__.py
|
||||||
@@ -617,7 +617,7 @@ def _decodeExtra(self, filename_crc):
|
@@ -621,7 +621,7 @@ def _decodeExtra(self, filename_crc):
|
||||||
extra = extra[ln+4:]
|
extra = extra[ln+4:]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -10,13 +10,13 @@ index 19aea290b58..51603ba9510 100644
|
|||||||
+ def from_file(cls, filename, arcname=None, *, strict_timestamps=False):
|
+ def from_file(cls, filename, arcname=None, *, strict_timestamps=False):
|
||||||
"""Construct an appropriate ZipInfo for a file on the filesystem.
|
"""Construct an appropriate ZipInfo for a file on the filesystem.
|
||||||
|
|
||||||
filename should be the path to a file or directory on the filesystem.
|
filename should be the path to a file or directory on the
|
||||||
@@ -1412,7 +1412,7 @@ class ZipFile:
|
@@ -1421,7 +1421,7 @@ class ZipFile:
|
||||||
_windows_illegal_name_trans_table = None
|
_ignore_invalid_names = False
|
||||||
|
|
||||||
def __init__(self, file, mode="r", compression=ZIP_STORED, allowZip64=True,
|
def __init__(self, file, mode="r", compression=ZIP_STORED, allowZip64=True,
|
||||||
- compresslevel=None, *, strict_timestamps=True, metadata_encoding=None):
|
- compresslevel=None, *, strict_timestamps=True, metadata_encoding=None):
|
||||||
+ compresslevel=None, *, strict_timestamps=False, metadata_encoding=None):
|
+ compresslevel=None, *, strict_timestamps=False, metadata_encoding=None):
|
||||||
"""Open the ZIP file with mode read 'r', write 'w', exclusive create 'x',
|
"""Open the ZIP file with mode read 'r', write 'w', exclusive create
|
||||||
or append 'a'."""
|
'x', or append 'a'."""
|
||||||
if mode not in ('r', 'w', 'x', 'a'):
|
if mode not in ('r', 'w', 'x', 'a'):
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
|
||||||
|
index be4fa627b5..d6af6a036b 100644
|
||||||
|
--- a/tests/qtest/meson.build
|
||||||
|
+++ b/tests/qtest/meson.build
|
||||||
|
@@ -29,7 +29,6 @@ qtests_generic = [
|
||||||
|
'test-hmp',
|
||||||
|
'qos-test',
|
||||||
|
'readconfig-test',
|
||||||
|
- 'netdev-socket',
|
||||||
|
]
|
||||||
|
if enable_modules
|
||||||
|
qtests_generic += [ 'modules-test' ]
|
||||||
|
@@ -402,7 +401,6 @@ qtests = {
|
||||||
|
'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'],
|
||||||
|
'virtio-net-failover': test_migration_files,
|
||||||
|
'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'),
|
||||||
|
- 'netdev-socket': files('netdev-socket.c', '../unit/socket-helpers.c'),
|
||||||
|
}
|
||||||
|
|
||||||
|
if vnc.found()
|
||||||
@@ -3,13 +3,17 @@ package qemu {
|
|||||||
website = "https://www.qemu.org";
|
website = "https://www.qemu.org";
|
||||||
anitya = 13607;
|
anitya = 13607;
|
||||||
|
|
||||||
version# = "11.0.1";
|
version# = "11.0.2";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://download.qemu.org/qemu-"+version+".tar.bz2";
|
url = "https://download.qemu.org/qemu-"+version+".tar.bz2";
|
||||||
checksum = "J3j3uNpiqxEoIEngBX2objV_1tzGfEgEphp5Ph86AJQvA_XMwYUakyvRH7YKEkwV";
|
checksum = "FcVvKLivqRuFg7bGJlgJxx6-MWLORgJcliHwBw_1WssI-R7epGT75JawvSYy8Ltq";
|
||||||
compress = bzip2;
|
compress = bzip2;
|
||||||
};
|
};
|
||||||
patches = [ "disable-mcast-test.patch" ];
|
patches = [
|
||||||
|
"disable-mcast-test.patch",
|
||||||
|
// fails with ipv6 disabled
|
||||||
|
"disable-netdev-socket.patch",
|
||||||
|
];
|
||||||
|
|
||||||
// configure script uses source as scratch space
|
// configure script uses source as scratch space
|
||||||
writable = true;
|
writable = true;
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package rename {
|
||||||
|
description = "rename renames the filenames supplied according to the rule specified as the first argument";
|
||||||
|
website = "https://search.cpan.org/dist/rename";
|
||||||
|
anitya = 14302;
|
||||||
|
|
||||||
|
version# = "1.16.2";
|
||||||
|
// CPAN missing files
|
||||||
|
source = remoteGitHub {
|
||||||
|
suffix = "pstray/rename";
|
||||||
|
tag = "v"+version;
|
||||||
|
checksum = "4VTeBcv1-oa_OlxpKS4h9ZxZMEq1wrk8hzaiBVZTMYCVQ0adDZ8ubPZ3VFf6qqeo";
|
||||||
|
};
|
||||||
|
|
||||||
|
exec = makeMaker {};
|
||||||
|
|
||||||
|
runtime = [ perl ];
|
||||||
|
}
|
||||||
@@ -5,11 +5,11 @@ package spirv-headers {
|
|||||||
// upstream changed version scheme, anitya incapable of filtering them
|
// upstream changed version scheme, anitya incapable of filtering them
|
||||||
latest = anityaFilterSPIRV;
|
latest = anityaFilterSPIRV;
|
||||||
|
|
||||||
version# = "1.4.350.0";
|
version# = "1.4.350.1";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "KhronosGroup/SPIRV-Headers";
|
suffix = "KhronosGroup/SPIRV-Headers";
|
||||||
tag = "vulkan-sdk-"+version;
|
tag = "vulkan-sdk-"+version;
|
||||||
checksum = "wFCZquDVL4HoE-kWbS_BHHb_d71EYR2A2kVp08oDutektpnQzhDP89wo821GgcpG";
|
checksum = "6cmvMCH5aiHykXcozckfMOVA0nm0am4Xr2g9swBB9FtOV1vYBHgats5aRv4uQ9Kq";
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = cmake {
|
exec = cmake {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package toybox-source {
|
|||||||
description = "toybox source tree";
|
description = "toybox source tree";
|
||||||
exclude = true;
|
exclude = true;
|
||||||
|
|
||||||
version# = "0.8.13";
|
version# = "0.8.14";
|
||||||
output = remoteTar {
|
output = remoteTar {
|
||||||
url = "https://landley.net/toybox/downloads/toybox-"+version+".tar.gz";
|
url = "https://landley.net/toybox/downloads/toybox-"+version+".tar.gz";
|
||||||
checksum = "rZ1V1ATDte2WeQZanxLVoiRGdfPXhMlEo5-exX-e-ml8cGn9qOv0ABEUVZpX3wTI";
|
checksum = "RZQp2CTsLt_y15vsZxwqUb2O1XfK7uvwn-2sTd38O4HAsFKPQpS1UP0brYJ3dRA-";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package util-linux {
|
|||||||
// release candidates confuse Anitya
|
// release candidates confuse Anitya
|
||||||
latest = anityaFallback;
|
latest = anityaFallback;
|
||||||
|
|
||||||
version# = "2.42.1";
|
version# = "2.42.2";
|
||||||
source = remoteTar {
|
source = remoteTar {
|
||||||
url = "https://www.kernel.org/pub/linux/utils/util-linux/"+
|
url = "https://www.kernel.org/pub/linux/utils/util-linux/"+
|
||||||
"v"+join {
|
"v"+join {
|
||||||
@@ -19,7 +19,7 @@ package util-linux {
|
|||||||
};
|
};
|
||||||
sep = ".";
|
sep = ".";
|
||||||
}+"/util-linux-"+version+".tar.gz";
|
}+"/util-linux-"+version+".tar.gz";
|
||||||
checksum = "f1c006mnFL9jTEsqnJn08hHqwcL8TpjCJNIToZNuGEPsLmEdNL87r8RzBT-nl9QB";
|
checksum = "Z4IZapPCKQP37aeWMDhxcvuOCy-IR_aHZvfUEMZ0T7trwC1znZACKH_3ddqXwBCg";
|
||||||
compress = gzip;
|
compress = gzip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ package vim {
|
|||||||
description = "a greatly improved version of the good old UNIX editor Vi";
|
description = "a greatly improved version of the good old UNIX editor Vi";
|
||||||
website = "https://www.vim.org";
|
website = "https://www.vim.org";
|
||||||
anitya = 5092;
|
anitya = 5092;
|
||||||
|
exclude = true;
|
||||||
|
block = "not exposed to end users";
|
||||||
|
|
||||||
version# = "9.2.0461";
|
version# = "9.2.0707";
|
||||||
source = remoteGitHub {
|
source = remoteGitHub {
|
||||||
suffix = "vim/vim";
|
suffix = "vim/vim";
|
||||||
tag = "v"+version;
|
tag = "v"+version;
|
||||||
checksum = "18Rr_5oIf_PkKuqVkN4CMZIGkZEgpN1vamlrsvPLBjn4mN98CRuoJmhzRZ7MoVYM";
|
checksum = "lWJTTs_CxKsj-uOZqoPEDk3Rgac6bK8RtV32uizRxEcqRwBtBRlmCpAuhRZsSLiG";
|
||||||
};
|
};
|
||||||
|
|
||||||
writable = true;
|
writable = true;
|
||||||
|
|||||||
@@ -654,12 +654,12 @@ package xkeyboard-config {
|
|||||||
website = "https://www.freedesktop.org/wiki/Software/XKeyboardConfig";
|
website = "https://www.freedesktop.org/wiki/Software/XKeyboardConfig";
|
||||||
anitya = 5191;
|
anitya = 5191;
|
||||||
|
|
||||||
version# = "2.47";
|
version# = "2.48";
|
||||||
source = remoteGitLab {
|
source = remoteGitLab {
|
||||||
domain = "gitlab.freedesktop.org";
|
domain = "gitlab.freedesktop.org";
|
||||||
suffix = "xkeyboard-config/xkeyboard-config";
|
suffix = "xkeyboard-config/xkeyboard-config";
|
||||||
ref = "xkeyboard-config-"+version;
|
ref = "xkeyboard-config-"+version;
|
||||||
checksum = "E03PsPIaRrxPAuKgDGSQyPiJB49wXtyyvdV0lVx3_G-pelMMlaFLkoTDHTHG_qgA";
|
checksum = "_CxeFtwCaki-ZzoVtBgLnJ1p6tDJTAsfGmWJy867ij7equ5-lTKMV2YheE_Lbpo4";
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = meson {};
|
exec = meson {};
|
||||||
|
|||||||
+12
-10
@@ -476,9 +476,6 @@ func (t Toolchain) NewPackage(
|
|||||||
if name == "" || version == "" {
|
if name == "" || version == "" {
|
||||||
panic("name must be non-empty")
|
panic("name must be non-empty")
|
||||||
}
|
}
|
||||||
if source == nil {
|
|
||||||
panic("source must be non-nil")
|
|
||||||
}
|
|
||||||
rn := name
|
rn := name
|
||||||
if version != Unversioned {
|
if version != Unversioned {
|
||||||
rn = name + "-" + version
|
rn = name + "-" + version
|
||||||
@@ -536,6 +533,17 @@ cd '/usr/src/` + name + `/'
|
|||||||
panic("cannot remain in root")
|
panic("cannot remain in root")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paths := attr.Paths
|
||||||
|
if source != nil {
|
||||||
|
paths = slices.Concat(attr.Paths, []pkg.ExecPath{
|
||||||
|
pkg.Path(AbsUsrSrc.Append(
|
||||||
|
name+sourceSuffix,
|
||||||
|
), attr.Writable || wantsWrite, t.NewPatchedSource(
|
||||||
|
rn, source, !attr.Chmod && !wantsChmod, attr.Patches...,
|
||||||
|
)),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return t.New(
|
return t.New(
|
||||||
rn,
|
rn,
|
||||||
attr.Flag,
|
attr.Flag,
|
||||||
@@ -543,13 +551,7 @@ cd '/usr/src/` + name + `/'
|
|||||||
attr.KnownChecksum,
|
attr.KnownChecksum,
|
||||||
attr.Env,
|
attr.Env,
|
||||||
scriptEarly+helper.script(t, name),
|
scriptEarly+helper.script(t, name),
|
||||||
slices.Concat(attr.Paths, []pkg.ExecPath{
|
paths...,
|
||||||
pkg.Path(AbsUsrSrc.Append(
|
|
||||||
name+sourceSuffix,
|
|
||||||
), attr.Writable || wantsWrite, t.NewPatchedSource(
|
|
||||||
rn, source, !attr.Chmod && !wantsChmod, attr.Patches...,
|
|
||||||
)),
|
|
||||||
})...,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-1
@@ -7,6 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"iter"
|
"iter"
|
||||||
@@ -879,6 +880,7 @@ func (s *S) getFrame() azalea.Frame {
|
|||||||
k("postInstall"): &attr.Script,
|
k("postInstall"): &attr.Script,
|
||||||
k("setup"): &attr.Setup,
|
k("setup"): &attr.Setup,
|
||||||
k("skipTest"): &attr.SkipTest,
|
k("skipTest"): &attr.SkipTest,
|
||||||
|
k("skipTests"): &attr.SkipTests,
|
||||||
k("interactiveTest"): &attr.InteractiveTest,
|
k("interactiveTest"): &attr.InteractiveTest,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return
|
return
|
||||||
@@ -1132,11 +1134,13 @@ func (ctx *evalContext) pf(
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if sourceA != nil {
|
||||||
panic(azalea.TypeError{
|
panic(azalea.TypeError{
|
||||||
Concrete: reflect.TypeOf(sourceA),
|
Concrete: reflect.TypeOf(sourceA),
|
||||||
Asserted: reflect.TypeFor[pkg.Artifact](),
|
Asserted: reflect.TypeFor[pkg.Artifact](),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
v = cachedArtifact{&meta, ctx.t.NewPackage(
|
v = cachedArtifact{&meta, ctx.t.NewPackage(
|
||||||
meta.Name,
|
meta.Name,
|
||||||
@@ -1255,6 +1259,16 @@ func (s *S) RegisterFS(fsys fs.FS) error {
|
|||||||
// The resulting IR is curable on the daemon. Must not be used concurrently with
|
// The resulting IR is curable on the daemon. Must not be used concurrently with
|
||||||
// any other method.
|
// any other method.
|
||||||
func (s *S) SetSource(fsys fs.FS) error {
|
func (s *S) SetSource(fsys fs.FS) error {
|
||||||
|
var version string
|
||||||
|
if p, err := fs.ReadFile(fsys, "cmd/dist/VERSION"); err != nil {
|
||||||
|
return err
|
||||||
|
} else if len(p) < 2 {
|
||||||
|
return fmt.Errorf("invalid version string %q", string(p))
|
||||||
|
} else {
|
||||||
|
version = unsafe.String(unsafe.SliceData(p), len(p))
|
||||||
|
}
|
||||||
|
version = version[1:len(version)-1] + "-CURRENT"
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
w, err := gzip.NewWriterLevel(&buf, gzip.BestSpeed)
|
w, err := gzip.NewWriterLevel(&buf, gzip.BestSpeed)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1326,7 +1340,7 @@ func (s *S) SetSource(fsys fs.FS) error {
|
|||||||
return &Metadata{
|
return &Metadata{
|
||||||
Name: name,
|
Name: name,
|
||||||
Description: "hakurei source tree (current)",
|
Description: "hakurei source tree (current)",
|
||||||
Version: "1.0.0-CURRENT",
|
Version: version,
|
||||||
Exclude: true,
|
Exclude: true,
|
||||||
}, pkg.NewTar(pkg.NewDecompress(a, pkg.Gzip))
|
}, pkg.NewTar(pkg.NewDecompress(a, pkg.Gzip))
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user