summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2019-01-11 12:29:57 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2019-01-14 09:27:28 +0200
commitc223cffa20d617863bffb0c7e3890172d93a53c8 (patch)
tree9802e02e4bc0989d1a33e14df17e4de1c766a463
parent27f1c296c4f5996227b28215400c787ea018862b (diff)
kmstest: use open_modesetting_card
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--utils/kmstest.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp
index 37f9e0f..79c7d1b 100644
--- a/utils/kmstest.cpp
+++ b/utils/kmstest.cpp
@@ -444,7 +444,7 @@ struct Arg
string arg;
};
-static string s_device_path = "/dev/dri/card0";
+static string s_device_path;
static vector<Arg> parse_cmdline(int argc, char **argv)
{
@@ -1111,29 +1111,34 @@ int main(int argc, char **argv)
{
vector<Arg> output_args = parse_cmdline(argc, argv);
- Card card(s_device_path);
+ unique_ptr<Card> card;
- if (!card.is_master())
+ if (s_device_path.empty())
+ card = Card::open_modesetting_card();
+ else
+ card = unique_ptr<Card>(new Card(s_device_path));
+
+ if (!card->is_master())
EXIT("Could not get DRM master permission. Card already in use?");
- if (!card.has_atomic() && s_flip_sync)
+ if (!card->has_atomic() && s_flip_sync)
EXIT("Synchronized flipping requires atomic modesetting");
- ResourceManager resman(card);
+ ResourceManager resman(*card);
- vector<OutputInfo> outputs = setups_to_outputs(card, resman, output_args);
+ vector<OutputInfo> outputs = setups_to_outputs(*card, resman, output_args);
if (!s_flip_mode)
draw_test_patterns(outputs);
print_outputs(outputs);
- set_crtcs_n_planes(card, outputs);
+ set_crtcs_n_planes(*card, outputs);
printf("press enter to exit\n");
if (s_flip_mode)
- main_flip(card, outputs);
+ main_flip(*card, outputs);
else
getchar();
}