Commit 581fbdf1 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Merge branch 'meson-winsys-for-pr' into 'master'

Add Linux Meson (amlogic soc) drm winsys driver for panfrost

See merge request !18
parents 3963b614 b720a6d4
......@@ -132,7 +132,7 @@ if _drivers.contains('auto')
elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
_drivers = [
'pl111', 'v3d', 'vc4', 'freedreno', 'etnaviv', 'imx', 'nouveau',
'tegra', 'virgl', 'swrast', 'panfrost', 'rockchip'
'tegra', 'virgl', 'swrast', 'panfrost', 'meson', 'rockchip'
]
else
error('Unknown architecture @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format(
......@@ -155,6 +155,7 @@ with_gallium_softpipe = _drivers.contains('swrast')
with_gallium_vc4 = _drivers.contains('vc4')
with_gallium_v3d = _drivers.contains('v3d')
with_gallium_panfrost = _drivers.contains('panfrost')
with_gallium_meson = _drivers.contains('meson')
with_gallium_rockchip = _drivers.contains('rockchip')
with_gallium_etnaviv = _drivers.contains('etnaviv')
with_gallium_imx = _drivers.contains('imx')
......@@ -193,6 +194,9 @@ if _vulkan_drivers.contains('auto')
host_machine.system()))
endif
endif
if (with_gallium_meson or with_gallium_rockchip) and not with_gallium_panfrost
error('meson/rockchip driver requires panfrost driver')
endif
with_intel_vk = _vulkan_drivers.contains('intel')
with_amd_vk = _vulkan_drivers.contains('amd')
......
......@@ -60,7 +60,7 @@ option(
choices : [
'', 'auto', 'pl111', 'radeonsi', 'r300', 'r600', 'nouveau', 'freedreno',
'swrast', 'v3d', 'vc4', 'etnaviv', 'imx', 'tegra', 'i915', 'svga', 'virgl',
'swr', 'panfrost', 'rockchip'
'swr', 'panfrost', 'meson', 'rockchip'
],
description : 'List of gallium drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built'
)
......
......@@ -151,6 +151,11 @@ static const struct drm_driver_descriptor driver_descriptors[] = {
.create_screen = pipe_tegra_create_screen,
.configuration = pipe_default_configuration_query,
},
{
.driver_name = "meson",
.create_screen = pipe_meson_create_screen,
.configuration = pipe_default_configuration_query,
},
};
#endif
......
......@@ -449,4 +449,27 @@ pipe_tegra_create_screen(int fd, const struct pipe_screen_config *config)
#endif
#ifdef GALLIUM_MESON
#include "meson/drm/meson_drm_public.h"
struct pipe_screen *
pipe_meson_create_screen(int fd, const struct pipe_screen_config *config)
{
struct pipe_screen *screen;
screen = meson_screen_create(fd);
return screen ? debug_screen_wrap(screen) : NULL;
}
#else
struct pipe_screen *
pipe_meson_create_screen(int fd, const struct pipe_screen_config *config)
{
fprintf(stderr, "meson: driver missing\n");
return NULL;
}
#endif
#endif /* DRM_HELPER_H */
......@@ -45,6 +45,9 @@ pipe_vc4_create_screen(int fd, const struct pipe_screen_config *config);
struct pipe_screen *
pipe_rockchip_create_screen(int fd, const struct pipe_screen_config *config);
struct pipe_screen *
pipe_meson_create_screen(int fd, const struct pipe_screen_config *config);
struct pipe_screen *
pipe_panfrost_create_screen(int fd, const struct pipe_screen_config *config);
......
......@@ -147,6 +147,11 @@ if with_gallium_virgl
else
driver_virgl = declare_dependency()
endif
if with_gallium_meson
subdir('winsys/meson/drm')
else
driver_meson = declare_dependency()
endif
if with_gallium_opencl
# TODO: this isn't really clover specific, but ATM clover is the only
# consumer
......
......@@ -58,12 +58,13 @@ libgallium_dri = shared_library(
driver_swrast, driver_r300, driver_r600, driver_radeonsi, driver_nouveau,
driver_pl111, driver_v3d, driver_vc4, driver_freedreno, driver_etnaviv,
driver_imx, driver_tegra, driver_i915, driver_svga, driver_virgl,
driver_swr, driver_panfrost, driver_rockchip
driver_swr, driver_panfrost, driver_meson, driver_rockchip
],
)
foreach d : [[with_gallium_pl111, 'pl111_dri.so'],
[with_gallium_rockchip, 'rockchip_dri.so'],
[with_gallium_meson, 'meson_dri.so'],
[with_gallium_radeonsi, 'radeonsi_dri.so'],
[with_gallium_nouveau, 'nouveau_dri.so'],
[with_gallium_freedreno, ['msm_dri.so', 'kgsl_dri.so']],
......
......@@ -98,3 +98,7 @@ DEFINE_LOADER_DRM_ENTRYPOINT(etnaviv)
#if defined(GALLIUM_TEGRA)
DEFINE_LOADER_DRM_ENTRYPOINT(tegra);
#endif
#if defined(GALLIUM_MESON)
DEFINE_LOADER_DRM_ENTRYPOINT(meson)
#endif
# Copyright (c) 2017 Lima Project
#
# 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.
LOCAL_PATH := $(call my-dir)
# get C_SOURCES
include $(LOCAL_PATH)/Makefile.sources
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(C_SOURCES)
LOCAL_MODULE := libmesa_winsys_meson
include $(GALLIUM_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
# Copyright (c) 2017 Lima Project
#
# 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 Makefile.sources
include $(top_srcdir)/src/gallium/Automake.inc
AM_CFLAGS = \
-I$(top_srcdir)/src/gallium/drivers \
-I$(top_srcdir)/src/gallium/winsys \
$(GALLIUM_WINSYS_CFLAGS) \
$(LIBDRM_CFLAGS)
noinst_LTLIBRARIES = libmesondrm.la
libmesondrm_la_SOURCES = $(C_SOURCES)
C_SOURCES := \
meson_drm_public.h \
meson_drm_winsys.c
# Copyright © 2018 Lima Project
#
# 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.
libmesonwinsys = static_library(
'mesonwinsys',
files('meson_drm_winsys.c'),
include_directories : [
inc_src, inc_include,
inc_gallium, inc_gallium_aux, inc_gallium_winsys,
],
dependencies: dep_libdrm,
)
driver_meson = declare_dependency(
compile_args : '-DGALLIUM_MESON',
link_with : libmesonwinsys,
)
/*
* Copyright (c) 2017 Lima Project
*
* 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.
*/
#ifndef __MESON_DRM_PUBLIC_H__
#define __MESON_DRM_PUBLIC_H__
struct pipe_screen;
struct pipe_screen *meson_screen_create(int fd);
#endif /* __MESON_DRM_PUBLIC_H__ */
/*
* Copyright (c) 2017 Lima Project
*
* 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 <fcntl.h>
#include <unistd.h>
#include "meson_drm_public.h"
#include "panfrost/drm/panfrost_drm_public.h"
#include "xf86drm.h"
#include "pipe/p_screen.h"
#include "renderonly/renderonly.h"
struct pipe_screen *meson_screen_create(int fd)
{
struct renderonly ro = {
.create_for_resource = renderonly_create_kms_dumb_buffer_for_resource,
.kms_fd = fd,
.gpu_fd = open("/dev/mali0", O_RDWR | O_CLOEXEC),
};
if (ro.gpu_fd < 0)
return NULL;
struct pipe_screen *screen = panfrost_drm_screen_create_renderonly(&ro);
if (!screen)
close(ro.gpu_fd);
return screen;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment