lists: add nicer+unsafe foreach, and list join macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
nouveau: pull in major libdrm rewrite

Redesigned primarily to allow us to better take advantage of BO's having
fixed GPU virtual addresses on GeForce 8 and up, and to reduce the overhead
of handling relocations on earlier chipsets.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
nouveau: init nvc0 channel alloc req structure fully

Kernel rejects ~0 handles, even though they're not used on NVC0.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
nouveau: remove unnecessary EAGAIN loops

drmCommandWrite / drmCommandWriteRead already loop on EAGAIN.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
nouveau: expose notifier handle on nvc0 as well

Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
nouveau: fix channel closing

Restore code lost in libdrm_nouveau rewrite.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
modetest: fix some compiler warnings

Use unsigned int instead of int:
- modetest.c:90:1: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
- modetest.c:98:1: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
- modetest.c:118:1: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
- modetest.c:286:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
- modetest.c:303:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
- modetest.c:694:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
- modetest.c:1088:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

The 'fd' variable is global, we don't need to pass it as an argument:
- modetest.c:998:40: warning: unused parameter ‘fd’ [-Wunused-parameter]

We don't use the 'modeset' variable:
- modetest.c:1025:8: warning: variable ‘modeset’ set but not used [-Wunused-but-set-variable]

V2: rebase, clear some more warnings

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
modetest: fix drmModeGetConnector memory leak

Don't "continue" without freeing the connector.

192 bytes in 6 blocks are indirectly lost in loss record 6 of 12
   at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4E30DD8: drmMalloc (xf86drm.c:147)
   by 0x4E35024: drmAllocCpy (xf86drmMode.c:73)
   by 0x4E35D69: drmModeGetConnector (xf86drmMode.c:507)
   by 0x402F22: dump_connectors (modetest.c:181)
   by 0x40261B: main (modetest.c:801)

Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
modetest: call drmModeFreePlaneResources

24 (16 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 7
   at 0x402994D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x4A25950: drmMalloc (xf86drm.c:147)
   by 0x4A2E26D: drmModeGetPlaneResources (xf86drmMode.c:951)
   by 0x4025FF: dump_planes (modetest.c:276)
   by 0x4052AF: main (modetest.c:1120)

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
modetest: print more about our properties

In the future we'll have more than just connector properties, so create
a dump_prop function that can handle any property (instead of the
current dump_props function that only handles connector properties).

Also, make this function print a lot more information about the existing
properties.

Also change the printed indentation of the modes to make the output more
readable.

The previous function dump_props also segfaulted when we didn't have
enought permissions. The new function does not segfault in this case (by
checking for the return value of drmModeGetProperty).

Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
radeon: Add new R600 PCI ids for surface manager

This is the same list of PCI ids added by Alex Deucher in xf86-video-ati commit
aacbd629b02cbee3f9e6a0ee452b4e3f21376bd3.

This is needed since the addition of the surface allocator helper in
commit c51f7f0e460dcadb9f1a56ecf1615810877c33c8 ; it needs to differentiate
pre and post-R600 GPUs.
Therefore we should maintain another PCI id list.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=48138
Signed-off-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
intel: Add the ability to supply annotations for .aub files.

This patch adds a new function,
drm_intel_bufmgr_gem_set_aub_annotations(), which can be used to
annotate the type and subtype of data stored in various sections of
each buffer.  This data is used to populate type and subtype fields
when generating the .aub file, which improves the ability of later
debugging tools to analyze the contents of the .aub file.

If drm_intel_bufmgr_gem_set_aub_annotations() is not called, then we
fall back to the old set of annotations (annotate the portion of the
batchbuffer that is executed as AUB_TRACE_TYPE_BATCH, and everything
else as AUB_TRACE_TYPE_NOTYPE).

Reviewed-by: Eric Anholt <eric@anholt.net>
configure: Bump version for 2.4.34.
libdrm: add exynos drm support

this patch adds libdrm_exynos helper layer that inclues some intefaces
for exynos specific gem and virtual display driver and also adds exynos
module name to modtest and vbltest.

Changelog v2:
- fixed exynos broken ioctl.
  the pointer of uint64_t *edid should be removed.
- removed unnecessary definitions.
- added drm prime interfaces.
  this feature is used to share a buffer between drivers or memory managers
  and for this, please, refer to below links:
	http://www.mjmwired.net/kernel/Documentation/dma-buf-sharing.txt
	http://lwn.net/Articles/488664/

this patch is based on a link below:
	git://anongit.freedesktop.org/mesa/drm
	commit id: d72a44c7c4f5eea9c1e5bb0c36cb9e0224b9ca22

Reviewed-by: Rob Clark <rob@ti.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Rob Clark <rob@ti.com>
radeon: Add Southern Islands PCI IDs.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
radeon: add new pci ids

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Add support for generic object properties IOCTLs

New library calls:
- drmModeObjectGetProperties
- drmModeFreeObjectProperties
- drmModeObjectSetProperties

Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
modetest: print CRTC properties

Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
tests: add proptest

A small program that allows us to see and modify properties.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Add support for bitmask properties

A bitmask property is similar to an enum.  The enum value is a bit
position (0-63), and valid property values consist of a mask of
zero or more of (1 << enum_val[n]).

Signed-off-by: Rob Clark <rob@ti.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>