Commit Graph

5729 Commits (2362c88251d4bba0bb76d2a25f233004c6f99134)

Author SHA1 Message Date
Jeff McGee d556e068a7 intel: Export total subslice and EU counts
Update kernel interface with new I915_GETPARAM ioctl entries for
subslice total and EU total. Add a wrapping function for each
parameter. Userspace drivers need these values when constructing
GPGPU commands. This kernel query method is intended to replace
the PCI ID-based tables that userspace drivers currently maintain.
The kernel driver can employ fuse register reads as needed to
ensure the most accurate determination of GT config attributes.
This first became important with Cherryview in which the config
could differ between devices with the same PCI ID.

The kernel detection of these values is device-specific. Userspace
drivers should continue to maintain ID-based tables for older
devices which return ENODEV when using this query.

v2: remove unnecessary include of <stdbool.h> and increment the
    I915_GETPARAM indices to match updated kernel patch.

For: VIZ-4636
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-03-18 18:15:37 +00:00
Emil Velikov d20413a7ce configure.ac: error out if building freedreno_kgsl without freedreno
The former is a subset of the latter. Error out early so the user is
aware that they are doing something very wrong.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
2015-03-17 22:37:05 +00:00
Emil Velikov 648508518e configure.ac: fix help string copy/pasta
The message "enabled on x86" was meant for the intel libdrm.
Take the opportunity to mention how libkms is autodetected.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-17 22:37:03 +00:00
Emil Velikov 0e4d5a3a46 configure.ac: fix host_cpu/atomics detection
Previous code was busted, as it wasn't checking directly for what it was
meant to, and at the end changing the user's selection if host_cpu
heuristics were involved.

Simplify things by adding a macro that does the long message printing
for us, and check for only what we need.

This fixes commit 36cff14bb03(configure: omap, freedreno and tegra
require atomics) which incorrectly assumed that the code was working
fine, and effectively made impossible to enable freedreno due to it's
host_cpu detection.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-17 22:37:02 +00:00
Emil Velikov ffb1e28530 autogen.sh: handle out-of-tree invokation
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-17 22:35:51 +00:00
Emil Velikov d8ea64d90b configure: Stop using AM_MAINTAINER_MODE
AM_MAINTAINER_MODE can be used to disable generation of rebuild rules.
This is not something we want to condone/support, considering it can
cause greater problems than the perceived benefits. Additionally the
Automake manual leans towards avoiding the use of AM_MAINTAINER_MODE.

http://www.gnu.org/software/automake/manual/html_node/maintainer_002dmode.html

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-17 22:34:59 +00:00
Tobias Jakobi 858b21f6af exynos: fimg2d: follow-up fix for G2D_COEFF_MODE_GB_COLOR
Also add the register field formatting info provided by
Inki Dae <inki.dae@samsung.com>.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Suggested-by: Inki Dae <inki.dae@samsung.com>
2015-03-16 22:21:40 +00:00
Tobias Jakobi 3f12191f29 exynos: add fimg2d header to common includes
The reason for this change is to let userspace use the header.
Currently 'make install' does not install it.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-16 22:21:40 +00:00
Tobias Jakobi 9a0949a8f4 exynos: add exynos prefix to fimg2d header
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-16 22:21:40 +00:00
Tobias Jakobi 736d6a1f0f exynos: use structure initialization instead of memset
Keeps the code cleaner, since the structs have to be initialized
once anyway.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
[evelikov: squash trivial conflict]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

Conflicts:
	tests/exynos/exynos_fimg2d_test.c
2015-03-16 22:21:03 +00:00
Tobias Jakobi 89037326ca exynos: honor the repeat mode in g2d_copy_with_scale
This is useful when the default repeat mode, which is 'repeat'
produces artifacts at the borders of the copied image.
Choose the 'pad' mode to make use of the color of the destination
image.

In my usage case the destination is the framebuffer, which is
solid filled with a background color. Scaling with 'pad' mode
would then just do the right thing and also produces nice
borders on the output.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-16 22:18:05 +00:00
Tobias Jakobi 03c9cccfa0 exynos: add g2d_scale_and_blend
This is a combination of g2d_copy_with_scale and g2d_scale.
It is a pretty common operation to scale one buffer and then
blend it on top of another, so provide a direct way to that
operation.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-16 22:18:05 +00:00
Tobias Jakobi 6f950de953 tests/exynos: fimg2d: add a checkerboard test
This makes it easier to spot memory corruptions which don't become
visible when using a plain buffer filled with a solid color (so
corruptions that are just a permutation of the bytes in the buffer).

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-16 22:18:05 +00:00
Emil Velikov 763ff19a2f modetest: include into the build when libkms is not selected.
With commit d7c0a08bc57(modetest: Allocate dumb buffers with the correct
bpp) we moved away from the libkms dependency. As such we are safe with
including the Makefile/subdir, even as we opt out of building the
library.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-16 22:18:04 +00:00
Jan Vesely d729d75f84 Add static qualifier to local functions
v2: Don't bother marking dead functions static
    (handler, xf86VDrvMsgVerb, drmSetDebugMsgFunction)

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-15 14:17:02 -04:00
Jan Vesely 0706c14e7c Fix unused, and unused-but-set variables warnings
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Emil Velikov <eil.l.velikov@gmail.com>
2015-03-14 17:02:06 -04:00
Jan Vesely 13e34308b7 dristat: Handle DRM_CONSISTENT
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Emil Velikov <eil.l.velikov@gmail.com>
2015-03-14 17:02:06 -04:00
Jan Vesely 65041c4a19 Fix type-limits, pointer-arith and sign-compare warnings
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Emil Velikov <eil.l.velikov@gmail.com>
2015-03-14 17:02:06 -04:00
Jan Vesely f11b8c955c tests: String literals are const char *
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Emil Velikov <eil.l.velikov@gmail.com>
2015-03-14 17:02:05 -04:00
Alan Coopersmith 0e1135de5c On Solaris, #include <sys/mkdev.h> in xf86drm.c
Needed on Solaris for the definitions of major() & minor() used in
drmGetNodeTypeFromFd() and makedev() used in drmOpenMinor()

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-14 08:37:36 -07:00
Maarten Lankhorst ba5a0b6274 nouveau: Do not add most bo's to the global bo list.
Only add wrapped bo's and bo's that have been exported through flink or dma-buf.
This avoids a lock in the common case, and decreases traversal needed for importing
a dma-buf or flink.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Tested-By: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-13 20:28:16 +01:00
Maarten Lankhorst 5ea6f1c326 nouveau: make nouveau importing global buffers completely thread-safe, with tests
While I've closed off most races in a previous patch, a small race still existed
where importing then unreffing cound cause an invalid bo. Add a test for this case.

Racing sequence fixed:

- thread 1 releases bo, refcount drops to zero, blocks on acquiring nvdev->lock.
- thread 2 increases refcount to 1.
- thread 2 decreases refcount to zero, blocks on acquiring nvdev->lock.

At this point the 2 threads will clean up the same bo.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Reviewed-By: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-13 20:26:33 +01:00
Maarten Lankhorst 7caa442e76 Use __sync_add_and_fetch instead of __sync_fetch_and_add for atomic_dec_and_test
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Acked-By: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-13 20:21:57 +01:00
Maarten Lankhorst cd4685498b Add atomic_inc_return to atomics.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Acked-By: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-13 20:21:00 +01:00
Tobias Jakobi f7b0586f16 exynos: fimg2d: whitespace fix in g2d_flush
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-10 19:23:49 +00:00
Tobias Jakobi 0d48697e7c exynos: fimg2d: introduce G2D_OP_INTERPOLATE
This sets up the blending equation in the following way:
out = src * src_alpha + dst * (1 - src_alpha)

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-10 19:23:49 +00:00
Tobias Jakobi 81b71e48e7 exynos: fimg2d: unify register style
Register defines all use uppercase hex codes.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-10 19:23:49 +00:00
Tobias Jakobi ac9e095847 exynos: fimg2d: fix comment for G2D_COEFF_MODE_GB_COLOR
The coefficient mode enables use of global color, not alpha.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-10 19:23:49 +00:00
Tobias Jakobi ba858e06d8 exynos: fimg2d: remove TRUE/FALSE from header
The fimg2d header was defining TRUE and FALSE, but actually
these defines are just used once. Remove them, since they
don't make the code better readable/understandable.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-10 19:23:45 +00:00
Tobias Jakobi 734d13b13b tests/exynos: improve error handling
Check for a useable connector and also if the resolution is sane
(width and height are both non-zero).

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-10 19:21:52 +00:00
Tobias Jakobi 74add49f1b exynos: introduce g2d_add_base_addr helper function
In almost all functions the base address register is written, so it
makes sense to have a helper function for this.

v3: Wrap line as pointed out by Emil Velikov
    <emil.l.velikov@gmail.com>.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-10 19:21:44 +00:00
Tobias Jakobi 6e2a9f936e tests/exynos: introduce wait_for_user_input
Currently getchar() is used to pause execution after each test.
The user isn't informed if one is supposed to do anything for
the tests to continue, so print a simple message to make this
more clear.

v3: Compactify printf calls as pointed out by
    Emil Velikov <emil.l.velikov@gmail.com>.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-10 19:21:33 +00:00
Tobias Jakobi a7c865dc0a tests/exynos: disable the G2D userptr/blend test
v2: Move the commit description into the patch itself.
v3: Use common commenting style as pointed out by
    Emil Velikov <emil.l.velikov@gmail.com>.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-10 19:21:21 +00:00
Tobias Jakobi c8168fe5b8 tests/exynos: fix typos and change wording
No functional changes.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-10 19:21:18 +00:00
Tobias Jakobi 1d7e78d787 exynos: replace G2D_DOUBLE_TO_FIXED macro with function
This also avoids the floating point conversion steps and just
uses pure integer arithmetic.
Since the G2D hardware scaling approach is a bit unintuitive,
document it in the function as well.

v2: Explicitly mention the normalization constant.
v3: Use common commenting style as pointed out by
    Emil Velikov <emil.l.velikov@gmail.com>.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Joonyoung Shim <jy0922.shim@samsung.com>
2015-03-10 19:04:35 +00:00
Emil Velikov 0ca03a4087 drm: add drmGet(Primary|Render)DeviceNameFromFd functions
Currently most places assume reliable primary(master) <> render node
mapping. Although this may work in some cases, it is not correct.

Add a couple of helpers that hide the details and provide the name of
the master or render device name, given an fd. The latter may belong to
either the master, control or render node device.

v2:
 - Rename Device and Primary to Master (aka the /dev/dri/cardX device).
 - Check for the file via readdir_r() rather than stat().
 - Wrap the check into a single function.
 - Return NULL for non-linux platforms.

v3:
 - Don't segfault if name is NULL.
 - Update function names, as suggested by Frank Binns.

v4:
 - Update commit message to reflect the function name changes.

Cc: Frank Binns <frank.binns@imgtec.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
2015-03-10 18:14:40 +00:00
Emil Velikov b374a59e0e tests: automake: keep the libs link at the final stage
Currently the static archive libdrmtest.la links against libdrm.la.
Only to have both added to the executables' LDADD. Simplify things a
bit, by doing the link in the final module (the executables/tests in
this case).

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-10 18:11:35 +00:00
Emil Velikov f5b7a1d2da tests: move the SUBDIR at the top of the makefile
None of the subdirs require the modules built in the local makefile, so
moving them at the top makes things a hell lot easier to read.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-10 18:11:35 +00:00
Emil Velikov 58e5010a09 automake: drop the NULL variable from the makefile
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-10 18:11:35 +00:00
Emil Velikov 9244d98136 configure: update help strings
Mention that freedreno and intel are both auto-detected (depending on
the presence of atomics), plus host_cpu "defined".

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-10 18:10:52 +00:00
Emil Velikov 36cff14bb0 configure: omap, freedreno and tegra require atomics
They have used them since day one, but the check was never there.

v2:
 - Update the freedreno message (API is no longer experimental).
 - Move the freedreno host_cpu detection next to the intel one.

Cc: Rob Clark <robdclark@gmail.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-10 18:09:18 +00:00
Emil Velikov 9f90ee9cdf automake: wrap an insanely long line
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-10 17:50:49 +00:00
Daniel Vetter fcff9e2165 Revert "intel: Fix documentation for drm_intel_gem_bo_wait()"
This reverts commit 080b4929b7.

Chris noticed that "negative values wait forever" is indeed intended
behaviour and the issue is just that we didn't have a testcase (fixed
now) and that a regression slipped through (fixed and on track for all
stable kernels).

So lets undo the documentation change for consistency, since working
around kernel regressions isn't good. Practical impact is nil anyway.

v2: Add a note to docs that some kernels have been broken.

v3: Remove the random garbage included by accident.

Cc: Kristian Høgsberg <krh@bitplanet.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-03-06 18:57:51 +01:00
Kristian Høgsberg 080b4929b7 intel: Fix documentation for drm_intel_gem_bo_wait()
The kernel doesn't actually wait indefinately when passed a negative,
timeout, it returns immediately.  Document this and suggest using INT64_MAX
for indefinite waits.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-03-02 16:14:13 -08:00
Emil Velikov f799a527db tests/radeon: set the list* functions as inline
To silence the chatty compiler.
As a future work we may want to merge these with libdrm_lists.h

Cc: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
2015-02-27 15:51:36 +00:00
Emil Velikov 0b3e540aa4 exynos_fimg2d_test: remove unused variables
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
2015-02-27 15:51:32 +00:00
Emil Velikov bb6cc7c972 tests: remove unused variables
As kindly pointed out by GCC.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
2015-02-27 15:51:28 +00:00
Emil Velikov 4c6b1b1a82 autotools: add WARN_CFLAGS to all targets
... minus test/ttmtest. The latter is not really hooked up with the
actual build.

This will give us 66 warnings on a distribution build of which
 - 12 -Wunused-variable
 - 11 -Wunused-function
 - 19 -Wmissing-prototypes
and a few -Wswitch-enum, -Wtype-limits etc.

Adding the CFLAGS gives some exposure to these so that we can fix them.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
2015-02-27 15:51:24 +00:00
Emil Velikov 794810d62d tests: fix implicit funciton declaration errors
ioctl() and strcmp() were used without the relevent header being
included.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
2015-02-27 15:51:15 +00:00
Emil Velikov 2b209fc409 exynos_fimg2d_test: fix implicit funciton declaration errors
As one adds WARN_CFLAGS to the build the compiler throws a couple of
lovely error messages. Add the relevant includes to fix them.

  error: implicit declaration of function ‘time’
  error: implicit declaration of function ‘getopt’

Cc: Inki Dae <inki.dae@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
2015-02-27 15:51:08 +00:00