Commit Graph

19 Commits (7e4f0664acfa79448f6e32c1f1b12b94626777b2)

Author SHA1 Message Date
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
Frank Binns 1f73578df3 Add new drmGetNodeTypeFromFd function
Add a helper function that returns the type of device node from an fd.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-02-23 09:29:19 +00:00
Jammy Zhou dbc8b11db6 Add new drmOpenOnceWithType function (v2)
v2: call drmOpenOnceWithType in drmOpenOnce, and drop unused param
for drmOpenOnceWithType

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-02-12 18:36:52 -05:00
Jammy Zhou f1adc4b375 Add new drmOpenWithType function (v4)
v2: Add drmGetMinorBase, and call drmOpenWithType in drmOpen
v3: Pass 'type' to drmOpenByBusid and drmOpenDevice in drmOpenByName
v4: Renumber node type definitions, and return -1 for unsupported type

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v3)
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
2015-02-12 18:34:57 -05:00
Frank Binns 0c5aaeef51 Add new drmOpenRender function
Add a new function, drmOpenRender, that can be used to open render nodes. This
can be used in the same way that drmOpenControl is used to open control nodes.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
2015-01-23 23:02:27 +00:00
Thierry Reding 44b08c0ddf Mark functions printf-like where possible
These functions all take a format string and either a list of variable
arguments or a va_list. Use the new DRM_PRINTFLIKE macro to tell the
compiler about it so that the arguments can be checked against the
format string.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-04-17 16:21:40 +02:00
Keith Packard cb4bc8ead6 Mark debug_print with __attribute__ ((format(__printf__, 1, 0)))
the drmServerInfo member, debug_print, takes a printf format string
and varargs list. Tell the compiler about it.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-01-13 10:13:42 -08:00
Damien Lespiau ddbbdb13d8 drm: Introduce a drmSetClientCap() wrapper
That wraps around the new DRM_SET_CLIENT_CAP ioctl.

v2: SET_CAP -> SET_CLIENT_CAP renaming

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-09-30 13:35:49 +01:00
Dave Airlie cc0a14575d libdrm: add prime fd->handle and handle->fd interfaces
These are just basic ioctl wrappers around the prime ioctls,
along with the capability reporting.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-16 02:39:56 +01:00
Tapani Pälli cfee5218b1 xf86drm.h : wrap C code for C++ compilation/linking
To enable usage of xf86drm.h from C++ programs/frameworks.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
[ickle: also wrap xf86drmMode.h]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-23 12:58:56 +01:00
Ilija Hadzic be8802a941 libdrm: (revised) vblank wait on crtc > 1
Hi Alex,

Enclosed is a revised version of the patch sent on Mar 18, against
the master branch of the drm userspace (i.e. libdrm). Details
summarised in this thread:
http://lists.freedesktop.org/archives/dri-devel/2011-March/009499.html

This patch reconciles libdrm with the the kernel change that Dave
pushed this morning. It *supersedes* the previously sent patch (i.e.
apply it to the master branch as it exists at the time of this writing,
not as an incremental patch to the one sent previously).

Regards,

Ilija

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2011-04-04 11:04:03 -04:00
Ben Skeggs 5c6c6913d1 Implement drmGetCap() to query device/driver capabilities
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-03-04 15:25:51 +10:00
Jesse Barnes 14f5958f7f Bump event context structure version for page flipping 2009-12-03 14:27:08 -08:00
Jesse Barnes 53addc5d6e Merge branch 'pageflip' of git://people.freedesktop.org/~jbarnes/drm
Conflicts:
	include/drm/drm.h - RMFB had its signature changed to avoid uint32_t
2009-12-03 14:17:26 -08:00
Robert Noland 6f66de982a Correctly set DRM_MAX_MINOR for all platforms.
DRM_MAJOR is platform specific, but not used outside of xf86drm.c
that I can find.
2009-11-25 15:09:24 -06:00
Alex Deucher 9558f6377f Add missing DRM_MAX_MINOR define
lost in 500f5b5240

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2009-11-24 15:03:32 -05:00
Kristian Høgsberg 22d4666904 Add drmGetDeviceNameFromFd function
Determines the /dev filename of the drm fd argument.
2009-11-23 20:51:34 -05:00
Kristian Høgsberg 500f5b5240 Fix build on *BSD
This adds a minimal #ifdef clause to drm.h that we'll push upstream.
Once that goes in we can share drm.h between linux, libdrm, and
the bsd's.
2009-11-23 18:25:11 -05:00
Kristian Høgsberg 4f57abfe66 Move libdrm/ up one level 2009-11-17 11:15:06 -05:00