Skip to content

Commit

Permalink
12395 Update to libdrm >= 2.4.97
Browse files Browse the repository at this point in the history
upgrade libdrm-2.4.75 to libdrm-2.4.109

Add back logic to deal with illumos clone-open devices
 and searching the devices tree in drmGetMinorNameForFD
Move gen...table_fourcc.h so clean will not remove it
  • Loading branch information
klausz65 authored and gwr committed Jan 7, 2022
1 parent 1948268 commit 6ec9a1e
Show file tree
Hide file tree
Showing 56 changed files with 3,436 additions and 532 deletions.
23 changes: 23 additions & 0 deletions ISSUES
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

Dec-30-2021 - Klaus Ziegler

Issues left over up from release 2.4.109:

1. This is just the upgrade from libdrm-2.4.75 to 2.4.109, no new functionality
of libdrm-2.4.109 has been checked or reflected in any manifest file, this
will be done in subsequent #PRs.

2. Implement dynamic creation of the new header file:

- generated_static_table_fourcc.h

into the build process of gfx-drm using Python, the regular build process
of libdrm uses meson to build this header file. For the moment, the supplied
header file was created using a regular meson build of the library on SPARC
and Intel platforms to make sure there are no differences.

3. The creation of manual pages has been disabled in usr/src/man/Makefile
for subdirectories man3 and man7, because illumos based distributions up to
date don't include rst2man(1) command.

4. Get rid of 32bit support.
40 changes: 40 additions & 0 deletions UPDATE_LIB
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

Dec-30-2021 - Klaus Ziegler

To upgrade libdrm:

change LIBDRM_VERS in
usr/src/common/libdrm/Makefile
usr/src/common/libdrm/Makefile.drm
LIBDRM_HASH in
usr/src/common/libdrm/Makefile

If the file extension of the file to be downloaded has changed, it must be
changed in usr/src/pkg/manifests/x11-library-libdrm.mf and LIBDRM_ARCHIVE in
usr/src/common/libdrm/Makefile must be modified accordingly.

# NOTE: if you want to contribute changes to this graphics/DRM gate,
# please use your own fork of gfx-drm.git and substitute HTTPS/URL below,
# to match your repository.

After you have setup a build environment as follows:
git clone https://github.com/illumos/gfx-drm.git
cd gfx-drm
export BLDENV=tools/bldenv
chmod 755 tools/bldenv

edit myenv.sh to suite your needs, and start the first build:
/usr/bin/env -i $BLDENV myenv.sh "cd usr/src; make install"

most likely this first build will err'out right after unpacking
the new library archive. At this stage the make target: check
is run, which checks differences of gfx-drm headers and the
new library supplied headers, these 5 headers will be checked:

drm.h drm_fourcc.h drm_mode.h drm_sarea.h i915_drm.h

To pass check target, generate patch files for these headers:
cd usr/src/common/libdrm/libdrm-2.4.<new-version>/include/drm
gdiff -u drm.h <WS>/usr/src/uts/common/drm/drm.h > /tmp/drm.h.patch
and the others as well, then apply these patches to headers
contained in usr/src/uts/common/drm and restart the build.
2 changes: 1 addition & 1 deletion myenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export PKGARCHIVE="${CODEMGR_WS}/packages/${MACH}/nightly"
# export PKGPUBLISHER_REDIST='on-redist'

# Package manifest format version.
export PKGFMT_OUTPUT='v1'
export PKGFMT_OUTPUT='v2'

# Disable shadow compilation.
export CW_NO_SHADOW='1'
Expand Down
Empty file modified tools/bldenv
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions usr/src/Makefile.master
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ ELFEDIT= /usr/bin/elfedit
ELFSIGN= /usr/bin/elfsign
DTRACE= /usr/sbin/dtrace -xnolibs
UNIQ= /usr/bin/uniq
TAR= /usr/bin/tar
TAR= /usr/bin/gtar
ASTBINDIR= /usr/ast/bin
MSGCC= $(ASTBINDIR)/msgcc
MSGFMT= /usr/bin/msgfmt -s
Expand Down Expand Up @@ -300,7 +300,7 @@ CCABS32= -Wc,-xcode=abs32
#
# generate v9 code which tolerates callers using the v7 ABI, for the sake of
# system calls.
CC32BITCALLERS= -_gcc=-massume-32bit-callers
CC32BITCALLERS=

# GCC, especially, is increasingly beginning to auto-inline functions and
# sadly does so separately not under the general -fno-inline-functions
Expand Down
5 changes: 3 additions & 2 deletions usr/src/cmd/drm-tests/Run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
# /opt/drm-tests/Run_all.sh > drm-tests.log
#

# Leaving out random (takes a while)
# Leaving out random (takes a while), and in the meantime has been removed.
# Also updatedraw (broken at the moment)
TESTS="drmdevice dristat drmstat drmsl hash"
# Deleted dristat drmstat from list below, also gone.
TESTS="drmdevice drmsl hash"

run_all() {
for f in $TESTS ; do
Expand Down
1 change: 0 additions & 1 deletion usr/src/cmd/drm-tests/misc1/Makefile.com
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
PROG= \
drmsl \
hash \
random \
drmdevice

include ../../Makefile.drm
Expand Down
4 changes: 3 additions & 1 deletion usr/src/cmd/drm-tests/modeprint/Makefile.com
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ include ../../Makefile.drm

SRCDIR= $(LIBDRM_CMN_DIR)/tests/modeprint

LDLIBS += -ldrm -lm
LDLIBS += -ldrm -lm -lutil

LDLIBS32 += -L$(ROOT)/usr/lib/xorg \
-L$(SRC)/cmd/drm-tests/util/$(MACH) \
-R/usr/lib/xorg
LDLIBS64 += -L$(ROOT)/usr/lib/xorg/$(MACH64) \
-L$(SRC)/cmd/drm-tests/util/$(MACH64) \
-R/usr/lib/xorg/$(MACH64)

all: $(PROG)
Expand Down
12 changes: 3 additions & 9 deletions usr/src/common/libdrm/Check-patches
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
# One big patch might be easier than all this...
# but for now the patches are split up as shown below.

ref=libdrm-2.4.75-ref
dir=libdrm-2.4.75
ref=libdrm-2.4.109-ref
dir=libdrm-2.4.109

# You make this directory by hand. Not doing this automatically
# because I want to make srue you to know it's being written into.
Expand Down Expand Up @@ -106,18 +106,12 @@ diff_ref libdrm_lists.h > $chk/libdrm-lists-h.patch
echo patches/util-double-list-h.patch
diff_ref util_double_list.h > $chk/util-double-list-h.patch

echo patches/util-math-h.patch
diff_ref util_math.h > $chk/util-math-h.patch

echo patches/xf86drm-c.patch
diff_ref xf86drm.c > $chk/xf86drm-c.patch

echo patches/xf86drm-h.patch
( head -27 patches/xf86drm-h.patch ;
diff_ref xf86drm.h ) > $chk/xf86drm-h.patch

echo patches/xf86drmMode-c.patch
diff_ref xf86drmMode.c > $chk/xf86drmMode-c.patch


diff -r patches $chk
diff -r patches $chk
8 changes: 4 additions & 4 deletions usr/src/common/libdrm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ FETCH= $(PYTHON) $(SRC)/tools/userland-fetch

# See also: ./Makefile.drm LIBDRM_VERS and ./Check-patches
# PLEASE RUN Check-patches after updating!
LIBDRM_VERS=2.4.75
LIBDRM_VERS=2.4.109

LIBDRM_DIR=libdrm-$(LIBDRM_VERS)
LIBDRM_ARCHIVE=$(LIBDRM_DIR).tar.bz2
LIBDRM_ARCHIVE=$(LIBDRM_DIR).tar.xz
LIBDRM_URL=http://dri.freedesktop.org/libdrm/$(LIBDRM_ARCHIVE)
LIBDRM_HASH=sha256:2d5a500eef412cc287d12268eed79d571e262d4957a2ec9258073f305985054f
LIBDRM_HASH=sha256:629352e08c1fe84862ca046598d8a08ce14d26ab25ee1f4704f993d074cb7f26

def all install install_h: .patched check

Expand Down Expand Up @@ -59,7 +59,7 @@ check: FRC
touch $@

.unpacked: $(USERLAND_ARCHIVES)$(LIBDRM_ARCHIVE)
tar xvfjo $(USERLAND_ARCHIVES)$(LIBDRM_ARCHIVE)
gtar xvfJo $(USERLAND_ARCHIVES)$(LIBDRM_ARCHIVE)
touch $@

$(USERLAND_ARCHIVES)$(LIBDRM_ARCHIVE) :
Expand Down
2 changes: 1 addition & 1 deletion usr/src/common/libdrm/Makefile.drm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# This make include is used in $SRC/lib/libdrm/*
#
# See also: ./Makefile LIBDRM_VERS, ./Check-patches
LIBDRM_VERS=2.4.75
LIBDRM_VERS=2.4.109

LIBDRM_CMN_DIR=$(SRC)/common/libdrm/libdrm-$(LIBDRM_VERS)

Expand Down
8 changes: 4 additions & 4 deletions usr/src/common/libdrm/patches/etnaviv.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--- libdrm-2.4.71/etnaviv/etnaviv_device.c.old 2016-10-18 23:11:06.163832408 +0300
+++ libdrm-2.4.71/etnaviv/etnaviv_device.c 2016-10-18 23:12:18.805796392 +0300
@@ -29,8 +29,8 @@
#endif
--- libdrm-2.4.109/etnaviv/etnaviv_device.c.orig 2021-11-25 21:33:02.000000000 +0000
+++ libdrm-2.4.109/etnaviv/etnaviv_device.c 2021-12-28 12:57:52.347557016 +0000
@@ -25,8 +25,8 @@
*/

#include <stdlib.h>
-#include <linux/stddef.h>
Expand Down
25 changes: 11 additions & 14 deletions usr/src/common/libdrm/patches/exynos.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
diff ... libdrm-2.4.73/exynos/exynos_drm.c
--- libdrm-2.4.73-ref/exynos/exynos_drm.c Wed Aug 24 12:57:39 2016
+++ libdrm-2.4.73/exynos/exynos_drm.c Sat Dec 31 12:27:53 2016
@@ -35,7 +35,7 @@
--- libdrm-2.4.109/exynos/exynos_drm.c.orig 2021-11-25 21:33:02.000000000 +0000
+++ libdrm-2.4.109/exynos/exynos_drm.c 2021-12-28 12:57:52.350690170 +0000
@@ -31,7 +31,7 @@
#include <unistd.h>

#include <sys/mman.h>
Expand All @@ -10,10 +9,9 @@ diff ... libdrm-2.4.73/exynos/exynos_drm.c

#include <xf86drm.h>

diff ... libdrm-2.4.73/exynos/exynos_fimg2d.c
--- libdrm-2.4.73-ref/exynos/exynos_fimg2d.c Wed Aug 24 12:57:39 2016
+++ libdrm-2.4.73/exynos/exynos_fimg2d.c Sat Dec 31 17:52:27 2016
@@ -21,7 +21,7 @@
--- libdrm-2.4.109/exynos/exynos_fimg2d.c.orig 2021-11-25 21:33:02.000000000 +0000
+++ libdrm-2.4.109/exynos/exynos_fimg2d.c 2021-12-28 12:57:52.351308656 +0000
@@ -30,7 +30,7 @@
#include <assert.h>

#include <sys/mman.h>
Expand All @@ -22,7 +20,7 @@ diff ... libdrm-2.4.73/exynos/exynos_fimg2d.c

#include <xf86drm.h>

@@ -698,9 +698,10 @@
@@ -693,9 +693,10 @@
if (negative)
negative = 1;

Expand All @@ -35,7 +33,7 @@ diff ... libdrm-2.4.73/exynos/exynos_fimg2d.c
scale = 1;
scale_x = g2d_get_scaling(src_w, dst_w);
scale_y = g2d_get_scaling(src_h, dst_h);
@@ -920,9 +921,10 @@
@@ -915,9 +916,10 @@
unsigned int scale, gem_space;
unsigned int scale_x, scale_y;

Expand All @@ -48,10 +46,9 @@ diff ... libdrm-2.4.73/exynos/exynos_fimg2d.c
scale = 1;
scale_x = g2d_get_scaling(src_w, dst_w);
scale_y = g2d_get_scaling(src_h, dst_h);
diff ... libdrm-2.4.73/tests/exynos/exynos_fimg2d_test.c
--- libdrm-2.4.73-ref/tests/exynos/exynos_fimg2d_test.c Wed Aug 24 12:57:39 2016
+++ libdrm-2.4.73/tests/exynos/exynos_fimg2d_test.c Sat Dec 31 12:27:53 2016
@@ -22,7 +22,7 @@
--- libdrm-2.4.109/tests/exynos/exynos_fimg2d_test.c.orig 2021-11-25 21:33:02.000000000 +0000
+++ libdrm-2.4.109/tests/exynos/exynos_fimg2d_test.c 2021-12-28 12:57:52.351698146 +0000
@@ -31,7 +31,7 @@
#include <unistd.h>

#include <sys/mman.h>
Expand Down
26 changes: 7 additions & 19 deletions usr/src/common/libdrm/patches/freedreno.patch
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
diff ... libdrm-2.4.73/freedreno/kgsl/kgsl_bo.c
--- libdrm-2.4.73-ref/freedreno/kgsl/kgsl_bo.c Wed Aug 24 12:57:41 2016
+++ libdrm-2.4.73/freedreno/kgsl/kgsl_bo.c Sat Dec 31 12:27:53 2016
@@ -32,7 +32,5 @@
--- libdrm-2.4.109/freedreno/kgsl/kgsl_bo.c.orig 2021-11-25 21:33:02.000000000 +0000
+++ libdrm-2.4.109/freedreno/kgsl/kgsl_bo.c 2021-12-29 08:58:14.846699228 +0000
@@ -28,7 +28,9 @@

#include "kgsl_priv.h"

-#include <linux/fb.h>
-
+#ifndef __sun
#include <linux/fb.h>
+#endif

static int set_memtype(struct fd_device *dev, uint32_t handle, uint32_t flags)
{
diff ... libdrm-2.4.73/freedreno/kgsl/kgsl_ringbuffer.c
--- libdrm-2.4.73-ref/freedreno/kgsl/kgsl_ringbuffer.c Mon Nov 14 12:55:20 2016
+++ libdrm-2.4.73/freedreno/kgsl/kgsl_ringbuffer.c Sat Dec 31 18:02:19 2016
@@ -146,7 +146,8 @@
ibdesc.gpuaddr = kgsl_ring->bo->gpuaddr;
ibdesc.hostptr = kgsl_ring->bo->hostptr;
ibdesc.sizedwords = 0x145;
- req.timestamp = (uint32_t)kgsl_ring->bo->hostptr;
+ /* This way to avoid GCC -Wpointer-to-int-cast */
+ req.timestamp = (unsigned int) (unsigned long) kgsl_ring->bo->hostptr;
}

do {
10 changes: 4 additions & 6 deletions usr/src/common/libdrm/patches/incl-drm-drm-h.patch
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@
# or other dealings in this Software without prior written authorization
# of the copyright holder.

diff -u ... libdrm-2.4.73/include/drm/drm.h
index 8adb9d5..f9bedd0 100644
--- libdrm-2.4.73-ref/include/drm/drm.h Mon Nov 14 14:46:05 2016
+++ libdrm-2.4.73/include/drm/drm.h Mon Nov 28 14:32:21 2016
--- libdrm-2.4.109/include/drm/drm.h.orig 2021-11-25 21:33:02.000000000 +0000
+++ libdrm-2.4.109/include/drm/drm.h 2021-12-28 13:56:31.700232551 +0000
@@ -55,14 +55,40 @@
typedef int64_t __s64;
typedef uint64_t __u64;
Expand Down Expand Up @@ -80,7 +78,7 @@ index 8adb9d5..f9bedd0 100644
+ _DRM_GEM = 6 /**< GEM object (XXX: Not libdrm?) */
};

/**
/*
@@ -214,12 +241,13 @@
* \sa drmAddMap().
*/
Expand Down Expand Up @@ -135,4 +133,4 @@ index 8adb9d5..f9bedd0 100644
+ int fd;
};

/**
/*
20 changes: 9 additions & 11 deletions usr/src/common/libdrm/patches/incl-drm-i915-drm-h.patch
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@
# or other dealings in this Software without prior written authorization
# of the copyright holder.

diff ... libdrm-2.4.75/include/drm/i915_drm.h
--- libdrm-2.4.75-ref/include/drm/i915_drm.h Fri Jan 27 20:15:16 2017
+++ libdrm-2.4.75/include/drm/i915_drm.h Fri Apr 21 21:31:17 2017
@@ -128,6 +128,7 @@
--- libdrm-2.4.109/include/drm/i915_drm.h.orig 2021-11-25 21:33:02.000000000 +0000
+++ libdrm-2.4.109/include/drm/i915_drm.h 2021-12-28 13:56:31.703875110 +0000
@@ -208,6 +208,7 @@
int pf_current_page; /* which buffer is being displayed? */
int perf_boxes; /* performance boxes to be displayed */
int width, height; /* screen size in pixels */
+ int pad0;

drm_handle_t front_handle;
int front_offset;
@@ -167,6 +168,8 @@
@@ -247,6 +248,8 @@
int pipeB_w;
int pipeB_h;

Expand All @@ -45,7 +44,7 @@ diff ... libdrm-2.4.75/include/drm/i915_drm.h
/* fill out some space for old userspace triple buffer */
drm_handle_t unused_handle;
__u32 unused1, unused2, unused3;
@@ -265,11 +268,14 @@
@@ -349,11 +352,14 @@
#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
Expand All @@ -63,7 +62,7 @@ diff ... libdrm-2.4.75/include/drm/i915_drm.h
#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
@@ -328,6 +334,15 @@
@@ -416,6 +422,15 @@
struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */
} drm_i915_batchbuffer_t;

Expand All @@ -79,7 +78,7 @@ diff ... libdrm-2.4.75/include/drm/i915_drm.h
/* As above, but pass a pointer to userspace buffer which can be
* validated by the kernel prior to sending to hardware.
*/
@@ -340,6 +355,15 @@
@@ -428,12 +443,25 @@
struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */
} drm_i915_cmdbuffer_t;

Expand All @@ -95,7 +94,6 @@ diff ... libdrm-2.4.75/include/drm/i915_drm.h
/* Userspace can request & wait on irq's:
*/
typedef struct drm_i915_irq_emit {
@@ -346,6 +370,10 @@
int *irq_seq;
} drm_i915_irq_emit_t;

Expand All @@ -106,7 +104,7 @@ diff ... libdrm-2.4.75/include/drm/i915_drm.h
typedef struct drm_i915_irq_wait {
int irq_seq;
} drm_i915_irq_wait_t;
@@ -421,6 +449,11 @@
@@ -597,6 +625,11 @@
int *value;
} drm_i915_getparam_t;

Expand All @@ -118,7 +116,7 @@ diff ... libdrm-2.4.75/include/drm/i915_drm.h
/* Ioctl to set kernel params:
*/
#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
@@ -444,6 +477,13 @@
@@ -621,6 +654,13 @@
int *region_offset; /* offset from start of fb or agp */
} drm_i915_mem_alloc_t;

Expand Down
Loading

0 comments on commit 6ec9a1e

Please sign in to comment.