Mir

Merge lp:~alan-griffiths/mir/fix-server-crash into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Chris Halse Rogers
Approved revision: no longer in the source branch.
Merged at revision: 3737
Proposed branch: lp:~alan-griffiths/mir/fix-server-crash
Merge into: lp:mir
Diff against target: 156 lines (+70/-61)
1 file modified
src/renderers/gl/renderer.cpp (+70/-61)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-server-crash
Reviewer Review Type Date Requested Status
Chris Halse Rogers Approve
Mir CI Bot continuous-integration Approve
Andreas Pokorny (community) Approve
Cemil Azizoglu (community) Approve
Review via email: mp+307459@code.launchpad.net

Commit message

Fix the server crash observed in lp:1629275

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3731
https://mir-jenkins.ubuntu.com/job/mir-ci/1870/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2372
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2435
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2427
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2427
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2427
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2401
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2401/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2401
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2401/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2401
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2401/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/2401
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/2401/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2401
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2401/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2401
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2401/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1870/rebuild

review: Approve (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3732
https://mir-jenkins.ubuntu.com/job/mir-ci/1871/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/2373/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2436
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2428
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2428
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2428
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2402/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2402
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2402/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2402
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2402/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/2402
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/2402/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2402
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2402/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2402
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2402/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1871/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

A test case might be good.

review: Approve
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

ok

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3732
https://mir-jenkins.ubuntu.com/job/mir-ci/1880/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/2384
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/2447
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2439
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2439
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2439
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2413
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=yakkety/2413/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2413
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/2413/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2413
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=yakkety/2413/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/2413
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/2413/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2413
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/2413/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2413
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/2413/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1880/rebuild

review: Approve (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote :

This looks sensible.

Do we have any idea about the underlying failure, though? There should probably be a bug about it.

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

On 05/10/16 02:34, Chris Halse Rogers wrote:
> Do we have any idea about the underlying failure, though? There should probably be a bug about it.

My current (unproven) thinking is that the underlying failure is a race
between the server becoming aware of the client crashing and the driver
becoming aware of the client crashing.

--
Alan Griffiths +44 (0)798 9938 758
Octopull Ltd http://www.octopull.co.uk/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/renderers/gl/renderer.cpp'
--- src/renderers/gl/renderer.cpp 2016-09-19 04:16:15 +0000
+++ src/renderers/gl/renderer.cpp 2016-10-03 16:14:19 +0000
@@ -1,4 +1,4 @@
1/* Copyright © 2013 Canonical Ltd.1/* Copyright © 2013, 2016 Canonical Ltd.
2 *2 *
3 * This program is free software: you can redistribute it and/or modify it3 * This program is free software: you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License version 3,4 * under the terms of the GNU General Public License version 3,
@@ -28,6 +28,7 @@
28#include "mir/gl/texture_cache.h"28#include "mir/gl/texture_cache.h"
29#include "mir/gl/texture.h"29#include "mir/gl/texture.h"
30#include "mir/log.h"30#include "mir/log.h"
31#include "mir/report_exception.h"
3132
32#define GLM_FORCE_RADIANS33#define GLM_FORCE_RADIANS
33#include <glm/gtc/matrix_transform.hpp>34#include <glm/gtc/matrix_transform.hpp>
@@ -287,70 +288,78 @@
287 primitives.clear();288 primitives.clear();
288 tessellate(primitives, renderable);289 tessellate(primitives, renderable);
289290
290 auto surface_tex = texture_cache->load(renderable);291 // if we fail to load the texture, we need to carry on (part of lp:1629275)
291292 try
292 typedef struct // Represents parameters of glBlendFuncSeparate()293 {
293 {294 auto surface_tex = texture_cache->load(renderable);
294 GLenum src_rgb, dst_rgb, src_alpha, dst_alpha;295
295 } BlendSeparate;296 typedef struct // Represents parameters of glBlendFuncSeparate()
296297 {
297 BlendSeparate client_blend;298 GLenum src_rgb, dst_rgb, src_alpha, dst_alpha;
298299 } BlendSeparate;
299 // These renderable method names could be better (see LP: #1236224)300
300 if (renderable.shaped()) // Client is RGBA:301 BlendSeparate client_blend;
301 {302
302 client_blend = {GL_ONE, GL_ONE_MINUS_SRC_ALPHA,303 // These renderable method names could be better (see LP: #1236224)
303 GL_ONE, GL_ONE_MINUS_SRC_ALPHA};304 if (renderable.shaped()) // Client is RGBA:
304 }305 {
305 else if (renderable.alpha() == 1.0f) // RGBX and no window translucency:306 client_blend = {GL_ONE, GL_ONE_MINUS_SRC_ALPHA,
306 {307 GL_ONE, GL_ONE_MINUS_SRC_ALPHA};
307 client_blend = {GL_ONE, GL_ZERO,308 }
308 GL_ZERO, GL_ONE}; // Avoid using src_alpha!309 else if (renderable.alpha() == 1.0f) // RGBX and no window translucency:
309 }310 {
310 else311 client_blend = {GL_ONE, GL_ZERO,
311 { // Client is RGBX but we also have window translucency.312 GL_ZERO, GL_ONE}; // Avoid using src_alpha!
312 // The texture alpha channel is possibly uninitialized so we must be
313 // careful and avoid using SRC_ALPHA (LP: #1423462).
314 client_blend = {GL_ONE, GL_ONE_MINUS_CONSTANT_ALPHA,
315 GL_ZERO, GL_ONE};
316 glBlendColor(0.0f, 0.0f, 0.0f, renderable.alpha());
317 }
318
319 for (auto const& p : primitives)
320 {
321 BlendSeparate blend;
322
323 if (p.tex_id == 0) // The client surface texture
324 {
325 blend = client_blend;
326 surface_tex->bind();
327 }
328 else // Some other texture from the shell (e.g. decorations) which
329 { // is always RGBA (valid SRC_ALPHA).
330 blend = {GL_ONE, GL_ONE_MINUS_SRC_ALPHA,
331 GL_ONE, GL_ONE_MINUS_SRC_ALPHA};
332 glBindTexture(GL_TEXTURE_2D, p.tex_id);
333 }
334
335 glVertexAttribPointer(prog.position_attr, 3, GL_FLOAT,
336 GL_FALSE, sizeof(mgl::Vertex),
337 &p.vertices[0].position);
338 glVertexAttribPointer(prog.texcoord_attr, 2, GL_FLOAT,
339 GL_FALSE, sizeof(mgl::Vertex),
340 &p.vertices[0].texcoord);
341
342 if (blend.dst_rgb == GL_ZERO)
343 {
344 glDisable(GL_BLEND);
345 }313 }
346 else314 else
315 { // Client is RGBX but we also have window translucency.
316 // The texture alpha channel is possibly uninitialized so we must be
317 // careful and avoid using SRC_ALPHA (LP: #1423462).
318 client_blend = {GL_ONE, GL_ONE_MINUS_CONSTANT_ALPHA,
319 GL_ZERO, GL_ONE};
320 glBlendColor(0.0f, 0.0f, 0.0f, renderable.alpha());
321 }
322
323 for (auto const& p : primitives)
347 {324 {
348 glEnable(GL_BLEND);325 BlendSeparate blend;
349 glBlendFuncSeparate(blend.src_rgb, blend.dst_rgb,326
350 blend.src_alpha, blend.dst_alpha);327 if (p.tex_id == 0) // The client surface texture
328 {
329 blend = client_blend;
330 surface_tex->bind();
331 }
332 else // Some other texture from the shell (e.g. decorations) which
333 { // is always RGBA (valid SRC_ALPHA).
334 blend = {GL_ONE, GL_ONE_MINUS_SRC_ALPHA,
335 GL_ONE, GL_ONE_MINUS_SRC_ALPHA};
336 glBindTexture(GL_TEXTURE_2D, p.tex_id);
337 }
338
339 glVertexAttribPointer(prog.position_attr, 3, GL_FLOAT,
340 GL_FALSE, sizeof(mgl::Vertex),
341 &p.vertices[0].position);
342 glVertexAttribPointer(prog.texcoord_attr, 2, GL_FLOAT,
343 GL_FALSE, sizeof(mgl::Vertex),
344 &p.vertices[0].texcoord);
345
346 if (blend.dst_rgb == GL_ZERO)
347 {
348 glDisable(GL_BLEND);
349 }
350 else
351 {
352 glEnable(GL_BLEND);
353 glBlendFuncSeparate(blend.src_rgb, blend.dst_rgb,
354 blend.src_alpha, blend.dst_alpha);
355 }
356
357 glDrawArrays(p.type, 0, p.nvertices);
351 }358 }
352359 }
353 glDrawArrays(p.type, 0, p.nvertices);360 catch (std::exception const& ex)
361 {
362 report_exception();
354 }363 }
355364
356 glDisableVertexAttribArray(prog.texcoord_attr);365 glDisableVertexAttribArray(prog.texcoord_attr);

Subscribers

People subscribed via source and target branches