Take screen resolution directly from Mir
This commit is contained in:
parent
c730e595c6
commit
f9164c47c4
3 changed files with 14 additions and 1 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
#include "anbox/graphics/gl_renderer_server.h"
|
#include "anbox/graphics/gl_renderer_server.h"
|
||||||
#include "anbox/graphics/mir_native_window_creator.h"
|
#include "anbox/graphics/mir_native_window_creator.h"
|
||||||
|
#include "anbox/graphics/mir_display_connection.h"
|
||||||
|
|
||||||
#include "OpenglRender/render_api.h"
|
#include "OpenglRender/render_api.h"
|
||||||
|
|
||||||
|
|
@ -71,10 +72,15 @@ void GLRendererServer::start() {
|
||||||
socket_path_ = server_addr;
|
socket_path_ = server_addr;
|
||||||
DEBUG("socket path %s", socket_path_);
|
DEBUG("socket path %s", socket_path_);
|
||||||
|
|
||||||
|
auto display = window_creator_->display();
|
||||||
|
|
||||||
// Create the window we use for rendering the output we get from the
|
// Create the window we use for rendering the output we get from the
|
||||||
// Android container. This will internally construct a Mir surface
|
// Android container. This will internally construct a Mir surface
|
||||||
// and use the host EGL/GLES libraries for rendering.
|
// and use the host EGL/GLES libraries for rendering.
|
||||||
showOpenGLSubwindow(0, 0, 0, 1080, 1920, 1080, 1920, 1.0f, 0);
|
const auto width = display->horizontal_resolution();
|
||||||
|
const auto height = display->vertical_resolution();
|
||||||
|
if (!showOpenGLSubwindow(0, 0, 0, width, height, width, height, 1.0f, 0))
|
||||||
|
BOOST_THROW_EXCEPTION(std::runtime_error("Failed to setup GL based window"));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GLRendererServer::socket_path() const {
|
std::string GLRendererServer::socket_path() const {
|
||||||
|
|
|
||||||
|
|
@ -57,5 +57,10 @@ void MirNativeWindowCreator::destroy_window(EGLNativeWindowType win) {
|
||||||
|
|
||||||
windows_.erase(iter);
|
windows_.erase(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<MirDisplayConnection> MirNativeWindowCreator::display() const {
|
||||||
|
return display_connection_;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace graphics
|
} // namespace graphics
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ public:
|
||||||
EGLNativeWindowType create_window(int x, int y, int width, int height) override;
|
EGLNativeWindowType create_window(int x, int y, int width, int height) override;
|
||||||
void destroy_window(EGLNativeWindowType win) override;
|
void destroy_window(EGLNativeWindowType win) override;
|
||||||
|
|
||||||
|
std::shared_ptr<MirDisplayConnection> display() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<InputChannel> input_channel_;
|
std::shared_ptr<InputChannel> input_channel_;
|
||||||
std::shared_ptr<MirDisplayConnection> display_connection_;
|
std::shared_ptr<MirDisplayConnection> display_connection_;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue