Mir

Merge lp://staging/~raof/mir/prober-drm-device-probe into lp://staging/~mir-team/mir/trunk

Proposed by Chris Halse Rogers
Status: Merged
Approved by: Chris Halse Rogers
Approved revision: no longer in the source branch.
Merged at revision: 798
Proposed branch: lp://staging/~raof/mir/prober-drm-device-probe
Merge into: lp://staging/~mir-team/mir/trunk
Diff against target: 1176 lines (+577/-22)
26 files modified
CMakeLists.txt (+12/-1)
cmake/MirCommon.cmake (+10/-0)
cmake/src/mir/mir_discover_gtest_tests.cpp (+13/-0)
debian/control (+3/-0)
include/test/mir_test_doubles/mock_drm.h (+4/-0)
include/test/mir_test_framework/udev_environment.h (+43/-0)
src/server/graphics/gbm/CMakeLists.txt (+2/-0)
src/server/graphics/gbm/gbm_display_helpers.cpp (+122/-14)
src/server/graphics/gbm/gbm_display_helpers.h (+23/-2)
src/server/graphics/gbm/gbm_platform.cpp (+1/-1)
src/server/graphics/gbm/gbm_platform.h (+1/-0)
tests/mir_test_doubles/CMakeLists.txt (+1/-2)
tests/mir_test_doubles/mock_drm.cpp (+73/-0)
tests/mir_test_framework/CMakeLists.txt (+17/-0)
tests/mir_test_framework/udev_environment.cpp (+49/-0)
tests/mir_test_framework/udev_recordings/standard-drm-devices.umockdev (+138/-0)
tests/unit-tests/CMakeLists.txt (+11/-2)
tests/unit-tests/graphics/gbm/test_gbm_buffer.cpp (+7/-0)
tests/unit-tests/graphics/gbm/test_gbm_buffer_allocator.cpp (+5/-0)
tests/unit-tests/graphics/gbm/test_gbm_display.cpp (+6/-0)
tests/unit-tests/graphics/gbm/test_gbm_display_configuration.cpp (+7/-0)
tests/unit-tests/graphics/gbm/test_gbm_display_multi_monitor.cpp (+7/-0)
tests/unit-tests/graphics/gbm/test_gbm_platform.cpp (+5/-0)
tests/unit-tests/graphics/test_display.cpp (+9/-0)
tests/unit-tests/graphics/test_graphics_platform.cpp (+7/-0)
tools/setup-partial-armhf-chroot.sh (+1/-0)
To merge this branch: bzr merge lp://staging/~raof/mir/prober-drm-device-probe
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Thomas Voß (community) Approve
Daniel van Vugt Needs Fixing
Alexandros Frantzis (community) Approve
Robert Ancell Approve
Review via email: mp+170765@code.staging.launchpad.net

Commit message

Improve GBM platform's device probing, by actually making it probe devices

Description of the change

Improve the GBM platform's device probing by actually probing devices

To post a comment you must log in.
Revision history for this message
Chris Halse Rogers (raof) wrote :

This is better than what we've currently got, but I'd prefer not to merge it yet because what we currently have accidentally works on my hybrid laptop and this only works about half the time; when the intel card gets to be the first drm device.

Revision history for this message
Chris Halse Rogers (raof) wrote :

Now actually selects a card that can possibly drive an output!

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Makes sense

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

201 + close(tmp_fd);

We also need to reset tmp_fd to -1. Otherwise we may end up returning an inappropriate fd instead of failing.

156 + udev_enumerate *enumerator = udev_enumerate_new(udev.ctx);
170 + udev_device *dev = udev_device_new_from_syspath(udev.ctx, sys_path);

Not a blocker for this MP, but ideally we would have RAII classes for udev resources to avoid the explicit new/unref matching.

Some style nits:

128 + const char *sys_path = udev_list_entry_get_name(device);

char const*

97 + char *busid = drmGetBusid(fd);
117 + udev_enumerate *children = udev_enumerate_new(udev.ctx);
248 + udev *ctx;
270 + int is_appropriate_device(UdevHelper const& udev, udev_device *dev);
... and at other places

'*' with type

+int mggh::DRMHelper::is_appropriate_device(UdevHelper const &udev, udev_device *drm_device)

'&' and '*' with type

124 + if (!udev_enumerate_scan_devices(children)) {
127 + udev_list_entry_foreach(device, devices) {
132 + if (strcmp(sys_path, udev_device_get_syspath(drm_device))) {
168 + udev_list_entry_foreach(device, devices) {
... and at other places

Opening brace should be on a separate line.

323 + .WillByDefault(DoAll(InvokeWithoutArgs([this]() {this->busid = (char *)malloc(10);}),

static_cast<char*>()

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Halse Rogers (raof) wrote :

@Alf: If you want to make a better UdevHelper class a blocker for the MP, I can certainly accommodate that ☺

Barring that (and getting the CI passing), stylistic comments should all be resolved.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

401 + va_list ap;
402 + mode_t mode;
403 + va_start(ap, flags);
404 + mode = va_arg(ap, mode_t);
405 + va_end(ap);
406 +
407 + return (*real_open)(path, flags, mode);

The C/C++ calling convention is to push parameters on the stack in reverse order. This means a function never needs to know exactly how many parameters the caller really passed. Yes, really.

So you should just implement the 3-parameter version of open and not bother with va_list stuff, I think.

review: Needs Fixing
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good as a first step. I am looking forward to:

1. 155 + // TODO: Wrap this up in a nice class

2. Tests to cover interaction with various udev configurations. If we continue with the link-time seam for injecting udev, perhaps it would be worth it to set up an infrastructure to create configurations easily (e.g. like we do with FakeDRMResources for KMS).

review: Approve
Revision history for this message
Robert Carr (robertcarr) wrote :

I think this is worth having integration or "acceptance testing" for. Especially if we expect our usage of udev to grow. It looks cumbersome to test, but will only become more so!

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Abstain. There are enough issues blocking this without my opinion right now.

review: Abstain
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Please make umockdev optional:

-- checking for module 'umockdev-1.0'
-- package 'umockdev-1.0' not found
CMake Error at /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:279 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
  CMakeLists.txt:131 (pkg_check_modules)

Not just for the sake of raring, but particularly for other distros that don't have umockdev packages.

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

^^^ I mean just disable those tests when umockdev is missing. It shouldn't be a build failure.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I think this is a step forward, but now I get all my tests skipped if I'm missing umockdev. I think that's extreme. We should only skip those tests (GBM?) that are not possible without umockdev.

I would like to see most of the tests still runnable without umockdev, as they are today in lp:mir.

I don't yet approve, but also understand that my vote is not a veto.

review: Needs Fixing
Revision history for this message
Chris Halse Rogers (raof) wrote :

I think the test-suite should be an all-or-nothing affair - if valgrind didn't take ages I'd be agitating to drop the non-memcheck option. The more optional bits of the test-suite there are the more likely it is that you accidentally miss out.

Dropping the test-suite entirely when you don't have the prerequisites for all of it makes it very clear.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Thomas Voß (thomas-voss) wrote :

LGTM, the udev functionality should see some refactoring but that can happen in a follow-up MP.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches