[PATCH 1/2] drm/core: Reuse the reserved member in drm_event_vblank for crtc_id.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Wed Oct 19 09:41:30 UTC 2016


Op 10-08-16 om 16:14 schreef Daniel Vetter:
> On Wed, Aug 10, 2016 at 12:46:23PM +0200, Maarten Lankhorst wrote:
>> When doing a atomic commit affecting multiple crtc's, multiple events
>> are generated. The user_data member does not allow you to distinguish,
>> because they all have the same pointer.
>>
>> I've chosen to use crtc_id, because using pipe would create ambiguity
>> when pipe = 0. A test for != 0 is easier to implement, and crtc_id
>> will never be 0.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
>> Cc: David Airlie <airlied at linux.ie>
>> Cc: Daniel Stone <daniels at collabora.com>
>> ---
>>  drivers/gpu/drm/drm_irq.c | 2 ++
>>  include/uapi/drm/drm.h    | 2 +-
>>  2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
>> index 97c70642dbe1..f01bb0eea31c 100644
>> --- a/drivers/gpu/drm/drm_irq.c
>> +++ b/drivers/gpu/drm/drm_irq.c
>> @@ -1021,6 +1021,7 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
>>  
>>  	e->pipe = pipe;
>>  	e->event.sequence = drm_vblank_count(dev, pipe);
>> +	e->event.crtc_id = crtc->base.id;
>>  	list_add_tail(&e->base.link, &dev->vblank_event_list);
>>  }
>>  EXPORT_SYMBOL(drm_crtc_arm_vblank_event);
>> @@ -1048,6 +1049,7 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
>>  		now = get_drm_timestamp();
>>  	}
>>  	e->pipe = pipe;
>> +	e->event.crtc_id = crtc->base.id;
>>  	send_vblank_event(dev, e, seq, &now);
>>  }
>>  EXPORT_SYMBOL(drm_crtc_send_vblank_event);
>> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
>> index 452675fb55d9..dced4d4517d6 100644
>> --- a/include/uapi/drm/drm.h
>> +++ b/include/uapi/drm/drm.h
>> @@ -850,7 +850,7 @@ struct drm_event_vblank {
>>  	__u32 tv_sec;
>>  	__u32 tv_usec;
>>  	__u32 sequence;
>> -	__u32 reserved;
>> +	__u32 crtc_id; /* 0 on older kernels that do not support this */
> Same comment as in reply to Michel's patch: Is there really no existing
> userspace which would fail to compile now because we renamed this? Simply
> creating a new drm_event_vblank2 struct would fix that.
Hey,

This comment must have fallen through, I haven't found any case in which this happened. All of them use a memset or allocate it zero'd.

~Maarten


More information about the dri-devel mailing list