Commit Graph

39 Commits (c7dc0465cf55f613f1caa085aa762db06cb14974)

Author SHA1 Message Date
Simon Ser 6d821612d9 xf86drmMode: introduce drmModeGetPropertyType
We already have drm_property_type_is, but it's needlessly complicated
and doesn't cover all use-cases (requires the caller to provide a
type).

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2021-03-31 07:42:15 +00:00
Simon Ser 523b3658aa xf86drmMode: add drmIsKMS
If a device has a primary node, it doesn't necessarily mean it's
suitable for KMS usage. For instance, render-only drivers also
expose primary nodes.

The check is extracted from Weston [1].

The motivation for this new function is two-fold:

- Avoid an unnecessary GETRESOURCES call. To check whether a
  primary node is suitable for KMS, we don't actually need to
  retrieve the object IDs we just need to check the counts.
- Avoid confusion in user-space and make sure user-space implements
  the check properly. For instance, wlroots doesn't [2]: it uses
  drmGetVersion which succeeds with render-only drivers.

[1]: https://gitlab.freedesktop.org/wayland/weston/-/blob/master/libweston/backend-drm/drm.c#L2689
[2]: a290d7a78d/backend/session/session.c (L268)

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2021-02-26 12:56:46 +01:00
Simon Ser 4f0fe66369
Remove outdated comments about stdint.h
We include stdint.h unconditionally in the header. We don't require
users to include it manually before xf86drmMode.h.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2021-01-11 17:08:01 +01:00
Simon Ser b82ed182ca
Remove definitions duplicated from drm_mode.h
I don't exactly know why these were duplicated before. Maybe libdrm
didn't always vendored drm_mode.h from the kernel? In any case, we now
do, so instead of having copy-pasted definitions, just include our
vendored version which cannot be outdated.

Contrary to what the comment says, drm.h doesn't include drm_mode.h, so
we need to add the include.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2021-01-11 17:05:47 +01:00
Simon Ser 31dc14840f xf86drmMode.h: use ANSI C99 arrays
This avoids the use of a GNU-specific extension in public headers. Also
see [1].

[1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/80#note_707458

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2020-12-10 09:45:39 +00:00
Simon Ser df373424c5 Document drmModeConnection
Signed-off-by: Simon Ser <contact@emersion.fr>
2020-12-10 09:24:42 +00:00
Daniel Stone 665c0f7fd8 Add DRM_MODE_CONNECTOR_WRITEBACK to xf86drmMode.h
xf86drmMode.h currently duplicates the connector-type definitions from
drm_mode.h. Add DRM_MODE_CONNECTOR_WRITEBACK, which is only visible
through a client cap, from drm_mode.h.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2020-03-17 12:19:10 +00:00
Daniel Stone d8731e9eec Add drmModeGetFB2
Add a wrapper around the getfb2 ioctl, which returns extended
framebuffer information mirroring addfb2, including multiple planes and
modifiers.

Changes since v7:
 - add new symbols to core-symbol.txt (Eric Engestrom)

Changes since v5:
 - style change

Changes since v4:
 - Set fb_id at init instead of memclear() and set (Eric Engestrom)

Changes since v3:
 - remove unnecessary null check in drmModeFreeFB2 (Daniel Stone)

Changes since v2:
 - getfb2 ioctl has been merged upstream
 - sync include/drm/drm.h in a seperate patch

Changes since v1:
 - functions should be drm_public
 - modifier should be 64 bits
 - update ioctl number

Signed-off-by: Juston Li <juston.li@intel.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2020-02-12 10:23:44 +11:00
Simon Ser d5682defcd Fix missing stdlib includes in xf86drmMode.h
Including xf86drmMode.h results in undefined references to uint32_t
and ssize_t. Include the stdlib headers that define them to allow the
file to be included without xf86drm.h.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2019-11-12 00:16:58 +00:00
Eric Engestrom 360292c7ab fix various typos
Saw a couple of typos fixes in the patch DragonFlyBSD carries [1], so
I ran codespell (a spell checker for code) on the whole repo.

[1] https://github.com/DragonFlyBSD/DPorts/blob/master/graphics/libdrm/files/patch-xf86drm.c

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-04-17 18:23:25 +01:00
Keith Packard c417153538 drm: Add drm mode lease ioctl wrappers [v3]
drmModeCreateLease
drmModeListLessees
drmModeGetLease
drmModeRevokeLease

Changes for v2:

Remove lessee id from GetLease
Remove lessor_id from ListLeases
Add revoke
Renumber to track kernel rebase on drm-next

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-18 10:04:02 +10:00
Tobias Jakobi 09be54122f Add const qualifier to arguments of drmModeAddFB2()
Both drmModeAddFB2() and drmModeAddFB2WithModifiers() have some
arguments that are just pointers to uint32_t in disguise. These
are not modified (just copied) in the function, so we can add a
const qualifier here.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-10-20 23:38:54 +02:00
Thierry Reding 4bfbe4c69e xf86drmMode.h: Add DisplayPort MST and DPI encoders/connectors
This brings xf86drmMode.h in sync with include/drm/drm_mode.h.
Eventually we really should only have a single set of definitions rather
than duplicating this in two files.

v2: add DPI encoder and connector types introduced in Linux v4.7

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-18 08:34:49 +01:00
Thierry Reding ab50ffbc70 xf86drmMode.h: Use consistent padding
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-18 08:34:36 +01:00
Michel Dänzer 7dd28475f1 Add drmModePageFlipTarget
It supports the DRM_MODE_PAGE_FLIP_TARGET_* flags.

Acked-by: Daniel Vetter <daniel@ffwll.ch>
2016-10-19 18:31:37 +09:00
Kristian H. Kristensen abfa680dbd Add drmModeAddFB2WithModifiers() which takes format modifiers
The only other user of this feature open codes the ioctl. Let's add an
entry point for this to libdrm.

Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
2016-09-28 03:32:23 -07:00
Tapani Pälli 1c205749fe remove usage of 'c_plusplus' preprocessor macro
Use only __cplusplus which is supported by the C++ standard.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-08-10 11:25:39 +03:00
Daniel Stone 32471b265c Add blob property create/destroy ioctl wrappers
v2: Use memclear to zero out structure.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
2015-06-29 19:19:22 +01:00
Ville Syrjälä ed44e0b958 Support atomic modesetting ioctl
Add support for the atomic modesetting ioctl through a property-set API.

v1: Squashed intermediate patches from Ville, Rob and myself. Updated
    for current kernel interface (no blobs).
v2: Rewrite user-facing API to provide transactional/cursor interface.
    Use memclear to zero out ioctl.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Signed-off-by: Daniel Stone <daniels@collabora.com>

v3 [Emil Velikov]: Remove DRM_CAP_ATOMIC - superseded by
DRM_CLIENT_CAP_ATOMIC.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-06-29 19:01:19 +01:00
Chris Wilson 5ed5fa1060 mode: Retrieve only the current information for a Connector
Add a new API that allows the caller to skip any forced probing, which
may require slow i2c to a remote display, and only report the currently
active mode and encoder for a Connector. This is often the information
of interest and is much, much faster than re-retrieving the link status
and EDIDs, e.g. if the caller only wishes to count the number of active
outputs.

v2: Fix error path to avoid double free after a failed GETCONNECTOR
ioctl.

v3: Daniel strongly disapproved of my disjoint in behaviour between
GetConnector and GetConnectorCurrent, and considering how best to make a
drop in replacement for drmmode_output_init() convinced me keeping the
API as consistent as possible was the right approach.

v4: Avoid probing on the second calls to GETCONNECTOR for unconnected
outputs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.com>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Cc: David Herrmann <dh.herrmann@googlemail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-04-14 15:58:26 +01:00
Daniel Kurtz d20314d083 xf86drmMode.h: inline -> __inline for use with gcc -std=c89 -pedantic
Unfortunately, there are some users of libdrm installed headers that like
to be built with -std=c89 -pedantic, which does not like "inline".

However, __inline works.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-04-05 15:33:33 +01:00
Rob Clark fb4177046d update signed/object prop types
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-11-24 19:56:50 -05:00
Matt Roper 8fc62ca8ac drm: Add universal plane capability bit and plane type enums
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-05-19 19:43:16 -04:00
Daniel Kurtz 828c3e85be Use signed location for drmModeSetPlane
DRM_IOCTL_MODE_SETPLANE crtc_x, crtc_y are s32.
This is to allow a destination location that is partially off screen.

Make this more obvious to users of libdrm by using signed crtc_x/_y
parameters for drmModeSetPlane() as well.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
2014-05-01 23:38:13 +03:00
Thomas Hellstrom c601444a90 libdrm/mode: Update the encoder and connector defines
Update the defines to match the kernel drm_mode.h

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-11-19 18:15:30 +01:00
Damien Lespiau edf5c7cde5 drm: Synchronize the stereo 3D mode flags from the kernel headers
v2: stereo layouts are now an enum (Daniel Vetter)

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-09-30 13:35:49 +01:00
Daniel Kurtz 0f4452bb51 libdrm: Make some drm headers compatible with gcc -std=c89 -pedantic
The following minor changes were needed to these headers:
 * Convert // comments to /* */
 * No , after final member of enum

With these changes, these header files can be included by a program that
is built with gcc options:
  -std=c89 -Werror -pedantic

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2013-09-22 13:30:46 -07:00
Dave Airlie 2e0ab62376 drm: add hotspot cursor interface support.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-07-02 09:21:39 +01:00
Paulo Zanoni 8c75703df0 Add support for generic object properties IOCTLs
New library calls:
- drmModeObjectGetProperties
- drmModeFreeObjectProperties
- drmModeObjectSetProperties

Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-by: Rob Clark <rob@ti.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2012-06-08 09:27:20 -05:00
David Herrman fd39e61d0e xf86drmMode.h: Add header protection
xf86drmMode.h is missing a header protection. xf86drm.h has one so just
copy it and adjust the name.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-09 13:40:14 -05:00
Ville Syrjälä a14c3dd0f9 This function was missing.
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
2012-02-02 14:53:41 -05:00
Jesse Barnes ac168bf2a0 libdrm: update drm headers from kernel, including new overlay ioctls & structs
Add structs and functions necessary for the new plane and fb handling code,
including a new header, drm_fourcc.h, that includes the surface formats
supported by various DRM drivers.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2011-12-13 11:47:15 -08: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
Marcin Kościelnicki 694ef59532 tests: vrefresh is actually not * 1000. 2010-02-28 00:25:22 +00:00
Alex Deucher 4a17be4a86 drm: a some new connector types from the kernel
Add eDP (embedded displayport) and generic TV

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2010-02-10 19:39:46 -05:00
Jakob Bornecrantz 3bd834a217 Merge branch 'modesetting-dirty-libdrm'
Conflicts:
	include/drm/drm.h
2009-12-02 19:40:58 +01: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
Jakob Bornecrantz 3e48613b48 Bring dirty code from old branch 2009-11-26 16:47:54 +01:00
Kristian Høgsberg 4f57abfe66 Move libdrm/ up one level 2009-11-17 11:15:06 -05:00