summaryrefslogtreecommitdiff
path: root/xf86drmMode.c
AgeCommit message (Collapse)AuthorFilesLines
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
2010-08-24Free the property blob along the error path.Chris Wilson1-1/+1
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-07-01drm mode: Return -errno on drmIoctl() failureChris Wilson1-24/+18
The high layers expect to receive a status code on error (on the pessimistic assumption that the errno value will have been overwritten by the time the failure is propagated all the way up), so convert xf86drmMode.c to return -errno on an ioctl error and be consistent with the rest of the libdrm API. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-01-06modes: Retry GETCONNECTOR if a hotplug event occurs between the two ioctlsPeter Clifton1-15/+43
If the available modes changes between the two GETCONNECTOR ioctls, that caused the kernel to skip filling one array and led to a crash (as the size of the allocated and initialised block of memory differed from the reported size, and might be NULL if no modes were present at first). This bug manifest its self on my machine due to spurious false positive detections of a connected TV-out. Fixes: http://bugs.freedesktop.org/show_bug.cgi?id=25912 Crash whilst probing modes Based upon the similar fixes for the GETRESOURCES ioctls by Chris Wilson, in the following commits: commit e6c136ca7a4c54457b48be1aec2be024b3e4a28d commit 85fb3e55fdb7af9b5f59c1ec0f15d1950e601b05 commit d1308f4fe7f94aae51ca9f70947aea8e09597f37 Signed-off-by: Peter Clifton <pcjc2@cam.ac.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-01-06modes: Fix previous commit for potential legal NULLsChris Wilson1-1/+5
If the count is 0, then the malloc is permitted to return NULL, so don't throw an error in that case. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-01-06modes: Free local resources after allocation failure in GETRESOURCESChris Wilson1-9/+29
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-01-06modes: Retry GETRESOURCES if a hotplug event occurs between the two ioctlsChris Wilson1-7/+22
Peter Clifton hit an issue whereby he had a spurious TV hotplug event that occurred between the two GETRESOURCES ioctls that caused the kernel to skip filling one array and led to a crash (as the size of the allocated and initialised block of memory differed from the reported size). Fixes: http://bugs.freedesktop.org/show_bug.cgi?id=25912 Crash whilst probing modes Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reported-by: Peter Clifton <pcjc2@cam.ac.uk>
2009-12-02Merge branch 'modesetting-dirty-libdrm'Jakob Bornecrantz1-0/+12
Conflicts: include/drm/drm.h
2009-12-03Bump event context structure version for page flippingJesse Barnes1-1/+1
2009-12-03Merge branch 'pageflip' of git://people.freedesktop.org/~jbarnes/drmJesse Barnes1-1/+24
Conflicts: include/drm/drm.h - RMFB had its signature changed to avoid uint32_t
2009-11-26Bring dirty code from old branchJakob Bornecrantz1-0/+12
2009-11-17Move libdrm/ up one levelKristian Høgsberg1-0/+712