diff --git a/src/asahi/drm-shim/asahi_noop.c b/src/asahi/drm-shim/asahi_noop.c new file mode 100644 index 00000000000..7d81d38ccd4 --- /dev/null +++ b/src/asahi/drm-shim/asahi_noop.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2022 Alyssa Rosenzweig + * Copyright © 2018 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "drm-shim/drm_shim.h" + +bool drm_shim_driver_prefers_first_render_node = true; + +static ioctl_fn_t driver_ioctls[] = { + /* The Asahi Linux UAPI is not yet upstream */ +}; + +void +drm_shim_driver_init(void) +{ + shim_device.bus_type = DRM_BUS_PLATFORM; + shim_device.driver_name = "asahi"; + shim_device.driver_ioctls = driver_ioctls; + shim_device.driver_ioctl_count = ARRAY_SIZE(driver_ioctls); + + drm_shim_override_file("DRIVER=asahi\n" + "OF_FULLNAME=/soc/agx\n" + "OF_COMPATIBLE_0=apple,gpu-g13g\n" + "OF_COMPATIBLE_N=1\n", + "/sys/dev/char/%d:%d/device/uevent", DRM_MAJOR, + render_node_minor); +} diff --git a/src/asahi/drm-shim/meson.build b/src/asahi/drm-shim/meson.build new file mode 100644 index 00000000000..c4058b170c7 --- /dev/null +++ b/src/asahi/drm-shim/meson.build @@ -0,0 +1,28 @@ +# Copyright © 2019 Broadcom +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +libasahi_noop_drm_shim = shared_library( + 'asahi_noop_drm_shim', + 'asahi_noop.c', + include_directories: [inc_include, inc_src], + dependencies: dep_drm_shim, + gnu_symbol_visibility : 'hidden', + install : true, +) diff --git a/src/asahi/meson.build b/src/asahi/meson.build index 82f1df933ba..6bf4ef96eba 100644 --- a/src/asahi/meson.build +++ b/src/asahi/meson.build @@ -26,3 +26,7 @@ inc_asahi = include_directories([ subdir('layout') subdir('lib') subdir('compiler') + +if with_tools.contains('drm-shim') + subdir('drm-shim') +endif