Commit Graph

206 Commits (1b18f508c89c574a9d4eb9347c608fd7e8beab31)

Author SHA1 Message Date
Christian König 1cc17744b9 amdgpu: fix high VA mask
That constant needs to be 64bits.

Fixes: amdgpu: use the high VA range if possible v2

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-01-23 11:17:43 +01:00
Christoph Haag 3509e7cd2b meson: fix the install path of amdgpu.ids
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
2018-01-18 10:13:43 -08:00
Michel Dänzer 57d3d4c968 amdgpu: Don't print error message if parse_one_line returned -EAGAIN
It means it just didn't find an entry for the GPU in the amdgpu.ids file.

Fixes spurious

 amdgpu_parse_asic_ids: Cannot parse ASIC IDs: Resource temporarily unavailable

error messages in that case.

Reported-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2018-01-15 10:01:39 +01:00
Dylan Baker 5f7deb5078 Add meson build system
This patch adds a complete meson build system, including tests and
install. It has the necessary hooks to allow it be used as a subproject
for other meson based builds such as mesa.

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-and-tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2018-01-12 09:40:48 -08:00
Christian König 07ea20d5be amdgpu: use the high VA range if possible v2
Retire the low range on Vega10 this frees up everything below 0xffff800000000000 for HMM.

v2: keep the 32bit range working.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2018-01-09 17:15:09 +01:00
Christian König a8e436de5d amdgpu: fix 32bit VA manager max address
The range is exclusive not inclusive.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2018-01-09 17:15:02 +01:00
Bas Nieuwenhuizen 5889f6ba1a amdgpu: Add syncobj reset & signal wrappers.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-18 09:51:50 +10:00
Michel Dänzer f05a2b4cb1 amdgpu: Only remember the device's marketing name
There's no point in keeping around the full table of marketing names,
when amdgpu_get_marketing_name only ever returns the device's marketing
name.

Acked-by: Slava Abramov <slava.abramov@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-12-05 12:50:20 +01:00
Michel Dänzer 5219809a32 amdgpu: Simplify error handling in parse_one_line
* Move empty/commented line check before the strdup and return -EAGAIN
  directly
* Initialize r = -EAGAIN and remove redundant assignments
* Set r = -ENOMEM if last strdup fails, and remove redundant goto

Acked-by: Slava Abramov <slava.abramov@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-12-05 12:49:13 +01:00
Michel Dänzer 85c6b0b00a amdgpu: Clean up amdgpu_parse_asic_ids error handling
* Move error message printing into amdgpu_parse_asic_ids and make it
  return void
* Print only "Invalid format" error message if parse_one_line returns
  -EINVAL
* Use strerror instead of printing the (negative) error code in hex

Acked-by: Slava Abramov <slava.abramov@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-12-01 16:52:01 +01:00
Michel Dänzer f71e95108d amdgpu: Add amdgpu_cs_create_syncobj2 to amdgpu-symbol-check
Fixes make check. Trivial.
2017-11-30 15:52:50 +01:00
David Mao 1749d56ea0 amdgpu: Adding amdgpu_cs_create_syncobj2 to create syncobj as signaled initially
Signed-off-by: David Mao <david.mao@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-11-29 22:05:25 -05:00
Christian König 931f01964a Revert "amdgpu: fix 32bit VA manager max address"
This reverts commit 944f6665de.

Accidentially pushed an imcomplete patch.

Signed-off-by: Christian König <christian.koenig@amd.com>
2017-11-09 10:36:10 +01:00
Christian König 0c2481edf7 Revert "amdgpu: use the high VA range if possible"
This reverts commit 6c0ea4b0c5.

Accidentially pushed an incomplete patch.

Signed-off-by: Christian König <christian.koenig@amd.com>
2017-11-09 10:35:44 +01:00
Christian König 6c0ea4b0c5 amdgpu: use the high VA range if possible
This frees up the low range for HMM.

Signed-off-by: Christian König <christian.koenig@amd.com>
2017-11-08 16:12:56 +01:00
Christian König 944f6665de amdgpu: fix 32bit VA manager max address
The range is exclusive not inclusive.

Signed-off-by: Christian König <christian.koenig@amd.com>
2017-11-08 16:12:29 +01:00
Christian König a844925c8a amdgpu: sanitize 64bit VA manager
Adding the extra reservation of the 32bit space to the 64bit manager is
complete nonsense and just a waste of memory and CPU cycles.

Signed-off-by: Christian König <christian.koenig@amd.com>
2017-11-08 16:11:40 +01:00
Christian König 4b4ccaac2e amdpgu: fix coding style in amdgpu_vamgr.c
No functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
2017-11-07 15:13:30 +01:00
Andrey Grodzovsky f3091bac21 amdgpu: Fix wrappers for AMDGPU_VM IOCTL.
Rmove amdgpu_context_handle from the interface and use
amdgpu_device_handle instead. Uupdate VMID reservation test
accordingly.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2017-11-03 13:07:30 +01:00
Marek Olšák 76c325ee7d amdgpu: fix 32-bit build 2017-10-31 15:48:23 +01:00
Andrey Grodzovsky 9b38ea82fc amdgpu: Add wrappers for AMDGPU_VM IOCTL.
v2:
Rename wrappers to match the IOCTL naming, fix
identation and fix make check error.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2017-10-27 18:25:53 +02:00
Andres Rodriguez 35bc82cee9 amdgpu: implement context priority for amdgpu_cs_ctx_create2 v3
Add a new context creation function that allows specifying the context
priority.

A high priority context has the potential of starving lower priority
contexts. The current kernel driver implementation allows only apps
that hold CAP_SYS_NICE or DRM_MASTER to acquire a priority above
AMDGPU_CTX_PRIORITY_NORMAL.

v2: corresponding changes for kernel patch v2
v3: Fixed 'make check' symbol error

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
2017-10-20 21:51:02 +02:00
Marek Olšák c74d461404 amdgpu: add amdgpu_cs_fence_to_handle
v2: update amdgpu-symbol-check

Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
2017-10-12 20:35:57 +02:00
Marek Olšák 59aa57b363 amdgpu: add amdgpu_cs_syncobj_wait
v2: update amdgpu-symbol-check

Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
2017-10-12 20:35:57 +02:00
Marek Olšák b6e24501a1 amdgpu: add sync_file import and export functions
v2: update amdgpu-symbol-check

Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
2017-10-12 20:35:57 +02:00
Rob Herring 011fd913b4 Android: move libraries to /vendor
As part of Treble project in Android O, all the device specific files have
to be located in a separate vendor partition. This is done by setting
LOCAL_PROPRIETARY_MODULE (the name is misleading). This change will not
break existing platforms without a vendor partition as it will just move
files to /system/vendor.

Signed-off-by: Rob Herring <robh@kernel.org>
2017-10-09 09:22:35 -05:00
Marek Olšák 1dd84e01a9 amdgpu: print error messages when amdgpu_device_initialize is failing
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-09-28 22:48:26 +02:00
Jan Vesely d55d0804f9 amdgpu: Do not write beyond allocated memory when parsing ids
Fixes crash when/usr/share/libdrm/amdgpu.ids contains ASIC_ID_TABLE_NUM_ENTRIES + 1 entries.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102432
Fixes: 7e6bf88cac (amdgpu: move asic id table to a separate file)
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-09-04 23:48:54 -04:00
Chih-Wei Huang a0531e76f6 android: amdgpu: fix build break
Define two macros to avoid building errors.

Fixes: 7e6bf88cac (amdgpu: move asic id table to a separate file)

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
2017-08-21 13:05:13 +01:00
Monk Liu 687d250797 amdgpu: merge and cleanup amdgpu_bo_free
since bo_reference and bo_internal_free are
all only used by bo_free, so we just merge them
together

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-08 12:16:20 -04:00
Monk Liu 2a89ae5d7a amdgpu: fix race issue between two bo functions(v2)
there is race issue between two threads on amdgpu_bo_reference and
amdgpu_bo_import, this patch tends to fix it by moving the
pthread_mutex_lock out of bo_free_internal and move to bo_reference
to cover the update_reference part.

The mutex_unlock in bo_import should also cover bo refcount
increasement.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-08 12:00:11 -04:00
Monk Liu 4d24415594 amdgpu: fix missing mutex unlock before return
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-07 15:00:06 -04:00
Dave Airlie e12af382b5 amdgpu: add new symbols to tests. 2017-07-19 00:40:38 +01:00
Dave Airlie 22790a65d4 drm/amdgpu: add new low overhead command submission API. (v2)
This just sends chunks to the kernel API for a single command
stream.

This should provide a more future proof and extensible API
for command submission.

v2: use amdgpu_bo_list_handle, add two helper functions to
access bo and context internals.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-07-19 00:33:14 +01:00
Dave Airlie 69532d0188 drm/amdgpu: add syncobj create/destroy/import/export apis
These are just wrappers using the amdgpu device handle.

Acked-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-07-19 00:32:53 +01:00
Xiaojie Yuan 7e6bf88cac amdgpu: move asic id table to a separate file
v2: fix an off by one error and leading white spaces
v3: use thread safe strtok_r(); initialize len before calling getline();
    change printf() to drmMsg(); add initial amdgpu.ids
v4: integrate some recent internal changes, including format changes
v5: fix line number for empty/commented lines; realloc to save memory;
    indentation changes
v6: remove a line error
v7: [Michel Dänzer]
* Move amdgpu.ids to new data directory
* Remove placeholder entries from amdgpu.ids
* Set libdrmdatadir variable in configure.ac instead of Makefile.am
  [Emil Velikov]
* Use isblank() instead of open-coding it [Emil Velikov]
* Don't leak asic_id_table memory if realloc fails [Emil Velikov]
* Check and bump table_max_size at the beginning of the while loop [Emil
  Velikov]
* Initialize table_max_size to the number of entries in data/amdgpu.ids
v8: [Michel Dänzer]
* Make sure amdgpu_asic_id.c gets rebuilt when amdgpu.ids changes

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Samuel Li <Samuel.Li@amd.com>
2017-06-13 10:21:39 +09:00
Michel Dänzer 87dac00db3 amdgpu: Add .editorconfig file for amdgpu coding style
The .editorconfig file in the toplevel directory doesn't match.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-06-13 10:20:16 +09:00
Nicolai Hähnle 41be41f99e amdgpu: add missing extern "C" headers
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Xie <AlexBin.Xie@amd.com>
2017-05-16 15:45:45 +02:00
Edward O'Callaghan 00aa2c1881 amdgpu: Use the canonical form in branch predicate
Suggested-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-05-03 21:36:02 +10:00
Edward O'Callaghan 7cfcd5ef4b amdgpu/: concisely && consistently check null ptrs in canonical form
Be consistent and use the canonical form while sanity checking
null pointers, also combine a few branches for brevity.

v2: rebase on top of 'add amdgpu_cs_wait_fences' series.

Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-04-19 18:08:10 +10:00
Nicolai Hähnle d8d45a4938 amdgpu: add the interface of waiting multiple fences
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
[v2: allow returning the first signaled fence index]
Signed-off-by: monk.liu <Monk.Liu@amd.com>
[v3:
 - cleanup *status setting
 - fix amdgpu symbols check
v4: simplify return from amdgpu_cs_wait_fences (suggested
    by Edward O'Callaghan)]
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com> (v1)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-04-18 21:05:00 +02:00
Samuel Pitoiset 047aba1697 amdgpu: allow to query GPU sensor related information
This exposes amdgpu_query_sensor_info().

v2: - add amdgpu_query_sensor_info() to the symbols list

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-04-07 17:58:54 +02:00
Emil Velikov f5995751b0 amdgpu: add amdgpu_bo_va_op_raw to the symbol check
Otherwise the make check will rightfully fail.

Fixes: 4e369f25a9 ("amdgpu: add amdgpu_bo_va_op_raw")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-04-03 17:46:06 +01:00
Junwei Zhang eead591107 amdgpu: add REPLACE and CLEAR checking for VA op (v2)
v2: fix indent

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
2017-04-03 18:32:12 +02:00
Nicolai Hähnle 4e369f25a9 amdgpu: add amdgpu_bo_va_op_raw
This variant allows the caller full control over flags and size, and
allows passing a NULL bo (for PRT support).

Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: Jerry Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2017-04-03 10:11:24 +02:00
Christian König f684bb109f amdgpu: stop reading CC_RB_BACKEND_DISABLE on Vega10
Follow up to 'drm: don't access deprecated register on Vega10'.

The same information is available in enabled_rb_pipes_mask and reading that
register can cause GRBM bus problems.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2017-03-27 21:42:07 +02:00
Huang Rui 99908bfd4c amdgpu: don't read registers not present on Vega10
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-27 21:42:07 +02:00
Alex Xie fe7cb34eda amdgpu: vamgr can be a struct instead of a pointer
vamgr is an integral part of amdgpu_device. We don't need to calloc and free it.
This can save CPU time, reduce heap fragmentation.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
[Grazvydas Ignotas: rebase, correct a typo in commit message]
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-02-02 15:22:53 -05:00
Alex Xie 067e9a1d47 amdgpu: vamgr_32 can be a struct instead of a pointer
vamgr_32 is an integral part of amdgpu_device. We don't need to calloc and free it.
This can save CPU time, reduce heap fragmentation.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
[Grazvydas Ignotas: rebase, correct a typo in commit message]
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-02-02 15:22:45 -05:00
Alex Xie 7a03cdf6a7 amdgpu: Free/uninit vamgr_32 in theoretically correct order
vamgr_32 is a region inside general VAM range. It is better to free and
deinitialize it before general VAM range.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Alex Xie <AlexBin.Xie@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2017-02-02 15:22:07 -05:00
Emil Velikov 03d2e91d00 android: introduce Android.common.mk to reduce boilerplate
... across the makefiles. Currently this isn't much but that will change
shortly.

As an added bonus this fixes all present and future cases where we've
forgotten to strip out the headers from LOCAL_SRC_FILES.

In a couple of cases (the tests) we start setting
LOCAL_EXPORT_C_INCLUDE_DIRS, which shouldn't be an issue.

Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2017-01-27 15:48:16 +00:00
Emil Velikov de5b41ef5a android: remove LOCAL_MODULE_TAGS := optional tag
Seems to be the default option since ~2009 with commit 2f31293ba78 "auto
import from //branches/cupcake/...@137197". Fleshed out from a larger
commit in the AOSP repo/fork.

Cc: Dan Willemsen <dwillemsen@google.com>
Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2017-01-27 15:47:13 +00:00
Matt Turner 01db192f97 amdgpu: Add amdgpu_asic_id.h to Makefile.sources. 2016-11-14 10:40:59 -08:00
Junwei Zhang 670f1e4fda amdgpu: add the function to get the marketing name (v4)
This function is used to look up the marking name
for a specific board.

v2: agd: Squash in subsequent updates to the table.
v3: [Michel Dänzer]
* Make amdgpu_asic_id_table static, so it's not exported from
  libdrm_amdgpu.so.1
* Add amdgpu_get_marketing_name to amdgpu-symbols-check
* Fix indentation of second line of if statement
* Squash in another change removing redundant entries
* Change spelling of "RADEON" -> "Radeon"
* Remove "(TM)" from a minority of entries
v4: [Michel Dänzer]
* Use const char* instead of fixed size array for marketing_name (Emil
  Velikov)

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Flora Cui <Flora.Cui@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-07 17:44:27 +09:00
Alex Deucher 6493860d70 amdgpu: check parameters in amdgpu_query_gpu_info
Make sure they aren't NULL.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97993

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-31 16:37:10 -04:00
Ronie Salgado a625ba8d2d amdgpu: add SI support
v2: without the amdgpu_drm.h change

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2016-09-05 15:46:29 +02:00
Marek Olšák c653779775 amdgpu: fix valgrind warnings caused by amdgpu_query_firmware_version 2016-09-05 15:43:22 +02:00
Rob Herring d342cd34ac Android: strip out header files from sources list
AOSP master now errors if LOCAL_SRC_FILES contains headers, so filter
out header files from the source lists.

Signed-off-by: Rob Herring <robh@kernel.org>
2016-07-06 16:58:38 +01:00
Eric Engestrom 0b3f9783df amdgpu: Fix spelling mistakes
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-04-07 18:15:45 +01:00
Ken Wang f884af9b57 amdgpu: fix for submition with no ibs
Avoid a crash if no IBs are specified.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-02-04 12:26:43 -05:00
Emil Velikov 87b3bf643d amdgpu: add libdrm as private requirement/dependency
Otherwise libdrm.so won't end up in the --libs, when one static links
libdrm_amdgpu.

Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-02-04 13:22:50 +00:00
Michel Dänzer 25712f1d35 amdgpu: Add new symbols to amdgpu-symbols-check
Fixes make check.

Trivial.
2016-01-20 15:59:08 +09:00
Junwei Zhang 6b79c66b84 amdgpu: list each entry safely for sw semaphore when submit ib
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: David Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2016-01-20 02:14:46 +01:00
Marek Olšák 6afadeaf13 amdgpu: add semaphore support
the semaphore is a binary semaphore. the work flow is:
1. create sem
2. signal sem
3. wait sem, reset sem after signalled
4. destroy sem.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2016-01-20 02:14:46 +01:00
Chunming Zhou f06c992819 amdgpu: validate user memory for userptr
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2016-01-20 02:14:46 +01:00
monk.liu 50386e09db amdgpu: drop address patching logics
we don't support non-page-aligned cpu pointer anymore

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2016-01-20 02:14:46 +01:00
Tom St Denis c05049b420 amdgpu: Make amdgpu_cs_calculate_timeout() return something sensible on error
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-11-20 19:21:48 -05:00
Jammy Zhou 9c15b4aacd amdgpu: fix overflow for timeout calculation
Set the timeout to AMDGPU_TIMEOUT_INFINITE when overflow happens

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-11-20 19:21:48 -05:00
Tom St Denis b176372af4 amdgpu: Cleanly handle ENOMEM on result in amdgpu_bo_list_create()
Move the allocation of result prior to the IOCTL so we can cleanly
backtrack if the allocation fails.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-10-22 12:36:55 -04:00
Tom St Denis 1a6a8f34a0 amdgpu: Fix use-after-free bug in vamgr_deinit
This patch fixes a use-after-free bug in the vamgr_deinit function.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-10-22 12:36:38 -04:00
Tom St Denis 988f31ecc2 amdgpu: Unlock mutex if base_required is invalid
In the function amdgpu_vamgr_find_va() the function would return
without unlocking the mutex if the base_required offset was below
the va managers base offset.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-10-22 12:35:14 -04:00
Alan Coopersmith 94ecdcb8b1 Include <alloca.h> when needed before calling alloca
Fixes "error: implicit declaration of function 'alloca'" failures
when building on Solaris

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-09-12 09:41:24 -07:00
Emil Velikov 6894f2340b amdgpu: remove unneeded -Wno-switch-enum flag
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-04 21:39:06 +01:00
Jonathan Gray 949c325c50 amdgpu: use EINVAL instead of EBADMSG in amdgpu_bo_cpu_unmap()
EBADMSG is a streams errno.  OpenBSD does not implement streams and does
include the streams errnos, this commit fixes the build on OpenBSD.

None of the callers of this function check the return value for -EBADMSG.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2015-09-02 10:00:25 -04:00
monk.liu f17017b8e2 amdgpu: fix missing deinit on vamgr_32
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: monk.liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-02 09:52:12 -04:00
Christian König a5ea0c64c5 amdgpu: serialize drmPrimeFDToHandle
Fixes the same problem as "intel: Serialize drmPrimeFDToHandle with struct_mutex".

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
2015-08-25 10:27:45 -04:00
Christian König f6f25d67a9 amdgpu: remove sequence mutex
It's not used any more.

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
2015-08-25 10:26:58 -04:00
Mauro Rossi b201abe76b amdgpu: add Android build support
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-08-20 16:58:32 +01:00
Mauro Rossi ae7f7b27a1 amdgpu: add Makefile.sources
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
[Emil Velikov: remove duplicate amdgpu.h from LIBDRM_AMDGPU_FILES]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-08-20 16:56:51 +01:00
Jammy Zhou 56d8dd6a9c amdgpu: make vamgr per device v2
Each device can have its own vamgr, so make it per device now.
This can fix the failure with multiple GPUs used in one single
process.

v2: rebase

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-17 16:29:26 -04:00
Jammy Zhou ffa305d0fc amdgpu: add flag to support 32bit VA address v4
The AMDGPU_VA_RANGE_32_BIT flag is added to request VA range in the
32bit address space for amdgpu_va_range_alloc.

The 32bit address space is reserved at initialization time, and managed
with a separate VAMGR as part of the global VAMGR. And if no enough VA
space available in range above 4GB, this reserved range can be used as
fallback.

v2: add comment for AMDGPU_VA_RANGE_32_BIT, and add vamgr to va_range
v3: rebase to Emil's drm_private series
v4: fix one warning

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-17 16:26:26 -04:00
Jammy Zhou 102ab6f004 amdgpu: improve amdgpu_vamgr_init
Make it a generic function independent of the device info.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-17 16:21:38 -04:00
Emil Velikov 15350568cc amdgpu: add symbols check test
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:39 +01:00
Emil Velikov bddf4df4a1 amdgpu: hide the final internal functions from global namespace
Thus the only symbols that we export are the ones officially provided by
the API.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:36 +01:00
Emil Velikov b471818977 amdgpu/amdgpu_vamgr: hide private symbols from global namespace
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:33 +01:00
Emil Velikov c19fa2b1ca amdgpu: squash trivial documentation typo
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:30 +01:00
Emil Velikov a30da8e9b3 amdgpu: cosmetic chances in license boilerplate
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:27 +01:00
Emil Velikov f4c2bfd63e amdgpu: add a bunch of missing config.h includes
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:24 +01:00
Emil Velikov f4d14f147c amdgpu/util_hash_table: hide private symbols from global namespace
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:22 +01:00
Emil Velikov 5f0f6387a6 amdgpu/util_hash: hide private symbols from global namespace
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-13 17:43:19 +01:00
Michel Dänzer 2978f5c37e amdgpu: Remove unused local variables bo_size/offset from amdgpu_cs_submit
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:50:38 -04:00
Jammy Zhou d01c361af5 amdgpu: expose the PCI revision ID
The PCI revision ID can be used to differentiate ASICs.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:50:29 -04:00
Mario Kleiner 7d418f906c libdrm/amdgpu: Use private fd for amdgpu_device and winsys hash table to fix ZaphodHeads. (v2)
The amdgpu_device for a device node needs its own dup'ed fd, instead
of using the original fd passed in for a screen, to make multi-x-screen
ZaphodHeads configurations work on amdgpu.

The original fd's lifetime differs from that of the amdgpu_device, and from the
one stored in the hash. The hash key is the fd, and in order to compare hash
entries we fstat them, so the fd must be around for as long as the amdgpu_device
is.

This patch for libdrm/amdgpu is a translation of the radeon-winsys ZaphodHeads
fix for mesa's radeon-winsys, from mesa commit 28dda47ae4d974e3e032d60e8e0965c8c068c6d8

"winsys/radeon: Use dup fd as key in drm-winsys hash table to fix ZaphodHeads."

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>

v2: Check for valid fd's being >= 0, because fd == 0 is in theory
    a valid, although unlikely, fd and fd == -1 would denote an
    invalid fd. Thanks to William Lewis for pointing this out.

Reported-by: William Lewis <minutemaidpark@hotmail.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2015-08-05 13:47:52 -04:00
Leo Liu d2cbe9ecbe amdgpu: add VCE harvesting instance query
Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00
Jammy Zhou 8aeffcc1cf amdgpu: add amdgpu_bo_va_op for va map/unmap support v3
The following interfaces are changed accordingly:
- amdgpu_bo_alloc
- amdgpu_create_bo_from_user_mem

v2: update the interfaces
v3: remove virtual_mc_base_address from amdgpu_bo

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00
Jammy Zhou 95d0f35daf amdgpu: add flags parameter for amdgpu_va_range_alloc
The flags is added for extensibility to cover some special requirements
in the future, i.e, request VA range in the first 4GB of address space

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00
Ken Wang 926c805686 amdgpu : move management of user fence from libdrm to UMD
Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:52 -04:00
Michel Dänzer 95ecf91c7b amdgpu: Use drmIoctl in amdgpu_ioctl_wait_cs
This is safe now because the ioctl uses an absolute timeout.

This prevents amdgpu_cs_query_fence_status from returning early e.g.
when a signal is delivered, which in turn caused Mesa winsys code to
assume a BO was idle when it actually wasn't yet.

Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00
Christian König 5463d2e83a amdgpu: use common fence structure for dependencies as well.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-05 13:47:52 -04:00
Jammy Zhou f91b56dc8c amdgpu: improve the amdgpu_cs_query_fence_status interface
make amdgpu_cs_query_fence reusable to support multi-fence query

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-05 13:47:52 -04:00