graphics: add memory-only storage for graphics data

Add a new graphics protocol key, N=1, to request that transmitted
image/frame data is kept only in memory and not written to the graphics
disk cache file.

This is useful for transient high-frequency updates such as video-like
streams, where the latest frame is the only useful data and persisting
each frame to the disk cache causes unnecessary write traffic.

The implementation keeps the existing graphics cache abstraction intact:
memory-only entries can still be read back by animation, composition, and
frame coalescing paths. Only persistence to the disk cache file is skipped.

The default behavior is unchanged when N is omitted or set to zero.
This commit is contained in:
Matsumoto Kotaro
2026-05-30 18:46:24 +09:00
parent 6bd62a5242
commit cc2d7a1789
9 changed files with 63 additions and 18 deletions

View File

@@ -143,7 +143,7 @@ type GraphicsCommand struct {
d GRT_d
U GRT_U
s, v, S, O, x, y, w, h, X, Y, c, r uint64
s, v, S, O, x, y, w, h, X, Y, c, r, N uint64
i, I, p uint32
@@ -176,6 +176,7 @@ func (self *GraphicsCommand) serialize_non_default_fields() (ans []string) {
write_key('U', self.U, null.U)
write_key('d', self.d, null.d)
write_key('N', self.N, null.N)
write_key('s', self.s, null.s)
write_key('v', self.v, null.v)
write_key('S', self.S, null.S)
@@ -376,6 +377,8 @@ func (self *GraphicsCommand) SetString(key byte, value string) (err error) {
err = set_val(&self.U, GRT_U_from_string, value)
case 'd':
err = set_val(&self.d, GRT_d_from_string, value)
case 'N':
err = set_uval(&self.N, value)
case 's':
err = set_uval(&self.s, value)
case 'v':
@@ -753,6 +756,19 @@ func (self *GraphicsCommand) SetFrameToMakeCurrent(c uint64) *GraphicsCommand {
return self
}
func (self *GraphicsCommand) NoDiskCache() bool {
return self.N != 0
}
func (self *GraphicsCommand) SetNoDiskCache(noDiskCache bool) *GraphicsCommand {
if noDiskCache {
self.N = 1
} else {
self.N = 0
}
return self
}
func (self *GraphicsCommand) ImageId() uint32 {
return self.i
}