gallium/radeon: import libdrm_radeon source code, drop the dependency

Only radeon_surface.h/c is used from libdrm and radeon_drm.h is imported
too. This code doesn't change anymore. We don't need the dependency.

Acked-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31827>
This commit is contained in:
Marek Olšák 2024-10-24 10:23:01 -04:00 committed by Marge Bot
parent ae9d365686
commit 1299f5c50a
9 changed files with 3805 additions and 11 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1627,18 +1627,15 @@ endif
# even if driver foo requires 2.4.0 and driver bar requires 2.4.3, if foo and
# bar are both on use 2.4.3 for both of them
dep_libdrm_amdgpu = null_dep
dep_libdrm_radeon = null_dep
dep_libdrm_intel = null_dep
_drm_amdgpu_ver = '2.4.121'
_drm_radeon_ver = '2.4.71'
_drm_intel_ver = '2.4.75'
_drm_ver = '2.4.109'
_libdrm_checks = [
['intel', with_gallium_i915],
['amdgpu', (with_amd_vk and not with_platform_windows) or with_gallium_radeonsi],
['radeon', (with_gallium_radeonsi or with_gallium_r300 or with_gallium_r600)],
]
# Loop over the enables versions and get the highest libdrm requirement for all

View File

@ -121,7 +121,7 @@ libr300 = static_library(
inc_mesa,
],
gnu_symbol_visibility : 'hidden',
dependencies : [dep_libdrm_radeon, dep_llvm, idep_mesautil, idep_nir, idep_xmlconfig],
dependencies : [dep_llvm, idep_mesautil, idep_nir, idep_xmlconfig],
)
driver_r300 = declare_dependency(

View File

@ -168,7 +168,7 @@ libr600 = static_library(
inc_src, inc_mapi, inc_mesa, inc_include, inc_gallium, inc_gallium_aux, inc_amd_common,
inc_gallium_drivers,
],
dependencies: [dep_libdrm_radeon, dep_elf, dep_llvm, idep_nir, idep_nir_headers, idep_mesautil],
dependencies: [dep_elf, dep_llvm, idep_nir, idep_nir_headers, idep_mesautil],
)
driver_r600 = declare_dependency(

View File

@ -105,7 +105,7 @@ files_libradeonsi = files(
radeonsi_include_dirs = [inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_amd_common,
inc_amd_common_llvm, inc_gallium_drivers, inc_compiler, inc_amd, inc_amd_vpe]
radeonsi_deps = [dep_llvm, dep_clock, dep_libdrm_radeon, idep_nir_headers, idep_amdgfxregs_h, idep_mesautil, idep_aco, idep_u_tracepoints, idep_si_tracepoints]
radeonsi_deps = [dep_llvm, dep_clock, dep_libdrm, idep_nir_headers, idep_amdgfxregs_h, idep_mesautil, idep_aco, idep_u_tracepoints, idep_si_tracepoints]
if with_perfetto
radeonsi_deps += dep_perfetto

View File

@ -3,10 +3,16 @@
libradeonwinsys = static_library(
'radeonwinsys',
files('radeon_drm_bo.c', 'radeon_drm_bo.h', 'radeon_drm_cs.c',
'radeon_drm_cs.h', 'radeon_drm_surface.c',
'radeon_drm_winsys.c', 'radeon_drm_winsys.h'),
files('radeon_drm_bo.c',
'radeon_drm_bo.h',
'radeon_drm_cs.c',
'radeon_drm_cs.h',
'radeon_drm_surface.c',
'radeon_drm_winsys.c',
'radeon_drm_winsys.h',
'radeon_surface.c',
'radeon_surface.h'),
include_directories : [inc_src, inc_include, inc_gallium, inc_gallium_aux],
gnu_symbol_visibility : 'hidden',
dependencies : [dep_libdrm_radeon, idep_mesautil],
dependencies : [idep_mesautil, dep_libdrm],
)

View File

@ -12,7 +12,7 @@
#include "pipebuffer/pb_slab.h"
#include "util/u_queue.h"
#include "util/list.h"
#include <radeon_drm.h>
#include "drm-uapi/radeon_drm.h"
struct radeon_drm_cs;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,151 @@
/*
* Copyright © 2011 Red Hat All Rights Reserved.
*
* 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, sub license, 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 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
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
* AND/OR ITS SUPPLIERS 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.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*/
/*
* Authors:
* Jérôme Glisse <jglisse@redhat.com>
*/
#ifndef RADEON_SURFACE_H
#define RADEON_SURFACE_H
#include <stdint.h>
/* Note :
*
* For texture array, the n layer are stored one after the other within each
* mipmap level. 0 value for field than can be hint is always valid.
*/
#define RADEON_SURF_MAX_LEVEL 32
#define RADEON_SURF_TYPE_MASK 0xFF
#define RADEON_SURF_TYPE_SHIFT 0
#define RADEON_SURF_TYPE_1D 0
#define RADEON_SURF_TYPE_2D 1
#define RADEON_SURF_TYPE_3D 2
#define RADEON_SURF_TYPE_CUBEMAP 3
#define RADEON_SURF_TYPE_1D_ARRAY 4
#define RADEON_SURF_TYPE_2D_ARRAY 5
#define RADEON_SURF_MODE_MASK 0xFF
#define RADEON_SURF_MODE_SHIFT 8
#define RADEON_SURF_MODE_LINEAR 0
#define RADEON_SURF_MODE_LINEAR_ALIGNED 1
#define RADEON_SURF_MODE_1D 2
#define RADEON_SURF_MODE_2D 3
#define RADEON_SURF_SCANOUT (1 << 16)
#define RADEON_SURF_ZBUFFER (1 << 17)
#define RADEON_SURF_SBUFFER (1 << 18)
#define RADEON_SURF_Z_OR_SBUFFER (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)
#define RADEON_SURF_HAS_SBUFFER_MIPTREE (1 << 19)
#define RADEON_SURF_HAS_TILE_MODE_INDEX (1 << 20)
#define RADEON_SURF_FMASK (1 << 21)
#define RADEON_SURF_GET(v, field) (((v) >> RADEON_SURF_ ## field ## _SHIFT) & RADEON_SURF_ ## field ## _MASK)
#define RADEON_SURF_SET(v, field) (((v) & RADEON_SURF_ ## field ## _MASK) << RADEON_SURF_ ## field ## _SHIFT)
#define RADEON_SURF_CLR(v, field) ((v) & ~(RADEON_SURF_ ## field ## _MASK << RADEON_SURF_ ## field ## _SHIFT))
/* first field up to mode need to match r6 struct so that we can reuse
* same function for linear & linear aligned
*/
struct radeon_surface_level {
uint64_t offset;
uint64_t slice_size;
uint32_t npix_x;
uint32_t npix_y;
uint32_t npix_z;
uint32_t nblk_x;
uint32_t nblk_y;
uint32_t nblk_z;
uint32_t pitch_bytes;
uint32_t mode;
};
enum si_tiling_mode {
SI_TILING_AUTO = 0,
SI_TILING_COLOR_1D,
SI_TILING_COLOR_1D_SCANOUT,
SI_TILING_COLOR_2D_8BPP,
SI_TILING_COLOR_2D_16BPP,
SI_TILING_COLOR_2D_32BPP,
SI_TILING_COLOR_2D_64BPP,
SI_TILING_COLOR_2D_SCANOUT_16BPP,
SI_TILING_COLOR_2D_SCANOUT_32BPP,
SI_TILING_COLOR_LINEAR,
SI_TILING_STENCIL_1D,
SI_TILING_STENCIL_2D,
SI_TILING_STENCIL_2D_2AA,
SI_TILING_STENCIL_2D_4AA,
SI_TILING_STENCIL_2D_8AA,
SI_TILING_DEPTH_1D,
SI_TILING_DEPTH_2D,
SI_TILING_DEPTH_2D_2AA,
SI_TILING_DEPTH_2D_4AA,
SI_TILING_DEPTH_2D_8AA,
SI_TILING_LAST_MODE,
};
struct radeon_surface {
uint32_t npix_x;
uint32_t npix_y;
uint32_t npix_z;
uint32_t blk_w;
uint32_t blk_h;
uint32_t blk_d;
uint32_t array_size;
uint32_t last_level;
uint32_t bpe;
uint32_t nsamples;
uint32_t flags;
/* Following is updated/fill by the allocator. It's allowed to
* set some of the value but they are use as hint and can be
* overridden (things lile bankw/bankh on evergreen for
* instance).
*/
uint64_t bo_size;
uint64_t bo_alignment;
/* apply to eg */
uint32_t bankw;
uint32_t bankh;
uint32_t mtilea;
uint32_t tile_split;
uint32_t stencil_tile_split;
uint64_t stencil_offset;
struct radeon_surface_level level[RADEON_SURF_MAX_LEVEL];
struct radeon_surface_level stencil_level[RADEON_SURF_MAX_LEVEL];
uint32_t tiling_index[RADEON_SURF_MAX_LEVEL];
uint32_t stencil_tiling_index[RADEON_SURF_MAX_LEVEL];
};
struct radeon_surface_manager *radeon_surface_manager_new(int fd);
void radeon_surface_manager_free(struct radeon_surface_manager *surf_man);
int radeon_surface_init(struct radeon_surface_manager *surf_man,
struct radeon_surface *surf);
int radeon_surface_best(struct radeon_surface_manager *surf_man,
struct radeon_surface *surf);
#endif