Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions autobuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>126e0fa4c16dfd433c9fb7d1d242da98f213d933</string>
<string>2a4147260900b4a8ebc781cd8d0dc385b9983c89</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/dullahan/releases/download/v1.24.0-CEF_139.0.40/dullahan-1.24.0.202510081737_139.0.40_g465474a_chromium-139.0.7258.139-darwin64-18353103947.tar.zst</string>
<string>https://github.com/secondlife/dullahan/releases/download/v1.26.1-CEF_139.0.40.accel/dullahan-1.26.0.202604010801_139.0.40_g465474a_chromium-139.0.7258.139-darwin64-23838332395.tar.zst</string>
</map>
<key>name</key>
<string>darwin64</string>
Expand All @@ -464,11 +464,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>209d031ae67bc66d8e8f8509c71d259014c65ceb</string>
<string>6f8d73431199fb0f669ca510ae1bdb5d797cd31e</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/dullahan/releases/download/v1.14.0-r3/dullahan-1.14.0.202408091637_118.4.1_g3dd6078_chromium-118.0.5993.54-linux64-10322607516.tar.zst</string>
<string>https://github.com/secondlife/dullahan/releases/download/v1.26.1-CEF_139.0.40.accel/dullahan-1.26.0.202604010801_139.0.40_g465474a_chromium-139.0.7258.139-linux64-23838332395.tar.zst</string>
</map>
<key>name</key>
<string>linux64</string>
Expand All @@ -478,11 +478,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>20de62c9e57d9e6539c1e2437ec4b46c3ca237bc</string>
<string>7a477ea33efaf1e6cea662ea602de914a718771e</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/dullahan/releases/download/v1.24.0-CEF_139.0.40/dullahan-1.24.0.202510081738_139.0.40_g465474a_chromium-139.0.7258.139-windows64-18353103947.tar.zst</string>
<string>https://github.com/secondlife/dullahan/releases/download/v1.26.1-CEF_139.0.40.accel/dullahan-1.26.0.202604010803_139.0.40_g465474a_chromium-139.0.7258.139-windows64-23838332395.tar.zst</string>
</map>
<key>name</key>
<string>windows64</string>
Expand All @@ -495,7 +495,7 @@
<key>copyright</key>
<string>Copyright (c) 2017, Linden Research, Inc.</string>
<key>version</key>
<string>1.24.0.202510081737_139.0.40_g465474a_chromium-139.0.7258.139</string>
<string>1.26.0.202604010801_139.0.40_g465474a_chromium-139.0.7258.139</string>
<key>name</key>
<string>dullahan</string>
<key>description</key>
Expand Down
41 changes: 30 additions & 11 deletions indra/llplugin/llpluginclassmedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ LLPluginClassMedia::~LLPluginClassMedia()
reset();
}

bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_dir, const std::string &plugin_filename, bool debug)
bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_dir, const std::string &plugin_filename, bool debug, S32 adapter_luid_high, U32 adapter_luid_low, bool shared_texture_enable)
{
LL_DEBUGS("Plugin") << "launcher: " << launcher_filename << LL_ENDL;
LL_DEBUGS("Plugin") << "dir: " << plugin_dir << LL_ENDL;
Expand All @@ -80,6 +80,12 @@ bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::s
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "init");
message.setValue("target", mTarget);
message.setValueReal("factor", mZoomFactor);
#if LL_WINDOWS
message.setValueU32("viewer_pid", (U32)GetCurrentProcessId());
message.setValueS32("adapter_luid_high", adapter_luid_high);
message.setValueU32("adapter_luid_low", adapter_luid_low);
#endif
message.setValueBoolean("shared_texture_enable", shared_texture_enable);
sendMessage(message);

mPlugin->init(launcher_filename, plugin_dir, plugin_filename, debug);
Expand Down Expand Up @@ -142,6 +148,8 @@ void LLPluginClassMedia::reset()
mMediaName.clear();
mMediaDescription.clear();
mBackgroundColor = LLColor4(1.0f, 1.0f, 1.0f, 1.0f);
mAcceleratedTextureHandle = nullptr;
mAcceleratedTextureId = 0;

// media_browser class
mNavigateURI.clear();
Expand Down Expand Up @@ -373,16 +381,6 @@ void LLPluginClassMedia::setSizeInternal(void)
mRequestedMediaHeight = nextPowerOf2(mRequestedMediaHeight);
}

#if LL_DARWIN
if (!gHiDPISupport)
#endif
{
if (mRequestedMediaWidth > 2048)
mRequestedMediaWidth = 2048;

if (mRequestedMediaHeight > 2048)
mRequestedMediaHeight = 2048;
}
}

void LLPluginClassMedia::setAutoScale(bool auto_scale)
Expand Down Expand Up @@ -1275,6 +1273,19 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
{
mHoverText = message.getValue("tooltip");
}
else if (message_name == "accelerated_update")
{
mAcceleratedTextureHandle = message.getValuePointer("handle");
mAcceleratedTextureId = message.getValueU32("texture_id");

// For the accelerated path, the texture dimensions are the full
// media size (what was given to CEF via setSize), not the dirty
// rect bounds which may be smaller
mTextureWidth = mMediaWidth;
mTextureHeight = mMediaHeight;

mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_ACCELERATED_UPDATE);
}
else
{
LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
Expand Down Expand Up @@ -1401,6 +1412,14 @@ void LLPluginClassMedia::mediaEvent(LLPluginClassMediaOwner::EMediaEvent event)
}
}

void LLPluginClassMedia::releaseAcceleratedTextureHandle()
{
if (mAcceleratedTextureHandle)
{
mAcceleratedTextureHandle = nullptr;
}
}

void LLPluginClassMedia::sendMessage(const LLPluginMessage &message)
{
if(mPlugin && mPlugin->isRunning())
Expand Down
12 changes: 11 additions & 1 deletion indra/llplugin/llpluginclassmedia.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
bool init(const std::string &launcher_filename,
const std::string &plugin_dir,
const std::string &plugin_filename,
bool debug);
bool debug,
S32 adapter_luid_high = 0,
U32 adapter_luid_low = 0,
bool shared_texture_enable = false);

// undoes everything init() didm called by the media manager when destroying a source
void reset();
Expand Down Expand Up @@ -315,6 +318,10 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
std::string getHoverText() const { return mHoverText; };
std::string getHoverLink() const { return mHoverLink; };

// Valid after MEDIA_EVENT_ACCELERATED_UPDATE
void* getAcceleratedTextureHandle() const { return mAcceleratedTextureHandle; };
void releaseAcceleratedTextureHandle();

// these are valid during MEDIA_EVENT_LINK_HOVERED
std::string getFileDownloadFilename() const { return mFileDownloadFilename; }

Expand Down Expand Up @@ -477,6 +484,9 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
std::string mFileDownloadFilename;
bool mIsMultipleFilePick;

void* mAcceleratedTextureHandle;
U32 mAcceleratedTextureId;

/////////////////////////////////////////
// media_time class
F64 mCurrentTime;
Expand Down
4 changes: 3 additions & 1 deletion indra/llplugin/llpluginclassmediaowner.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class LLPluginClassMediaOwner

MEDIA_EVENT_DEBUG_MESSAGE, // plugin sending back debug information for host to process

MEDIA_EVENT_LINK_HOVERED // Got a "link hovered" event from the plugin
MEDIA_EVENT_LINK_HOVERED, // Got a "link hovered" event from the plugin

MEDIA_EVENT_ACCELERATED_UPDATE // Accelerated (GPU) texture handle update from the plugin

} EMediaEvent;

Expand Down
4 changes: 4 additions & 0 deletions indra/llrender/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ target_link_libraries(llrender
OpenGL::GLU
)

if (WINDOWS)
target_link_libraries(llrender d3d11 dxgi)
endif (WINDOWS)

61 changes: 61 additions & 0 deletions indra/llrender/llgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@

#if LL_WINDOWS
#include "lldxhardware.h"
#include <d3d11.h>
#include <dxgi.h>
#endif

#ifdef _DEBUG
Expand Down Expand Up @@ -236,6 +238,14 @@ PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC wglBlitContextFramebufferAMD = n
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr;
PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = nullptr;

// WGL_NV_DX_interop
PFNWGLDXOPENDEVICENVPROC wglDXOpenDeviceNV = nullptr;
PFNWGLDXCLOSEDEVICENVPROC wglDXCloseDeviceNV = nullptr;
PFNWGLDXREGISTEROBJECTNVPROC wglDXRegisterObjectNV = nullptr;
PFNWGLDXUNREGISTEROBJECTNVPROC wglDXUnregisterObjectNV = nullptr;
PFNWGLDXLOCKOBJECTSNVPROC wglDXLockObjectsNV = nullptr;
PFNWGLDXUNLOCKOBJECTSNVPROC wglDXUnlockObjectsNV = nullptr;

#endif

// GL_VERSION_1_2
Expand Down Expand Up @@ -1058,6 +1068,57 @@ void LLGLManager::initWGL()
{
LL_WARNS("RenderInit") << "No ARB WGL render texture extensions" << LL_ENDL;
}

mHasNVDXInterop = ExtensionExists("WGL_NV_DX_interop", gGLHExts.mSysExts);
if (mHasNVDXInterop)
{
wglDXOpenDeviceNV = (PFNWGLDXOPENDEVICENVPROC)GLH_EXT_GET_PROC_ADDRESS("wglDXOpenDeviceNV");
wglDXCloseDeviceNV = (PFNWGLDXCLOSEDEVICENVPROC)GLH_EXT_GET_PROC_ADDRESS("wglDXCloseDeviceNV");
wglDXRegisterObjectNV = (PFNWGLDXREGISTEROBJECTNVPROC)GLH_EXT_GET_PROC_ADDRESS("wglDXRegisterObjectNV");
wglDXUnregisterObjectNV = (PFNWGLDXUNREGISTEROBJECTNVPROC)GLH_EXT_GET_PROC_ADDRESS("wglDXUnregisterObjectNV");
wglDXLockObjectsNV = (PFNWGLDXLOCKOBJECTSNVPROC)GLH_EXT_GET_PROC_ADDRESS("wglDXLockObjectsNV");
wglDXUnlockObjectsNV = (PFNWGLDXUNLOCKOBJECTSNVPROC)GLH_EXT_GET_PROC_ADDRESS("wglDXUnlockObjectsNV");

// Discover which adapter the GL context lives on by probing wglDXOpenDeviceNV
IDXGIFactory1* dxgi_factory = nullptr;
if (SUCCEEDED(CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&dxgi_factory)))
{
IDXGIAdapter* adapter = nullptr;
for (UINT i = 0; dxgi_factory->EnumAdapters(i, &adapter) != DXGI_ERROR_NOT_FOUND; ++i)
{
ID3D11Device* probe_device = nullptr;
HRESULT hr = D3D11CreateDevice(
adapter, D3D_DRIVER_TYPE_UNKNOWN,
nullptr, 0, nullptr, 0,
D3D11_SDK_VERSION,
&probe_device, nullptr, nullptr);

if (SUCCEEDED(hr) && probe_device)
{
HANDLE probe_handle = wglDXOpenDeviceNV(probe_device);
if (probe_handle)
{
// This adapter matches the GL context
DXGI_ADAPTER_DESC adesc;
if (SUCCEEDED(adapter->GetDesc(&adesc)))
{
mGLAdapterLuidHigh = adesc.AdapterLuid.HighPart;
mGLAdapterLuidLow = adesc.AdapterLuid.LowPart;
LL_INFOS("RenderInit") << "GL adapter LUID: "
<< std::hex << mGLAdapterLuidHigh << ":" << mGLAdapterLuidLow << LL_ENDL;
}
wglDXCloseDeviceNV(probe_handle);
probe_device->Release();
adapter->Release();
break;
}
probe_device->Release();
}
adapter->Release();
}
dxgi_factory->Release();
}
}
#endif
}

Expand Down
3 changes: 3 additions & 0 deletions indra/llrender/llgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ class LLGLManager
// Vendor-specific extensions
bool mHasAMDAssociations = false;
bool mHasNVXGpuMemoryInfo = false;
bool mHasNVDXInterop = false;
S32 mGLAdapterLuidHigh = 0;
U32 mGLAdapterLuidLow = 0;

bool mIsAMD;
bool mIsNVIDIA;
Expand Down
8 changes: 8 additions & 0 deletions indra/llrender/llglheaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ extern PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT;
// WGL_ARB_create_context
extern PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;

// WGL_NV_DX_interop
extern PFNWGLDXOPENDEVICENVPROC wglDXOpenDeviceNV;
extern PFNWGLDXCLOSEDEVICENVPROC wglDXCloseDeviceNV;
extern PFNWGLDXREGISTEROBJECTNVPROC wglDXRegisterObjectNV;
extern PFNWGLDXUNREGISTEROBJECTNVPROC wglDXUnregisterObjectNV;
extern PFNWGLDXLOCKOBJECTSNVPROC wglDXLockObjectsNV;
extern PFNWGLDXUNLOCKOBJECTSNVPROC wglDXUnlockObjectsNV;

// GL_VERSION_1_3
extern PFNGLACTIVETEXTUREPROC glActiveTexture;
extern PFNGLSAMPLECOVERAGEPROC glSampleCoverage;
Expand Down
Loading
Loading