[Feature] (disaggregated): WindowKind::HostFrame - the host-framed surface crosses the wire

The last thing between the host-framed surface and a run: the sub-byte on the wire that names it.
ServerOwned had one (7) and the host frame had none, so the encoder refused the op with
UnknownWindowKind - a correct refusal, and the reason the first run of MOBILEGL_IPC_SURFACE=host
failed in the codec rather than anywhere near the pixels.

 - protocol.fbs: WindowKind::HostFrame = 8, appended, legal on CreateWindowSurface only and always
   with nativeToken 0 - the same rules ServerOwned carries, for the same reason: no pointer of any
   process's window system crosses (Rule G/H).
 - SurfaceRefusal: HostFrameOnSetWindowHandle = 5, its own code rather than reusing the
   server-owned one: a refusal that names the wrong owner sends the next reader to the wrong place.
 - SurfaceOpCodec: the encode and decode arms, the two wire errors that go with them
   (HostFrameTokenNotZero latches as corruption, HostFrameOnSetWindowHandle is a named refusal), and
   the range bound that had ServerOwned as its upper limit now ends at HostFrame.
 - protocol_generated.h regenerated with the pinned submodule's flatc (scripts/gen_protocol.py),
   diff being exactly the two appended enumerators.

Both ends must be rebuilt together, as any protocol revision here: the container's client and the
device's server went out with this on either side.
This commit is contained in:
gold
2026-10-01 01:26:02 +08:00
parent ead7a10b68
commit 1ae7a8eaa4
6 changed files with 61 additions and 12 deletions
@@ -341,11 +341,12 @@ enum class WindowKind : uint8_t {
Pbuffer = 5,
MetalLayer = 6,
ServerOwned = 7,
HostFrame = 8,
MIN = None,
MAX = ServerOwned
MAX = HostFrame
};
inline const WindowKind (&EnumValuesWindowKind())[8] {
inline const WindowKind (&EnumValuesWindowKind())[9] {
static const WindowKind values[] = {
WindowKind::None,
WindowKind::AndroidNativeWindow,
@@ -354,13 +355,14 @@ inline const WindowKind (&EnumValuesWindowKind())[8] {
WindowKind::Surfaceless,
WindowKind::Pbuffer,
WindowKind::MetalLayer,
WindowKind::ServerOwned
WindowKind::ServerOwned,
WindowKind::HostFrame
};
return values;
}
inline const char * const *EnumNamesWindowKind() {
static const char * const names[9] = {
static const char * const names[10] = {
"None",
"AndroidNativeWindow",
"X11",
@@ -369,13 +371,14 @@ inline const char * const *EnumNamesWindowKind() {
"Pbuffer",
"MetalLayer",
"ServerOwned",
"HostFrame",
nullptr
};
return names;
}
inline const char *EnumNameWindowKind(WindowKind e) {
if (::flatbuffers::IsOutRange(e, WindowKind::None, WindowKind::ServerOwned)) return "";
if (::flatbuffers::IsOutRange(e, WindowKind::None, WindowKind::HostFrame)) return "";
const size_t index = static_cast<size_t>(e);
return EnumNamesWindowKind()[index];
}
@@ -386,35 +389,38 @@ enum class SurfaceRefusal : uint8_t {
NoServerWindow = 2,
SurfaceModeMismatch = 3,
ServerOwnedOnSetWindowHandle = 4,
HostFrameOnSetWindowHandle = 5,
MIN = None,
MAX = ServerOwnedOnSetWindowHandle
MAX = HostFrameOnSetWindowHandle
};
inline const SurfaceRefusal (&EnumValuesSurfaceRefusal())[5] {
inline const SurfaceRefusal (&EnumValuesSurfaceRefusal())[6] {
static const SurfaceRefusal values[] = {
SurfaceRefusal::None,
SurfaceRefusal::NoServerDisplay,
SurfaceRefusal::NoServerWindow,
SurfaceRefusal::SurfaceModeMismatch,
SurfaceRefusal::ServerOwnedOnSetWindowHandle
SurfaceRefusal::ServerOwnedOnSetWindowHandle,
SurfaceRefusal::HostFrameOnSetWindowHandle
};
return values;
}
inline const char * const *EnumNamesSurfaceRefusal() {
static const char * const names[6] = {
static const char * const names[7] = {
"None",
"NoServerDisplay",
"NoServerWindow",
"SurfaceModeMismatch",
"ServerOwnedOnSetWindowHandle",
"HostFrameOnSetWindowHandle",
nullptr
};
return names;
}
inline const char *EnumNameSurfaceRefusal(SurfaceRefusal e) {
if (::flatbuffers::IsOutRange(e, SurfaceRefusal::None, SurfaceRefusal::ServerOwnedOnSetWindowHandle)) return "";
if (::flatbuffers::IsOutRange(e, SurfaceRefusal::None, SurfaceRefusal::HostFrameOnSetWindowHandle)) return "";
const size_t index = static_cast<size_t>(e);
return EnumNamesSurfaceRefusal()[index];
}