Mir

Merge lp:~vanvugt/mir/distinguish-crtc-exceptions into lp:~mir-team/mir/trunk

Proposed by Daniel van Vugt
Status: Merged
Approved by: Thomas Voß
Approved revision: no longer in the source branch.
Merged at revision: 1010
Proposed branch: lp:~vanvugt/mir/distinguish-crtc-exceptions
Merge into: lp:~mir-team/mir/trunk
Diff against target: 79 lines (+45/-3)
1 file modified
src/server/graphics/gbm/real_kms_output.cpp (+45/-3)
To merge this branch: bzr merge lp:~vanvugt/mir/distinguish-crtc-exceptions
Reviewer Review Type Date Requested Status
Thomas Voß (community) Approve
Robert Ancell Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+181947@code.launchpad.net

Commit message

Disambiguate an exception message which could come from three places:
   Output has no associated crtc
with more rich and meaningful information:
   Output <NAME> has no associated CRTC to <ACTION> on

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) wrote :

It would be preferrable to have "Unknown(n)" instead of just "Unknown()" - but looks good otherwise.

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

It will have a number. connector_name will return "Unknown-N".

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

It wont have the type which can be useful in debugging, e.g. UnknownM-N. From M we can tell if it's a number we haven't got a name for yet or something worse like memory corruption.

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

I don't understand your concern. "Unknown-N" will be unique, unambiguous, and less confusing than "UnknownM-N".

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

M = conn->connector_type
N = conn->connector_type_id

If M is converted into "Unknown" then there will be no way to know what M was from the log message.

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

Oh, right. I suspect M > 14 might be impossible. So it's not a scenario I want to write any more logic for. "Unknown" is good enough.

Revision history for this message
Thomas Voß (thomas-voss) wrote :

LGTM, type can be used as an index according to /usr/include/xf86drmMode.h.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/graphics/gbm/real_kms_output.cpp'
2--- src/server/graphics/gbm/real_kms_output.cpp 2013-08-01 07:44:17 +0000
3+++ src/server/graphics/gbm/real_kms_output.cpp 2013-08-24 06:33:27 +0000
4@@ -89,6 +89,42 @@
5 return (encoder->possible_crtcs & (1 << crtc_index));
6 }
7
8+const char *connector_type_name(uint32_t type)
9+{
10+ static const int nnames = 15;
11+ static const char * const names[nnames] =
12+ { // Ordered according to xf86drmMode.h
13+ "Unknown",
14+ "VGA",
15+ "DVII",
16+ "DVID",
17+ "DVIA",
18+ "Composite",
19+ "SVIDEO",
20+ "LVDS",
21+ "Component",
22+ "9PinDIN",
23+ "DisplayPort",
24+ "HDMIA",
25+ "HDMIB",
26+ "TV",
27+ "eDP"
28+ };
29+
30+ if (type >= nnames)
31+ type = 0;
32+
33+ return names[type];
34+}
35+
36+std::string connector_name(const drmModeConnector *conn)
37+{
38+ std::string name = connector_type_name(conn->connector_type);
39+ name += '-';
40+ name += std::to_string(conn->connector_type_id);
41+ return name;
42+}
43+
44 }
45
46 mgg::RealKMSOutput::RealKMSOutput(int drm_fd, uint32_t connector_id,
47@@ -144,7 +180,9 @@
48 bool mgg::RealKMSOutput::set_crtc(uint32_t fb_id)
49 {
50 if (!ensure_crtc())
51- BOOST_THROW_EXCEPTION(std::runtime_error("Output has no associated crtc"));
52+ BOOST_THROW_EXCEPTION(std::runtime_error("Output " +
53+ connector_name(connector.get()) +
54+ " has no associated CRTC to set a framebuffer on"));
55
56 auto ret = drmModeSetCrtc(drm_fd, current_crtc->crtc_id,
57 fb_id, fb_offset.dx.as_int(), fb_offset.dy.as_int(),
58@@ -163,7 +201,9 @@
59 bool mgg::RealKMSOutput::schedule_page_flip(uint32_t fb_id)
60 {
61 if (!current_crtc)
62- BOOST_THROW_EXCEPTION(std::runtime_error("Output has no associated crtc"));
63+ BOOST_THROW_EXCEPTION(std::runtime_error("Output " +
64+ connector_name(connector.get()) +
65+ " has no associated CRTC to schedule page flips on"));
66
67 return page_flipper->schedule_flip(current_crtc->crtc_id, fb_id);
68 }
69@@ -171,7 +211,9 @@
70 void mgg::RealKMSOutput::wait_for_page_flip()
71 {
72 if (!current_crtc)
73- BOOST_THROW_EXCEPTION(std::runtime_error("Output has no associated crtc"));
74+ BOOST_THROW_EXCEPTION(std::runtime_error("Output " +
75+ connector_name(connector.get()) +
76+ " has no associated CRTC to wait on"));
77
78 page_flipper->wait_for_flip(current_crtc->crtc_id);
79 }

Subscribers

People subscribed via source and target branches