summaryrefslogtreecommitdiff
path: root/xf86drmMode.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove outdated comments about stdint.hSimon Ser2021-01-111-5/+0
| | | | | | | | 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>
* drm mode : fix memory leak when freeing drmModePropertyPtrBoram Park2020-05-051-0/+1
| | | | | Closes: https://gitlab.freedesktop.org/mesa/drm/-/issues/5 Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* libdrm: drmCheckModesettingSupported: fix for FreeBSDEmmanuel Vadot2020-04-211-1/+1
| | | | | | | | FreeBSD only support up to 10 GPUs not 16. Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* libdrm: drmCheckModesettingSupported: Fix for FreeBSDEmmanuel Vadot2020-04-211-10/+2
| | | | | | | | Remove some useless busid rewritting. Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* Add drmModeGetFB2Daniel Stone2020-02-121-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* meson: always define whether headers existEric Engestrom2020-01-231-1/+1
| | | | | | | | Combined with -Wundef (added in 75758d2ccf & enforced in ba17673eed), this provides absolute safety against #ifdef typos. Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* xf86drm: Fix possible memory leak with drmModeGetPropertyPtr()Seung-Woo Kim2019-05-031-1/+1
| | | | | | | | | In drmModeGetPropertyPtr(), from upper error path, it calls free but with just next error path, it does not call. Fix the possible memory leak. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
* libdrm: reduce number of reallocations in drmModeAtomicAddPropertyAdrian Salido2019-04-251-3/+4
| | | | | | | | | | | | | | | | | | | | | | | When calling drmModeAtomicAddProperty allocation of memory happens as needed in increments of 16 elements. This can be very slow if there are multiple properties to be updated in an Atomic Commit call. Increase this to as many as can fit in a memory PAGE to avoid having to reallocate memory too often. Also this patch has a small one line perf tweak in drmModeAtomicDuplicate() to only memcpy items to the cursor position in order avoid copying the entire item array if its mostly empty. Cc: Sean Paul <seanpaul@chromium.org> Cc: Alistair Strachan <astrachan@google.com> Cc: Marissa Wall <marissaw@google.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> [jstultz: Expanded commit message] Signed-off-by: John Stultz <john.stultz@linaro.org>
* libdrm: annotate public functionsLucas De Marchi2018-09-191-73/+85
| | | | | | | | | | | | | | | | | | | | | | This was done with: nm --dynamic --defined-only build/libdrm.so | \ grep " T " | \ grep -v _fini | grep -v _init | \ cut -d' ' -f3 > /tmp/a.txt while read sym; do read f func line _ <<<$(cscope -d -L -1 $sym) if [ ! -z "$f" ]; then sed -i "${line}s/^/drm_public /" $f fi done < /tmp/a.txt Then the alignment of function arguments were manually fixed all over. The idea here will be to switch the default visibility to hidden so we don't export symbols we shouldn't. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
* xf86drmMode: merge successive mutually-exclusive #ifsEric Engestrom2018-03-221-2/+1
| | | | | | Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* meson,configure: include config.h automaticallyEric Engestrom2018-03-201-4/+0
| | | | | | | | | This will prevent any more missing `#include "config.h"` bug, at the cost of having to recompile some files that didn't need to be when changing build options. Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* drm/atomic: Refuse to add invalid objects to requestsDaniel Stone2018-03-071-0/+3
| | | | | | | | Object and property IDs cannot be zero. Prevent them from being added to the request stream at all, rather than breaking at commit time. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
* drm: Add CrtcGetSequence and CrtcQueueSequence IOCTLs [v2]Keith Packard2017-12-181-0/+9
| | | | | | | | | | | These provide a crtc-id based interface to get the current sequence (frame) number and to queue an event to be delivered at a specific sequence. v2: Remove FIRST_PIXEL_OUT flag. This has been removed from the proposed kernel API Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Add drm mode lease ioctl wrappers [v3]Keith Packard2017-12-181-0/+89
| | | | | | | | | | | | | | | | | 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>
* Add const qualifier to arguments of drmModeAddFB2()Tobias Jakobi2017-10-201-5/+5
| | | | | | | | | | 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>
* Add CRTC ID to vblank eventAnder Conselvan de Oliveira2017-04-061-8/+16
| | | | | | | | | | | | | | | | | | | | When using the atomic API, one request can span multiple CRTCs, however one event is generated per CRTC. As we cannot disambiguate the CRTC with user data (since we only have one piece of user data to pass in), newer kernels can include the CRTC ID in the page flip event. Add a new vfunc to dispatch vblank events carrying a CRTC ID to clients who negotiate a higher interface version. [daniels: Rebased, include new cap, call page_flip_handler if it is set but page_flip_handler2 isn't even on newer contexts, write a commit message.] v2: Split into separate commit. Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@intel.com>
* xf86drm: Fix type-punned pointer build warningThierry Reding2017-01-181-1/+1
| | | | | | | | | | | | CC libdrm_la-xf86drmMode.lo ../xf86drmMode.c: In function 'drmHandleEvent': ../xf86drmMode.c:854:15: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] e = (struct drm_event *)(&buffer[i]); ^ Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99350 Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
* Add drmModePageFlipTargetMichel Dänzer2016-10-191-0/+16
| | | | | | It supports the DRM_MODE_PAGE_FLIP_TARGET_* flags. Acked-by: Daniel Vetter <daniel@ffwll.ch>
* Add drmModeAddFB2WithModifiers() which takes format modifiersKristian H. Kristensen2016-09-281-4/+17
| | | | | | | | 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>
* xf86drm: Fix spelling mistakesEric Engestrom2016-04-071-1/+1
| | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* Fix memory leak with drmModeGetConnectorCurrent()Ville Syrjälä2016-01-071-4/+7
| | | | | | | | | | | | | | | | | drmModeGetConnectorCurrent() must provide temporary storage for the kernel to fill in at least one mode (asking for !=0 modes is how you prevent the heavyweight probe in the kernel). Currently we malloc that temp storage but we fail to free it before overwriting the pointer with the address of the actual storage we use to store the real mode list we get from the kernel in the second ioctl call. Let's just keep the temporary storage on the stack and thus we avoid the leak and also eliminate some pointless mallocs. Cc: Chris Wilson <chris@chris-wilson.co.uk> Fixes: 5ed5fa10600f ("mode: Retrieve only the current information for a Connector") Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
* xf86drmMode: smoke-test the atomic APIEmil Velikov2015-09-211-1/+16
| | | | | | | | | | | | | | As going through the modetest patches for atomic support I've noticed that if we pass NULL for the drmModeAtomicReqPtr argument we'll crash. So let's handle things appropriately if the user forgot to check the return value of drmModeAtomicAlloc and drmModeAtomicDuplicate or made a typo somewhere along the way. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Rob Clark <robclark@freedesktop.org> Cc: Daniel Stone <daniels@collabora.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* xf86drmMode: remove the trailing white spacesHyungwon Hwang2015-08-201-2/+2
| | | | | | This patch removes the trailing white spaces. Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
* libdrm: Make indentation consistentThierry Reding2015-08-181-2/+2
| | | | | | | | Use tabs and spaces consistently to align function arguments on subsequent lines with those of the first line. Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
* libdrm: Remove gratuitous blank linesThierry Reding2015-08-181-8/+0
| | | | | | | | Usage of blank lines can be a matter of taste, of course, but for these we can surely all agree that they're not needed and inconsistent. Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
* xf86drmMode: Implement drmCheckModesettingSupported() for OpenBSDJonathan Gray2015-07-291-1/+18
| | | | | | | | This is implemented with kms ioctls so it could also be used as a generic fallback. Signed-off-by: Jonathan Gray <jsg@jsg.id.au> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* drm: Detect no-op drmModeAtomicRequest and return earlyChris Wilson2015-07-281-2/+6
| | | | | | | | | | | | | | | If the number of items to process in the request is zero, we can forgo duplicating, sorting the request and feeding it into the kernel and instead report success immediately. This prevents a NULL dereference of the sorted->items for the no-op request. Fixes: ed44e0b9585c563905447eceed12af9c1c7ca8d4 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Rob Clark <robclark@freedesktop.org> Cc: Daniel Stone <daniels@collabora.com> Cc: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* Fix headers inclusion in xf86drmMode.cJulien Cristau2015-07-111-0/+3
| | | | | | | | | | | Add sys/sysctl.h to get sysctlbyname declaration on kFreeBSD Updated by Thorsten “mirabilos” Glaser <t.glaser@tarent.de> to add autoconf check and only include <sys/sysctl.h> if it is detected by configure as it’s unusable on Linux/x32 (and others, e.g. other new architectures). Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* xf86drmMode: include config.h before anything elseEmil Velikov2015-06-291-4/+5
| | | | Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* xf86drmMode: remove unused valgrind(VG) macrosEmil Velikov2015-06-291-8/+0
| | | | Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* Add blob property create/destroy ioctl wrappersDaniel Stone2015-06-291-0/+34
| | | | | | | v2: Use memclear to zero out structure. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Rob Clark <robclark@freedesktop.org>
* Support atomic modesetting ioctlVille Syrjälä2015-06-291-0/+240
| | | | | | | | | | | | | | | | | 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>
* mode: Retrieve only the current information for a ConnectorChris Wilson2015-04-141-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix type-limits, pointer-arith and sign-compare warningsJan Vesely2015-03-141-1/+1
| | | | | Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Reviewed-by: Emil Velikov <eil.l.velikov@gmail.com>
* xf86drmMode: Unconditionally clear ioctl structsDaniel Vetter2015-02-111-27/+28
| | | | | | | | | We really have to do this to avoid surprises when extending the ABI later on. Especially when growing the structures. Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
* Fix gcc -Wextra warningsJan Vesely2015-02-101-1/+1
| | | | | | Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Reviewed-by: Ian Romanick <idr@freedesktop.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* drm: Implement drmCheckModesettingSupported() for DragonFlyFrançois Tigeot2014-08-141-0/+2
| | | | | | | | | | | | For the sake of simplicity, KMS support can always be considered present on DragonFly. If some particular version doesn't support KMS yet, appropriate checks are already done in Dports's x11-drivers/ Makefiles and KMS-enabled driver packages don't get built. Signed-off-by: François Tigeot <ftigeot@wolfpond.org> Signed-off-by: Maarten Lankhorst <dev@mblankhorst.nl>
* Use signed location for drmModeSetPlaneDaniel Kurtz2014-05-011-1/+1
| | | | | | | | | | | 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>
* drm: Implement drmCheckModesettingSupported() for FreeBSDRobert Millan2014-01-241-1/+34
| | | | | | | | | Add the missing implementation of drmCheckModesettingSupported() to detect KMS support on FreeBSD (and GNU/kFreeBSD). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72847 Signed-off-by: Konstantin Belousov <kib@freebsd.org> Signed-off-by: Robert Millan <rmh@freebsd.org>
* drm: Initialize or valgrind-clear modesetting ioctl arguments.Eric Anholt2014-01-201-0/+19
| | | | | | | | Fixes valgrind complaints in the modesetting driver. I tried to follow each ioctl's pattern for whether it was initializing just the in values, or both in and out values. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* drm: add hotspot cursor interface support.Dave Airlie2013-07-021-0/+15
| | | | Signed-off-by: Dave Airlie <airlied@redhat.com>
* initialize width/height fields in drmModeCrtcRob Clark2012-10-141-1/+4
| | | | | | | | | If we have valid timings, we can at least set width/height to *something*, which is I think at least less confusing than always seeing width/height of zero. At least modeprint and modetest seem to expect width/height to mean something. Signed-off-by: Rob Clark <rob@ti.com>
* Add support for bitmask propertiesRob Clark2012-06-081-2/+2
| | | | | | | | | 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>
* Add support for generic object properties IOCTLsPaulo Zanoni2012-06-081-0/+83
| | | | | | | | | | | 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>
* Using sizeof() on a function parameter with an array type does notVille Syrjälä2012-02-021-3/+3
| | | | | | work. sizeof() treats such parameters as pointers. Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
* This function was missing.Ville Syrjälä2012-02-021-0/+9
| | | | Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
* drmModeFreeResources() always leaked some memory.Ville Syrjälä2012-02-021-0/+6
| | | | | | | drmModeGetPlaneResources() and drmModeGetPlane() leaked in one error path. Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
* libdrm: update drm headers from kernel, including new overlay ioctls & structsJesse Barnes2011-12-131-0/+153
| | | | | | | | 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>
* drm mode: fix drmIoctl wrapperMarcin Slusarz2011-09-181-1/+1
| | | | | | | | | | | Both drmIoctl and ioctl define second argument as unigned long. Debugging/tracing tools (like strace or valgrind) on 64-bit machines see different request value for ioctls with 32nd bit set, because casting signed int to unsigned long extends 32nd bit to upper word, so 0x80000000 becomes 0xFFFFFFFF80000000) Nobody noticed because higher 32 bits are chopped off on their way to kernel.
* Specify the return type explicitly.Chih-Wei Huang2011-07-121-1/+1
|