summaryrefslogtreecommitdiff
path: root/xf86drmMode.c
AgeCommit message (Collapse)AuthorFilesLines
2020-12-08support drm_user_handler to handle vendor eventsBoram Park1-0/+73
Add drm_user_hander to handle vendor drm events like ipp events. Note: From tizen, this is used from libtdm vendor layer. Change-Id: I23149a08d9f9f66f9929d95dcfe6a96c1c897404 Signed-off-by: Boram Park <boram1288.park@samsung.com> check if user_handler_list inited Change-Id: I95abd7e8cc8d0485a7cc06dca54bfa46775eb8aa Signed-off-by: Boram Park <boram1288.park@samsung.com> [inki.dae: add omitted patch from tizen libdrm-2.4.75] Signed-off-by: Inki Dae <inki.dae@samsung.com> [sw0312.kim: squash user_handler patches] Signed-off-by: Seung-Woo Kim <sw0312.kim>
2020-05-05drm mode : fix memory leak when freeing drmModePropertyPtrBoram Park1-0/+1
Closes: https://gitlab.freedesktop.org/mesa/drm/-/issues/5 Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21libdrm: drmCheckModesettingSupported: fix for FreeBSDEmmanuel Vadot1-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>
2020-04-21libdrm: drmCheckModesettingSupported: Fix for FreeBSDEmmanuel Vadot1-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>
2020-02-12Add drmModeGetFB2Daniel Stone1-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>
2020-01-23meson: always define whether headers existEric Engestrom1-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>
2019-05-03xf86drm: Fix possible memory leak with drmModeGetPropertyPtr()Seung-Woo Kim1-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>
2019-04-25libdrm: reduce number of reallocations in drmModeAtomicAddPropertyAdrian Salido1-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>
2018-09-19libdrm: annotate public functionsLucas De Marchi1-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>
2018-03-22xf86drmMode: merge successive mutually-exclusive #ifsEric Engestrom1-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>
2018-03-20meson,configure: include config.h automaticallyEric Engestrom1-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>
2018-03-07drm/atomic: Refuse to add invalid objects to requestsDaniel Stone1-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>
2017-12-18drm: Add CrtcGetSequence and CrtcQueueSequence IOCTLs [v2]Keith Packard1-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>
2017-12-18drm: Add drm mode lease ioctl wrappers [v3]Keith Packard1-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>
2017-10-20Add const qualifier to arguments of drmModeAddFB2()Tobias Jakobi1-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>
2017-04-06Add CRTC ID to vblank eventAnder Conselvan de Oliveira1-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>
2017-01-18xf86drm: Fix type-punned pointer build warningThierry Reding1-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>
2016-10-19Add drmModePageFlipTargetMichel Dänzer1-0/+16
It supports the DRM_MODE_PAGE_FLIP_TARGET_* flags. Acked-by: Daniel Vetter <daniel@ffwll.ch>
2016-09-28Add drmModeAddFB2WithModifiers() which takes format modifiersKristian H. Kristensen1-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>
2016-04-07xf86drm: Fix spelling mistakesEric Engestrom1-1/+1
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-01-07Fix memory leak with drmModeGetConnectorCurrent()Ville Syrjälä1-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>
2015-09-21xf86drmMode: smoke-test the atomic APIEmil Velikov1-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>
2015-08-20xf86drmMode: remove the trailing white spacesHyungwon Hwang1-2/+2
This patch removes the trailing white spaces. Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
2015-08-18libdrm: Make indentation consistentThierry Reding1-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>
2015-08-18libdrm: Remove gratuitous blank linesThierry Reding1-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>
2015-07-29xf86drmMode: Implement drmCheckModesettingSupported() for OpenBSDJonathan Gray1-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>
2015-07-28drm: Detect no-op drmModeAtomicRequest and return earlyChris Wilson1-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>
2015-07-11Fix headers inclusion in xf86drmMode.cJulien Cristau1-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>
2015-06-29xf86drmMode: include config.h before anything elseEmil Velikov1-4/+5
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-06-29xf86drmMode: remove unused valgrind(VG) macrosEmil Velikov1-8/+0
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-06-29Add blob property create/destroy ioctl wrappersDaniel Stone1-0/+34
v2: Use memclear to zero out structure. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Rob Clark <robclark@freedesktop.org>
2015-06-29Support atomic modesetting ioctlVille Syrjälä1-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>
2015-04-14mode: Retrieve only the current information for a ConnectorChris Wilson1-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>
2015-03-14Fix type-limits, pointer-arith and sign-compare warningsJan Vesely1-1/+1
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Reviewed-by: Emil Velikov <eil.l.velikov@gmail.com>
2015-02-11xf86drmMode: Unconditionally clear ioctl structsDaniel Vetter1-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>
2015-02-10Fix gcc -Wextra warningsJan Vesely1-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>
2014-08-14drm: Implement drmCheckModesettingSupported() for DragonFlyFrançois Tigeot1-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>
2014-05-01Use signed location for drmModeSetPlaneDaniel Kurtz1-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>
2014-01-24drm: Implement drmCheckModesettingSupported() for FreeBSDRobert Millan1-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>
2014-01-20drm: Initialize or valgrind-clear modesetting ioctl arguments.Eric Anholt1-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>
2013-07-02drm: add hotspot cursor interface support.Dave Airlie1-0/+15
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-10-14initialize width/height fields in drmModeCrtcRob Clark1-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>
2012-06-08Add support for bitmask propertiesRob Clark1-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>
2012-06-08Add support for generic object properties IOCTLsPaulo Zanoni1-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>
2012-02-02Using sizeof() on a function parameter with an array type does notVille Syrjälä1-3/+3
work. sizeof() treats such parameters as pointers. Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
2012-02-02This function was missing.Ville Syrjälä1-0/+9
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
2012-02-02drmModeFreeResources() always leaked some memory.Ville Syrjälä1-0/+6
drmModeGetPlaneResources() and drmModeGetPlane() leaked in one error path. Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
2011-12-13libdrm: update drm headers from kernel, including new overlay ioctls & structsJesse Barnes1-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>
2011-09-18drm mode: fix drmIoctl wrapperMarcin Slusarz1-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.
2011-07-12Specify the return type explicitly.Chih-Wei Huang1-1/+1