...
 
Commits (8)
......@@ -134,7 +134,7 @@ if _drivers.contains('auto')
elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
_drivers = [
'pl111', 'v3d', 'vc4', 'freedreno', 'etnaviv', 'imx', 'nouveau',
'tegra', 'virgl', 'swrast',
'tegra', 'virgl', 'swrast', 'panfrost', 'rockchip'
]
else
error('Unknown architecture @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format(
......@@ -156,6 +156,8 @@ with_gallium_freedreno = _drivers.contains('freedreno')
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_rockchip = _drivers.contains('rockchip')
with_gallium_etnaviv = _drivers.contains('etnaviv')
with_gallium_imx = _drivers.contains('imx')
with_gallium_tegra = _drivers.contains('tegra')
......
......@@ -60,7 +60,7 @@ option(
choices : [
'', 'auto', 'pl111', 'radeonsi', 'r300', 'r600', 'nouveau', 'freedreno',
'swrast', 'v3d', 'vc4', 'etnaviv', 'imx', 'tegra', 'i915', 'svga', 'virgl',
'swr',
'swr', 'panfrost', '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'
)
......
......@@ -153,6 +153,7 @@ files_libnir = files(
'nir_normalize_cubemap_coords.c',
'nir_opt_conditional_discard.c',
'nir_opt_constant_folding.c',
'nir_opt_constant_channel.c',
'nir_opt_copy_prop_vars.c',
'nir_opt_copy_propagate.c',
'nir_opt_cse.c',
......
......@@ -3059,6 +3059,7 @@ bool nir_rematerialize_derefs_in_use_blocks_impl(nir_function_impl *impl);
bool nir_opt_algebraic(nir_shader *shader);
bool nir_opt_algebraic_before_ffma(nir_shader *shader);
bool nir_opt_algebraic_late(nir_shader *shader);
bool nir_opt_constant_channel(nir_shader *shader);
bool nir_opt_constant_folding(nir_shader *shader);
bool nir_opt_global_to_local(nir_shader *shader);
......
/*
* Copyright © 2018 Alyssa Rosenzweig
* Copyright © 2014 Intel Corporation
*
* 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 "nir.h"
#include "nir_builder.h"
/** @file nir_opt_constant_channel.c
*
* Optimizes simple arithmetic operations involving vector constants with
* redundant channels. For instance, (v + vec2(f, 0)) will be optimized to
* vec2(v.x, v.y + f). In an ideal case with a single "active" component, this
* optimizes the vector operation into an equivalent scalar operation, aiding
* scheduling on vector backends.
*/
/* Returns the identity magic number for a given op, where performing the
* operation is a no-op. For instance, for addition this is zero, per the
* additive identity.
*/
static int
get_operation_identity(nir_op op, bool *incomplete)
{
switch (op) {
case nir_op_fadd:
return 0;
case nir_op_fmul:
return 1;
default:
*incomplete = true;
return -1;
}
}
/* Tiny helper to find destination of instruction to be rewritten */
static nir_dest*
get_dest_for_instr(nir_instr *instr)
{
if (instr->type == nir_instr_type_alu)
return &nir_instr_as_alu(instr)->dest.dest;
else if (instr->type == nir_instr_type_intrinsic)
return &nir_instr_as_intrinsic(instr)->dest;
else
return NULL;
}
static bool
nir_opt_constant_channel_block(nir_builder *b, nir_block *block, nir_function_impl *impl)
{
nir_foreach_instr_safe(instr, block) {
if (instr->type == nir_instr_type_alu) {
nir_alu_instr *alu = nir_instr_as_alu(instr);
/* Check if it's a binary ALU instruction we know. If we know it, find the identity */
bool unknown_op = false;
int identity = get_operation_identity(alu->op, &unknown_op);
if (unknown_op) continue;
/* We need one of the operands to be a constant; otherwise, there's
* nothing to do. Search for the constan. Practically, there is only
* one due to constant folding. */
assert(nir_op_infos[alu->op].num_inputs == 2);
nir_load_const_instr* load_const = NULL;
unsigned active_writemask = 0, components = 0, idx = 0;
for (unsigned i = 0; i < 2; i++) {
if (!alu->src[i].src.is_ssa)
continue;
nir_instr *src_instr = alu->src[i].src.ssa->parent_instr;
if (src_instr->type != nir_instr_type_load_const)
continue;
assert(!alu->src[i].abs && !alu->src[i].negate);
load_const = nir_instr_as_load_const(src_instr);
/* TODO: Handle non-SSA, non-fp32 cases */
if (load_const->def.bit_size != 32)
continue;
if (!alu->dest.dest.is_ssa) continue;
printf("Found a fp32 constant <");
/* We have the constant: scan it for redundant (identity) components in order to construct a writemask */
components = nir_ssa_alu_instr_src_components(alu, i);
for (unsigned j = 0; j < components; ++j) {
float v = load_const->value.f32[alu->src[i].swizzle[j]];
printf("%f, ", v);
if (v != identity)
active_writemask |= (1 << j);
}
printf(">\n");
idx = i;
break;
}
if (!load_const)
continue;
/* If all components are used, there's nothing to do */
if (active_writemask == ((1 << components) - 1))
continue;
/* We need to mask out some components, which conflicts with SSA.
* Generate a vec instruction instead, which can be coalesced to a
* register later by nir_lower_vec_to_movs etc. */
b->cursor = nir_after_instr(instr);
nir_ssa_def *comps[4];
/* We don't know how to handle registers */
if (!alu->dest.dest.is_ssa)
continue;
nir_ssa_def *passthrough = alu->src[1 - idx].src.ssa;
nir_ssa_def *result = &alu->dest.dest.ssa;
unsigned active_c = 0;
for (unsigned c = 0; c < components; ++c) {
/* Eliminate the component from the ALU operation */
if (active_writemask & (1 << c)) {
alu->src[idx].swizzle[active_c] = c;
alu->src[1 - idx].swizzle[active_c] = c;
comps[c] = nir_channel(b, result, active_c);
++active_c;
} else {
comps[c] = nir_channel(b, passthrough, c);
result->num_components--;
}
}
alu->dest.write_mask = (1 << result->num_components) - 1;
nir_ssa_def *vec = nir_vec(b, comps, components);
/* Now rewrite to use our vector instead */
nir_ssa_def_rewrite_uses_after(result, nir_src_for_ssa(vec), vec->parent_instr);
#if 0
nir_instr *dynamic_src_instr = alu->src[1 - idx].src.ssa->parent_instr;
/* Get the destination to rewrite into a register */
nir_dest *dest2 = get_dest_for_instr(instr);
if (!dest2)
continue;
if (alu->dest.dest.is_ssa) {
nir_register *reg = nir_local_reg_create(impl);
reg->num_components = alu->dest.dest.ssa.num_components;
reg->bit_size = alu->dest.dest.ssa.bit_size;
#if 0
nir_ssa_def_rewrite_uses(alu->src[1 - idx].src.ssa, nir_src_for_reg(reg));
nir_ssa_def_rewrite_uses(&alu->dest.dest.ssa, nir_src_for_reg(reg));
nir_instr_rewrite_dest(&alu->instr, &alu->dest.dest,
nir_dest_for_reg(reg));
#endif
nir_instr_rewrite_dest(dynamic_src_instr, dest2,
nir_dest_for_reg(reg));
printf("Writemask %X\n", active_writemask);
alu->dest.write_mask = active_writemask;
}
#endif
}
}
return false;
}
bool
nir_opt_constant_channel(nir_shader *shader)
{
bool progress = false;
nir_builder builder;
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder_init(&builder, function->impl);
nir_foreach_block_safe(block, function->impl) {
progress |= nir_opt_constant_channel_block(&builder, block, function->impl);
}
}
}
return progress;
}
......@@ -1285,7 +1285,7 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
* Every hardware driver_name is set using strdup. Doing the same in
* here will allow is to simply free the memory at dri2_terminate().
*/
dri2_dpy->driver_name = strdup("swrast");
dri2_dpy->driver_name = strdup("panfrost");
if (!dri2_load_driver_swrast(disp))
goto cleanup;
......
......@@ -111,6 +111,11 @@ static const struct drm_driver_descriptor driver_descriptors[] = {
.create_screen = pipe_pl111_create_screen,
.configuration = pipe_default_configuration_query,
},
{
.driver_name = "rockchip",
.create_screen = pipe_rockchip_create_screen,
.configuration = pipe_default_configuration_query,
},
{
.driver_name = "virtio_gpu",
.create_screen = pipe_virgl_create_screen,
......@@ -126,6 +131,11 @@ static const struct drm_driver_descriptor driver_descriptors[] = {
.create_screen = pipe_vc4_create_screen,
.configuration = pipe_default_configuration_query,
},
{
.driver_name = "panfrost",
.create_screen = pipe_panfrost_create_screen,
.configuration = pipe_default_configuration_query,
},
{
.driver_name = "etnaviv",
.create_screen = pipe_etna_create_screen,
......
......@@ -106,6 +106,29 @@ pipe_pl111_create_screen(int fd, const struct pipe_screen_config *config)
#endif
#ifdef GALLIUM_ROCKCHIP
#include "rockchip/drm/rockchip_drm_public.h"
struct pipe_screen *
pipe_rockchip_create_screen(int fd, const struct pipe_screen_config *config)
{
struct pipe_screen *screen;
screen = rockchip_drm_screen_create(fd);
return screen ? debug_screen_wrap(screen) : NULL;
}
#else
struct pipe_screen *
pipe_rockchip_create_screen(int fd, const struct pipe_screen_config *config)
{
fprintf(stderr, "rockchip: driver missing\n");
return NULL;
}
#endif
#ifdef GALLIUM_R300
#include "radeon/radeon_winsys.h"
#include "radeon/drm/radeon_drm_public.h"
......@@ -356,6 +379,29 @@ pipe_etna_create_screen(int fd, const struct pipe_screen_config *config)
#endif
#if 0
#include "panfrost/drm/panfrost_drm_public.h"
struct pipe_screen *
pipe_panfrost_create_screen(int fd, const struct pipe_screen_config *config)
{
struct pipe_screen *screen;
screen = panfrost_drm_screen_create(fd);
return screen ? debug_screen_wrap(screen) : NULL;
}
#else
struct pipe_screen *
pipe_panfrost_create_screen(int fd, const struct pipe_screen_config *config)
{
fprintf(stderr, "panfrost: driver missing\n");
return NULL;
}
#endif
#ifdef GALLIUM_IMX
#include "imx/drm/imx_drm_public.h"
......
......@@ -42,6 +42,12 @@ pipe_v3d_create_screen(int fd, const struct pipe_screen_config *config);
struct pipe_screen *
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_panfrost_create_screen(int fd, const struct pipe_screen_config *config);
struct pipe_screen *
pipe_pl111_create_screen(int fd, const struct pipe_screen_config *config);
......
......@@ -18,6 +18,10 @@
#include "softpipe/sp_public.h"
#endif
#ifdef GALLIUM_PANFROST
#include "panfrost/pan_public.h"
#endif
#ifdef GALLIUM_LLVMPIPE
#include "llvmpipe/lp_public.h"
#endif
......@@ -55,6 +59,11 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
screen = swr_create_screen(winsys);
#endif
#if defined(GALLIUM_PANFROST)
if (screen == NULL && strcmp(driver, "panfrost") == 0)
screen = panfrost_create_screen(winsys);
#endif
return screen;
}
......@@ -71,6 +80,8 @@ sw_screen_create(struct sw_winsys *winsys)
default_driver = "softpipe";
#elif defined(GALLIUM_SWR)
default_driver = "swr";
#elif defined(GALLIUM_PANFROST)
default_driver = "panfrost";
#else
default_driver = "";
#endif
......
......@@ -24,6 +24,10 @@
#include "swr/swr_public.h"
#endif
#ifdef GALLIUM_PANFROST
#include "panfrost/pan_public.h"
#endif
#ifdef GALLIUM_VIRGL
#include "virgl/virgl_public.h"
#include "virgl/vtest/virgl_vtest_public.h"
......@@ -57,6 +61,11 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
screen = swr_create_screen(winsys);
#endif
#if defined(GALLIUM_PANFROST)
if (screen == NULL && strcmp(driver, "panfrost") == 0)
screen = panfrost_create_screen(-1, (struct renderonly *) winsys);
#endif
return screen;
}
......@@ -73,6 +82,8 @@ sw_screen_create(struct sw_winsys *winsys)
default_driver = "softpipe";
#elif defined(GALLIUM_SWR)
default_driver = "swr";
#elif defined(GALLIUM_PANFROST)
default_driver = "panfrost";
#else
default_driver = "";
#endif
......
......@@ -83,6 +83,12 @@ if with_gallium_freedreno
else
driver_freedreno = declare_dependency()
endif
if with_gallium_panfrost
subdir('winsys/panfrost/drm')
subdir('drivers/panfrost')
else
driver_panfrost = declare_dependency()
endif
if with_gallium_vc4
subdir('winsys/vc4/drm')
subdir('drivers/vc4')
......@@ -94,6 +100,11 @@ if with_gallium_pl111
else
driver_pl111 = declare_dependency()
endif
if with_gallium_rockchip
subdir('winsys/rockchip/drm')
else
driver_rockchip = declare_dependency()
endif
if with_gallium_v3d
subdir('winsys/v3d/drm')
subdir('drivers/v3d')
......
......@@ -58,11 +58,12 @@ 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_swr, driver_panfrost, driver_rockchip
],
)
foreach d : [[with_gallium_pl111, 'pl111_dri.so'],
[with_gallium_rockchip, 'rockchip_dri.so'],
[with_gallium_radeonsi, 'radeonsi_dri.so'],
[with_gallium_nouveau, 'nouveau_dri.so'],
[with_gallium_freedreno, ['msm_dri.so', 'kgsl_dri.so']],
......@@ -70,6 +71,7 @@ foreach d : [[with_gallium_pl111, 'pl111_dri.so'],
[with_gallium_softpipe and with_gallium_drisw_kms, 'kms_swrast_dri.so'],
[with_gallium_v3d, 'v3d_dri.so'],
[with_gallium_vc4, 'vc4_dri.so'],
[with_gallium_panfrost, 'panfrost_dri.so'],
[with_gallium_etnaviv, 'etnaviv_dri.so'],
[with_gallium_imx, 'imx-drm_dri.so'],
[with_gallium_tegra, 'tegra_dri.so'],
......
......@@ -82,6 +82,16 @@ DEFINE_LOADER_DRM_ENTRYPOINT(pl111)
#endif
#endif
#if defined(GALLIUM_PANFROST)
const __DRIextension **__driDriverGetExtensions_panfrost(void);
PUBLIC const __DRIextension **__driDriverGetExtensions_panfrost(void)
{
globalDriverAPI = &galliumsw_driver_api;
return galliumsw_driver_extensions;
}
#endif
#if defined(GALLIUM_ETNAVIV)
DEFINE_LOADER_DRM_ENTRYPOINT(imx_drm)
DEFINE_LOADER_DRM_ENTRYPOINT(etnaviv)
......
# Copyright (C) 2014 Emil Velikov <emil.l.velikov@gmail.com>
#
# 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_vc4
include $(GALLIUM_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
# Copyright © 2014 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 Makefile.sources
include $(top_srcdir)/src/gallium/Automake.inc
AM_CFLAGS = \
-I$(top_srcdir)/src/gallium/drivers \
$(GALLIUM_WINSYS_CFLAGS)
noinst_LTLIBRARIES = libvc4drm.la
libvc4drm_la_SOURCES = $(C_SOURCES)
EXTRA_DIST = meson.build
C_SOURCES := \
vc4_drm_public.h \
vc4_drm_winsys.c
# Copyright © 2017 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.
libpanfrostwinsys = static_library(
'panfrostwinsys',
files('panfrost_drm_winsys.c'),
include_directories : [
inc_src, inc_include,
inc_gallium, inc_gallium_aux, inc_gallium_drivers,
],
c_args : [c_vis_args],
)
/*
* Copyright © 2014 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.
*/
#ifndef __PAN_DRM_PUBLIC_H__
#define __PAN_DRM_PUBLIC_H__
struct pipe_screen;
struct renderonly;
struct pipe_screen *panfrost_drm_screen_create(int drmFD);
struct pipe_screen *panfrost_drm_screen_create_renderonly(struct renderonly *ro);
#endif /* __PAN_DRM_PUBLIC_H__ */
/*
* Copyright © 2014 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 <unistd.h>
#include <fcntl.h>
#include "renderonly/renderonly.h"
#include "panfrost_drm_public.h"
#include "panfrost/pan_public.h"
struct pipe_screen *
panfrost_drm_screen_create(int fd)
{
return panfrost_create_screen(fcntl(fd, F_DUPFD_CLOEXEC, 3), NULL);
}
struct pipe_screen *
panfrost_drm_screen_create_renderonly(struct renderonly *ro)
{
return panfrost_create_screen(fcntl(ro->gpu_fd, F_DUPFD_CLOEXEC, 3), ro);
}
# Copyright (C) 2014 Emil Velikov <emil.l.velikov@gmail.com>
#
# 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_pl111
include $(GALLIUM_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
# Copyright © 2012 Intel Corporation
#
# 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 = libpl111drm.la
libpl111drm_la_SOURCES = $(C_SOURCES)
EXTRA_DIST = meson.build
C_SOURCES := \
pl111_drm_public.h \
pl111_drm_winsys.c
# Copyright © 2017 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.
librockchipwinsys = static_library(
'rockchipwinsys',
files('rockchip_drm_winsys.c'),
include_directories : [
inc_src, inc_include,
inc_gallium, inc_gallium_aux, inc_gallium_winsys,
],
c_args : [c_vis_args],
dependencies: dep_libdrm,
link_with : libpanfrostwinsys,
)
driver_rockchip = declare_dependency(
compile_args : '-DGALLIUM_ROCKCHIP',
link_with : librockchipwinsys,
)
/*
* Copyright (C) 2016 Christian Gmeiner <christian.gmeiner@gmail.com>
*
* 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.
*
* Authors:
* Christian Gmeiner <christian.gmeiner@gmail.com>
*/
#ifndef __ROCKCHIP_DRM_PUBLIC_H__
#define __ROCKCHIP_DRM_PUBLIC_H__
struct pipe_screen;
struct pipe_screen *rockchip_drm_screen_create(int fd);
#endif /* __ROCKCHIP_DRM_PUBLIC_H__ */
/*
* Copyright (C) 2016 Christian Gmeiner <christian.gmeiner@gmail.com>
* Copyright (C) 2017 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 <fcntl.h>
#include <unistd.h>
#include "rockchip_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 *rockchip_drm_screen_create(int fd)
{
struct renderonly ro = {
/* Passes the panfrost-allocated BO through to the rockchip DRM device using
* PRIME buffer sharing. The VC4 BO must be linear, which the SCANOUT
* flag on allocation will have ensured.
*/
.create_for_resource = renderonly_create_gpu_import_for_resource,
.kms_fd = fd,
.gpu_fd = drmOpenWithType("panfrost", NULL, DRM_NODE_RENDER),
};
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;
}
......@@ -746,7 +746,7 @@ driswDestroyScreen(struct glx_screen *base)
free(psc);
}
#define SWRAST_DRIVER_NAME "swrast"
#define SWRAST_DRIVER_NAME "panfrost"
static void *
driOpenSwrast(void)
......