Re: [PATCH 4.19 098/118] drm/lease: Send a distinct uevent

2018-12-11 Thread Keith Packard
Greg Kroah-Hartman writes: > 4.19-stable review patch. If anyone has any objections, please let me > know. Acked-by: Keith Packard -- -keith signature.asc Description: PGP signature

Re: [PATCH] drm: Add crtc_queue_syncobj and crtc_get_syncobj ioctls

2018-04-07 Thread Keith Packard
Jason Ekstrand writes: > Yeah, I suppose an application could ask for 10k frames in the future or > something ridiculous like that. For sync_file, people strongly want a > finite time guarantee for security/deadlock reasons. I don't know how > happy they would be with a finite time of 10 minute

Re: [PATCH] drm: Add crtc_queue_syncobj and crtc_get_syncobj ioctls

2018-04-06 Thread Keith Packard
Jason Ekstrand writes: > Is the given sequence number guaranteed to be hit in finite time? Certainly, it's a finite value... However, realistically, it's just like all of the other vblank interfaces where you can specify a crazy sequence and block for a very long time. So, no different from the

[PATCH 0/1] drm: Add crtc_queue_syncobj and crtc_get_syncobj ioctls

2018-04-06 Thread Keith Packard
(This is an RFC on whether this pair of ioctls seems reasonable. The code compiles, but I haven't tested it as I'm away from home this weekend.) I'm rewriting my implementation of the Vulkan EXT_display_control extension, which provides a way to signal a Vulkan fence at vblank time. I had implemen

[PATCH] drm: Add crtc_queue_syncobj and crtc_get_syncobj ioctls

2018-04-06 Thread Keith Packard
-by: Keith Packard --- drivers/gpu/drm/drm_file.c | 5 + drivers/gpu/drm/drm_internal.h | 4 + drivers/gpu/drm/drm_ioctl.c| 2 + drivers/gpu/drm/drm_syncobj.c | 13 ++- drivers/gpu/drm/drm_vblank.c | 212 + include/drm/drm_file.h

Re: [PATCH] USB: chaoskey: Use kasprintf() over strcpy()/strcat()

2018-02-16 Thread Keith Packard
Kees Cook writes: > Instead of kmalloc() with manually calculated values followed by > multiple strcpy()/strcat() calls, just fold it all into a single > kasprintf() call. > > Signed-off-by: Kees Cook Reviewed-by: Keith Packard -- -keith signature.asc Description: PGP signature

Re: [PATCH] hwrng: Explicitly drop current_rng when unregistering rng device

2018-02-04 Thread Keith Packard
Tom Lendacky writes: > A similar fix was already in the cryptodev tree and I thought was part of > a recent pull request. Yup, just saw it on master. I've checked and it will do pretty much the same thing as my patch, with the addition of clearing cur_rng_set_by_user, which is necessary. Thanks

[PATCH] hwrng: Explicitly drop current_rng when unregistering rng device

2018-01-30 Thread Keith Packard
hang. Signed-off-by: Keith Packard --- drivers/char/hw_random/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 657b8770b6b9..8df3f9f147e2 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char

Re: [PATCH] drm: Check for lessee in DROP_MASTER ioctl

2018-01-30 Thread Keith Packard
Daniel Vetter writes: > On Thu, Jan 18, 2018 at 05:51:59PM -0800, Keith Packard wrote: >> Don't let a lessee control what the current DRM master is set to; >> that's the job of the "real" master. Otherwise, the lessee would >> disable all access to master

Re: [PATCH] USB: misc: chaoskey: Use true and false for boolean values

2018-01-23 Thread Keith Packard
"Gustavo A. R. Silva" writes: > Assign true or false to boolean variables instead of an integer value. > > This issue was detected with the help of Coccinelle. > > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Keith Packard -- -keith signature.asc Description: PGP signature

[PATCH] drm: Check for lessee in DROP_MASTER ioctl

2018-01-18 Thread Keith Packard
Don't let a lessee control what the current DRM master is set to; that's the job of the "real" master. Otherwise, the lessee would disable all access to master operations for the owner and all lessees under it. This matches the same check made in the SET_MASTER ioctl.

[PATCH] drm: move lease init after validation in drm_lease_create

2017-12-20 Thread Keith Packard
s are not filled in until the parameters are all validated and the function will succeed. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_lease.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_le

[PATCH] drm: Update edid-derived drm_display_info fields at edid property set [v2]

2017-12-13 Thread Keith Packard
pdate_edid_property about potentially merging that with drm_add_edid_modes to avoid the need for two driver calls. Signed-off-by: Keith Packard Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_connector.c | 13 ++ drivers/gpu

[PATCH] drm: Update edid-derived drm_display_info fields at edid property set

2017-12-07 Thread Keith Packard
e_edid_property taking a 'const struct edid *' parameter and wanting to pass that along to drm_add_display_info. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_connector.c | 13 ++ drivers/gpu/drm/drm_edid.c | 53 ++--- include/drm

[PATCH 2/3] drm/fb: add support for not enabling fbcon on non-desktop displays [v2]

2017-11-10 Thread Keith Packard
From: Dave Airlie We don't want fbcon to get used on non-desktop dislays, don't pass them as enabled connectors to the fb helper setup. This prevents my HMD from getting disorted fbcon, and from affecting other displays console. v2: Change description from non-standard to non-desktop Signed-of

[PATCH 0/3] drm: Add connector info/property for non-desktop [v2]

2017-11-10 Thread Keith Packard
This is the same as the series for non-standard displays but uses the phrase 'non-desktop' instead. No functional changes.

[PATCH 3/3] drm/edid: quirk HTC vive headset as non-desktop. [v2]

2017-11-10 Thread Keith Packard
From: Dave Airlie This uses the EDID info from my HTC Vive to mark it as non-desktop. v2: Change description from non-standard to non-desktop Signed-off-by: Dave Airlie --- drivers/gpu/drm/drm_edid.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/g

[PATCH 1/3] drm: add connector info/property for non-desktop displays [v2]

2017-11-10 Thread Keith Packard
From: Dave Airlie This adds the infrastructure needed to quirk displays using edid and to mark them a non-desktop. A non-desktop display is one which shouldn't normally be included as a part of a desktop environment. This is meant to cover head mounted devices like HTC Vive. v2: Change descrip

Re: [PATCH 5/5] drm: Add four ioctls for managing drm mode object leases [v6]

2017-10-16 Thread Keith Packard
Sean Paul writes: > nit: space before , Thanks. >> +/* Clone the lessor file to create a new file for us */ >> +DRM_DEBUG_LEASE("Allocating lease file\n"); >> +path_get(&lessor_file->f_path); > > Please forgive the stupid question, but where is this reference given > up? That's not

Re: [PATCH 3/5] drm: Add drm_object lease infrastructure [v4]

2017-10-16 Thread Keith Packard
Sean Paul writes: > With these nits fixed, > Reviewed-by: Sean Paul Like this? From 0aa52dd5a0873831c79c14942075354c041e5bed Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 16 Oct 2017 13:41:20 -0700 Subject: [PATCH] drm: Mark functions requiring idr_mutex. Add lock

Re: [PATCH 0/5]: drm: Add drm mode object leases

2017-10-16 Thread Keith Packard
Daniel Vetter writes: > A bit lacking time to do an in-depth review, but all my major concerns > seem to be addressed. On the series. Thanks much. I sent out a note over the weekend about how we can make the Vulkan API work without the permissions change in the kernel. We need to provide access

Re: [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v3]

2017-10-15 Thread Keith Packard
Sean Paul writes: > Sphinx won't pick these up, and will issue warnings. Please update to @ > instead of \param > > If you want to try it out: > make htmldocs Yeah, I was attempting to emulate the existing style. I suggest that a general cleanup to fix the docstrings should be in a separate patc

[PATCH 3/5] drm: Add drm_object lease infrastructure [v4]

2017-10-12 Thread Keith Packard
d by removing all of the objects they have access to. The lease itself hangs around as it's hanging off a file. * Free the leases IDR when the master is destroyed * _drm_lease_held should look at lessees, not lessor * Allow non-master files to check for lease status Changes in v

[PATCH 2/5] drm: Add new LEASE debug level

2017-10-12 Thread Keith Packard
Separate out lease debugging from the core. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_drv.c | 3 ++- include/drm/drmP.h| 4 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index c0292e5d7281

[PATCH 0/5]: drm: Add drm mode object leases

2017-10-12 Thread Keith Packard
New since last time: * Don't lease encoders * Do lease planes * Automatically lease primary and cursor planes for apps which don't set universal_planes * Restrict leases to only contain objects which are actually leasable (connectors, crtcs and planes) * Drop the patch which changes per

[PATCH 4/5] drm: Check mode object lease status in all master ioctl paths [v3]

2017-10-12 Thread Keith Packard
along, we can now centralize most of the lease-based access checks in that function. * A few places skip that API and require in-line checks. Changes for v3 provided by Dave Airlie * remove support for leasing encoders. * add support for leasing planes. Signed-off-by: Keith Packard

[PATCH 1/5] drm/plane: drop num_overlay_planes (v2)

2017-10-12 Thread Keith Packard
From: Dave Airlie In order to implement plane leasing we need to count things, just make the code consistent with the counting code currently used for counting crtcs/encoders/connectors and drop the need for num_overlay_planes. v2: don't forget to assign plane_ptr. (keithp) Signed-off-by: Dave

[PATCH 5/5] drm: Add four ioctls for managing drm mode object leases [v6]

2017-10-12 Thread Keith Packard
s as well. This also moves the object look ups earlier as a side effect, so we'd exit the ioctl quicker for non-existant objects. * Restrict leases to crtc/connector/planes. This only allows leasing for objects we wish to allow. Signed-off-by: Keith Packard Signed-off-by: Dave

[PATCH 2/3] drm: Reorganize drm_pending_event to support future event types [v2]

2017-10-12 Thread Keith Packard
for MODESETTING before looking for crtc in queue_vblank_event UMS drivers will oops if we try to get a crtc, so make sure we're modesetting before we try to find a crtc_id to fill into the event. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_atomic.c

[PATCH 0/3] drm: Add new vblank ioctls [v4]

2017-10-12 Thread Keith Packard
This series removes portions of the first patch which switched to ktime_t as Arnd Bergmann posted a cleaner patch which did only that. Otherwise, it's the same. -keith

[PATCH 1/3] drm: Widen vblank count to 64-bits [v3]

2017-10-12 Thread Keith Packard
the switch to ktime_t parts. Suggested-by: Michel Dänzer Suggested-by: Daniel Vetter Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_vblank.c | 104 +-- include/drm/drm_vblank.h | 10 +++-- 2 files changed, 78 insertions(+), 36 deletions(-)

[PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v3]

2017-10-12 Thread Keith Packard
re that of the first pixel leaving the display engine for the display (using the same wording as the Vulkan spec). Suggested-by: Michel Dänzer Acked-by: Dave Airlie Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_internal.h | 6 ++ drivers/gpu/drm/drm_ioctl.c| 2 + drive

Re: [PATCH 2/6] drm: Allow render nodes to query display objects

2017-10-12 Thread Keith Packard
Daniel Vetter writes: > One more that came up on irc after discussion why this is needed: The > userspace side using this won't work on split gpus where the render node > has 0 displays, and hence where you really need to query the compositor > anyway. Agreed -- using the X connection to get the

Re: [PATCH 2/6] drm: Allow render nodes to query display objects

2017-10-12 Thread Keith Packard
Daniel Vetter writes: > So given the huge possibilities of abuse, do we really, really need all > this, and is there not any way to create a bit of protocol to pass the > relevant data from X to clients? From your presentation is sounded like > current xrandr is (almost) there ... Yeah, it's the

Re: [PATCH 1/2] drm: vblank: use ktime_t instead of timeval

2017-10-12 Thread Keith Packard
tch is better than the portion of my patch which does the same thing as it uses the ktime APIs consistently and doesn't assume that ktime_t is in ns. Thanks much! Reviewed-by: Keith Packard -- -keith signature.asc Description: PGP signature

Re: [PATCH 1/2] drm: vblank: use ktime_t instead of timeval

2017-10-11 Thread Keith Packard
Sean Paul writes: > Would it be easier for you to respin this into your series, or for me > to just apply it to drm-misc-next? Yeah, I don't see any particular hurry to getting just the time widening patch merged as it doesn't change any external interfaces. I'll go ahead and respin my series us

Re: [PATCH 1/2] drm: vblank: use ktime_t instead of timeval

2017-10-11 Thread Keith Packard
Sean Paul writes: > It looks like perhaps Keith missed one of the comment tweaks that you have > below. > > Keith, perhaps you can rebase your widening patch on this one? I'm easy; either order works for me just fine. Having the time change separated from the sequence change might be nice? --

Re: [PATCH 1/2] drm: vblank: use ktime_t instead of timeval

2017-10-11 Thread Keith Packard
Arnd Bergmann writes: > That is an interesting coincidence, I created my patch earlier this week > without having any idea that others were looking at the same files. My requirements were to support 64-bit vblank counts and ns precision vblank timing for Vulkan; obviously using ktime_t was a goo

[PATCH 2/3] drm: Reorganize drm_pending_event to support future event types [v2]

2017-10-10 Thread Keith Packard
for MODESETTING before looking for crtc in queue_vblank_event UMS drivers will oops if we try to get a crtc, so make sure we're modesetting before we try to find a crtc_id to fill into the event. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_atomic.c |

[PATCH 1/3] drm: Widen vblank UAPI to 64 bits. Change vblank time to ktime_t [v2]

2017-10-10 Thread Keith Packard
count as before. * Leave driver API with 32-bit vblank count Suggested-by: Michel Dänzer Suggested-by: Daniel Vetter Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_vblank.c | 214 +++ include/drm/drm_drv.h| 2 +- include/drm/drm_vblank.h

[PATCH 4/6] drm: Add drm_object lease infrastructure [v4]

2017-10-10 Thread Keith Packard
d by removing all of the objects they have access to. The lease itself hangs around as it's hanging off a file. * Free the leases IDR when the master is destroyed * _drm_lease_held should look at lessees, not lessor * Allow non-master files to check for lease status Changes in v

[PATCH 6/6] drm: Add four ioctls for managing drm mode object leases [v5]

2017-10-10 Thread Keith Packard
lign on 64-bit boundaries Changes for v5 suggested by Dave Airlie * Check for non-negative object_id in create_lease to avoid debug output from the kernel. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_ioctl.c | 4 + drivers/gpu/drm/drm_

[PATCH 3/6] drm: Add new LEASE debug level

2017-10-10 Thread Keith Packard
Separate out lease debugging from the core. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_drv.c | 3 ++- include/drm/drmP.h| 4 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index c0292e5d7281

[PATCH 5/6] drm: Check mode object lease status in all master ioctl paths [v2]

2017-10-10 Thread Keith Packard
, we can now centralize most of the lease-based access checks in that function. A few places skip that API and require in-line checks. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_auth.c| 2 +- drivers/gpu/drm/drm_connector.c | 5 +++-- drivers/gpu/drm/drm_encoder.c | 8

[PATCH 0/6] drm: Add drm mode object leases

2017-10-10 Thread Keith Packard
New since last time: * Fix vboxvideo driver in staging * Fixed some formatting and whitespace errors (Dave Airlie) * Explain the odd use of the idr interface for leases (Dave Airlie) * Disallow negative object_id in lease creation (Dave Airlie) It's also been rebased on top of the drm-sequenc

[PATCH 2/6] drm: Allow render nodes to query display objects

2017-10-10 Thread Keith Packard
This allows an application to discover what display resources are available before requesting a lease from the X server. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_ioctl.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm

[PATCH 1/6] drm: Pass struct drm_file * to __drm_mode_object_find [v2]

2017-10-10 Thread Keith Packard
This will allow __drm_mode_object_file to be extended to perform access control checks based on the file in use. v2: Also fix up vboxvideo driver in staging Suggested-by: Daniel Vetter Signed-off-by: Keith Packard --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 16

[PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v3]

2017-10-10 Thread Keith Packard
re that of the first pixel leaving the display engine for the display (using the same wording as the Vulkan spec). Suggested-by: Michel Dänzer Acked-by: Dave Airlie Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_internal.h | 6 ++ drivers/gpu/drm/drm_ioctl.c| 2 + drive

[PATCH 0/3] drm: add new vblank ioctls [v3]

2017-10-10 Thread Keith Packard
This version removes the FIRST_PIXEL_OUT flag as the existing code already conforms to that requirement. It has also been rebased to drm-next.

Re: [PATCH 6/6] drm: Add four ioctls for managing drm mode object leases [v4]

2017-10-10 Thread Keith Packard
Dave Airlie writes: >> +*/ >> + ret = idr_alloc(&leases, &drm_lease_idr_object , object_id, >> object_id + 1, GFP_KERNEL); > > In current kernels, the idr_alloc warns if start < 0, so if object_id > is a negative signed integer, which your > igt tests actually make

Re: [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v2]

2017-10-09 Thread Keith Packard
Daniel Vetter writes: > I just figured that -modesetting would be the simplest domenstration > vehicle, since the vulkan patches don't look ready yet. I need fully > reviewed&tested userspace before we can land any kernel stuff. Doing > the quick modesetting conversion would unblock. I've provid

Re: [PATCH 6/6] drm: Add four ioctls for managing drm mode object leases [v3]

2017-10-04 Thread Keith Packard
Dave Airlie writes: > I think a comment in here is definitely warranted with what you expect > from the idr interface here. I've added a longer comment where this value is used; I tried replacing the IDR with a sorted array and the result wasn't any easier to use or understand. I'm pretty sure i

[PATCH 1/6] drm: Pass struct drm_file * to __drm_mode_object_find

2017-10-04 Thread Keith Packard
This will allow __drm_mode_object_file to be extended to perform access control checks based on the file in use. Suggested-by: Daniel Vetter Signed-off-by: Keith Packard --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 16 drivers/gpu/drm/amd/amdgpu/dce_virtual.c

[PATCH 4/6] drm: Add drm_object lease infrastructure [v4]

2017-10-04 Thread Keith Packard
d by removing all of the objects they have access to. The lease itself hangs around as it's hanging off a file. * Free the leases IDR when the master is destroyed * _drm_lease_held should look at lessees, not lessor * Allow non-master files to check for lease status Changes in v

[PATCH 2/6] drm: Allow render nodes to query display objects

2017-10-04 Thread Keith Packard
This allows an application to discover what display resources are available before requesting a lease from the X server. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_ioctl.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm

[PATCH 6/6] drm: Add four ioctls for managing drm mode object leases [v4]

2017-10-04 Thread Keith Packard
lign on 64-bit boundaries Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_ioctl.c | 4 + drivers/gpu/drm/drm_lease.c | 277 include/drm/drm_lease.h | 12 ++ include/uapi/drm/drm.h | 5 + include/uapi/drm/drm_mode.h | 66 +++ 5 file

[PATCH 3/6] drm: Add new LEASE debug level

2017-10-04 Thread Keith Packard
Separate out lease debugging from the core. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_drv.c | 3 ++- include/drm/drmP.h| 4 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 2ed2d919beae

[PATCH 0/6] drm: Add leases [v4]

2017-10-04 Thread Keith Packard
Here's another version of the DRM lease series. No changes in the code at all: [PATCH 4/6] drm: Add drm_object lease infrastructure [v4] Changes in v4, suggested by Dave Airlie * Formatting and whitespace changes [PATCH 6/6] drm: Add four ioctls for managing drm mode object leas

[PATCH 5/6] drm: Check mode object lease status in all master ioctl paths [v2]

2017-10-04 Thread Keith Packard
, we can now centralize most of the lease-based access checks in that function. A few places skip that API and require in-line checks. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_auth.c| 2 +- drivers/gpu/drm/drm_connector.c | 5 +++-- drivers/gpu/drm/drm_encoder.c | 8

Re: [PATCH 1/3] drm: Widen vblank UAPI to 64 bits. Change vblank time to ktime_t [v2]

2017-08-06 Thread Keith Packard
Daniel Vetter writes: > Subject is a bit confusing since you say uapi, but this is just the > internal prep work. Dropping UAPI fixes that. With that fixed: Yeah, thanks. > Reviewed-by: Daniel Vetter Added. > Two more optional comments below, feel free to adapt or ignore. I'll wait > for Mic

Re: [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v2]

2017-08-05 Thread Keith Packard
Michel Dänzer writes: > [...] > >> +#define DRM_CRTC_SEQUENCE_NEXT_ON_MISS 0x0002 /* Use >> next sequence if we've missed */ > > Do you have userspace making use of DRM_CRTC_SEQUENCE_NEXT_ON_MISS? If > not, drop it. I added this so that the new ioctl would be compatible wi

Re: [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v2]

2017-08-05 Thread Keith Packard
Daniel Vetter writes: > Since I missed all the details Michel spotted, so I'll defer to his r-b. > Also, before merging we need the userspace user. Do we have e.g. > -modesetting patch for this, fully reviewed&ready for merging, just as > demonstration? Well, given that we'll have to keep the ol

[PATCH 0/3] drm: Add CRTC-id based ioctls for vblank query/event

2017-07-31 Thread Keith Packard
Here's an updated series for the proposed new IOCTLs. Major changes since last time: * Leave driver API with 32-bit vblank counts * Use ktime_t instead of struct timespec. * Check for MODESETTING before using modesetting APIs * Ensure vblank is running in new get_sequence ioctl There are othe

[PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v2]

2017-07-31 Thread Keith Packard
nce ioctls Daniel Vetter prefers these over the old drm_vblank_put/get APIs. * Return s64 ns instead of u64 in new sequence event Suggested-by: Daniel Vetter Suggested-by: Ville Syrjälä Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_internal.h | 6 ++ drivers/gpu/drm/d

[PATCH 1/3] drm: Widen vblank UAPI to 64 bits. Change vblank time to ktime_t [v2]

2017-07-31 Thread Keith Packard
count as before. * Leave driver API with 32-bit vblank count Suggested-by: Michel Dänzer Suggested-by: Daniel Vetter Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_vblank.c | 186 +-- include/drm/drmP.h | 2 +- include/drm/drm_drv.h

[PATCH 2/3] drm: Reorganize drm_pending_event to support future event types [v2]

2017-07-31 Thread Keith Packard
for MODESETTING before looking for crtc in queue_vblank_event UMS drivers will oops if we try to get a crtc, so make sure we're modesetting before we try to find a crtc_id to fill into the event. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_atomic.c |

Re: [PATCH 1/3] drm: Widen vblank count to 64 bits. Change vblank time precision to ns

2017-07-25 Thread Keith Packard
Daniel Vetter writes: > I'd drop that part (but keep 64 everywhere else ofc). Yeah, we only ever ask drivers for a delta anyways, so keeping an internal 64-bit value while retaining the 32-bit driver API is easy to manage. >> > Other thought on this, since you bother to change all the types: Af

Re: [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls

2017-07-06 Thread Keith Packard
Ville Syrjälä writes: > With the disable_immediate thing we only wait until the next vblank > before disabling the irq again. Ok, still sounds like we'll be doing fine if the application does a get immediately followed by a queue event. At least most of the time. -- -keith signature.asc Desc

Re: [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls

2017-07-06 Thread Keith Packard
Ville Syrjälä writes: > I was mostly thinking of the 'seq = query(); wait(seq + n);' pattern > where we can avoid doing the full update more than once if we enable > the interrupt already during the query. Don't we still wait 5 seconds before disabling vblank? In that case, the chances of hittin

Re: [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls

2017-07-06 Thread Keith Packard
Ville Syrjälä writes: > Maybe, or maybe we want to turn the interrupt on in that case? That's > what the old ioctl does. That's what I suggested in my reply to Daniel's review. Even if we add the accurate function, we'll still need the interrupt-enable case as a fallback for drivers which don't

Re: [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls

2017-07-06 Thread Keith Packard
Daniel Vetter writes: > I very much like this since the old ioctl really is a rather bad horror > show. And since it's tied in with ums drivers everything is > complicated. Thanks for your kind words. > I started a discussion a while back whether these should be restricted to > DRM_MASTER (i.e.

Re: [PATCH 2/3] drm: Reorganize drm_pending_event to support future event types

2017-07-06 Thread Keith Packard
Daniel Vetter writes: > A few nits below, but looks good otherwise. Thanks. >> static struct drm_pending_vblank_event *create_vblank_event( >> -struct drm_device *dev, uint64_t user_data) >> +struct drm_device *dev, struct drm_crtc *crtc, uint64_t >> user_data) > > Nit

Re: [PATCH 1/3] drm: Widen vblank count to 64 bits. Change vblank time precision to ns

2017-07-06 Thread Keith Packard
Michel Dänzer writes: > BTW, this got me thinking that we should probably treat > _DRM_VBLANK_NEXTONMISS the same way, i.e. clear the flag after updating > vblwait->request.sequence. Otherwise there could theoretically (though > unlikely) be an infinite loop: I was thinking that we should just r

Re: [PATCH 1/3] drm: Widen vblank count to 64 bits. Change vblank time precision to ns

2017-07-06 Thread Keith Packard
Michel Dänzer writes: > Subtle breakage here: vblwait->request.sequence must still get updated > for _DRM_VBLANK_RELATIVE, in case we're interrupted by a signal. Thanks for finding this. I think it might be better to just not modify the request.type field instead, so that on re-entry it gets re

Re: [PATCH 1/3] drm: Widen vblank count to 64 bits. Change vblank time precision to ns

2017-07-06 Thread Keith Packard
Daniel Vetter writes: > Extending the reported/sw vblank counter to u64 makes sense imo, but do we > have to extend the driver interfaces too? If there's no 64 bit hw vblank > currently I think I'd be good to postpone that part, simply because I'm > too lazy to audit all the drivers for correctly

Re: [PATCH 6/6] drm: Add four ioctls for managing drm mode object leases [v3]

2017-07-05 Thread Keith Packard
Dave Airlie writes: > I think this needs a pad ^. > And this. Yup. Thanks! >> +struct drm_mode_revoke_lease { >> + /** Unique ID of lessee >> +*/ >> + __u32 lessee_id; > > And this. None of the other bare 32-bit ioctl structures are padded; I think that's probably fine as

[PATCH 0/6] drm: Add mode object leases [v3]

2017-07-05 Thread Keith Packard
Here's a third version of my DRM mode object leases series. Since v2: * Add revocation. This allows leases to be effectively revoked by removing all of the objects they have access to. The lease itself hangs around as it's hanging off a file. * Allow non-master files to lo

[PATCH 3/6] drm: Add new LEASE debug level

2017-07-05 Thread Keith Packard
Separate out lease debugging from the core. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_drv.c | 3 ++- include/drm/drmP.h| 4 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index b5c6bb46a425

[PATCH 6/6] drm: Add four ioctls for managing drm mode object leases [v3]

2017-07-05 Thread Keith Packard
lease' value has been removed * change ioctl has been removed. Changes for v3 suggested in part by Dave Airlie * Add revoke ioctl. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_ioctl.c | 4 + drivers/gpu/drm/drm_lease.c | 270 i

[PATCH 5/6] drm: Check mode object lease status in all master ioctl paths [v2]

2017-07-05 Thread Keith Packard
, we can now centralize most of the lease-based access checks in that function. A few places skip that API and require in-line checks. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_auth.c| 2 +- drivers/gpu/drm/drm_connector.c | 5 +++-- drivers/gpu/drm/drm_encoder.c | 8

[PATCH 1/6] drm: Pass struct drm_file * to __drm_mode_object_find

2017-07-05 Thread Keith Packard
This will allow __drm_mode_object_file to be extended to perform access control checks based on the file in use. Suggested-by: Daniel Vetter Signed-off-by: Keith Packard --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 16 drivers/gpu/drm/amd/amdgpu/dce_virtual.c

[PATCH 2/6] drm: Allow render nodes to query display objects

2017-07-05 Thread Keith Packard
This allows an application to discover what display resources are available before requesting a lease from the X server. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_ioctl.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm

[PATCH 4/6] drm: Add drm_object lease infrastructure [v3]

2017-07-05 Thread Keith Packard
d by removing all of the objects they have access to. The lease itself hangs around as it's hanging off a file. * Free the leases IDR when the master is destroyed * _drm_lease_held should look at lessees, not lessor * Allow non-master files to check for lease status Signed-off-by:

[PATCH 2/3] drm: Reorganize drm_pending_event to support future event types

2017-07-05 Thread Keith Packard
, rather than when delievered. This way, delivery doesn't need to have the crtc ID available. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_atomic.c | 7 --- drivers/gpu/drm/drm_plane.c | 2 +- drivers/gpu/drm/drm_vblank.c | 27 --- dr

[PATCH 1/3] drm: Widen vblank count to 64 bits. Change vblank time precision to ns

2017-07-05 Thread Keith Packard
necessary to widen that value was already included to handle devices returning fewer than 32-bits. This will provide the necessary datatypes for the Vulkan API. Signed-off-by: Keith Packard --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers

[PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls

2017-07-05 Thread Keith Packard
These provide crtc-id based functions instead of pipe-number, while also offering higher resolution time (ns) and wider frame count (64) as required by the Vulkan API. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_internal.h | 6 ++ drivers/gpu/drm/drm_ioctl.c| 2 + drivers/gpu

[PATCH 0/3] drm: Add CRTC-id based ioctls for vblank query/event

2017-07-05 Thread Keith Packard
This patch series provides a new interface which fixes three issues with the current VBLANK_WAIT ioctl: 1) CRTC indices to select a target. 2) 32-bits of count resolution. 3) Microsecond time resolution. The first makes it quite difficult to use this interface from a leased DRM device; without

[PATCH 5/5] drm: Add three ioctls for managing drm mode object leases [v2]

2017-04-28 Thread Keith Packard
ned-off-by: Keith Packard --- drivers/gpu/drm/drm_ioctl.c | 3 + drivers/gpu/drm/drm_lease.c | 220 include/drm/drm_lease.h | 9 ++ include/uapi/drm/drm.h | 3 + include/uapi/drm/drm_mode.h | 55 +++ 5 files changed, 290 insertion

[PATCH 3/5] drm: Add drm_object lease infrastructure [v2]

2017-04-28 Thread Keith Packard
e controlled by the lessor; the 'mask_lease' flag has been removed * Checking for leased status has been simplified, replacing the drm_lease_check function with drm_lease_held. Signed-off-by: Keith Packard --- drivers/gpu/drm/Makefile

[PATCH 4/5] drm: Check mode object lease status in all master ioctl paths [v2]

2017-04-28 Thread Keith Packard
, we can now centralize most of the lease-based access checks in that function. A few places skip that API and require in-line checks. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_auth.c| 2 +- drivers/gpu/drm/drm_connector.c | 8 +++--- drivers/gpu/drm/drm_encoder.c | 8

[PATCH 2/5] drm: Add new LEASE debug level

2017-04-28 Thread Keith Packard
Separate out lease debugging from the core. Signed-off-by: Keith Packard --- drivers/gpu/drm/drm_drv.c | 3 ++- include/drm/drmP.h| 4 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 6594b4088f11

[PATCH 1/5] drm: Pass struct drm_file * to __drm_mode_object_find

2017-04-28 Thread Keith Packard
This will allow __drm_mode_object_file to be extended to perform access control checks based on the file in use. Suggested-by: Daniel Vetter Signed-off-by: Keith Packard --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 16 drivers/gpu/drm/amd/amdgpu/dce_virtual.c

[PATCH 0/5] drm: Add mode resource leasing [v2]

2017-04-28 Thread Keith Packard
Here's a second try at mode resource leasing. The differences from v1 are mostly deleting functionality that isn't currently useful. There are no more sub-leases; there's the owner, the owner is the only lessor and so the only one who can create leases and hand those out. The lessor can now manip

Re: [PATCH 3/4] drm: Check mode object lease status in all master ioctl paths

2017-04-09 Thread Keith Packard
Daniel Vetter writes: > I think it'd be good if we could consolidate all the lease checking into > drm_mode_object_find (respectively __drm_mode_object_find). We'd need to > wire up the fpriv to be able to do that, but we could upstream that patch > right away before anything else. That should ta

Re: [PATCH 2/4] drm: Add drm_object lease infrastructure

2017-04-02 Thread Keith Packard
Daniel Vetter writes: > On Sat, Apr 01, 2017 at 10:08:39AM -0700, Keith Packard wrote: >> +BUG_ON(__mutex_owner(&master->dev->mode_config.idr_mutex) != current); > > Forgot to reply on this: > > lockdep_assert_held + enable lockdep. Thanks. Will fix. -- -ke

Re: [PATCH 4/4] drm: Add four ioctls for managing drm mode object leases

2017-04-02 Thread Keith Packard
Daniel Vetter writes: > Should we just use fd for this? Essentially lessors would be required to > keep track of all their pending leases, and just dup() them over to the > client. Would reduce the uapi scope a bit, and if a lessor can't keep > track of it's leases there's a problem. Right now,

Re: [PATCH 3/4] drm: Check mode object lease status in all master ioctl paths

2017-04-02 Thread Keith Packard
Daniel Vetter writes: > I think it'd be good if we could consolidate all the lease checking into > drm_mode_object_find (respectively __drm_mode_object_find). We'd need to > wire up the fpriv to be able to do that, but we could upstream that patch > right away before anything else. That should ta

Re: [PATCH 2/4] drm: Add drm_object lease infrastructure

2017-04-02 Thread Keith Packard
Daniel Vetter writes: > Still not sure we want to restrict objects on the lessor side. Feels like > unecessary complexity (i.e. more bugs in kernel, that's never good), and > at best only needed for lessors who can't keep track of stuff. It's been useful when hacking existing code, and will help

[PATCH 4/4] drm: Add four ioctls for managing drm mode object leases

2017-04-01 Thread Keith Packard
leased objects for a particular lessee drm_mode_change_lease Adjust the terms of a lease, adding or removing resources or switching from masking to non-masking. This should suffice to at least create, query and manage available leases. Signed-off-by: Keith Packard --- drivers/gpu

[PATCH 2/4] drm: Add drm_object lease infrastructure

2017-04-01 Thread Keith Packard
leasing objects from an owner (either directly, or indirectly through another lessee), can be searched from an idr in the drm_master of the owner. Signed-off-by: Keith Packard --- drivers/gpu/drm/Makefile| 3 +- drivers/gpu/drm/drm_auth.c | 22 +- drivers/gpu/drm/drm_lease.c | 485 +

  1   2   >