lima,panfrost: Move lima_tiling.c/h to /src/panfrost

This will allow both drivers to share this code. Both drivers
build-tested with meson. Android build not tested.

v2: Change naming from tiling->shared, in case Lima and Panfrost can
share more in the future. Fix Android build system.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-and-tested-by: Qiang Yu <yuq825@gmail.com>
This commit is contained in:
Alyssa Rosenzweig 2019-06-18 11:16:21 -07:00
parent c57b4c86c0
commit 413242277a
12 changed files with 166 additions and 34 deletions

View File

@ -67,8 +67,6 @@ LOCAL_SRC_FILES := \
lima_submit.h \
lima_texture.c \
lima_texture.h \
lima_tiling.c \
lima_tiling.h \
lima_util.c \
lima_util.h

View File

@ -44,7 +44,7 @@
#include "lima_resource.h"
#include "lima_bo.h"
#include "lima_util.h"
#include "lima_tiling.h"
#include "pan_tiling.h"
static struct pipe_resource *
lima_resource_create_scanout(struct pipe_screen *pscreen,
@ -505,7 +505,7 @@ lima_transfer_map(struct pipe_context *pctx,
trans->staging = malloc(ptrans->stride * ptrans->box.height * ptrans->box.depth);
if (usage & PIPE_TRANSFER_READ)
lima_load_tiled_image(trans->staging, bo->map + res->levels[level].offset,
panfrost_load_tiled_image(trans->staging, bo->map + res->levels[level].offset,
&ptrans->box,
ptrans->stride,
res->levels[level].stride,
@ -545,7 +545,7 @@ lima_transfer_unmap(struct pipe_context *pctx,
if (trans->staging) {
pres = &res->base;
if (ptrans->usage & PIPE_TRANSFER_WRITE)
lima_store_tiled_image(bo->map + res->levels[ptrans->level].offset, trans->staging,
panfrost_store_tiled_image(bo->map + res->levels[ptrans->level].offset, trans->staging,
&ptrans->box,
res->levels[ptrans->level].stride,
ptrans->stride,

View File

@ -69,8 +69,6 @@ files_lima = files(
'lima_texture.h',
'lima_fence.c',
'lima_fence.h',
'lima_tiling.c',
'lima_tiling.h',
)
liblima = static_library(
@ -78,12 +76,13 @@ liblima = static_library(
files_lima,
include_directories : [
inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_gallium_drivers,
inc_panfrost
],
dependencies : [dep_libdrm, idep_nir_headers],
)
driver_lima = declare_dependency(
compile_args : '-DGALLIUM_LIMA',
link_with : [liblima, liblimawinsys],
link_with : [liblima, liblimawinsys, libpanfrost_shared],
dependencies : idep_nir,
)

View File

@ -63,7 +63,7 @@ files_panfrost = files(
'pan_tiler.c',
)
inc_panfrost = [
panfrost_includes = [
inc_common,
inc_gallium,
inc_gallium_aux,
@ -99,7 +99,7 @@ libpanfrost = static_library(
dep_libdrm,
idep_nir
],
include_directories : inc_panfrost,
include_directories : panfrost_includes,
c_args : [c_vis_args, c_msvc_compat_args, compile_args_panfrost],
)
@ -151,7 +151,7 @@ files_pandecode = files(
pandecode = executable(
'pandecode',
files_pandecode,
include_directories : inc_panfrost,
include_directories : panfrost_includes,
dependencies : [
dep_thread,
],

View File

@ -70,6 +70,9 @@ endif
if with_gallium_freedreno or with_freedreno_vk
subdir('freedreno')
endif
if with_gallium_panfrost or with_gallium_lima
subdir('panfrost')
endif
if with_dri_i965 or with_intel_vk or with_gallium_iris
subdir('intel')
endif

28
src/panfrost/Android.mk Normal file
View File

@ -0,0 +1,28 @@
# Mesa 3-D graphics library
#
# Copyright (C)
#
# 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.
# Android.mk for libpanfrost_*
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/Makefile.sources
include $(LOCAL_PATH)/Android.shared.mk

View File

@ -0,0 +1,43 @@
# Mesa 3-D graphics library
#
# Copyright (C)
#
# 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.
# Android.mk for libpanfrost_shared.a
# ---------------------------------------
# Build libpanfrost_shared
# ---------------------------------------
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(shared_SOURCES)
LOCAL_C_INCLUDES := \
LOCAL_STATIC_LIBRARIES := \
LOCAL_MODULE := libpanfrost_shared
LOCAL_GENERATED_SOURCES := \
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)

View File

@ -0,0 +1,3 @@
shared_FILES := \
shared/pan_tiling.c \
shared/pan_tiling.h

24
src/panfrost/meson.build Normal file
View File

@ -0,0 +1,24 @@
# Copyright © 2018 Rob Clark
# Copyright © 2019 Collabora
# 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.
inc_panfrost = include_directories(['.', 'shared'])
subdir('shared')

View File

@ -0,0 +1,34 @@
# Copyright © 2018 Rob Clark
# Copyright © 2019 Collabora
# 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.
libpanfrost_shared_files = files(
'pan_tiling.c',
'pan_tiling.h',
)
libpanfrost_shared = static_library(
'panfrost_shared',
[libpanfrost_shared_files],
include_directories : [inc_common],
c_args : [c_vis_args, no_override_init_args],
cpp_args : [cpp_vis_args],
build_by_default : false,
)

View File

@ -24,7 +24,7 @@
*
*/
#include "lima_tiling.h"
#include "pan_tiling.h"
uint32_t space_filler[16][16] = {
{ 0, 1, 4, 5, 16, 17, 20, 21, 64, 65, 68, 69, 80, 81, 84, 85, },
@ -46,7 +46,7 @@ uint32_t space_filler[16][16] = {
};
static void
lima_store_tiled_image_bpp4(void *dst, const void *src,
panfrost_store_tiled_image_bpp4(void *dst, const void *src,
const struct pipe_box *box,
uint32_t dst_stride,
uint32_t src_stride)
@ -71,7 +71,7 @@ lima_store_tiled_image_bpp4(void *dst, const void *src,
}
static void
lima_store_tiled_image_generic(void *dst, const void *src,
panfrost_store_tiled_image_generic(void *dst, const void *src,
const struct pipe_box *box,
uint32_t dst_stride,
uint32_t src_stride,
@ -99,7 +99,7 @@ lima_store_tiled_image_generic(void *dst, const void *src,
}
static void
lima_load_tiled_image_bpp4(void *dst, const void *src,
panfrost_load_tiled_image_bpp4(void *dst, const void *src,
const struct pipe_box *box,
uint32_t dst_stride,
uint32_t src_stride)
@ -124,7 +124,7 @@ lima_load_tiled_image_bpp4(void *dst, const void *src,
}
static void
lima_load_tiled_image_generic(void *dst, const void *src,
panfrost_load_tiled_image_generic(void *dst, const void *src,
const struct pipe_box *box,
uint32_t dst_stride,
uint32_t src_stride,
@ -152,7 +152,7 @@ lima_load_tiled_image_generic(void *dst, const void *src,
}
void
lima_store_tiled_image(void *dst, const void *src,
panfrost_store_tiled_image(void *dst, const void *src,
const struct pipe_box *box,
uint32_t dst_stride,
uint32_t src_stride,
@ -160,15 +160,15 @@ lima_store_tiled_image(void *dst, const void *src,
{
switch (bpp) {
case 4:
lima_store_tiled_image_bpp4(dst, src, box, dst_stride, src_stride);
panfrost_store_tiled_image_bpp4(dst, src, box, dst_stride, src_stride);
break;
default:
lima_store_tiled_image_generic(dst, src, box, dst_stride, src_stride, bpp);
panfrost_store_tiled_image_generic(dst, src, box, dst_stride, src_stride, bpp);
}
}
void
lima_load_tiled_image(void *dst, const void *src,
panfrost_load_tiled_image(void *dst, const void *src,
const struct pipe_box *box,
uint32_t dst_stride,
uint32_t src_stride,
@ -176,9 +176,9 @@ lima_load_tiled_image(void *dst, const void *src,
{
switch (bpp) {
case 4:
lima_load_tiled_image_bpp4(dst, src, box, dst_stride, src_stride);
panfrost_load_tiled_image_bpp4(dst, src, box, dst_stride, src_stride);
break;
default:
lima_load_tiled_image_generic(dst, src, box, dst_stride, src_stride, bpp);
panfrost_load_tiled_image_generic(dst, src, box, dst_stride, src_stride, bpp);
}
}

View File

@ -24,21 +24,21 @@
*
*/
#ifndef H_LIMA_TILING
#define H_LIMA_TILING
#ifndef H_PANFROST_TILING
#define H_PANFROST_TILING
#include "util/u_box.h"
void lima_load_tiled_image(void *dst, const void *src,
const struct pipe_box *box,
uint32_t dst_stride,
uint32_t src_stride,
uint32_t bpp);
void panfrost_load_tiled_image(void *dst, const void *src,
const struct pipe_box *box,
uint32_t dst_stride,
uint32_t src_stride,
uint32_t bpp);
void lima_store_tiled_image(void *dst, const void *src,
const struct pipe_box *box,
uint32_t dst_stride,
uint32_t src_stride,
uint32_t bpp);
void panfrost_store_tiled_image(void *dst, const void *src,
const struct pipe_box *box,
uint32_t dst_stride,
uint32_t src_stride,
uint32_t bpp);
#endif