st/gui: Port to using xrt_instance, instead of xrt_prober directly.

This commit is contained in:
Ryan Pavlik 2020-05-26 16:56:33 -05:00
parent 1a313b6f58
commit 1438541147
6 changed files with 22 additions and 29 deletions

View file

@ -47,6 +47,7 @@ struct gui_program
struct gui_scene_manager *gsm;
struct xrt_device *xdevs[NUM_XDEVS];
struct xrt_instance *instance;
struct xrt_prober *xp;
struct gui_ogl_texture *texs[256];

View file

@ -7,6 +7,7 @@
*/
#include "xrt/xrt_prober.h"
#include "xrt/xrt_instance.h"
#include "util/u_time.h"
#include "gui_common.h"
@ -37,17 +38,23 @@ gui_prober_init(struct gui_program *p)
int ret = 0;
// Initialize the prober.
ret = xrt_prober_create(&p->xp);
ret = xrt_instance_create(&p->instance);
if (ret != 0) {
return do_exit(p, ret);
}
ret = xrt_instance_get_prober(p->instance, &p->xp);
if (ret != 0) {
return do_exit(p, ret);
}
// Need to prime the prober with devices before dumping and listing.
ret = xrt_prober_probe(p->xp);
if (ret != 0) {
return do_exit(p, ret);
if (p->xp != NULL) {
// Need to prime the prober with devices before dumping and
// listing.
ret = xrt_prober_probe(p->xp);
if (ret != 0) {
return do_exit(p, ret);
}
}
return 0;
}
@ -57,7 +64,7 @@ gui_prober_select(struct gui_program *p)
int ret;
// Multiple devices can be found.
ret = xrt_prober_select(p->xp, p->xdevs, NUM_XDEVS);
ret = xrt_instance_select(p->instance, p->xdevs, NUM_XDEVS);
if (ret != 0) {
return ret;
}
@ -89,5 +96,5 @@ gui_prober_teardown(struct gui_program *p)
p->xdevs[i] = NULL;
}
xrt_prober_destroy(&p->xp);
xrt_instance_destroy(&p->instance);
}

View file

@ -170,6 +170,10 @@ create(void)
void
gui_scene_select_video_calibrate(struct gui_program *p)
{
if (p->xp == NULL) {
// No prober, nothing to create.
return;
}
struct video_select *vs = create();
gui_scene_push_front(p, &vs->base);

View file

@ -8,7 +8,6 @@ set(SOURCE_FILES
gui_sdl2.c
gui_sdl2_imgui.c
gui_sdl2_main.c
gui_sdl2_prober.c
)
add_executable(gui
@ -26,8 +25,7 @@ target_link_libraries(gui PRIVATE
aux_util
aux_math
st_gui
st_prober
target_lists
target_instance_no_comp
imgui_impl_sdl
)
target_include_directories(gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)

View file

@ -1,16 +0,0 @@
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Enable the use of the prober in the gui application.
* @author Jakob Bornecrantz <jakob@collabora.com>
*/
#include "target_lists.h"
int
xrt_prober_create(struct xrt_prober **out_xp)
{
return xrt_prober_create_with_lists(out_xp, &target_lists);
}

View file

@ -19,7 +19,6 @@ gui = executable(
'gui_sdl2.c',
'gui_sdl2_imgui.c',
'gui_sdl2_main.c',
'gui_sdl2_prober.c',
'../../../external/imgui/imgui/cimgui_sdl.cpp',
'../../../external/imgui/imgui/imgui_impl_sdl.cpp',
'../../../external/imgui/imgui/imgui_impl_sdl.h',
@ -31,7 +30,7 @@ gui = executable(
lib_aux_math,
lib_st_prober,
lib_st_gui,
lib_target_lists,
lib_target_instance_no_comp,
] + driver_libs,
include_directories: [
aux_include,