WIP: Finish the IPC story

This commit is contained in:
p
2026-09-08 09:39:24 +02:00
parent 5ce8d21943
commit 0df1955435
32 changed files with 3239 additions and 288 deletions
+37
View File
@@ -44,3 +44,40 @@ struct Error {
struct Cancel {
u64 id;
};
// Where a large payload lives. Inline stays within the negotiated maximum
// payload; shared means the Nth attachment on the frame carrying it.
union Blob switch (enum BlobKind {
INLINE,
SHARED,
} kind) {
case INLINE:
u8 bytes<>;
case SHARED:
u64 size;
};
union DaemonHelloReply switch (enum DaemonHelloResult {
ACCEPTED,
VERSION_MISMATCH,
SESSION_MISMATCH,
} result) {
case ACCEPTED:
struct DaemonLimits {
u32 max_payload_size;
u64 max_blob_size;
} limits;
case VERSION_MISMATCH:
u32 server_protocol_version;
case SESSION_MISMATCH:
void;
};
// Working format: BGRA_PREMUL_4X16LE, stride in bytes.
struct Pixmap {
u32 width;
u32 height;
u32 stride;
i32 orientation; // Exif, 0 = unknown; carried, not applied
Blob pixels;
};
+58
View File
@@ -0,0 +1,58 @@
//
// imaged.lxdr: image decoder daemon protocol
//
// Copyright The Dawn Authors
// SPDX-License-Identifier: MPL-2.0
//
const IMAGED_PROTOCOL_VERSION = 1;
const IMAGED_MAX_BLOB_SIZE = 1073741824;
struct DecodeRequest {
Blob data;
u8 target_icc<>; // empty means sRGB
bool first_frame_only;
};
struct DecodeResponse {
Pixmap pixmap;
string loader;
u8 icc<>; // the file's own profile blob, if any
bool profile_assumed;
};
struct Request {
u64 id;
DecodeRequest decode;
};
struct Response {
u64 id;
union Result switch (enum ResponseKind {
DECODED,
ERROR,
} kind) {
case DECODED:
DecodeResponse decoded;
case ERROR:
Error error;
} result;
};
struct Frame {
union Payload switch (enum FrameKind {
HELLO,
HELLO_REPLY,
REQUEST,
RESPONSE,
} kind) {
case HELLO:
Hello hello;
case HELLO_REPLY:
DaemonHelloReply hello_reply;
case REQUEST:
Request request;
case RESPONSE:
Response response;
} payload;
};
+57
View File
@@ -0,0 +1,57 @@
//
// thumbd.lxdr: thumbnail scaler daemon protocol
//
// Copyright The Dawn Authors
// SPDX-License-Identifier: MPL-2.0
//
const THUMBD_PROTOCOL_VERSION = 1;
const THUMBD_MAX_BLOB_SIZE = 1073741824;
struct ScaleRequest {
Pixmap source;
u32 out_width;
u32 out_height;
};
struct ScaleResponse {
u32 width;
u32 height;
Blob rgba8; // straight, non-premultiplied, stride = width * 4
};
struct Request {
u64 id;
ScaleRequest scale;
};
struct Response {
u64 id;
union Result switch (enum ResponseKind {
SCALED,
ERROR,
} kind) {
case SCALED:
ScaleResponse scaled;
case ERROR:
Error error;
} result;
};
struct Frame {
union Payload switch (enum FrameKind {
HELLO,
HELLO_REPLY,
REQUEST,
RESPONSE,
} kind) {
case HELLO:
Hello hello;
case HELLO_REPLY:
DaemonHelloReply hello_reply;
case REQUEST:
Request request;
case RESPONSE:
Response response;
} payload;
};