Mir

Merge lp:~kdub/mir/anw-logger into lp:mir

Proposed by Kevin DuBois on 2016-07-06
Status: Merged
Merged at revision: 3589
Proposed branch: lp:~kdub/mir/anw-logger
Merge into: lp:mir
Diff against target: 1511 lines (+574/-110)
17 files modified
src/platforms/android/client/android_client_platform.cpp (+14/-35)
src/platforms/android/common/CMakeLists.txt (+1/-0)
src/platforms/android/common/mir_native_window.cpp (+55/-6)
src/platforms/android/common/native_window_report.cpp (+170/-0)
src/platforms/android/include/mir_native_window.h (+7/-1)
src/platforms/android/include/native_window_report.h (+81/-0)
src/platforms/android/server/display.cpp (+7/-1)
src/platforms/android/server/display.h (+3/-0)
src/platforms/android/server/platform.cpp (+55/-34)
src/platforms/android/server/platform.h (+3/-0)
tests/unit-tests/client/android/test_android_native_window.cpp (+27/-28)
tests/unit-tests/graphics/android/CMakeLists.txt (+1/-0)
tests/unit-tests/graphics/android/test_anw_logger.cpp (+107/-0)
tests/unit-tests/graphics/android/test_display.cpp (+31/-0)
tests/unit-tests/graphics/android/test_display_buffer.cpp (+3/-1)
tests/unit-tests/graphics/android/test_display_hotplug.cpp (+2/-0)
tests/unit-tests/graphics/android/test_platform.cpp (+7/-4)
To merge this branch: bzr merge lp:~kdub/mir/anw-logger
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Needs Fixing on 2016-07-12
Andreas Pokorny (community) 2016-07-06 Approve on 2016-07-12
Alan Griffiths Approve on 2016-07-12
Chris Halse Rogers Approve on 2016-07-12
Review via email: mp+299343@code.launchpad.net

Commit Message

android: add loggers for ANativeWindow events. The logging can be turned on for the server context with "--report-fb-native-window log" (or MIR_SERVER_REPORT_FB_NATIVE_WINDOW=log of course). The logging can be turned on for the client context with MIR_CLIENT_ANDROID_WINDOW_REPORT=log

Description of the Change

android: add loggers for ANativeWindow events. The logging can be turned on for the server context with "--report-fb-native-window log" (or MIR_SERVER_REPORT_FB_NATIVE_WINDOW=log of course). The logging can be turned on for the client context with MIR_CLIENT_ANDROID_WINDOW_REPORT=log

logging this information is helpful in diagnosing android driver problems.
sample log:
[2016-07-11 05:48:52.454842] <DEBUG> AndroidNativeWindow: addr (0xb5e02844): query: NATIVE_WINDOW_DEFAULT_HEIGHT: result: 0x200
[2016-07-11 05:48:52.455548] <DEBUG> AndroidNativeWindow: addr (0xb5e02844): perform: NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS:
[2016-07-11 05:48:52.456375] <DEBUG> AndroidNativeWindow: addr (0xb5e02844): dequeueBuffer: 0xb5e05b40, fence: none
[2016-07-11 05:48:52.457877] <DEBUG> AndroidNativeWindow: addr (0xb5e02844): perform: NATIVE_WINDOW_SET_BUFFERS_TRANSFORM:
[2016-07-11 05:48:52.459220] <DEBUG> AndroidNativeWindow: addr (0xb5e02844): queueBuffer: 0xb5e05b40, fence: 32
[2016-07-11 05:48:52.469637] <DEBUG> AndroidNativeWindow: addr (0xb5e02844): query: NATIVE_WINDOW_TRANSFORM_HINT: result: 0x0
^CSignal 2 received. Good night.

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

FAILED: Continuous integration, rev:3585
https://mir-jenkins.ubuntu.com/job/mir-ci/1235/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1437/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1489
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1480
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1480
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1451
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1451/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1451
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1451/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1451/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1451/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/1451
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1451/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1451
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1451/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Andreas Pokorny (andreas-pokorny) wrote :

Why logger and not report? It kind of stands out next to HwcReport and DisplayReport.

Looks fine.

review: Needs Information
Kevin DuBois (kdub) wrote :

ci failure was somewhat strange, looks unrelated and device-setup specific:
19:59:49 Failed to set up camera device

Kevin DuBois (kdub) wrote :

> Why logger and not report? It kind of stands out next to HwcReport and
> DisplayReport.
>
> Looks fine.

the option is called report to line up with the hwc-report, is that what is being referred to?

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3585
https://mir-jenkins.ubuntu.com/job/mir-ci/1246/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1454/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1506
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1497
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1497
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1468
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1468/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1468
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1468/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1468/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1468/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/1468
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1468/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1468
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1468/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Kevin DuBois (kdub) wrote :

^failure needs fixing

Kevin DuBois (kdub) wrote :

> ^failure needs fixing
poking around a bit more, not so sure if this is pre-existing smoke test problem or not. Will keep investigating

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3586
https://mir-jenkins.ubuntu.com/job/mir-ci/1248/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1456
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1508
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1499
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1499
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1470
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1470/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1470
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1470/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/1470
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1470/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/1470
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1470/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1470
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1470/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Kevin DuBois (kdub) wrote :

previous CI failure was similar to LP: #1597768, could not reproduce on my device.

Andreas Pokorny (andreas-pokorny) wrote :

> > Why logger and not report? It kind of stands out next to HwcReport and
> > DisplayReport.
> >
> > Looks fine.
>
> the option is called report to line up with the hwc-report, is that what is
> being referred to?

I was referring to the class names.. ConsoleNativeWindowLogger, NullNativeWindowLogger

Alan Griffiths (alan-griffiths) wrote :

Can we justify this design?

+ std::cout << win << type << ": " << buf << ", fence: ";

Should we be using std::cout directly?

We have a logging facility that provides timestamps and log levels (and can be redirected to other outputs).

In the server where, AFAICS, this code could be running we have a "reports" infrastructure that can provide logs (using the logging facility) or other analysis of system behavior. That could also be an alternative design.

~~~~

- return self->queueBuffer(buffer, -1);
+ return self->queueBufferDeprecated(buffer);

How is this related to adding a logger?

review: Needs Information
Kevin DuBois (kdub) wrote :

IMO, writing to stdout is sufficient for the intented purposes. I don't mind reworking to use the common/ logging facilities though.

Its useful to know whether a device is using a deprecated function or not, and splitting the queueBuffer entry points to the MirNativeWindow lets us distinguish what hook the driver is calling.

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3587
https://mir-jenkins.ubuntu.com/job/mir-ci/1259/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1472/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1524
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1515
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1515
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1515
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1487/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1487/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1487
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1487/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/1487
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1487/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1487/console

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

review: Needs Fixing (continuous-integration)
Kevin DuBois (kdub) wrote :

^ #1573293, retriggering

Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:3587
https://mir-jenkins.ubuntu.com/job/mir-ci/1261/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1474/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1526
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1517
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1517
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1517
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1489/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1489/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1489
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1489/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/1489
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1489/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1489/console

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

review: Needs Fixing (continuous-integration)
Chris Halse Rogers (raof) wrote :

Looks good to me.

review: Approve
Alan Griffiths (alan-griffiths) wrote :

ok

review: Approve
Andreas Pokorny (andreas-pokorny) wrote :

oh sure

review: Approve
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/394/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1483/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/422/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1535
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1526
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1526
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/1526
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1498/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/1498/console
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1498/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1498/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/1498
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1498/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/1498/console

review: Needs Fixing (continuous-integration)
Kevin DuBois (kdub) wrote :

^LP: #1602199, seems to be an ongoing CI storm, will retrigger once problem is resolved.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/platforms/android/client/android_client_platform.cpp'
2--- src/platforms/android/client/android_client_platform.cpp 2016-05-03 06:55:25 +0000
3+++ src/platforms/android/client/android_client_platform.cpp 2016-07-11 12:50:47 +0000
4@@ -23,6 +23,8 @@
5 #include "gralloc_registrar.h"
6 #include "android_client_buffer_factory.h"
7 #include "egl_native_surface_interpreter.h"
8+#include "native_window_report.h"
9+#include "mir/logging/dumb_console_logger.h"
10
11 #include "mir/weak_egl.h"
12 #include <EGL/egl.h>
13@@ -33,18 +35,6 @@
14 namespace mcla=mir::client::android;
15 namespace mga=mir::graphics::android;
16
17-namespace
18-{
19-
20-struct EmptyDeleter
21-{
22- void operator()(void*)
23- {
24- }
25-};
26-
27-}
28-
29 mcla::AndroidClientPlatform::AndroidClientPlatform(
30 ClientContext* const context)
31 : context{context}
32@@ -62,35 +52,24 @@
33
34 gralloc_module_t* gr_dev = (gralloc_module_t*) hw_module;
35 /* we use an empty deleter because hw_get_module does not give us the ownership of the ptr */
36- EmptyDeleter empty_del;
37- auto gralloc_dev = std::shared_ptr<gralloc_module_t>(gr_dev, empty_del);
38+ auto gralloc_dev = std::shared_ptr<gralloc_module_t>(gr_dev, [](auto){});
39 auto registrar = std::make_shared<mcla::GrallocRegistrar>(gralloc_dev);
40 return std::make_shared<mcla::AndroidClientBufferFactory>(registrar);
41 }
42
43-namespace
44-{
45-struct MirNativeWindowDeleter
46-{
47- MirNativeWindowDeleter(mga::MirNativeWindow* window)
48- : window(window) {}
49-
50- void operator()(void*)
51- {
52- delete window;
53- }
54-
55-private:
56- mga::MirNativeWindow *window;
57-};
58-}
59-
60 std::shared_ptr<void> mcla::AndroidClientPlatform::create_egl_native_window(EGLNativeSurface *surface)
61 {
62- auto anativewindow_interpreter = std::make_shared<mcla::EGLNativeSurfaceInterpreter>(*surface);
63- auto mir_native_window = new mga::MirNativeWindow(anativewindow_interpreter);
64- MirNativeWindowDeleter deleter = MirNativeWindowDeleter(mir_native_window);
65- return std::shared_ptr<void>(mir_native_window, deleter);
66+ auto log = getenv("MIR_CLIENT_ANDROID_WINDOW_REPORT");
67+ std::shared_ptr<mga::NativeWindowReport> report;
68+ char const* on_val = "log";
69+ if (log && !strncmp(log, on_val, strlen(on_val)))
70+ report = std::make_shared<mga::ConsoleNativeWindowReport>(
71+ std::make_shared<mir::logging::DumbConsoleLogger>());
72+ else
73+ report = std::make_shared<mga::NullNativeWindowReport>();
74+
75+ return std::make_shared<mga::MirNativeWindow>(
76+ std::make_shared<mcla::EGLNativeSurfaceInterpreter>(*surface), report);
77 }
78
79 std::shared_ptr<EGLNativeDisplayType>
80
81=== modified file 'src/platforms/android/common/CMakeLists.txt'
82--- src/platforms/android/common/CMakeLists.txt 2016-05-03 06:55:25 +0000
83+++ src/platforms/android/common/CMakeLists.txt 2016-07-11 12:50:47 +0000
84@@ -14,4 +14,5 @@
85 syncfence.cpp
86 egl_sync_fence.cpp
87 egl_sync_extensions.cpp
88+ native_window_report.cpp
89 )
90
91=== modified file 'src/platforms/android/common/mir_native_window.cpp'
92--- src/platforms/android/common/mir_native_window.cpp 2016-01-29 08:18:22 +0000
93+++ src/platforms/android/common/mir_native_window.cpp 2016-07-11 12:50:47 +0000
94@@ -19,6 +19,7 @@
95 #include "mir_native_window.h"
96 #include "android_driver_interpreter.h"
97 #include "sync_fence.h"
98+#include "native_window_report.h"
99
100 #define MIR_LOG_COMPONENT "AndroidWindow"
101 #include "mir/uncaught.h"
102@@ -88,7 +89,7 @@
103 struct ANativeWindowBuffer* buffer)
104 {
105 auto self = static_cast<mga::MirNativeWindow*>(window);
106- return self->queueBuffer(buffer, -1);
107+ return self->queueBufferDeprecated(buffer);
108 }
109
110 int queueBuffer_static(struct ANativeWindow* window,
111@@ -115,7 +116,8 @@
112 int cancelBuffer_deprecated_static(struct ANativeWindow* window,
113 struct ANativeWindowBuffer* buffer)
114 {
115- return cancelBuffer_static(window, buffer, -1);
116+ auto self = static_cast<mga::MirNativeWindow*>(window);
117+ return self->cancelBufferDeprecated(buffer);
118 }
119
120 int cancelBuffer_static(struct ANativeWindow* window,
121@@ -126,8 +128,12 @@
122 }
123 }
124
125-mga::MirNativeWindow::MirNativeWindow(std::shared_ptr<AndroidDriverInterpreter> const& interpreter)
126- : driver_interpreter(interpreter), sync_ops(std::make_shared<mga::RealSyncFileOps>())
127+mga::MirNativeWindow::MirNativeWindow(
128+ std::shared_ptr<AndroidDriverInterpreter> const& interpreter,
129+ std::shared_ptr<NativeWindowReport> const& report) :
130+ driver_interpreter(interpreter),
131+ report(report),
132+ sync_ops(std::make_shared<mga::RealSyncFileOps>())
133 {
134 ANativeWindow::query = &query_static;
135 ANativeWindow::perform = &perform_static;
136@@ -177,6 +183,8 @@
137 *fence_fd = buffer->copy_fence();
138 *buffer_to_driver = buffer->anwb();
139 }
140+
141+ report->buffer_event(mga::BufferEvent::Dequeue, this, *buffer_to_driver, *fence_fd);
142 return 0;
143 }
144 catch (std::exception const& e)
145@@ -199,6 +207,7 @@
146 *buffer_to_driver = buffer->anwb();
147 buffer->ensure_available_for(mga::BufferAccess::write);
148 }
149+ report->buffer_event(mga::BufferEvent::Dequeue, this, *buffer_to_driver);
150 return 0;
151 }
152 catch (std::exception const& e)
153@@ -210,6 +219,7 @@
154 int mga::MirNativeWindow::queueBuffer(struct ANativeWindowBuffer* buffer, int fence)
155 try
156 {
157+ report->buffer_event(mga::BufferEvent::Queue, this, buffer, fence);
158 driver_interpreter->driver_returns_buffer(buffer, fence);
159 return 0;
160 }
161@@ -219,9 +229,23 @@
162 return -1;
163 }
164
165+int mga::MirNativeWindow::queueBufferDeprecated(struct ANativeWindowBuffer* buffer)
166+try
167+{
168+ report->buffer_event(mga::BufferEvent::Queue, this, buffer);
169+ driver_interpreter->driver_returns_buffer(buffer, -1);
170+ return 0;
171+}
172+catch (std::exception const& e)
173+{
174+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
175+ return -1;
176+}
177+
178 int mga::MirNativeWindow::cancelBuffer(struct ANativeWindowBuffer* buffer, int fence)
179 try
180 {
181+ report->buffer_event(mga::BufferEvent::Cancel, this, buffer, fence);
182 mga::SyncFence sync_fence(sync_ops, mir::Fd(fence));
183 sync_fence.wait();
184
185@@ -234,10 +258,24 @@
186 return -1;
187 }
188
189+int mga::MirNativeWindow::cancelBufferDeprecated(struct ANativeWindowBuffer* buffer)
190+try
191+{
192+ report->buffer_event(mga::BufferEvent::Cancel, this, buffer);
193+ cancelled_buffers.push_back(buffer);
194+ return 0;
195+}
196+catch (std::exception const& e)
197+{
198+ MIR_LOG_DRIVER_BOUNDARY_EXCEPTION(e);
199+ return -1;
200+}
201+
202 int mga::MirNativeWindow::query(int key, int* value) const
203 try
204 {
205 *value = driver_interpreter->driver_requests_info(key);
206+ report->query_event(this, key, *value);
207 return 0;
208 }
209 catch (std::exception const& e)
210@@ -256,13 +294,24 @@
211 switch(key)
212 {
213 case NATIVE_WINDOW_SET_BUFFERS_FORMAT:
214- driver_interpreter->dispatch_driver_request_format(va_arg(args, int));
215+ {
216+ auto format = va_arg(args, int);
217+ driver_interpreter->dispatch_driver_request_format(format);
218+ report->perform_event(this, key, {format});
219 break;
220+ }
221 case NATIVE_WINDOW_SET_BUFFER_COUNT:
222- driver_interpreter->dispatch_driver_request_buffer_count(va_arg(args, int));
223+ {
224+ auto count = va_arg(args, int);
225+ driver_interpreter->dispatch_driver_request_buffer_count(count);
226+ report->perform_event(this, key, {count});
227 break;
228+ }
229 default:
230+ {
231+ report->perform_event(this, key, {});
232 break;
233+ }
234 }
235
236 va_end(args);
237
238=== added file 'src/platforms/android/common/native_window_report.cpp'
239--- src/platforms/android/common/native_window_report.cpp 1970-01-01 00:00:00 +0000
240+++ src/platforms/android/common/native_window_report.cpp 2016-07-11 12:50:47 +0000
241@@ -0,0 +1,170 @@
242+/*
243+ * Copyright © 2016 Canonical Ltd.
244+ *
245+ * This program is free software: you can redistribute it and/or modify it
246+ * under the terms of the GNU Lesser General Public License version 3,
247+ * as published by the Free Software Foundation.
248+ *
249+ * This program is distributed in the hope that it will be useful,
250+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
251+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
252+ * GNU Lesser General Public License for more details.
253+ *
254+ * You should have received a copy of the GNU Lesser General Public License
255+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
256+ *
257+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
258+ */
259+
260+#include "mir/logging/logger.h"
261+#include "native_window_report.h"
262+#include <sstream>
263+
264+#define CASE_KEY(var) case var: return out << #var;
265+namespace mga = mir::graphics::android;
266+
267+namespace
268+{
269+
270+struct NativePerformKey
271+{
272+ int key;
273+};
274+
275+struct NativeQueryKey
276+{
277+ int key;
278+};
279+
280+std::ostream& operator<<(std::ostream& out, NativeQueryKey key)
281+{
282+ switch (key.key)
283+ {
284+ CASE_KEY(NATIVE_WINDOW_WIDTH)
285+ CASE_KEY(NATIVE_WINDOW_HEIGHT)
286+ CASE_KEY(NATIVE_WINDOW_FORMAT)
287+ CASE_KEY(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS)
288+ CASE_KEY(NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER)
289+ CASE_KEY(NATIVE_WINDOW_CONCRETE_TYPE)
290+ CASE_KEY(NATIVE_WINDOW_DEFAULT_WIDTH)
291+ CASE_KEY(NATIVE_WINDOW_DEFAULT_HEIGHT)
292+ CASE_KEY(NATIVE_WINDOW_TRANSFORM_HINT)
293+ CASE_KEY(NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND)
294+ CASE_KEY(NATIVE_WINDOW_CONSUMER_USAGE_BITS)
295+ CASE_KEY(NATIVE_WINDOW_STICKY_TRANSFORM)
296+ CASE_KEY(NATIVE_WINDOW_DEFAULT_DATASPACE)
297+ CASE_KEY(NATIVE_WINDOW_BUFFER_AGE)
298+ default: return out << "unknown query key: " << key.key;
299+ }
300+}
301+
302+std::ostream& operator<<(std::ostream& out, NativePerformKey key)
303+{
304+ switch (key.key)
305+ {
306+ CASE_KEY(NATIVE_WINDOW_SET_USAGE)
307+ CASE_KEY(NATIVE_WINDOW_CONNECT)
308+ CASE_KEY(NATIVE_WINDOW_DISCONNECT)
309+ CASE_KEY(NATIVE_WINDOW_SET_CROP)
310+ CASE_KEY(NATIVE_WINDOW_SET_BUFFER_COUNT)
311+ CASE_KEY(NATIVE_WINDOW_SET_BUFFERS_GEOMETRY)
312+ CASE_KEY(NATIVE_WINDOW_SET_BUFFERS_TRANSFORM)
313+ CASE_KEY(NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP)
314+ CASE_KEY(NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS)
315+ CASE_KEY(NATIVE_WINDOW_SET_BUFFERS_FORMAT)
316+ CASE_KEY(NATIVE_WINDOW_SET_SCALING_MODE)
317+ CASE_KEY(NATIVE_WINDOW_LOCK)
318+ CASE_KEY(NATIVE_WINDOW_UNLOCK_AND_POST)
319+ CASE_KEY(NATIVE_WINDOW_API_CONNECT)
320+ CASE_KEY(NATIVE_WINDOW_API_DISCONNECT)
321+ CASE_KEY(NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS)
322+ CASE_KEY(NATIVE_WINDOW_SET_POST_TRANSFORM_CROP)
323+ CASE_KEY(NATIVE_WINDOW_SET_BUFFERS_STICKY_TRANSFORM)
324+ CASE_KEY(NATIVE_WINDOW_SET_SIDEBAND_STREAM)
325+ CASE_KEY(NATIVE_WINDOW_SET_BUFFERS_DATASPACE)
326+ CASE_KEY(NATIVE_WINDOW_SET_SURFACE_DAMAGE)
327+ default: return out << "unknown perform key: " << key.key;
328+ }
329+}
330+
331+std::ostream& operator<<(std::ostream& out, mga::BufferEvent type)
332+{
333+ switch (type)
334+ {
335+ case mga::BufferEvent::Queue: return out << "queueBuffer";
336+ case mga::BufferEvent::Dequeue: return out << "dequeueBuffer";
337+ case mga::BufferEvent::Cancel: return out << "cancelBuffer";
338+ default: return out;
339+ }
340+}
341+
342+std::ostream& operator<<(std::ostream& out, ANativeWindow const* window)
343+{
344+ return out << "addr (" << static_cast<void const*>(window) << "): ";
345+}
346+}
347+
348+mga::ConsoleNativeWindowReport::ConsoleNativeWindowReport(
349+ std::shared_ptr<mir::logging::Logger> const& logger) :
350+ logger(logger)
351+{
352+}
353+
354+void mga::ConsoleNativeWindowReport::buffer_event(
355+ BufferEvent type, ANativeWindow const* win, ANativeWindowBuffer* buf, int fence) const
356+{
357+ std::stringstream str;
358+
359+ str << win << type << ": " << buf << ", fence: ";
360+ if ( fence > 0 )
361+ str << fence;
362+ else
363+ str << "none";
364+
365+ logger->log(mir::logging::Severity::debug, str.str(), component_name);
366+}
367+
368+void mga::ConsoleNativeWindowReport::buffer_event(
369+ BufferEvent type, ANativeWindow const* win, ANativeWindowBuffer* buf) const
370+{
371+ std::stringstream str;
372+ str << win << type << "_deprecated: " << buf;
373+ logger->log(mir::logging::Severity::debug, str.str(), component_name);
374+}
375+
376+void mga::ConsoleNativeWindowReport::query_event(ANativeWindow const* win, int type, int result) const
377+{
378+ std::stringstream str;
379+ str << std::hex << win << "query: " << NativeQueryKey{type} << ": result: 0x" << result;
380+ logger->log(mir::logging::Severity::debug, str.str(), component_name);
381+}
382+
383+void mga::ConsoleNativeWindowReport::perform_event(
384+ ANativeWindow const* win, int type, std::vector<int> const& args) const
385+{
386+ std::stringstream str;
387+ str << std::hex << win << "perform: " << NativePerformKey{type} << ": ";
388+ for (auto i = 0u; i < args.size(); i++)
389+ {
390+ if (i != 0u)
391+ str << ", ";
392+ str << "0x" << args[i];
393+ }
394+ logger->log(mir::logging::Severity::debug, str.str(), component_name);
395+}
396+
397+void mga::NullNativeWindowReport::buffer_event(mga::BufferEvent, ANativeWindow const*, ANativeWindowBuffer*, int) const
398+{
399+}
400+
401+void mga::NullNativeWindowReport::buffer_event(mga::BufferEvent, ANativeWindow const*, ANativeWindowBuffer*) const
402+{
403+}
404+
405+void mga::NullNativeWindowReport::query_event(ANativeWindow const*, int, int) const
406+{
407+}
408+
409+void mga::NullNativeWindowReport::perform_event(ANativeWindow const*, int, std::vector<int> const&) const
410+{
411+}
412
413=== modified file 'src/platforms/android/include/mir_native_window.h'
414--- src/platforms/android/include/mir_native_window.h 2015-02-22 07:46:25 +0000
415+++ src/platforms/android/include/mir_native_window.h 2016-07-11 12:50:47 +0000
416@@ -32,21 +32,27 @@
417 {
418 class AndroidDriverInterpreter;
419 class SyncFileOps;
420+class NativeWindowReport;
421
422 class MirNativeWindow : public ANativeWindow
423 {
424 public:
425- explicit MirNativeWindow(std::shared_ptr<AndroidDriverInterpreter> const& interpreter);
426+ explicit MirNativeWindow(
427+ std::shared_ptr<AndroidDriverInterpreter> const& interpreter,
428+ std::shared_ptr<NativeWindowReport> const& report);
429
430 int query(int key, int* value) const;
431 int perform(int key, va_list args );
432 int dequeueBuffer(struct ANativeWindowBuffer** buffer, int* fence);
433 int dequeueBufferAndWait(struct ANativeWindowBuffer** buffer);
434 int queueBuffer(struct ANativeWindowBuffer* buffer, int fence);
435+ int queueBufferDeprecated(struct ANativeWindowBuffer* buffer);
436 int cancelBuffer(struct ANativeWindowBuffer* buffer, int fence);
437+ int cancelBufferDeprecated(struct ANativeWindowBuffer* buffer);
438 int setSwapInterval(int interval);
439 private:
440 std::shared_ptr<AndroidDriverInterpreter> const driver_interpreter;
441+ std::shared_ptr<NativeWindowReport> const report;
442 std::shared_ptr<SyncFileOps> const sync_ops;
443 std::vector<struct ANativeWindowBuffer*> cancelled_buffers;
444 };
445
446=== added file 'src/platforms/android/include/native_window_report.h'
447--- src/platforms/android/include/native_window_report.h 1970-01-01 00:00:00 +0000
448+++ src/platforms/android/include/native_window_report.h 2016-07-11 12:50:47 +0000
449@@ -0,0 +1,81 @@
450+/*
451+ * Copyright © 2016 Canonical Ltd.
452+ *
453+ * This program is free software: you can redistribute it and/or modify it
454+ * under the terms of the GNU Lesser General Public License version 3,
455+ * as published by the Free Software Foundation.
456+ *
457+ * This program is distributed in the hope that it will be useful,
458+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
459+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
460+ * GNU Lesser General Public License for more details.
461+ *
462+ * You should have received a copy of the GNU Lesser General Public License
463+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
464+ *
465+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
466+ */
467+
468+#ifndef MIR_GRAPHICS_ANDROID_NATIVE_WINDOW_REPORT_H_
469+#define MIR_GRAPHICS_ANDROID_NATIVE_WINDOW_REPORT_H_
470+#include <system/window.h>
471+#include <vector>
472+#include <memory>
473+
474+namespace mir
475+{
476+namespace logging
477+{
478+class Logger;
479+}
480+namespace graphics
481+{
482+namespace android
483+{
484+enum class BufferEvent
485+{
486+ Queue,
487+ Dequeue,
488+ Cancel
489+};
490+class NativeWindowReport
491+{
492+public:
493+ NativeWindowReport() = default;
494+ virtual ~NativeWindowReport() = default;
495+
496+ virtual void buffer_event(BufferEvent type, ANativeWindow const* win, ANativeWindowBuffer* buf, int fence) const = 0;
497+ virtual void buffer_event(BufferEvent type, ANativeWindow const* win, ANativeWindowBuffer* buf) const = 0;
498+ virtual void query_event(ANativeWindow const* win, int type, int result) const = 0;
499+ virtual void perform_event(ANativeWindow const* win, int type, std::vector<int> const& args) const = 0;
500+
501+private:
502+ NativeWindowReport(NativeWindowReport const&) = delete;
503+ NativeWindowReport& operator=(NativeWindowReport const&) = delete;
504+};
505+
506+class NullNativeWindowReport : public NativeWindowReport
507+{
508+ void buffer_event(BufferEvent type, ANativeWindow const* win, ANativeWindowBuffer* buf, int fence) const override;
509+ void buffer_event(BufferEvent type, ANativeWindow const* win, ANativeWindowBuffer* buf) const override;
510+ void query_event(ANativeWindow const* win, int type, int result) const override;
511+ void perform_event(ANativeWindow const* win, int type, std::vector<int> const& args) const override;
512+};
513+
514+class ConsoleNativeWindowReport : public NativeWindowReport
515+{
516+public:
517+ ConsoleNativeWindowReport(std::shared_ptr<logging::Logger> const&);
518+ void buffer_event(BufferEvent type, ANativeWindow const* win, ANativeWindowBuffer* buf, int fence) const override;
519+ void buffer_event(BufferEvent type, ANativeWindow const* win, ANativeWindowBuffer* buf) const override;
520+ void query_event(ANativeWindow const* win, int type, int result) const override;
521+ void perform_event(ANativeWindow const* win, int type, std::vector<int> const& args) const override;
522+private:
523+ std::shared_ptr<logging::Logger> const logger;
524+ std::string const component_name = "AndroidNativeWindow";
525+};
526+
527+}
528+}
529+}
530+#endif /* MIR_GRAPHICS_ANDROID_NATIVE_WINDOW_REPORT_H_ */
531
532=== modified file 'src/platforms/android/server/display.cpp'
533--- src/platforms/android/server/display.cpp 2016-06-28 18:35:12 +0000
534+++ src/platforms/android/server/display.cpp 2016-07-11 12:50:47 +0000
535@@ -117,13 +117,14 @@
536 std::shared_ptr<mgl::ProgramFactory> const& gl_program_factory,
537 mga::PbufferGLContext const& gl_context,
538 geom::Displacement displacement,
539+ std::shared_ptr<mga::NativeWindowReport> const& report,
540 mga::OverlayOptimization overlay_option)
541 {
542 std::shared_ptr<mga::FramebufferBundle> fbs{display_buffer_builder.create_framebuffers(config)};
543 auto cache = std::make_shared<mga::InterpreterCache>();
544 mga::DeviceQuirks quirks(mga::PropertiesOps{}, gl_context);
545 auto interpreter = std::make_shared<mga::ServerRenderWindow>(fbs, config.current_format, cache, quirks);
546- auto native_window = std::make_shared<mga::MirNativeWindow>(interpreter);
547+ auto native_window = std::make_shared<mga::MirNativeWindow>(interpreter, report);
548 return std::unique_ptr<mga::ConfigurableDisplayBuffer>(new mga::DisplayBuffer(
549 name,
550 display_buffer_builder.create_layer_list(),
551@@ -143,8 +144,10 @@
552 std::shared_ptr<mgl::ProgramFactory> const& gl_program_factory,
553 std::shared_ptr<GLConfig> const& gl_config,
554 std::shared_ptr<DisplayReport> const& display_report,
555+ std::shared_ptr<NativeWindowReport> const& native_window_report,
556 mga::OverlayOptimization overlay_option) :
557 display_report{display_report},
558+ native_window_report{native_window_report},
559 display_buffer_builder{display_buffer_builder},
560 hwc_config{display_buffer_builder->create_hwc_configuration()},
561 hotplug_subscription{hwc_config->subscribe_to_config_changes(
562@@ -169,6 +172,7 @@
563 gl_program_factory,
564 gl_context,
565 geom::Displacement{0,0},
566+ native_window_report,
567 overlay_option),
568 [this] { on_hotplug(); }), //Recover from exception by forcing a configuration change
569 overlay_option(overlay_option)
570@@ -187,6 +191,7 @@
571 gl_program_factory,
572 gl_context,
573 geom::Displacement{0,0},
574+ native_window_report,
575 overlay_option));
576 }
577
578@@ -254,6 +259,7 @@
579 gl_program_factory,
580 gl_context,
581 config.external().top_left - origin,
582+ native_window_report,
583 overlay_option));
584 if ((!config.external().connected) && displays.display_present(mga::DisplayName::external))
585 displays.remove(mga::DisplayName::external);
586
587=== modified file 'src/platforms/android/server/display.h'
588--- src/platforms/android/server/display.h 2016-02-01 22:53:06 +0000
589+++ src/platforms/android/server/display.h 2016-07-11 12:50:47 +0000
590@@ -46,6 +46,7 @@
591 class ConfigurableDisplayBuffer;
592 class DisplayChangePipe;
593 class DisplayDevice;
594+class NativeWindowReport;
595
596 class Display : public graphics::Display
597 {
598@@ -55,6 +56,7 @@
599 std::shared_ptr<gl::ProgramFactory> const& gl_program_factory,
600 std::shared_ptr<GLConfig> const& gl_config,
601 std::shared_ptr<DisplayReport> const& display_report,
602+ std::shared_ptr<NativeWindowReport> const& native_window_report,
603 OverlayOptimization overlay_option);
604 ~Display() noexcept;
605
606@@ -85,6 +87,7 @@
607
608 geometry::Point const origin{0,0};
609 std::shared_ptr<DisplayReport> const display_report;
610+ std::shared_ptr<NativeWindowReport> const native_window_report;
611 std::shared_ptr<DisplayComponentFactory> const display_buffer_builder;
612 std::mutex mutable configuration_mutex;
613 bool mutable configuration_dirty{false};
614
615=== modified file 'src/platforms/android/server/platform.cpp'
616--- src/platforms/android/server/platform.cpp 2016-05-03 06:55:25 +0000
617+++ src/platforms/android/server/platform.cpp 2016-07-11 12:50:47 +0000
618@@ -27,6 +27,7 @@
619 #include "ipc_operations.h"
620 #include "sync_fence.h"
621 #include "native_buffer.h"
622+#include "native_window_report.h"
623
624 #include "mir/graphics/platform_ipc_package.h"
625 #include "mir/graphics/buffer_ipc_message.h"
626@@ -38,6 +39,7 @@
627 #include "mir/abnormal_exit.h"
628 #include "mir/assert_module_entry_point.h"
629 #include "mir/libname.h"
630+#include "mir/logging/dumb_console_logger.h"
631
632 #include <boost/throw_exception.hpp>
633 #include <stdexcept>
634@@ -50,49 +52,60 @@
635
636 namespace
637 {
638-
639- char const* const hwc_log_opt = "hwc-report";
640- char const* const hwc_overlay_opt = "disable-overlays";
641-
642- std::shared_ptr<mga::HwcReport> make_hwc_report(mo::Option const& options)
643- {
644- if (!options.is_set(hwc_log_opt))
645- return std::make_shared<mga::NullHwcReport>();
646-
647- auto opt = options.get<std::string>(hwc_log_opt);
648- if (opt == mo::log_opt_value)
649- return std::make_shared<mga::HwcFormattedLogger>();
650- else if (opt == mo::off_opt_value)
651- return std::make_shared<mga::NullHwcReport>();
652- else
653- throw mir::AbnormalExit(
654- std::string("Invalid hwc-report option: " + opt + " (valid options are: \"" +
655- mo::off_opt_value + "\" and \"" + mo::log_opt_value + "\")"));
656- }
657-
658- mga::OverlayOptimization should_use_overlay_optimization(mo::Option const& options)
659- {
660- if (!options.is_set(hwc_overlay_opt))
661- return mga::OverlayOptimization::enabled;
662-
663- if (options.get<bool>(hwc_overlay_opt))
664- return mga::OverlayOptimization::disabled;
665- else
666- return mga::OverlayOptimization::enabled;
667- }
668-
669+char const* const hwc_log_opt = "hwc-report";
670+char const* const hwc_overlay_opt = "disable-overlays";
671+char const* const fb_native_window_report_opt = "report-fb-native-window";
672+
673+std::shared_ptr<mga::HwcReport> make_hwc_report(mo::Option const& options)
674+{
675+ if (!options.is_set(hwc_log_opt))
676+ return std::make_shared<mga::NullHwcReport>();
677+
678+ auto opt = options.get<std::string>(hwc_log_opt);
679+ if (opt == mo::log_opt_value)
680+ return std::make_shared<mga::HwcFormattedLogger>();
681+ else if (opt == mo::off_opt_value)
682+ return std::make_shared<mga::NullHwcReport>();
683+ else
684+ throw mir::AbnormalExit(
685+ std::string("Invalid hwc-report option: " + opt + " (valid options are: \"" +
686+ mo::off_opt_value + "\" and \"" + mo::log_opt_value + "\")"));
687+}
688+
689+std::shared_ptr<mga::NativeWindowReport> make_native_window_report(mo::Option const& options)
690+{
691+ if (options.is_set(fb_native_window_report_opt) &&
692+ options.get<std::string>(fb_native_window_report_opt) == mo::log_opt_value)
693+ return std::make_shared<mga::ConsoleNativeWindowReport>(
694+ std::make_shared<mir::logging::DumbConsoleLogger>());
695+ else
696+ return std::make_shared<mga::NullNativeWindowReport>();
697+}
698+
699+mga::OverlayOptimization should_use_overlay_optimization(mo::Option const& options)
700+{
701+ if (!options.is_set(hwc_overlay_opt))
702+ return mga::OverlayOptimization::enabled;
703+
704+ if (options.get<bool>(hwc_overlay_opt))
705+ return mga::OverlayOptimization::disabled;
706+ else
707+ return mga::OverlayOptimization::enabled;
708+}
709 }
710
711 mga::Platform::Platform(
712 std::shared_ptr<graphics::GraphicBufferAllocator> const& buffer_allocator,
713 std::shared_ptr<mga::DisplayComponentFactory> const& display_buffer_builder,
714 std::shared_ptr<mg::DisplayReport> const& display_report,
715+ std::shared_ptr<mga::NativeWindowReport> const& native_window_report,
716 mga::OverlayOptimization overlay_option,
717 std::shared_ptr<mga::DeviceQuirks> const& quirks) :
718 buffer_allocator(buffer_allocator),
719 display_buffer_builder(display_buffer_builder),
720 display_report(display_report),
721 quirks(quirks),
722+ native_window_report(native_window_report),
723 overlay_option(overlay_option)
724 {
725 }
726@@ -130,7 +143,7 @@
727 {
728 auto const program_factory = std::make_shared<mir::gl::DefaultProgramFactory>();
729 return mir::make_module_ptr<mga::Display>(
730- display_buffer_builder, program_factory, gl_config, display_report, overlay_option);
731+ display_buffer_builder, program_factory, gl_config, display_report, native_window_report, overlay_option);
732 }
733
734 mir::UniqueModulePtr<mg::PlatformIpcOperations> mga::Platform::make_ipc_operations() const
735@@ -160,7 +173,9 @@
736
737 return mir::make_module_ptr<mga::Platform>(
738 component_factory->the_buffer_allocator(),
739- component_factory, display_report, overlay_option, quirks);
740+ component_factory, display_report,
741+ make_native_window_report(*options),
742+ overlay_option, quirks);
743 }
744
745 mir::UniqueModulePtr<mg::Platform> create_guest_platform(
746@@ -180,7 +195,10 @@
747 //TODO: remove nullptr parameter once platform classes are sorted.
748 // mg::NativePlatform cannot create a display anyways, so it doesnt need a display builder
749 auto const buffer_allocator = std::make_shared<mga::GraphicBufferAllocator>(sync_factory, quirks);
750- return mir::make_module_ptr<mga::Platform>(buffer_allocator, nullptr, display_report, mga::OverlayOptimization::disabled, quirks);
751+ return mir::make_module_ptr<mga::Platform>(
752+ buffer_allocator, nullptr, display_report,
753+ std::make_shared<mga::NullNativeWindowReport>(),
754+ mga::OverlayOptimization::disabled, quirks);
755 }
756
757 void add_graphics_platform_options(
758@@ -191,6 +209,9 @@
759 (hwc_log_opt,
760 boost::program_options::value<std::string>()->default_value(std::string{mo::off_opt_value}),
761 "[platform-specific] How to handle the HWC logging report. [{log,off}]")
762+ (fb_native_window_report_opt,
763+ boost::program_options::value<std::string>()->default_value(std::string{mo::off_opt_value}),
764+ "[platform-specific] whether to log the EGLNativeWindowType backed by the framebuffer [{log,off}]")
765 (hwc_overlay_opt,
766 boost::program_options::value<bool>()->default_value(false),
767 "[platform-specific] Whether to disable overlay optimizations [{on,off}]");
768
769=== modified file 'src/platforms/android/server/platform.h'
770--- src/platforms/android/server/platform.h 2016-05-03 06:55:25 +0000
771+++ src/platforms/android/server/platform.h 2016-07-11 12:50:47 +0000
772@@ -34,6 +34,7 @@
773 class FramebufferFactory;
774 class DisplayComponentFactory;
775 class CommandStreamSyncFactory;
776+class NativeWindowReport;
777
778 class Platform : public graphics::Platform
779 {
780@@ -42,6 +43,7 @@
781 std::shared_ptr<graphics::GraphicBufferAllocator> const& buffer_allocator,
782 std::shared_ptr<DisplayComponentFactory> const& display_buffer_builder,
783 std::shared_ptr<DisplayReport> const& display_report,
784+ std::shared_ptr<NativeWindowReport> const& native_window_report,
785 OverlayOptimization overlay_option,
786 std::shared_ptr<DeviceQuirks> const& quirks);
787
788@@ -59,6 +61,7 @@
789 std::shared_ptr<DisplayReport> const display_report;
790 std::shared_ptr<PlatformIpcOperations> const ipc_operations;
791 std::shared_ptr<DeviceQuirks> const quirks;
792+ std::shared_ptr<NativeWindowReport> const native_window_report;
793 OverlayOptimization const overlay_option;
794
795 };
796
797=== modified file 'tests/unit-tests/client/android/test_android_native_window.cpp'
798--- tests/unit-tests/client/android/test_android_native_window.cpp 2016-01-29 08:18:22 +0000
799+++ tests/unit-tests/client/android/test_android_native_window.cpp 2016-07-11 12:50:47 +0000
800@@ -18,6 +18,7 @@
801
802 #include "mir_native_window.h"
803 #include "android_driver_interpreter.h"
804+#include "native_window_report.h"
805 #include "mir/egl_native_surface.h"
806 #include "mir/test/doubles/mock_android_native_buffer.h"
807 #include "mir/test/doubles/stub_android_native_buffer.h"
808@@ -26,11 +27,19 @@
809 #include <gtest/gtest.h>
810 #include <memory>
811
812+using namespace testing;
813 namespace mga=mir::graphics::android;
814 namespace mtd=mir::test::doubles;
815
816 namespace
817 {
818+struct MockReport : mga::NativeWindowReport
819+{
820+ MOCK_CONST_METHOD4(buffer_event, void(mga::BufferEvent, ANativeWindow const*, ANativeWindowBuffer*, int));
821+ MOCK_CONST_METHOD3(buffer_event, void(mga::BufferEvent, ANativeWindow const*, ANativeWindowBuffer*));
822+ MOCK_CONST_METHOD3(query_event, void(ANativeWindow const*, int, int));
823+ MOCK_CONST_METHOD3(perform_event, void(ANativeWindow const*, int, std::vector<int> const&));
824+};
825
826 class MockAndroidDriverInterpreter : public mga::AndroidDriverInterpreter
827 {
828@@ -38,7 +47,6 @@
829 MockAndroidDriverInterpreter()
830 : buffer(std::make_shared<mtd::StubAndroidNativeBuffer>())
831 {
832- using namespace testing;
833 ON_CALL(*this, driver_requests_buffer())
834 .WillByDefault(Return(buffer.get()));
835 }
836@@ -52,12 +60,13 @@
837 std::shared_ptr<mir::graphics::NativeBuffer> buffer;
838 };
839
840-class AndroidNativeWindowTest : public ::testing::Test
841+class AndroidNativeWindowTest : public ::Test
842 {
843 protected:
844 std::shared_ptr<MockAndroidDriverInterpreter> const mock_driver_interpreter =
845- std::make_shared<testing::NiceMock<MockAndroidDriverInterpreter>>();
846- mga::MirNativeWindow mir_native_window{mock_driver_interpreter};
847+ std::make_shared<NiceMock<MockAndroidDriverInterpreter>>();
848+ std::shared_ptr<MockReport> const mock_report = std::make_shared<NiceMock<MockReport>>();
849+ mga::MirNativeWindow mir_native_window{mock_driver_interpreter, mock_report};
850 ANativeWindow& window = mir_native_window;
851 int const failure_code{-1};
852 };
853@@ -66,8 +75,6 @@
854
855 TEST_F(AndroidNativeWindowTest, native_window_swapinterval)
856 {
857- using namespace testing;
858-
859 ASSERT_NE(nullptr, window.setSwapInterval);
860 EXPECT_CALL(*mock_driver_interpreter, sync_to_display(true))
861 .Times(1);
862@@ -87,17 +94,17 @@
863 /* Query hook tests */
864 TEST_F(AndroidNativeWindowTest, native_window_query_hook)
865 {
866- using namespace testing;
867-
868 int returned_width;
869 int const width = 271828;
870+ int key = NATIVE_WINDOW_WIDTH;
871
872 ASSERT_NE(nullptr, window.query);
873 EXPECT_CALL(*mock_driver_interpreter, driver_requests_info(NATIVE_WINDOW_WIDTH))
874 .Times(1)
875 .WillOnce(Return(width));
876+ EXPECT_CALL(*mock_report, query_event(_, key, width));
877
878- window.query(&window, NATIVE_WINDOW_WIDTH ,&returned_width);
879+ window.query(&window, key, &returned_width);
880
881 EXPECT_EQ(width, returned_width);
882 }
883@@ -106,12 +113,14 @@
884 TEST_F(AndroidNativeWindowTest, native_window_perform_hook_callable)
885 {
886 int const format = 4;
887+ int const key = NATIVE_WINDOW_SET_BUFFERS_FORMAT;
888
889 EXPECT_CALL(*mock_driver_interpreter, dispatch_driver_request_format(format))
890 .Times(1);
891
892 ASSERT_NE(nullptr, window.perform);
893- window.perform(&window, NATIVE_WINDOW_SET_BUFFERS_FORMAT, format);
894+ EXPECT_CALL(*mock_report, perform_event(_, key, _));
895+ window.perform(&window, key, format);
896 }
897
898 TEST_F(AndroidNativeWindowTest, native_window_perform_hook_calls_set_buffer)
899@@ -138,13 +147,12 @@
900 int fence_fd;
901
902 ASSERT_NE(nullptr, window.dequeueBuffer);
903+ EXPECT_CALL(*mock_report, buffer_event(mga::BufferEvent::Dequeue, _, _, _));
904 window.dequeueBuffer(&window, &returned_buffer, &fence_fd);
905 }
906
907 TEST_F(AndroidNativeWindowTest, native_window_dequeue_returns_right_buffer)
908 {
909- using namespace testing;
910-
911 int fake_fd = 4948;
912 auto mock_buffer = std::make_shared<NiceMock<mtd::MockAndroidNativeBuffer>>();
913 EXPECT_CALL(*mock_buffer, copy_fence())
914@@ -164,7 +172,6 @@
915
916 TEST_F(AndroidNativeWindowTest, native_window_dequeue_returns_previously_cancelled_buffer)
917 {
918- using namespace testing;
919 ANativeWindowBuffer buffer;
920 int fence_fd = 33;
921
922@@ -190,8 +197,6 @@
923
924 TEST_F(AndroidNativeWindowTest, native_window_dequeue_deprecated_returns_right_buffer)
925 {
926- using namespace testing;
927-
928 ANativeWindowBuffer* returned_buffer;
929 auto mock_buffer = std::make_shared<NiceMock<mtd::MockAndroidNativeBuffer>>();
930
931@@ -202,6 +207,7 @@
932 .Times(1);
933 EXPECT_CALL(*mock_buffer, copy_fence())
934 .Times(0);
935+ EXPECT_CALL(*mock_report, buffer_event(mga::BufferEvent::Dequeue, _, _));
936
937 window.dequeueBuffer_DEPRECATED(&window, &returned_buffer);
938 EXPECT_EQ(mock_buffer->anwb(), returned_buffer);
939@@ -209,7 +215,6 @@
940
941 TEST_F(AndroidNativeWindowTest, native_window_dequeue_deprecated_returns_previously_cancelled_buffer)
942 {
943- using namespace testing;
944 ANativeWindowBuffer buffer;
945
946 auto rc = window.cancelBuffer_DEPRECATED(&window, &buffer);
947@@ -235,10 +240,10 @@
948
949 TEST_F(AndroidNativeWindowTest, native_window_queue_passes_buffer_back)
950 {
951- using namespace testing;
952 ANativeWindowBuffer buffer;
953 int fence_fd = 33;
954
955+ EXPECT_CALL(*mock_report, buffer_event(mga::BufferEvent::Queue, _, &buffer, fence_fd));
956 EXPECT_CALL(*mock_driver_interpreter, driver_returns_buffer(&buffer, fence_fd))
957 .Times(1);
958
959@@ -255,9 +260,9 @@
960
961 TEST_F(AndroidNativeWindowTest, native_window_queue_deprecated_passes_buffer_back)
962 {
963- using namespace testing;
964 ANativeWindowBuffer buffer;
965
966+ EXPECT_CALL(*mock_report, buffer_event(mga::BufferEvent::Queue, _, &buffer));
967 EXPECT_CALL(*mock_driver_interpreter, driver_returns_buffer(&buffer,_))
968 .Times(1);
969
970@@ -268,11 +273,14 @@
971 TEST_F(AndroidNativeWindowTest, native_window_cancel_hooks_callable)
972 {
973 ANativeWindowBuffer* tmp = nullptr;
974+ int fence_fd = -1;
975
976+ EXPECT_CALL(*mock_report, buffer_event(mga::BufferEvent::Cancel, _, tmp));
977+ EXPECT_CALL(*mock_report, buffer_event(mga::BufferEvent::Cancel, _, tmp, fence_fd));
978 ASSERT_NE(nullptr, window.cancelBuffer_DEPRECATED);
979 ASSERT_NE(nullptr, window.cancelBuffer);
980 window.cancelBuffer_DEPRECATED(&window, tmp);
981- window.cancelBuffer(&window, tmp, -1);
982+ window.cancelBuffer(&window, tmp, fence_fd);
983 }
984
985 /* lock hook tests */
986@@ -315,7 +323,6 @@
987
988 TEST_F(AndroidNativeWindowTest, native_window_cancel_hook_does_not_call_driver_interpreter)
989 {
990- using namespace testing;
991 ANativeWindowBuffer buffer;
992 int fence_fd = 33;
993
994@@ -328,8 +335,6 @@
995
996 TEST_F(AndroidNativeWindowTest, returns_error_on_dequeue_buffer_failure)
997 {
998- using namespace testing;
999-
1000 EXPECT_CALL(*mock_driver_interpreter, driver_requests_buffer())
1001 .WillOnce(Throw(std::runtime_error("")))
1002 .WillOnce(Throw(std::runtime_error("")));
1003@@ -340,8 +345,6 @@
1004
1005 TEST_F(AndroidNativeWindowTest, returns_error_on_queue_buffer_failure)
1006 {
1007- using namespace testing;
1008-
1009 EXPECT_CALL(*mock_driver_interpreter, driver_returns_buffer(_, _))
1010 .WillOnce(Throw(std::runtime_error("")))
1011 .WillOnce(Throw(std::runtime_error("")));
1012@@ -352,8 +355,6 @@
1013
1014 TEST_F(AndroidNativeWindowTest, returns_error_on_query_failure)
1015 {
1016- using namespace testing;
1017-
1018 EXPECT_CALL(*mock_driver_interpreter, driver_requests_info(_))
1019 .WillOnce(Throw(std::runtime_error("")));
1020
1021@@ -362,8 +363,6 @@
1022
1023 TEST_F(AndroidNativeWindowTest, returns_error_on_perform_failure)
1024 {
1025- using namespace testing;
1026-
1027 EXPECT_CALL(*mock_driver_interpreter, dispatch_driver_request_format(_))
1028 .WillOnce(Throw(std::runtime_error("")));
1029
1030
1031=== modified file 'tests/unit-tests/graphics/android/CMakeLists.txt'
1032--- tests/unit-tests/graphics/android/CMakeLists.txt 2016-05-03 06:55:25 +0000
1033+++ tests/unit-tests/graphics/android/CMakeLists.txt 2016-07-11 12:50:47 +0000
1034@@ -32,6 +32,7 @@
1035 ${CMAKE_CURRENT_SOURCE_DIR}/test_display_hotplug.cpp
1036 ${CMAKE_CURRENT_SOURCE_DIR}/test_egl_sync_extensions.cpp
1037 ${CMAKE_CURRENT_SOURCE_DIR}/test_egl_sync_fence.cpp
1038+ ${CMAKE_CURRENT_SOURCE_DIR}/test_anw_logger.cpp
1039 $<TARGET_OBJECTS:mirplatformgraphicsandroidobjects>
1040 )
1041
1042
1043=== added file 'tests/unit-tests/graphics/android/test_anw_logger.cpp'
1044--- tests/unit-tests/graphics/android/test_anw_logger.cpp 1970-01-01 00:00:00 +0000
1045+++ tests/unit-tests/graphics/android/test_anw_logger.cpp 2016-07-11 12:50:47 +0000
1046@@ -0,0 +1,107 @@
1047+/*
1048+ * Copyright © 2014 Canonical Ltd.
1049+ *
1050+ * This program is free software: you can redistribute it and/or modify
1051+ * it under the terms of the GNU General Public License version 3 as
1052+ * published by the Free Software Foundation.
1053+ *
1054+ * This program is distributed in the hope that it will be useful,
1055+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1056+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1057+ * GNU General Public License for more details.
1058+ *
1059+ * You should have received a copy of the GNU General Public License
1060+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1061+ *
1062+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1063+ */
1064+
1065+#include "native_window_report.h"
1066+#include "mir/logging/logger.h"
1067+#include <system/window.h>
1068+#include <iostream>
1069+#include <gmock/gmock.h>
1070+#include <gtest/gtest.h>
1071+
1072+using namespace testing;
1073+namespace mga = mir::graphics::android;
1074+namespace ml = mir::logging;
1075+
1076+namespace
1077+{
1078+
1079+struct MockLogger : ml::Logger
1080+{
1081+ MOCK_METHOD3(log, void(ml::Severity, std::string const&, std::string const&));
1082+};
1083+
1084+struct ANWLogger : Test
1085+{
1086+ std::shared_ptr<MockLogger> mock_logger = std::make_shared<MockLogger>();
1087+ mga::ConsoleNativeWindowReport report{mock_logger};
1088+ ANativeWindow anw;
1089+ ANativeWindowBuffer anwb;
1090+ int dummy_fd = 421;
1091+ int dummy_cleared_fd = -421;
1092+
1093+};
1094+}
1095+
1096+TEST_F(ANWLogger, logs_buffer_events)
1097+{
1098+ std::stringstream expected1;
1099+ std::stringstream expected2;
1100+ std::stringstream expected3;
1101+ std::stringstream expected4;
1102+ std::stringstream expected5;
1103+ expected1 << "addr (" << &anw << "): queueBuffer: " << &anwb << ", fence: " << dummy_fd;
1104+ expected2 << "addr (" << &anw << "): dequeueBuffer: " << &anwb << ", fence: none";
1105+ expected3 << "addr (" << &anw << "): cancelBuffer: " << &anwb << ", fence: none";
1106+ expected4 << "addr (" << &anw << "): dequeueBuffer_deprecated: " << &anwb;
1107+ expected5 << "addr (" << &anw << "): cancelBuffer_deprecated: " << &anwb;
1108+
1109+ InSequence seq;
1110+ EXPECT_CALL(*mock_logger, log(_,StrEq(expected1.str()),_));
1111+ EXPECT_CALL(*mock_logger, log(_,StrEq(expected2.str()),_));
1112+ EXPECT_CALL(*mock_logger, log(_,StrEq(expected3.str()),_));
1113+ EXPECT_CALL(*mock_logger, log(_,StrEq(expected4.str()),_));
1114+ EXPECT_CALL(*mock_logger, log(_,StrEq(expected5.str()),_));
1115+
1116+ report.buffer_event(mga::BufferEvent::Queue, &anw, &anwb, dummy_fd);
1117+ report.buffer_event(mga::BufferEvent::Dequeue, &anw, &anwb, dummy_cleared_fd);
1118+ report.buffer_event(mga::BufferEvent::Cancel, &anw, &anwb, dummy_cleared_fd);
1119+ report.buffer_event(mga::BufferEvent::Dequeue, &anw, &anwb);
1120+ report.buffer_event(mga::BufferEvent::Cancel, &anw, &anwb);
1121+}
1122+
1123+TEST_F(ANWLogger, logs_perform_events)
1124+{
1125+ std::stringstream expected1;
1126+ std::stringstream expected2;
1127+ expected1 << "addr (" << &anw << "): perform: NATIVE_WINDOW_SET_USAGE: 0x734, 0x858";
1128+ expected2 << "addr (" << &anw << "): perform: NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP: 0x313";
1129+
1130+ InSequence seq;
1131+ EXPECT_CALL(*mock_logger, log(_,StrEq(expected1.str()),_));
1132+ EXPECT_CALL(*mock_logger, log(_,StrEq(expected2.str()),_));
1133+
1134+ report.perform_event(&anw, NATIVE_WINDOW_SET_USAGE, {0x734, 0x858} );
1135+ report.perform_event(&anw, NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP, {0x313} );
1136+}
1137+
1138+TEST_F(ANWLogger, logs_query_events)
1139+{
1140+ unsigned int width = 0x380;
1141+ unsigned int type = 0x2;
1142+ std::stringstream expected1;
1143+ std::stringstream expected2;
1144+ expected1 << "addr (" << &anw << "): query: NATIVE_WINDOW_WIDTH: result: 0x380";
1145+ expected2 << "addr (" << &anw << "): query: NATIVE_WINDOW_CONCRETE_TYPE: result: 0x2";
1146+
1147+ InSequence seq;
1148+ EXPECT_CALL(*mock_logger, log(_,StrEq(expected1.str()),_));
1149+ EXPECT_CALL(*mock_logger, log(_,StrEq(expected2.str()),_));
1150+
1151+ report.query_event(&anw, NATIVE_WINDOW_WIDTH, width);
1152+ report.query_event(&anw, NATIVE_WINDOW_CONCRETE_TYPE, type);
1153+}
1154
1155=== modified file 'tests/unit-tests/graphics/android/test_display.cpp'
1156--- tests/unit-tests/graphics/android/test_display.cpp 2016-06-28 18:35:12 +0000
1157+++ tests/unit-tests/graphics/android/test_display.cpp 2016-07-11 12:50:47 +0000
1158@@ -34,6 +34,7 @@
1159 #include "mir/test/doubles/stub_display_configuration.h"
1160 #include "mir/test/doubles/stub_renderable.h"
1161 #include "mir_native_window.h"
1162+#include "native_window_report.h"
1163 #include "mir/test/doubles/stub_driver_interpreter.h"
1164
1165 #include <gtest/gtest.h>
1166@@ -63,6 +64,7 @@
1167 dummy_context{mock_egl.fake_egl_context},
1168 dummy_config{mock_egl.fake_configs[0]},
1169 null_display_report{mir::report::null_display_report()},
1170+ null_anw_report(std::make_shared<mga::NullNativeWindowReport>()),
1171 stub_db_factory{std::make_shared<mtd::StubDisplayBuilder>()},
1172 stub_gl_config{std::make_shared<mtd::StubGLConfig>()},
1173 stub_gl_program_factory{std::make_shared<mtd::StubGLProgramFactory>()}
1174@@ -77,6 +79,7 @@
1175 EGLConfig const dummy_config;
1176
1177 std::shared_ptr<mg::DisplayReport> const null_display_report;
1178+ std::shared_ptr<mga::NativeWindowReport> const null_anw_report;
1179 std::shared_ptr<mtd::StubDisplayBuilder> const stub_db_factory;
1180 std::shared_ptr<mtd::StubGLConfig> const stub_gl_config;
1181 std::shared_ptr<mtd::StubGLProgramFactory> const stub_gl_program_factory;
1182@@ -132,6 +135,7 @@
1183 stub_gl_program_factory,
1184 stub_gl_config,
1185 null_display_report,
1186+ null_anw_report,
1187 mga::OverlayOptimization::disabled);
1188 }
1189
1190@@ -181,6 +185,7 @@
1191 stub_gl_program_factory,
1192 stub_gl_config,
1193 null_display_report,
1194+ null_anw_report,
1195 mga::OverlayOptimization::disabled);
1196 EXPECT_EQ(correct_config, selected_config);
1197 }
1198@@ -210,6 +215,7 @@
1199 stub_gl_program_factory,
1200 mock_gl_config,
1201 null_display_report,
1202+ null_anw_report,
1203 mga::OverlayOptimization::disabled);
1204 }
1205
1206@@ -233,6 +239,7 @@
1207 stub_gl_program_factory,
1208 stub_gl_config,
1209 mock_display_report,
1210+ null_anw_report,
1211 mga::OverlayOptimization::disabled);
1212 }
1213
1214@@ -261,6 +268,7 @@
1215 stub_gl_program_factory,
1216 stub_gl_config,
1217 mock_display_report,
1218+ null_anw_report,
1219 mga::OverlayOptimization::disabled);
1220 }, std::runtime_error);
1221 }
1222@@ -288,6 +296,7 @@
1223 stub_gl_program_factory,
1224 stub_gl_config,
1225 mock_display_report,
1226+ null_anw_report,
1227 mga::OverlayOptimization::disabled);
1228 }, std::runtime_error);
1229 }
1230@@ -306,6 +315,7 @@
1231 stub_gl_program_factory,
1232 stub_gl_config,
1233 null_display_report,
1234+ null_anw_report,
1235 mga::OverlayOptimization::disabled);
1236 }
1237
1238@@ -323,6 +333,7 @@
1239 stub_gl_program_factory,
1240 stub_gl_config,
1241 null_display_report,
1242+ null_anw_report,
1243 mga::OverlayOptimization::disabled);});
1244 }
1245
1246@@ -341,6 +352,7 @@
1247 stub_gl_program_factory,
1248 stub_gl_config,
1249 null_display_report,
1250+ null_anw_report,
1251 mga::OverlayOptimization::disabled);
1252 }
1253
1254@@ -365,6 +377,7 @@
1255 stub_gl_program_factory,
1256 stub_gl_config,
1257 null_display_report,
1258+ null_anw_report,
1259 mga::OverlayOptimization::disabled);
1260
1261 auto configuration = display.configuration();
1262@@ -427,6 +440,7 @@
1263 stub_gl_program_factory,
1264 stub_gl_config,
1265 null_display_report,
1266+ null_anw_report,
1267 mga::OverlayOptimization::enabled);
1268 auto config = display.configuration();
1269
1270@@ -478,6 +492,7 @@
1271 stub_gl_program_factory,
1272 stub_gl_config,
1273 null_display_report,
1274+ null_anw_report,
1275 mga::OverlayOptimization::enabled);
1276 auto config = display.configuration();
1277
1278@@ -527,6 +542,7 @@
1279 stub_gl_program_factory,
1280 stub_gl_config,
1281 null_display_report,
1282+ null_anw_report,
1283 mga::OverlayOptimization::enabled);
1284 auto config = display.configuration();
1285 config->for_each_output([](mg::UserDisplayConfigurationOutput const& c){
1286@@ -552,6 +568,7 @@
1287 stub_gl_program_factory,
1288 stub_gl_config,
1289 null_display_report,
1290+ null_anw_report,
1291 mga::OverlayOptimization::enabled);
1292
1293 auto config = display.configuration();
1294@@ -575,6 +592,7 @@
1295 stub_gl_program_factory,
1296 stub_gl_config,
1297 null_display_report,
1298+ null_anw_report,
1299 mga::OverlayOptimization::enabled);
1300
1301 auto scale = 4.2f;
1302@@ -598,6 +616,7 @@
1303 stub_gl_program_factory,
1304 stub_gl_config,
1305 null_display_report,
1306+ null_anw_report,
1307 mga::OverlayOptimization::enabled);
1308
1309 auto form_factor = mir_form_factor_tablet;
1310@@ -630,6 +649,7 @@
1311 stub_gl_program_factory,
1312 stub_gl_config,
1313 null_display_report,
1314+ null_anw_report,
1315 mga::OverlayOptimization::enabled);
1316 EXPECT_THAT(subscription.use_count(), Gt(use_count_before));
1317 }
1318@@ -679,6 +699,7 @@
1319 stub_gl_program_factory,
1320 stub_gl_config,
1321 null_display_report,
1322+ null_anw_report,
1323 mga::OverlayOptimization::enabled);
1324
1325 auto config = display.configuration();
1326@@ -722,6 +743,7 @@
1327 stub_gl_program_factory,
1328 stub_gl_config,
1329 null_display_report,
1330+ null_anw_report,
1331 mga::OverlayOptimization::enabled);
1332
1333 auto group_count = 0;
1334@@ -803,6 +825,7 @@
1335 stub_gl_program_factory,
1336 stub_gl_config,
1337 null_display_report,
1338+ null_anw_report,
1339 mga::OverlayOptimization::enabled);
1340
1341 //hotplug external away
1342@@ -842,6 +865,7 @@
1343 stub_gl_program_factory,
1344 stub_gl_config,
1345 null_display_report,
1346+ null_anw_report,
1347 mga::OverlayOptimization::enabled);
1348
1349 auto configuration = display.configuration();
1350@@ -883,6 +907,7 @@
1351 stub_gl_program_factory,
1352 stub_gl_config,
1353 report,
1354+ null_anw_report,
1355 mga::OverlayOptimization::enabled);
1356
1357 vsync_fn(mga::DisplayName::primary);
1358@@ -896,6 +921,7 @@
1359 stub_gl_program_factory,
1360 stub_gl_config,
1361 null_display_report,
1362+ null_anw_report,
1363 mga::OverlayOptimization::enabled);
1364
1365 int num_cards = 0;
1366@@ -918,6 +944,7 @@
1367 stub_gl_program_factory,
1368 stub_gl_config,
1369 null_display_report,
1370+ null_anw_report,
1371 mga::OverlayOptimization::enabled);
1372
1373 auto config = display.configuration();
1374@@ -964,6 +991,7 @@
1375 stub_gl_program_factory,
1376 stub_gl_config,
1377 null_display_report,
1378+ null_anw_report,
1379 mga::OverlayOptimization::enabled);
1380
1381 //hotplug external back
1382@@ -1000,6 +1028,7 @@
1383 stub_gl_program_factory,
1384 stub_gl_config,
1385 null_display_report,
1386+ null_anw_report,
1387 mga::OverlayOptimization::disabled);
1388
1389 display.for_each_display_sync_group([](mg::DisplaySyncGroup& group) {
1390@@ -1035,6 +1064,7 @@
1391 stub_gl_program_factory,
1392 stub_gl_config,
1393 null_display_report,
1394+ null_anw_report,
1395 mga::OverlayOptimization::enabled);
1396
1397 auto db_count = 0;
1398@@ -1063,6 +1093,7 @@
1399 stub_gl_program_factory,
1400 stub_gl_config,
1401 null_display_report,
1402+ null_anw_report,
1403 mga::OverlayOptimization::enabled);
1404
1405 int const virtual_output_width{1234};
1406
1407=== modified file 'tests/unit-tests/graphics/android/test_display_buffer.cpp'
1408--- tests/unit-tests/graphics/android/test_display_buffer.cpp 2016-05-03 06:55:25 +0000
1409+++ tests/unit-tests/graphics/android/test_display_buffer.cpp 2016-07-11 12:50:47 +0000
1410@@ -18,6 +18,7 @@
1411
1412 #include "src/platforms/android/server/display_buffer.h"
1413 #include "src/platforms/android/server/gl_context.h"
1414+#include "native_window_report.h"
1415 #include "android_format_conversion-inl.h"
1416 #include "mir/test/doubles/mock_display_device.h"
1417 #include "mir/test/doubles/mock_display_report.h"
1418@@ -59,7 +60,8 @@
1419 std::make_shared<testing::NiceMock<mtd::StubBuffer>>()};
1420 std::shared_ptr<ANativeWindow> native_window{
1421 std::make_shared<mg::android::MirNativeWindow>(
1422- std::make_shared<mtd::StubDriverInterpreter>())};
1423+ std::make_shared<mtd::StubDriverInterpreter>(),
1424+ std::make_shared<mga::NullNativeWindowReport>())};
1425 std::shared_ptr<mtd::MockDisplayDevice> mock_display_device{
1426 std::make_shared<testing::NiceMock<mtd::MockDisplayDevice>>()};
1427 geom::Size const display_size{433,232};
1428
1429=== modified file 'tests/unit-tests/graphics/android/test_display_hotplug.cpp'
1430--- tests/unit-tests/graphics/android/test_display_hotplug.cpp 2016-05-03 06:55:25 +0000
1431+++ tests/unit-tests/graphics/android/test_display_hotplug.cpp 2016-07-11 12:50:47 +0000
1432@@ -30,6 +30,7 @@
1433 #include "mir/test/doubles/mock_egl.h"
1434 #include "mir/test/doubles/mock_gl.h"
1435 #include "mir/test/auto_unblock_thread.h"
1436+#include "native_window_report.h"
1437 #include <gtest/gtest.h>
1438
1439 namespace mga=mir::graphics::android;
1440@@ -128,6 +129,7 @@
1441 std::make_shared<mir::gl::DefaultProgramFactory>(),
1442 std::make_shared<mtd::StubGLConfig>(),
1443 mir::report::null_display_report(),
1444+ std::make_shared<mga::NullNativeWindowReport>(),
1445 mga::OverlayOptimization::enabled};
1446 };
1447
1448
1449=== modified file 'tests/unit-tests/graphics/android/test_platform.cpp'
1450--- tests/unit-tests/graphics/android/test_platform.cpp 2016-06-29 15:50:53 +0000
1451+++ tests/unit-tests/graphics/android/test_platform.cpp 2016-07-11 12:50:47 +0000
1452@@ -33,6 +33,7 @@
1453 #include "mir/test/doubles/null_gl_context.h"
1454 #include "mir_test_framework/executable_path.h"
1455 #include "mir/shared_library.h"
1456+#include "native_window_report.h"
1457 #include <system/window.h>
1458 #include <gtest/gtest.h>
1459
1460@@ -90,6 +91,7 @@
1461 std::shared_ptr<mtd::MockBuffer> mock_buffer;
1462 std::shared_ptr<native_handle_t> native_buffer_handle;
1463 std::shared_ptr<mg::DisplayReport> stub_display_report;
1464+ std::shared_ptr<mga::NativeWindowReport> anw_report = std::make_shared<mga::NullNativeWindowReport>();
1465 testing::NiceMock<mtd::MockEGL> mock_egl;
1466 mtd::NullGLContext context;
1467 std::shared_ptr<mga::DeviceQuirks> quirks;
1468@@ -107,7 +109,7 @@
1469 .WillOnce(Return(fake_fence));
1470
1471 mga::Platform platform(stub_buffer_allocator, stub_display_builder,
1472- stub_display_report, mga::OverlayOptimization::enabled, quirks);
1473+ stub_display_report, anw_report, mga::OverlayOptimization::enabled, quirks);
1474
1475 mtd::MockBufferIpcMessage mock_ipc_msg;
1476 int offset = 0;
1477@@ -140,7 +142,7 @@
1478 .WillOnce(Return(-1));
1479
1480 mga::Platform platform(stub_buffer_allocator, stub_display_builder,
1481- stub_display_report, mga::OverlayOptimization::enabled, quirks);
1482+ stub_display_report, anw_report, mga::OverlayOptimization::enabled, quirks);
1483
1484 mtd::MockBufferIpcMessage mock_ipc_msg;
1485 int offset = 0;
1486@@ -181,7 +183,7 @@
1487 .WillOnce(Return(-1));
1488
1489 mga::Platform platform(stub_buffer_allocator, stub_display_builder,
1490- stub_display_report, mga::OverlayOptimization::enabled, quirks);
1491+ stub_display_report, anw_report, mga::OverlayOptimization::enabled, quirks);
1492
1493 mtd::MockBufferIpcMessage mock_ipc_msg;
1494 int offset = 0;
1495@@ -217,7 +219,7 @@
1496
1497 int fake_fence{33};
1498 mga::Platform platform(stub_buffer_allocator, stub_display_builder,
1499- stub_display_report, mga::OverlayOptimization::enabled, quirks);
1500+ stub_display_report, anw_report, mga::OverlayOptimization::enabled, quirks);
1501 auto ipc_ops = platform.make_ipc_operations();
1502
1503 mtd::MockBufferIpcMessage mock_ipc_msg;
1504@@ -247,6 +249,7 @@
1505 std::make_shared<mtd::StubBufferAllocator>(),
1506 std::make_shared<mtd::StubDisplayBuilder>(),
1507 mr::null_display_report(),
1508+ std::make_shared<mga::NullNativeWindowReport>(),
1509 mga::OverlayOptimization::enabled,
1510 std::make_shared<mga::DeviceQuirks>(mga::PropertiesOps{}, context));
1511 EXPECT_EQ(EGL_DEFAULT_DISPLAY, platform.egl_native_display());

Subscribers

People subscribed via source and target branches