Skip to content

optimize RS-Viewer loading time #13985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

gilpazintel
Copy link

@gilpazintel gilpazintel commented May 6, 2025

allow late initialization for platform camera in order not to hold realsense logo on startup.

tracked by LRS-1254

as the try-catch mechanism is very time consuming, and as platform camera is in high probability w/o these controls, we want to try and add them in parallel to the viewer execution and avoid adding them from the main thread (which will stuck the logo for several seconds)

…alsense logo on startup.

as the try-catch mechanism is very time consuming, and as platform camera is in high probability w/o these controls, we want to try and add them in parallel to the viewer execution and avoid adding them from the main thread (which will stuck the logo for several seconds)
@sysrsbuild
Copy link
Collaborator

Can one of the admins verify this patch?

@Nir-Az Nir-Az requested a review from OhadMeir May 6, 2025 17:39
@@ -70,6 +70,8 @@ class device_interface

virtual bool contradicts( const stream_profile_interface * a,
const std::vector< stream_profile > & others ) const = 0;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OhadMeir any idea how this added an API w/o adding it to the include headers?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

realsense-viewer.cpp added an include to api.h which, despite the name, is actually under src folder. This bypass the API mechanism.

@Nir-Az
Copy link
Collaborator

Nir-Az commented May 6, 2025

What happened to the title and description with the ...

image

@gilpazintel gilpazintel changed the title allow late initialization for platform camera in order not to hold re… optimize RS-Viewer loading time May 6, 2025
auto dev_itr = begin(future_initialization_devices);
while (dev_itr != end(future_initialization_devices))
{
auto dev = *dev_itr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copies the object. Can use auto &?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -70,6 +70,8 @@ class device_interface

virtual bool contradicts( const stream_profile_interface * a,
const std::vector< stream_profile > & others ) const = 0;

virtual void add_controls() = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming initialize. Adding controls is specific initialization for a device type.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@gilpazintel gilpazintel closed this May 7, 2025
@gilpazintel gilpazintel reopened this May 7, 2025
@gilpazintel gilpazintel closed this May 7, 2025
@gilpazintel gilpazintel reopened this May 7, 2025
@@ -19,6 +19,7 @@
#include <mutex>
#include <set>
#include <regex>
#include <api.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files under src folder should not be included by user application, only from include folder.
If a function needs to be exposed to users it should be done via the C API.

I am still not sure we need a new API for this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed that

color_ep->try_register_pu( RS2_OPTION_WHITE_BALANCE );
color_ep->try_register_pu( RS2_OPTION_ENABLE_AUTO_EXPOSURE );
color_ep->try_register_pu( RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE );
void platform_camera::initialize()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently initialize is added to device-interface but is relevant only here. Can we just open a thread in platform-device constructor that will do the initialization (maybe even after some sleep time)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (allow_future_initialization)
{
auto dev_itr = begin(future_initialization_devices);
while (dev_itr != end(future_initialization_devices))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style only - I would discard the flag and use the vector as indication if a job is needed.

while( ! future_initialization_devices.empty() )
{
//Handle a device
//Erase that device from the list
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@OhadMeir OhadMeir merged commit 1577f1c into IntelRealSense:development May 11, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants