asahi: Add drm-shim implementation

Forked off from v3d's. This gets us a render node which is good enough for
shader-db.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19540>
This commit is contained in:
Alyssa Rosenzweig 2022-11-04 22:32:10 -04:00 committed by Marge Bot
parent af868fcaad
commit 350be81aa3
3 changed files with 79 additions and 0 deletions

View file

@ -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);
}

View file

@ -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,
)

View file

@ -26,3 +26,7 @@ inc_asahi = include_directories([
subdir('layout')
subdir('lib')
subdir('compiler')
if with_tools.contains('drm-shim')
subdir('drm-shim')
endif