diff options
author | Eric Anholt <[email protected]> | 2018-10-26 18:19:37 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-04-26 15:02:03 -0700 |
commit | edb04953c8b8520108f333b1e289f18719a7d597 (patch) | |
tree | 2537f23bfb1eb9b4facb8106a6fcd4643b34bb4e /src | |
parent | 7e069832a05ebd5948d3ef95d3b5028156c829b3 (diff) |
vc4: Fall back to renderonly if the vc4 driver doesn't have v3d.
I have a platform with vc4 display but V3D 4.x. We can fall back on
kmsro's probing to bring up the v3d gallium driver.
Acked-by: Rob Clark <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/vc4/meson.build | 1 | ||||
-rw-r--r-- | src/gallium/winsys/vc4/drm/meson.build | 15 | ||||
-rw-r--r-- | src/gallium/winsys/vc4/drm/vc4_drm_winsys.c | 23 |
3 files changed, 35 insertions, 4 deletions
diff --git a/src/gallium/drivers/vc4/meson.build b/src/gallium/drivers/vc4/meson.build index 617578d4593..5ce5af5f6b4 100644 --- a/src/gallium/drivers/vc4/meson.build +++ b/src/gallium/drivers/vc4/meson.build @@ -96,7 +96,6 @@ if host_machine.cpu_family() == 'arm' vc4_c_args += '-DUSE_ARM_ASM' endif -dep_simpenrose = dependency('simpenrose', required : false) if dep_simpenrose.found() vc4_c_args += '-DUSE_VC4_SIMULATOR' endif diff --git a/src/gallium/winsys/vc4/drm/meson.build b/src/gallium/winsys/vc4/drm/meson.build index 58216dc5f54..55c85734e04 100644 --- a/src/gallium/winsys/vc4/drm/meson.build +++ b/src/gallium/winsys/vc4/drm/meson.build @@ -18,12 +18,23 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +dep_simpenrose = dependency('simpenrose', required : false) + +vc4_winsys_c_args = [] +if with_gallium_kmsro + vc4_winsys_c_args += '-DGALLIUM_KMSRO' +endif + +if dep_simpenrose.found() + vc4_winsys_c_args += '-DUSE_VC4_SIMULATOR' +endif + libvc4winsys = static_library( 'vc4winsys', files('vc4_drm_winsys.c'), include_directories : [ inc_src, inc_include, - inc_gallium, inc_gallium_aux, inc_gallium_drivers, + inc_gallium, inc_gallium_aux, inc_gallium_drivers, inc_gallium_winsys, ], - c_args : [c_vis_args], + c_args : [c_vis_args, vc4_winsys_c_args], ) diff --git a/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c b/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c index 73717d25fe4..4215857d06b 100644 --- a/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c +++ b/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c @@ -23,15 +23,36 @@ #include <unistd.h> #include <fcntl.h> +#include <sys/ioctl.h> #include "renderonly/renderonly.h" +#include "kmsro/drm/kmsro_drm_public.h" #include "vc4_drm_public.h" #include "vc4/vc4_screen.h" +#include "drm-uapi/vc4_drm.h" struct pipe_screen * vc4_drm_screen_create(int fd) { - return vc4_screen_create(fcntl(fd, F_DUPFD_CLOEXEC, 3), NULL); + bool v3d_present = true; + +#ifndef USE_VC4_SIMULATOR + struct drm_vc4_get_param ident0 = { + .param = DRM_VC4_PARAM_V3D_IDENT0, + }; + + int ret = ioctl(fd, DRM_IOCTL_VC4_GET_PARAM, &ident0); + v3d_present = ret == 0; +#endif + + if (v3d_present) + return vc4_screen_create(fcntl(fd, F_DUPFD_CLOEXEC, 3), NULL); + +#ifdef GALLIUM_KMSRO + return kmsro_drm_screen_create(fd); +#endif + + return NULL; } struct pipe_screen * |