Compare commits
10 Commits
7275ef8eba
...
d3f9b3ca14
Author | SHA1 | Date |
---|---|---|
LeRoyce Pearson | d3f9b3ca14 | |
Simon Ser | 362b5b0a88 | |
David Heidelberg | 1179edb49a | |
Simon Ser | f94a79a7a7 | |
Simon Ser | 5a9cfb3c59 | |
Joaquim Monteiro | 764ed8b916 | |
Joaquim Monteiro | fbb83f74d6 | |
Pierre-Eric Pelloux-Prayer | c7c3c14bfc | |
Matt Turner | c45ffb1edf | |
Matt Turner | 525e80447f |
|
@ -1 +1,3 @@
|
|||
/build*
|
||||
/build*/
|
||||
/zig-cache/
|
||||
/zig-out/
|
||||
|
|
|
@ -190,8 +190,8 @@ x86_64-freebsd-container_prep:
|
|||
variables:
|
||||
GIT_DEPTH: 10
|
||||
script:
|
||||
- meson build
|
||||
--auto-features=enabled
|
||||
- meson setup build
|
||||
--fatal-meson-warnings --auto-features=enabled
|
||||
-D udev=true
|
||||
- ninja -C build
|
||||
- ninja -C build test
|
||||
|
@ -213,7 +213,7 @@ x86_64-freebsd-container_prep:
|
|||
# the workspace to see details about the failed tests.
|
||||
- |
|
||||
set +e
|
||||
/app/vmctl exec "pkg info; cd $CI_PROJECT_NAME ; meson build --auto-features=enabled -D etnaviv=disabled -D nouveau=disabled -D valgrind=disabled && ninja -C build"
|
||||
/app/vmctl exec "pkg info; cd $CI_PROJECT_NAME ; meson setup build --fatal-meson-warnings --auto-features=enabled -D etnaviv=disabled -D nouveau=disabled -D valgrind=disabled && ninja -C build"
|
||||
set -ex
|
||||
scp -r vm:$CI_PROJECT_NAME/build/meson-logs .
|
||||
/app/vmctl exec "ninja -C $CI_PROJECT_NAME/build install"
|
||||
|
|
|
@ -95,11 +95,17 @@ static int amdgpu_get_auth(int fd, int *auth)
|
|||
|
||||
static void amdgpu_device_free_internal(amdgpu_device_handle dev)
|
||||
{
|
||||
amdgpu_device_handle *node = &dev_list;
|
||||
|
||||
/* Remove dev from dev_list, if it was added there. */
|
||||
while (*node != dev && *node && (*node)->next)
|
||||
node = &(*node)->next;
|
||||
if (dev == dev_list) {
|
||||
dev_list = dev->next;
|
||||
} else {
|
||||
for (amdgpu_device_handle node = dev_list; node; node = node->next) {
|
||||
if (node->next == dev) {
|
||||
node->next = dev->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(dev->fd);
|
||||
if ((dev->flink_fd >= 0) && (dev->fd != dev->flink_fd))
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const lib = b.addStaticLibrary(.{
|
||||
.name = "drm",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
lib.root_module.c_std = .C11;
|
||||
lib.addCSourceFiles(.{
|
||||
.files = &.{
|
||||
"xf86drm.c",
|
||||
"xf86drmHash.c",
|
||||
"xf86drmRandom.c",
|
||||
"xf86drmSL.c",
|
||||
"xf86drmMode.c",
|
||||
},
|
||||
});
|
||||
lib.addIncludePath(.{ .path = "include/drm" });
|
||||
lib.linkLibC();
|
||||
lib.defineCMacro("HAVE_OPEN_MEMSTREAM", "1");
|
||||
// TODO: Figure out if where this varies
|
||||
lib.defineCMacro("MAJOR_IN_SYSMACROS", "1");
|
||||
// lib.defineCMacro("MAJOR_IN_MKDEV", "1");
|
||||
|
||||
lib.installHeader("libsync.h", "libsync.h");
|
||||
lib.installHeader("xf86drm.h", "xf86drm.h");
|
||||
lib.installHeader("xf86drmMode.h", "xf86drmMode.h");
|
||||
|
||||
lib.installHeadersDirectoryOptions(.{
|
||||
.source_dir = .{ .path = "include/drm" },
|
||||
.install_dir = .header,
|
||||
.install_subdir = "libdrm",
|
||||
});
|
||||
|
||||
b.installArtifact(lib);
|
||||
|
||||
// const lib_unit_tests = b.addTest(.{
|
||||
// .root_source_file = .{ .path = "src/root.zig" },
|
||||
// .target = target,
|
||||
// .optimize = optimize,
|
||||
// });
|
||||
|
||||
// const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
|
||||
|
||||
// const exe_unit_tests = b.addTest(.{
|
||||
// .root_source_file = .{ .path = "src/main.zig" },
|
||||
// .target = target,
|
||||
// .optimize = optimize,
|
||||
// });
|
||||
|
||||
// const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
|
||||
// const test_step = b.step("test", "Run unit tests");
|
||||
// test_step.dependOn(&run_lib_unit_tests.step);
|
||||
// test_step.dependOn(&run_exe_unit_tests.step);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
.{
|
||||
.name = "drm",
|
||||
.version = "2.4.120",
|
||||
|
||||
// This field is optional.
|
||||
// This is currently advisory only; Zig does not yet do anything
|
||||
// with this value.
|
||||
//.minimum_zig_version = "0.11.0",
|
||||
|
||||
.dependencies = .{ },
|
||||
|
||||
// Specifies the set of files and directories that are included in this package.
|
||||
// Only files and directories listed here are included in the `hash` that
|
||||
// is computed for this package.
|
||||
// Paths are relative to the build root. Use the empty string (`""`) to refer to
|
||||
// the build root itself.
|
||||
// A directory listed here means that all files within, recursively, are included.
|
||||
.paths = .{ "" },
|
||||
}
|
|
@ -56,6 +56,6 @@ test(
|
|||
args : [
|
||||
'--lib', libdrm_exynos,
|
||||
'--symbols-file', files('exynos-symbols.txt'),
|
||||
'--nm', prog_nm.path(),
|
||||
'--nm', prog_nm.full_path(),
|
||||
],
|
||||
)
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn main() !void {
|
||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||
defer _ = gpa.deinit();
|
||||
|
||||
const argv = try std.process.argsAlloc(gpa.allocator());
|
||||
defer std.process.argsFree(gpa.allocator(), argv);
|
||||
|
||||
const filename = argv[1];
|
||||
|
||||
const contents = try std.fs.cwd().readFileAlloc(gpa.allocator(), filename, 50 * 1024 * 1024);
|
||||
defer gpa.allocator().free(contents);
|
||||
|
||||
const stdout = std.io.getStdOut();
|
||||
const out = stdout.writer();
|
||||
|
||||
try out.writeAll(
|
||||
\\/* AUTOMATICALLY GENERATED by gen_table_fourcc.py. You should modify
|
||||
\\ that script instead of adding here entries manually! */
|
||||
\\static const struct drmFormatModifierInfo drm_format_modifier_table[] = {
|
||||
\\ { DRM_MODIFIER_INVALID(NONE, INVALID) },
|
||||
\\ { DRM_MODIFIER_LINEAR(NONE, LINEAR) },
|
||||
\\
|
||||
);
|
||||
var line_iter = std.mem.splitScalar(u8, contents, '\n');
|
||||
check_each_line: while (line_iter.next()) |line| {
|
||||
errdefer std.log.debug("line = \"{}\"", .{std.zig.fmtEscapes(line)});
|
||||
if (matchStart(line, "#define I915_FORMAT_MOD_")) |after| {
|
||||
const modifier_end = std.mem.indexOfAny(u8, after, "\t ") orelse return error.Invalid;
|
||||
const modifier = after[0..modifier_end];
|
||||
for (modifier) |character| {
|
||||
if (character != '_' and !std.ascii.isAlphanumeric(character)) {
|
||||
continue :check_each_line;
|
||||
}
|
||||
}
|
||||
try out.print(
|
||||
\\ {{ DRM_MODIFIER_INTEL({[modifier]s}, {[modifier]s}) }},
|
||||
\\
|
||||
, .{
|
||||
.modifier = modifier,
|
||||
});
|
||||
} else if (matchStart(line, "#define DRM_FORMAT_MOD_")) |after| {
|
||||
const end_of_identifier = std.mem.indexOfAny(u8, after, "\t ") orelse return error.Invalid;
|
||||
const identifier = after[0..end_of_identifier];
|
||||
|
||||
const end_of_vendor = std.mem.indexOfScalar(u8, identifier, '_') orelse continue;
|
||||
const vendor_str = identifier[0..end_of_vendor];
|
||||
const modifier = identifier[end_of_vendor + 1 ..];
|
||||
|
||||
for (modifier) |character| {
|
||||
if (character != '_' and !std.ascii.isAlphanumeric(character)) {
|
||||
continue :check_each_line;
|
||||
}
|
||||
}
|
||||
|
||||
const Vendor = enum { ARM, SAMSUNG, QCOM, VIVANTE, NVIDIA, BROADCOM, ALLWINNER };
|
||||
|
||||
const vendor = std.meta.stringToEnum(Vendor, vendor_str) orelse continue;
|
||||
|
||||
if (vendor == .ARM) {
|
||||
if (std.mem.eql(u8, modifier, "TYPE_AFBC")) continue;
|
||||
if (std.mem.eql(u8, modifier, "TYPE_MISC")) continue;
|
||||
if (std.mem.eql(u8, modifier, "TYPE_AFRC")) continue;
|
||||
}
|
||||
|
||||
try out.print(
|
||||
\\ {{ DRM_MODIFIER({[vendor]s}, {[modifier]s}, {[modifier]s}) }},
|
||||
\\
|
||||
, .{
|
||||
.vendor = @tagName(vendor),
|
||||
.modifier = modifier,
|
||||
});
|
||||
}
|
||||
}
|
||||
try out.writeAll(
|
||||
\\};
|
||||
\\static const struct drmFormatModifierVendorInfo drm_format_modifier_vendor_table[] = {
|
||||
\\
|
||||
);
|
||||
|
||||
line_iter.reset();
|
||||
check_each_line: while (line_iter.next()) |line| {
|
||||
if (matchStart(line, "#define DRM_FORMAT_MOD_VENDOR_")) |after| {
|
||||
const modifier_end = std.mem.indexOfAny(u8, after, "\t ") orelse return error.Invalid;
|
||||
const modifier = after[0..modifier_end];
|
||||
|
||||
for (modifier) |character| {
|
||||
if (character != '_' and !std.ascii.isAlphanumeric(character)) {
|
||||
continue :check_each_line;
|
||||
}
|
||||
}
|
||||
|
||||
try out.print(
|
||||
\\ {{ DRM_FORMAT_MOD_VENDOR_{[modifier]s}, "{[modifier]s}" }},
|
||||
\\
|
||||
, .{
|
||||
.modifier = modifier,
|
||||
});
|
||||
}
|
||||
}
|
||||
try out.writeAll(
|
||||
\\};
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
fn matchStart(haystack: []const u8, needle: []const u8) ?[]const u8 {
|
||||
if (std.mem.startsWith(u8, haystack, needle)) {
|
||||
return haystack[needle.len..];
|
||||
}
|
||||
return null;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* AUTOMATICALLY GENERATED by gen_table_fourcc.py. You should modify
|
||||
that script instead of adding here entries manually! */
|
||||
static const struct drmFormatModifierInfo drm_format_modifier_table[] = {
|
||||
{ DRM_MODIFIER_INVALID(NONE, INVALID) },
|
||||
{ DRM_MODIFIER_LINEAR(NONE, LINEAR) },
|
||||
{ DRM_MODIFIER_INTEL(X_TILED, X_TILED) },
|
||||
{ DRM_MODIFIER_INTEL(Y_TILED, Y_TILED) },
|
||||
{ DRM_MODIFIER_INTEL(Yf_TILED, Yf_TILED) },
|
||||
{ DRM_MODIFIER_INTEL(Y_TILED_CCS, Y_TILED_CCS) },
|
||||
{ DRM_MODIFIER_INTEL(Yf_TILED_CCS, Yf_TILED_CCS) },
|
||||
{ DRM_MODIFIER_INTEL(Y_TILED_GEN12_RC_CCS, Y_TILED_GEN12_RC_CCS) },
|
||||
{ DRM_MODIFIER_INTEL(Y_TILED_GEN12_MC_CCS, Y_TILED_GEN12_MC_CCS) },
|
||||
{ DRM_MODIFIER_INTEL(Y_TILED_GEN12_RC_CCS_CC, Y_TILED_GEN12_RC_CCS_CC) },
|
||||
{ DRM_MODIFIER_INTEL(4_TILED, 4_TILED) },
|
||||
{ DRM_MODIFIER_INTEL(4_TILED_DG2_RC_CCS, 4_TILED_DG2_RC_CCS) },
|
||||
{ DRM_MODIFIER_INTEL(4_TILED_DG2_MC_CCS, 4_TILED_DG2_MC_CCS) },
|
||||
{ DRM_MODIFIER_INTEL(4_TILED_DG2_RC_CCS_CC, 4_TILED_DG2_RC_CCS_CC) },
|
||||
{ DRM_MODIFIER_INTEL(4_TILED_MTL_RC_CCS, 4_TILED_MTL_RC_CCS) },
|
||||
{ DRM_MODIFIER_INTEL(4_TILED_MTL_MC_CCS, 4_TILED_MTL_MC_CCS) },
|
||||
{ DRM_MODIFIER_INTEL(4_TILED_MTL_RC_CCS_CC, 4_TILED_MTL_RC_CCS_CC) },
|
||||
{ DRM_MODIFIER(SAMSUNG, 64_32_TILE, 64_32_TILE) },
|
||||
{ DRM_MODIFIER(SAMSUNG, 16_16_TILE, 16_16_TILE) },
|
||||
{ DRM_MODIFIER(QCOM, COMPRESSED, COMPRESSED) },
|
||||
{ DRM_MODIFIER(QCOM, TILED3, TILED3) },
|
||||
{ DRM_MODIFIER(QCOM, TILED2, TILED2) },
|
||||
{ DRM_MODIFIER(VIVANTE, TILED, TILED) },
|
||||
{ DRM_MODIFIER(VIVANTE, SUPER_TILED, SUPER_TILED) },
|
||||
{ DRM_MODIFIER(VIVANTE, SPLIT_TILED, SPLIT_TILED) },
|
||||
{ DRM_MODIFIER(VIVANTE, SPLIT_SUPER_TILED, SPLIT_SUPER_TILED) },
|
||||
{ DRM_MODIFIER(NVIDIA, TEGRA_TILED, TEGRA_TILED) },
|
||||
{ DRM_MODIFIER(NVIDIA, 16BX2_BLOCK_ONE_GOB, 16BX2_BLOCK_ONE_GOB) },
|
||||
{ DRM_MODIFIER(NVIDIA, 16BX2_BLOCK_TWO_GOB, 16BX2_BLOCK_TWO_GOB) },
|
||||
{ DRM_MODIFIER(NVIDIA, 16BX2_BLOCK_FOUR_GOB, 16BX2_BLOCK_FOUR_GOB) },
|
||||
{ DRM_MODIFIER(NVIDIA, 16BX2_BLOCK_EIGHT_GOB, 16BX2_BLOCK_EIGHT_GOB) },
|
||||
{ DRM_MODIFIER(NVIDIA, 16BX2_BLOCK_SIXTEEN_GOB, 16BX2_BLOCK_SIXTEEN_GOB) },
|
||||
{ DRM_MODIFIER(NVIDIA, 16BX2_BLOCK_THIRTYTWO_GOB, 16BX2_BLOCK_THIRTYTWO_GOB) },
|
||||
{ DRM_MODIFIER(BROADCOM, VC4_T_TILED, VC4_T_TILED) },
|
||||
{ DRM_MODIFIER(BROADCOM, SAND32, SAND32) },
|
||||
{ DRM_MODIFIER(BROADCOM, SAND64, SAND64) },
|
||||
{ DRM_MODIFIER(BROADCOM, SAND128, SAND128) },
|
||||
{ DRM_MODIFIER(BROADCOM, SAND256, SAND256) },
|
||||
{ DRM_MODIFIER(BROADCOM, UIF, UIF) },
|
||||
{ DRM_MODIFIER(ARM, 16X16_BLOCK_U_INTERLEAVED, 16X16_BLOCK_U_INTERLEAVED) },
|
||||
{ DRM_MODIFIER(ALLWINNER, TILED, TILED) },
|
||||
};
|
||||
static const struct drmFormatModifierVendorInfo drm_format_modifier_vendor_table[] = {
|
||||
{ DRM_FORMAT_MOD_VENDOR_NONE, "NONE" },
|
||||
{ DRM_FORMAT_MOD_VENDOR_INTEL, "INTEL" },
|
||||
{ DRM_FORMAT_MOD_VENDOR_AMD, "AMD" },
|
||||
{ DRM_FORMAT_MOD_VENDOR_NVIDIA, "NVIDIA" },
|
||||
{ DRM_FORMAT_MOD_VENDOR_SAMSUNG, "SAMSUNG" },
|
||||
{ DRM_FORMAT_MOD_VENDOR_QCOM, "QCOM" },
|
||||
{ DRM_FORMAT_MOD_VENDOR_VIVANTE, "VIVANTE" },
|
||||
{ DRM_FORMAT_MOD_VENDOR_BROADCOM, "BROADCOM" },
|
||||
{ DRM_FORMAT_MOD_VENDOR_ARM, "ARM" },
|
||||
{ DRM_FORMAT_MOD_VENDOR_ALLWINNER, "ALLWINNER" },
|
||||
{ DRM_FORMAT_MOD_VENDOR_AMLOGIC, "AMLOGIC" },
|
||||
};
|
|
@ -104,6 +104,6 @@ test(
|
|||
args : [
|
||||
'--lib', libdrm_intel,
|
||||
'--symbols-file', files('intel-symbols.txt'),
|
||||
'--nm', prog_nm.path(),
|
||||
'--nm', prog_nm.full_path(),
|
||||
],
|
||||
)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/poll.h>
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -235,7 +235,7 @@ config_file = configure_file(
|
|||
configuration : config,
|
||||
output : 'config.h',
|
||||
)
|
||||
add_project_arguments('-include', '@0@'.format(config_file), language : 'c')
|
||||
add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c')
|
||||
|
||||
inc_root = include_directories('.')
|
||||
inc_drm = include_directories('include/drm')
|
||||
|
|
|
@ -56,6 +56,6 @@ test(
|
|||
args : [
|
||||
'--lib', libdrm_omap,
|
||||
'--symbols-file', files('omap-symbols.txt'),
|
||||
'--nm', prog_nm.path(),
|
||||
'--nm', prog_nm.full_path(),
|
||||
],
|
||||
)
|
||||
|
|
|
@ -7,6 +7,7 @@ import subprocess
|
|||
|
||||
# This list contains symbols that _might_ be exported for some platforms
|
||||
PLATFORM_SYMBOLS = [
|
||||
'_GLOBAL_OFFSET_TABLE_',
|
||||
'__bss_end__',
|
||||
'__bss_start__',
|
||||
'__bss_start',
|
||||
|
@ -16,6 +17,9 @@ PLATFORM_SYMBOLS = [
|
|||
'_end',
|
||||
'_fini',
|
||||
'_init',
|
||||
'_fbss',
|
||||
'_fdata',
|
||||
'_ftext',
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/poll.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include "private.h"
|
||||
|
||||
|
|
|
@ -59,6 +59,6 @@ test(
|
|||
args : [
|
||||
'--lib', libdrm_tegra,
|
||||
'--symbols-file', files('tegra-symbols.txt'),
|
||||
'--nm', prog_nm.path(),
|
||||
'--nm', prog_nm.full_path(),
|
||||
],
|
||||
)
|
||||
|
|
|
@ -926,6 +926,11 @@ extern int drmGetDeviceFromDevId(dev_t dev_id, uint32_t flags, drmDevicePtr *dev
|
|||
*/
|
||||
extern int drmGetNodeTypeFromDevId(dev_t devid);
|
||||
|
||||
/**
|
||||
* Check if two drmDevice pointers represent the same DRM device.
|
||||
*
|
||||
* Returns 1 if the devices are equal, 0 otherwise.
|
||||
*/
|
||||
extern int drmDevicesEqual(drmDevicePtr a, drmDevicePtr b);
|
||||
|
||||
extern int drmSyncobjCreate(int fd, uint32_t flags, uint32_t *handle);
|
||||
|
|
Loading…
Reference in New Issue