⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 211145 in webkit


Ignore:
Timestamp:
Jan 25, 2017, 8:54:28 AM (10 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] UIProcess from WebKitGtk+ 2.15.x SIGSEGVs because of X Error BadDamage in WebKit::AcceleratedBackingStoreX11::update(WebKit::LayerTreeContext const&) () at Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp:145
https://bugs.webkit.org/show_bug.cgi?id=165656

Reviewed by Michael Catanzaro.

Source/WebCore:

Also return the base error code from PlatformDisplayX11::supportsXDamage().

  • platform/graphics/x11/PlatformDisplayX11.cpp:

(WebCore::PlatformDisplayX11::supportsXDamage):

  • platform/graphics/x11/PlatformDisplayX11.h:

Source/WebKit2:

We are incorrectly handling BadDamage errors because the BadDamage value we pass to the XErrorTrapper is not
the actual error code used by X11. Since XDamage is an extension, it has its own errors and a base error
code. We need to use the base error code we get when calling XDamageQueryExtension to pass the right error code
to the XErrorTrapper.

  • UIProcess/gtk/AcceleratedBackingStoreX11.cpp:

(WebKit::AcceleratedBackingStoreX11::create): Get also the damage base error.
(WebKit::xDamageErrorCode): Helper to get the actual error code.
(WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11): Use xDamageErrorCode().
(WebKit::AcceleratedBackingStoreX11::update): Ditto.

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r211142 r211145  
     12017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] UIProcess from WebKitGtk+ 2.15.x SIGSEGVs because of X Error BadDamage in WebKit::AcceleratedBackingStoreX11::update(WebKit::LayerTreeContext const&) () at Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp:145
     4        https://bugs.webkit.org/show_bug.cgi?id=165656
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Also return the base error code from PlatformDisplayX11::supportsXDamage().
     9
     10        * platform/graphics/x11/PlatformDisplayX11.cpp:
     11        (WebCore::PlatformDisplayX11::supportsXDamage):
     12        * platform/graphics/x11/PlatformDisplayX11.h:
     13
    1142017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
    215
  • trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp

    r209064 r211145  
    9999}
    100100
    101 bool PlatformDisplayX11::supportsXDamage(std::optional<int>& damageEventBase) const
     101bool PlatformDisplayX11::supportsXDamage(std::optional<int>& damageEventBase, std::optional<int>& damageErrorBase) const
    102102{
    103103    if (!m_supportsXDamage) {
     
    107107            int eventBase, errorBase;
    108108            m_supportsXDamage = XDamageQueryExtension(m_display, &eventBase, &errorBase);
    109             if (m_supportsXDamage.value())
     109            if (m_supportsXDamage.value()) {
    110110                m_damageEventBase = eventBase;
     111                m_damageErrorBase = errorBase;
     112            }
    111113        }
    112114#endif
     
    114116
    115117    damageEventBase = m_damageEventBase;
     118    damageErrorBase = m_damageErrorBase;
    116119    return m_supportsXDamage.value();
    117120}
  • trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h

    r209064 r211145  
    4444    Display* native() const { return m_display; }
    4545    bool supportsXComposite() const;
    46     bool supportsXDamage(std::optional<int>& damageEventBase) const;
     46    bool supportsXDamage(std::optional<int>& damageEventBase, std::optional<int>& damageErrorBase) const;
    4747
    4848private:
     
    5757    mutable std::optional<bool> m_supportsXDamage;
    5858    mutable std::optional<int> m_damageEventBase;
     59    mutable std::optional<int> m_damageErrorBase;
    5960};
    6061
  • trunk/Source/WebKit2/ChangeLog

    r211141 r211145  
     12017-01-25  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] UIProcess from WebKitGtk+ 2.15.x SIGSEGVs because of X Error BadDamage in WebKit::AcceleratedBackingStoreX11::update(WebKit::LayerTreeContext const&) () at Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp:145
     4        https://bugs.webkit.org/show_bug.cgi?id=165656
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        We are incorrectly handling BadDamage errors because the BadDamage value we pass to the XErrorTrapper is not
     9        the actual error code used by X11. Since XDamage is an extension, it has its own errors and a base error
     10        code. We need to use the base error code we get when calling XDamageQueryExtension to pass the right error code
     11        to the XErrorTrapper.
     12
     13        * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
     14        (WebKit::AcceleratedBackingStoreX11::create): Get also the damage base error.
     15        (WebKit::xDamageErrorCode): Helper to get the actual error code.
     16        (WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11): Use xDamageErrorCode().
     17        (WebKit::AcceleratedBackingStoreX11::update): Ditto.
     18
    1192017-01-25  Miguel Gomez  <magomez@igalia.com>
    220
  • trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreX11.cpp

    r209063 r211145  
    4848
    4949static std::optional<int> s_damageEventBase;
     50static std::optional<int> s_damageErrorBase;
    5051
    5152class XDamageNotifier {
     
    106107{
    107108    auto& display = downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay());
    108     if (!display.supportsXComposite() || !display.supportsXDamage(s_damageEventBase))
     109    if (!display.supportsXComposite() || !display.supportsXDamage(s_damageEventBase, s_damageErrorBase))
    109110        return nullptr;
    110111    return std::unique_ptr<AcceleratedBackingStoreX11>(new AcceleratedBackingStoreX11(webPage));
     
    116117}
    117118
     119static inline unsigned char xDamageErrorCode(unsigned char errorCode)
     120{
     121    ASSERT(s_damageErrorBase);
     122    return static_cast<unsigned>(s_damageErrorBase.value()) + errorCode;
     123}
     124
    118125AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11()
    119126{
     
    122129
    123130    Display* display = downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native();
    124     XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, BadDamage });
     131    XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
    125132    if (m_damage) {
    126133        XDamageNotifier::singleton().remove(m_damage.get());
     
    139146
    140147    if (m_surface) {
    141         XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, BadDamage });
     148        XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
    142149        if (m_damage) {
    143150            XDamageNotifier::singleton().remove(m_damage.get());
     
    159166    size.scale(deviceScaleFactor);
    160167
    161     XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, BadDamage });
     168    XErrorTrapper trapper(display, XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
    162169    ASSERT(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native() == GDK_DISPLAY_XDISPLAY(gdk_display_get_default()));
    163170    GdkVisual* visual = gdk_screen_get_rgba_visual(gdk_screen_get_default());
  • trunk/Source/WebKit2/UIProcess/gtk/WebPreferencesGtk.cpp

    r209534 r211145  
    6262    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11) {
    6363        auto& display = downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay());
    64         std::optional<int> damageBase;
    65         if (!display.supportsXComposite() || !display.supportsXDamage(damageBase))
     64        std::optional<int> damageBase, errorBase;
     65        if (!display.supportsXComposite() || !display.supportsXDamage(damageBase, errorBase))
    6666            setAcceleratedCompositingEnabled(false);
    6767    }
Note: See TracChangeset for help on using the changeset viewer.