WebKit Bugzilla
Attachment 343891 Details for
Bug 185764
: [WPE] Rendering on a HiDPI display looks scaled up instead of rendered at 2x
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
wip (text/plain), 4.12 KB, created by
Carlos Bentzen
on 2018-06-28 21:31:13 PDT
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Carlos Bentzen
Created:
2018-06-28 21:31:13 PDT
Size:
4.12 KB
patch
obsolete
>diff --git a/Source/WebKit/UIProcess/API/wpe/WPEView.cpp b/Source/WebKit/UIProcess/API/wpe/WPEView.cpp >index 48d8044135f..b50549252a3 100644 >--- a/Source/WebKit/UIProcess/API/wpe/WPEView.cpp >+++ b/Source/WebKit/UIProcess/API/wpe/WPEView.cpp >@@ -140,6 +140,19 @@ View::View(struct wpe_view_backend* backend, const API::PageConfiguration& baseC > wpe_view_backend_initialize(m_backend); > > m_pageProxy->initializeWebPage(); >+ >+ // FIXME: definitely not the way to get display scale >+ const char* MINIBROWSER_WPE_SCALE = g_getenv("MINIBROWSER_WPE_SCALE"); >+ unsigned scale = 1; >+ >+ if (MINIBROWSER_WPE_SCALE) >+ scale = atoi(MINIBROWSER_WPE_SCALE); >+ >+ // Ensure scale >= 1 >+ if (scale < 1) >+ scale = 1; >+ >+ m_pageProxy->setIntrinsicDeviceScaleFactor(scale); > } > > View::~View() >diff --git a/Tools/wpe/backends/WindowViewBackend.cpp b/Tools/wpe/backends/WindowViewBackend.cpp >index d13749abb6a..c0cdafd6769 100644 >--- a/Tools/wpe/backends/WindowViewBackend.cpp >+++ b/Tools/wpe/backends/WindowViewBackend.cpp >@@ -105,7 +105,7 @@ const struct wl_registry_listener WindowViewBackend::s_registryListener = { > auto* window = static_cast<WindowViewBackend*>(data); > > if (!std::strcmp(interface, "wl_compositor")) >- window->m_compositor = static_cast<struct wl_compositor*>(wl_registry_bind(registry, name, &wl_compositor_interface, 1)); >+ window->m_compositor = static_cast<struct wl_compositor*>(wl_registry_bind(registry, name, &wl_compositor_interface, 3)); > > if (!std::strcmp(interface, "zxdg_shell_v6")) > window->m_xdg = static_cast<struct zxdg_shell_v6*>(wl_registry_bind(registry, name, &zxdg_shell_v6_interface, 1)); >@@ -144,8 +144,9 @@ const struct wl_pointer_listener WindowViewBackend::s_pointerListener = { > [](void* data, struct wl_pointer*, uint32_t time, wl_fixed_t fixedX, wl_fixed_t fixedY) > { > auto& window = *static_cast<WindowViewBackend*>(data); >- int x = wl_fixed_to_int(fixedX); >- int y = wl_fixed_to_int(fixedY); >+ // Don't know why I need to multiply by the scale. It should work automatically >+ int x = wl_fixed_to_int(fixedX) * window.m_scale; >+ int y = wl_fixed_to_int(fixedY) * window.m_scale; > window.m_seatData.pointer.coords = { x, y }; > > if (window.m_seatData.pointer.target) { >@@ -406,6 +407,17 @@ WindowViewBackend::WindowViewBackend(uint32_t width, uint32_t height) > } > > m_surface = wl_compositor_create_surface(m_compositor); >+ // FIXME: definitely not the way to get display scale >+ const char* MINIBROWSER_WPE_SCALE = g_getenv("MINIBROWSER_WPE_SCALE"); >+ if (MINIBROWSER_WPE_SCALE) >+ m_scale = atoi(MINIBROWSER_WPE_SCALE); >+ >+ // Ensure m_scale >= 1 >+ if (m_scale < 1) >+ m_scale = 1; >+ >+ wl_surface_set_buffer_scale(m_surface, m_scale); >+ > if (m_xdg) { > m_xdgSurface = zxdg_shell_v6_get_xdg_surface(m_xdg, m_surface); > zxdg_surface_v6_add_listener(m_xdgSurface, &s_xdgSurfaceListener, nullptr); >@@ -417,7 +429,12 @@ WindowViewBackend::WindowViewBackend(uint32_t width, uint32_t height) > } > } > >- m_eglWindow = wl_egl_window_create(m_surface, m_width, m_height); >+ // From the wayland protocol: >+ // "Note that if the scale is larger than 1, then you have to attach >+ // a buffer that is larger (by a factor of scale in each dimension) >+ // than the desired surface size." >+ // Not sure this is the place to multiply when using EGL, but worked for me. >+ m_eglWindow = wl_egl_window_create(m_surface, m_width * m_scale, m_height * m_scale); > > auto createPlatformWindowSurface = > reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>(eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT")); >diff --git a/Tools/wpe/backends/WindowViewBackend.h b/Tools/wpe/backends/WindowViewBackend.h >index 044b5b7ddd6..8cf8fe73e67 100644 >--- a/Tools/wpe/backends/WindowViewBackend.h >+++ b/Tools/wpe/backends/WindowViewBackend.h >@@ -116,6 +116,7 @@ private: > struct wl_resource* bufferResource { nullptr }; > EGLImageKHR image; > } m_committed; >+ unsigned m_scale { 1 }; > }; > > } // WPEToolingBackends
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185764
:
340688
|
343499
|
343891
|
347582
|
347583
|
347605
|
369485
|
369525
|
369667