@deepseek-ai/libreoffice-kit 0.2.0 → 0.2.3-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +5 -5
- package/README.zh.md +5 -5
- package/frame-forwarding/CMakeLists.txt +3 -4
- package/frame-forwarding/README.md +21 -17
- package/frame-forwarding/README.zh.md +22 -18
- package/frame-forwarding/include/dsh_frame_forwarding.h +42 -9
- package/frame-forwarding/index.d.ts +58 -54
- package/frame-forwarding/index.mjs +14 -17
- package/frame-forwarding/prebuilds/darwin-arm64/frame-forwarding.node +0 -0
- package/frame-forwarding/prebuilds/darwin-arm64/libdsh_frame_forwarding_sdk.a +0 -0
- package/frame-forwarding/prebuilds/darwin-arm64/manifest.json +23 -21
- package/frame-forwarding/prebuilds/darwin-x64/frame-forwarding.node +0 -0
- package/frame-forwarding/prebuilds/darwin-x64/libdsh_frame_forwarding_sdk.a +0 -0
- package/frame-forwarding/prebuilds/darwin-x64/manifest.json +23 -21
- package/frame-forwarding/prebuilds/win32-arm64/dsh_frame_forwarding_sdk.lib +0 -0
- package/frame-forwarding/prebuilds/win32-arm64/frame-forwarding.node +0 -0
- package/frame-forwarding/prebuilds/win32-arm64/manifest.json +23 -21
- package/frame-forwarding/prebuilds/win32-x64/dsh_frame_forwarding_sdk.lib +0 -0
- package/frame-forwarding/prebuilds/win32-x64/frame-forwarding.node +0 -0
- package/frame-forwarding/prebuilds/win32-x64/manifest.json +23 -21
- package/frame-forwarding/receipt.json +16 -14
- package/frame-forwarding/scripts/build-webgpu.mjs +1 -0
- package/frame-forwarding/scripts/build.mjs +3 -3
- package/frame-forwarding/scripts/metadata.mjs +12 -8
- package/frame-forwarding/scripts/source-identity.mjs +3 -3
- package/frame-forwarding/sdk.json +7 -5
- package/frame-forwarding/{include/dsh_webgpu.h → src/graphite-interop-internal.hxx} +22 -22
- package/frame-forwarding/src/{webgpu.cc → graphite-interop.cc} +34 -24
- package/frame-forwarding/src/node-producer.cc +24 -154
- package/frame-forwarding/src/producer.cc +120 -30
- package/frame-forwarding/src/receiver.cc +422 -212
- package/frame-forwarding/src/relay-transport.inc +38 -10
- package/frame-forwarding/src/transport.cc +328 -155
- package/frame-forwarding/src/transport.h +73 -9
- package/frame-forwarding/verify.d.mts +1 -1
- package/frame-forwarding/verify.mjs +19 -17
- package/lib/cli.js +6 -6
- package/lib/editor.js +15 -10
- package/lib/index.js +6 -6
- package/lib/types/editor.d.ts +17 -4
- package/lib/types/engine.d.ts +1 -1
- package/lib/types/fonts.d.ts +1 -1
- package/lib/worker.js +3 -2
- package/package.json +8 -10
- package/frame-forwarding/include/dsh_frame_forwarding_engine.h +0 -66
- package/frame-forwarding/include/dsh_frame_forwarding_node.h +0 -27
|
@@ -26,6 +26,13 @@ struct RelayDevice {
|
|
|
26
26
|
ComPtr<ID3D11Device1> device;
|
|
27
27
|
ComPtr<ID3D11DeviceContext> context;
|
|
28
28
|
};
|
|
29
|
+
struct RelaySource {
|
|
30
|
+
ComPtr<ID3D11Device1> device;
|
|
31
|
+
ComPtr<ID3D11Texture2D> texture;
|
|
32
|
+
HANDLE handle = nullptr;
|
|
33
|
+
uint32_t width = 0, height = 0;
|
|
34
|
+
~RelaySource() { if (handle) CloseHandle(handle); }
|
|
35
|
+
};
|
|
29
36
|
struct RelayReadback {
|
|
30
37
|
ComPtr<ID3D11Device1> device;
|
|
31
38
|
ComPtr<ID3D11DeviceContext> context;
|
|
@@ -179,12 +186,28 @@ bool relay_begin(uintptr_t resource, uint32_t width, uint32_t height,
|
|
|
179
186
|
slot->stage = RelayStage::waiting_target; return true;
|
|
180
187
|
}
|
|
181
188
|
|
|
182
|
-
bool relay_readback_begin(uintptr_t resource, uint32_t width, uint32_t height,
|
|
183
|
-
std::shared_ptr<RelayReadback>& slot, std::
|
|
189
|
+
bool relay_readback_begin(uintptr_t resource, uint32_t width, uint32_t height, uint32_t stride,
|
|
190
|
+
std::shared_ptr<RelayReadback>& slot, std::shared_ptr<RelaySource>& imported,
|
|
191
|
+
std::string& diagnostic, std::string& adapter, bool* keyed_mutex,
|
|
184
192
|
std::chrono::steady_clock::time_point deadline) {
|
|
193
|
+
ComPtr<ID3D11Texture2D> source;
|
|
194
|
+
using CompareHandles = BOOL (WINAPI*)(HANDLE, HANDLE);
|
|
195
|
+
static const auto compare_handles = reinterpret_cast<CompareHandles>(
|
|
196
|
+
GetProcAddress(GetModuleHandleW(L"KernelBase.dll"), "CompareObjectHandles"));
|
|
197
|
+
const bool reused = imported && imported->width == width && imported->height == height &&
|
|
198
|
+
stride == width * 4 && compare_handles && compare_handles(imported->handle, reinterpret_cast<HANDLE>(resource));
|
|
199
|
+
if (reused) {
|
|
200
|
+
source = imported->texture; adapter = device_adapter(imported->device.Get());
|
|
201
|
+
D3D11_TEXTURE2D_DESC description{}; source->GetDesc(&description);
|
|
202
|
+
if (keyed_mutex) *keyed_mutex = (description.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0;
|
|
203
|
+
}
|
|
204
|
+
if (!reused && !open_frame(resource, width, height, stride, diagnostic, adapter, keyed_mutex, source)) {
|
|
205
|
+
if (source) { std::string ignored; source_ready(source.Get(), deadline, ignored); }
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
185
208
|
if (!slot || slot->width != width || slot->height != height) {
|
|
186
209
|
auto next = std::make_shared<RelayReadback>();
|
|
187
|
-
next->device = validation_device; next->width = width; next->height = height;
|
|
210
|
+
next->device = reused ? imported->device : validation_device; next->width = width; next->height = height;
|
|
188
211
|
next->device->GetImmediateContext(&next->context);
|
|
189
212
|
D3D11_TEXTURE2D_DESC description{};
|
|
190
213
|
description.Width = width; description.Height = height; description.MipLevels = 1; description.ArraySize = 1;
|
|
@@ -195,8 +218,15 @@ bool relay_readback_begin(uintptr_t resource, uint32_t width, uint32_t height,
|
|
|
195
218
|
if (!relay_prepare_sync(next->device.Get(), next->context.Get(), next->completion, diagnostic)) return false;
|
|
196
219
|
slot = std::move(next);
|
|
197
220
|
}
|
|
198
|
-
|
|
199
|
-
|
|
221
|
+
if (!reused && compare_handles) {
|
|
222
|
+
auto next = std::make_shared<RelaySource>();
|
|
223
|
+
if (!DuplicateHandle(GetCurrentProcess(), reinterpret_cast<HANDLE>(resource), GetCurrentProcess(),
|
|
224
|
+
&next->handle, 0, FALSE, DUPLICATE_SAME_ACCESS))
|
|
225
|
+
return gpu_failure(diagnostic, "Cannot retain relay source handle", HRESULT_FROM_WIN32(GetLastError()));
|
|
226
|
+
next->texture = source; next->device = slot->device;
|
|
227
|
+
next->width = width; next->height = height; imported = std::move(next);
|
|
228
|
+
}
|
|
229
|
+
slot->source = std::move(source);
|
|
200
230
|
SourceAccess source_access;
|
|
201
231
|
if (!source_access.acquire(slot->source.Get(), deadline, diagnostic)) return false;
|
|
202
232
|
slot->context->CopyResource(slot->staging.Get(), slot->source.Get());
|
|
@@ -284,10 +314,8 @@ int relay_with_pixels(const std::shared_ptr<RelayReadback>& staging,
|
|
|
284
314
|
struct Unmap { RelayReadback* source; ~Unmap() { source->context->Unmap(source->staging.Get(), 0); } } unmap{staging.get()};
|
|
285
315
|
return consume(static_cast<const uint8_t*>(mapped.pData), mapped.RowPitch) ? 1 : -1;
|
|
286
316
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
const auto result = validation_device->OpenSharedResource1(reinterpret_cast<HANDLE>(resource), IID_PPV_ARGS(&texture));
|
|
290
|
-
if (FAILED(result)) return gpu_failure(diagnostic, "Cannot open producer texture for direct import", result);
|
|
317
|
+
/** Acquire and release key 0 of a keyed-mutex texture within the deadline; a texture without a keyed mutex is ready. */
|
|
318
|
+
bool source_ready(ID3D11Texture2D* texture, std::chrono::steady_clock::time_point deadline, std::string& diagnostic) {
|
|
291
319
|
SourceAccess access;
|
|
292
|
-
return access.acquire(texture
|
|
320
|
+
return access.acquire(texture, deadline, diagnostic) && access.release(diagnostic);
|
|
293
321
|
}
|