drm: update todo.rst
Subsystems (9)
PATCH 1/11 drm: update todo.rst
Just drive-by, but we have gsoc running so better to update it now.
Great news is that two entries can be removed because essentially all done.
v2: Keep a bunch of the todos, Gabriel is working on them.
--- Documentation/gpu/todo.rst | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-)
Documentation/gpu/todo.rst +4 -27
@@ -16,7 +16,7 @@ De-midlayer drivers With the recent ``drm_bus`` cleanup patches for 3.17 it is no longer required to have a ``drm_bus`` structure set up. Drivers can directly set up the ``drm_device`` structure instead of relying on bus methods in ``drm_usb.c`` -and ``drm_platform.c``. The goal is to get rid of the driver's ``->load`` / +and ``drm_pci.c``. The goal is to get rid of the driver's ``->load`` / ``->unload`` callbacks and open-code the load/unload sequence properly, using the new two-stage ``drm_device`` setup/teardown.
@@ -175,7 +175,7 @@ fine-grained per-buffer object and per-context lockings scheme. Currently the following drivers still use ``struct_mutex``: ``msm``, ``omapdrm`` and ``udl``. -Contact: Daniel Vetter +Contact: Daniel Vetter, respective driver maintainers Switch to drm_connector_list_iter for any connector_list walking ----------------------------------------------------------------
@@ -217,6 +217,8 @@ plan is to switch to per-file driver API headers, which will also structure the kerneldoc better. This should also allow more fine-grained ``#include`` directives. +In the end no .c file should need to include ``drmP.h`` anymore. + Contact: Daniel Vetter Add missing kerneldoc for exported functions
@@ -244,13 +246,8 @@ be hidden so that driver writers don't accidentally end up using it. And to prevent security issues in those legacy IOCTLs from being exploited on modern drivers. This has multiple possible subtasks: -* Make sure legacy IOCTLs can't be used on modern drivers. * Extract support code for legacy features into a ``drm-legacy.ko`` kernel module and compile it only when one of the legacy drivers is enabled. -* Extract legacy functions into their own headers and remove it that from the - monolithic ``drmP.h`` header. -* Remove any lingering cruft from the OS abstraction layer from modern - drivers. This is mostly done, the only thing left is to split up ``drm_irq.c`` into legacy cruft and the parts needed by modern KMS drivers.
@@ -408,23 +405,3 @@ Contact: Noralf Trønnes, Daniel Vetter Outside DRM =========== - -Better kerneldoc ----------------- - -This is pretty much done, but there's some advanced topics: - -Come up with a way to hyperlink to struct members. Currently you can hyperlink -to the struct using ``#struct_name``, but not to a member within. Would need -buy-in from kerneldoc maintainers, and the big question is how to make it work -without totally unsightly -``drm_foo_bar_really_long_structure->even_longer_memeber`` all over the text -which breaks text flow. - -Figure out how to integrate the asciidoc support for ascii-diagrams. We have a -few of those (e.g. to describe mode timings), and asciidoc supports converting -some ascii-art dialect into pngs. Would be really pretty to make that work. - -Contact: Daniel Vetter, Jani Nikula - -Jani is working on this already, hopefully lands in 4.8.
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/11 drm: Consolidate and document sysfs support
- remove docs for internal func, doesn't add value
- add short overview snippet instead explaining that drivers don't have to bother themselves with reg/unreg concerns
- drop the ttm comment about drmP.h, drmP.h is disappearing ...
--- Documentation/gpu/drm-uapi.rst | 10 ++++++ drivers/gpu/drm/drm_sysfs.c | 70 ++++++++++++++++-------------------------- include/drm/drmP.h | 5 +-- include/drm/drm_sysfs.h | 8 ++--- 4 files changed, 42 insertions(+), 51 deletions(-)
Documentation/gpu/drm-uapi.rst +10 -0
@@ -219,6 +219,16 @@ Debugfs Support .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c :export: +Sysfs Support +============= + +.. kernel-doc:: drivers/gpu/drm/drm_sysfs.c + :doc: overview + +.. kernel-doc:: drivers/gpu/drm/drm_sysfs.c + :export: + + VBlank event handling =====================
drivers/gpu/drm/drm_sysfs.c +27 -43
108 lines not on this page · raw message
include/drm/drmP.h +1 -4
@@ -80,6 +80,7 @@#include <drm/drm_file.h> #include <drm/drm_debugfs.h> #include <drm/drm_ioctl.h> +#include <drm/drm_sysfs.h> struct module ;
@@ -512,10 +513,6 @@ static inline int drm_device_is_unplugged(struct drm_device *dev)* DMA quiscent + idle. DMA quiescent usually requires the hardware lock. */ -/* sysfs support (drm_sysfs.c) */ -extern void drm_sysfs_hotplug_event (struct drm_device *dev); - -/*@}*/ /* returns true if currently okay to sleep */
include/drm/drm_sysfs.h +4 -4
@@ -1,12 +1,12 @@#ifndef _DRM_SYSFS_H_#define _DRM_SYSFS_H_ -/** -* This minimalistic include file is intended for users (read TTM) that -* don't want to include the full drmP.h file. -*/ +struct drm_device ; +struct device ;int drm_class_device_register (struct device *dev);void drm_class_device_unregister (struct device *dev); +void drm_sysfs_hotplug_event (struct drm_device *dev); +#endif
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 02/11] drm: Consolidate and document sysfs support
Quoted 187 lines · Daniel Vetter
- remove docs for internal func, doesn't add value
- add short overview snippet instead explaining that drivers don't have to bother themselves with reg/unreg concerns
- drop the ttm comment aboutdrmP.h,drmP.his disappearing ...Signed-off-by Daniel Vetter <[email protected]>--- Documentation/gpu/drm-uapi.rst | 10 ++++++ drivers/gpu/drm/drm_sysfs.c | 70 ++++++++++++++++-------------------------- include/drm/drmP.h | 5 +-- include/drm/drm_sysfs.h | 8 ++--- 4 files changed, 42 insertions(+), 51 deletions(-)Documentation/gpu/drm-uapi.rst +10
-0@@ -219,6 +219,16 @@ Debugfs Support .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c :export: +Sysfs Support +============= + +.. kernel-doc:: drivers/gpu/drm/drm_sysfs.c + :doc: overview + +.. kernel-doc:: drivers/gpu/drm/drm_sysfs.c + :export: + + VBlank event handling =====================drivers/gpu/drm/drm_sysfs.c +27
-43@@ -25,6 +25,20 @@#define to_drm_minor (d) dev_get_drvdata(d)#define to_drm_connector (d) dev_get_drvdata(d) +/** +* DOC: overview +* +* DRM provides very little additional support to drivers for sysfs +* interactions, beyond just all the standard stuff. Drivers who want to expose +* additional sysfs properties and property groups can attach them at either +* &drm_device.dev or &drm_connector.kdev. +* +* Registration is automatically handled when calling drm_dev_register(), or +* drm_connector_register() in case of hot-plugged connectors. Unregistration is +* also automatically handled by drm_dev_unregister() and +* drm_connector_unregister(). +*/ +static struct device_type drm_sysfs_device_minor = { .name ="drm_minor" };@@ -250,15 +264,6 @@ static const struct attribute_group *connector_dev_groups[] = { NULL }; -/** -* drm_sysfs_connector_add - add a connector to sysfs -* @connector: connector to add -* -* Create a connector device in sysfs, along with its associated connector -* properties (so far, connection status, dpms, mode list and edid) and -* generate a hotplug event so userspace knows there's a new connector -* available. -*/ int drm_sysfs_connector_add (struct drm_connector *connector) {struct drm_device *dev = connector->dev;@@ -285,19 +290,6 @@ int drm_sysfs_connector_add(struct drm_connector *connector)return 0 ; } -/** -* drm_sysfs_connector_remove - remove an connector device from sysfs -* @connector: connector to remove -* -* Remove @connector and its associated attributes from sysfs. Note that -* the device model core will take care of sending the "remove" uevent -* at this time, so we don't need to do it. -* -* Note: -* This routine should only be called if the connector was previously -* successfully registered. If @connector hasn't been registered yet, -* you'll likely see a panic somewhere deep in sysfs code when called. -*/ void drm_sysfs_connector_remove (struct drm_connector *connector) {if (!connector->kdev)@@ -333,20 +325,6 @@ static void drm_sysfs_release(struct device *dev)kfree (dev); } -/** -* drm_sysfs_minor_alloc() - Allocate sysfs device for given minor -* @minor: minor to allocate sysfs device for -* -* This allocates a new sysfs device for @minor and returns it. The device is -* not registered nor linked. The caller has to use device_add() and -* device_del() to register and unregister it. -* -* Note that dev_get_drvdata() on the new device will return the minor. -* However, the device does not hold a ref-count to the minor nor to the -* underlying drm_device. This is unproblematic as long as you access the -* private data only in sysfs callbacks. device_del() disables those -* synchronously, so they cannot be called after you cleanup a minor. -*/ struct device *drm_sysfs_minor_alloc (struct drm_minor *minor) {const char *minor_str;@@ -384,15 +362,13 @@ struct device *drm_sysfs_minor_alloc(struct drm_minor *minor) }/** -* drm_class_device_register - Register a struct device in the drm class. +* drm_class_device_register - register new device with the DRM sysfs class +* @dev: device to register * -* @dev: pointer to struct device to register. -* -* @dev should have all relevant members pre-filled with the exception -* of the class member. In particular, the device_type member must -* be set. +* Registers a new &struct device within the DRM sysfs class. Essentially only +* used by ttm to have a place for its global settings. Drivers should never use +* this. */ -int drm_class_device_register (struct device *dev) {if (!drm_class ||IS_ERR (drm_class))@@ -403,6 +379,14 @@ int drm_class_device_register(struct device *dev) }EXPORT_SYMBOL_GPL (drm_class_device_register); +/** +* drm_class_device_unregister - unregister device with the DRM sysfs class +* @dev: device to unregister +* +* Unregisters a &struct device from the DRM sysfs class. Essentially only used +* by ttm to have a place for its global settings. Drivers should never use +* this. +*/ void drm_class_device_unregister (struct device *dev) {return device_unregister (dev);include/drm/drmP.h +1
-4@@ -80,6 +80,7 @@#include <drm/drm_file.h> #include <drm/drm_debugfs.h> #include <drm/drm_ioctl.h> +#include <drm/drm_sysfs.h> struct module ;@@ -512,10 +513,6 @@ static inline int drm_device_is_unplugged(struct drm_device *dev)* DMA quiscent + idle. DMA quiescent usually requires the hardware lock. */ -/* sysfs support (drm_sysfs.c) */ -extern void drm_sysfs_hotplug_event (struct drm_device *dev); - -/*@}*/ /* returns true if currently okay to sleep */ include/drm/drm_sysfs.h +0
-3@@ -1,12 +1,12 @@#ifndef _DRM_SYSFS_H_#define _DRM_SYSFS_H_ -/** -* This minimalistic include file is intended for users (read TTM) that -* don't want to include the full drmP.h file.
include/drm/drm_sysfs.h line 12
Quoted 10 lines
include/drm/drm_sysfs.h +4
-1-*/ +struct drm_device ; +struct device ;int drm_class_device_register (struct device *dev);void drm_class_device_unregister (struct device *dev); +void drm_sysfs_hotplug_event (struct drm_device *dev); +#endif
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/11 drm: Extract drm_ioctl.h
In reply to Daniel VetterTo match the drm_ioctl.c we already have.
v2: Remove spurious space (Ville).
--- include/drm/drmP.h | 1 + 1 file changed, 1 insertion(+)
include/drm/drmP.h +1 -0
@@ -81,6 +81,7 @@#include <drm/drm_debugfs.h> #include <drm/drm_ioctl.h> #include <drm/drm_sysfs.h> +#include <drm/drm_ioctl.h> struct module ;
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/11] drm: Extract drm_ioctl.h
Quoted 17 lines · Daniel Vetter
To match the
drm_ioctl.cwe already have.v2: Remove spurious space (Ville).
Cc Ville Syrjälä <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- include/drm/drmP.h | 1 + 1 file changed, 1 insertion(+)include/drm/drmP.h +0
-0
include/drm/drmP.h line 87
Quoted 7 lines
include/drm/drmP.h +1
-0@@ -81,6 +81,7 @@#include <drm/drm_debugfs.h> #include <drm/drm_ioctl.h> #include <drm/drm_sysfs.h> +#include <drm/drm_ioctl.h> struct module ;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/11] drm: Extract drm_ioctl.h
Quoted 12 lines · Neil Armstrong
Quoted 11 lines · Daniel Vetter
To match the
drm_ioctl.cwe already have.v2: Remove spurious space (Ville).
Cc Ville Syrjälä <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- include/drm/drmP.h | 1 + 1 file changed, 1 insertion(+)
Quoted 9 lines
include/drm/drmP.h line 84
Quoted 9 lines
include/drm/drmP.h +1
-0@@ -81,6 +81,7 @@#include <drm/drm_debugfs.h> #include <drm/drm_ioctl.h> #include <drm/drm_sysfs.h> +#include <drm/drm_ioctl.h>
This is rebase fail, drm_ioctl.h is already included.
Quoted 5 lines
include/drm/drmP.h
Quoted 3 lines
include/drm/drmP.h +0
-0struct module ;Reviewed-by Neil Armstrong <[email protected]>
You might want to retract that r-b ... :-)
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/11 drm: document drm_ioctl.[hc]
In reply to Daniel VetterAlso unify/merge with the existing stuff.
I was a bit torn where to put this, but in the end I decided to put all the ioctl/sysfs/debugfs stuff into drm-uapi.rst. That means we have a bit a split with the other uapi related stuff used internally, like drm_file.[hc], but I think overall this makes more sense.
If it's too confusing we can always add more cross-links to make it more discoverable. But the auto-sprinkling of links kernel-doc already does seems sufficient.
Also for prettier docs and more cross-links, switch the internal defines over to an enum, as usual.
v2: Update kerneldoc fro drm_compat_ioctl too (caught by 0day), plus a bit more drive-by polish.
v3: Fix typo, spotted by xerpi on irc (Sergi).
--- Documentation/gpu/drm-internals.rst | 50 ---------------- Documentation/gpu/drm-uapi.rst | 14 +++++ drivers/gpu/drm/drm_ioc32.c | 76 ++++++++++++----------- drivers/gpu/drm/drm_ioctl.c | 50 +++++++++++++++- include/drm/drm_ioctl.h | 116 +++++++++++++++++++++++++++++++----- 5 files changed, 203 insertions(+), 103 deletions(-)
Documentation/gpu/drm-internals.rst +0 -50
@@ -255,56 +255,6 @@ File Operations .. kernel-doc:: drivers/gpu/drm/drm_file.c :export: -IOCTLs ------- - -struct drm_ioctl_desc \*ioctls; int num_ioctls; - Driver-specific ioctls descriptors table. - -Driver-specific ioctls numbers start at DRM_COMMAND_BASE. The ioctls -descriptors table is indexed by the ioctl number offset from the base -value. Drivers can use the DRM_IOCTL_DEF_DRV() macro to initialize -the table entries. - -:: - - DRM_IOCTL_DEF_DRV(ioctl, func, flags) - -``ioctl`` is the ioctl name. Drivers must define the DRM_##ioctl and -DRM_IOCTL_##ioctl macros to the ioctl number offset from -DRM_COMMAND_BASE and the ioctl number respectively. The first macro is -private to the device while the second must be exposed to userspace in a -public header. - -``func`` is a pointer to the ioctl handler function compatible with the -``drm_ioctl_t`` type. - -:: - - typedef int drm_ioctl_t(struct drm_device *dev, void *data, - struct drm_file *file_priv); - -``flags`` is a bitmask combination of the following values. It restricts -how the ioctl is allowed to be called. - -- DRM_AUTH - Only authenticated callers allowed - -- DRM_MASTER - The ioctl can only be called on the master file handle - -- DRM_ROOT_ONLY - Only callers with the SYSADMIN capability allowed - -- DRM_CONTROL_ALLOW - The ioctl can only be called on a control - device - -- DRM_UNLOCKED - The ioctl handler will be called without locking the - DRM global mutex. This is the enforced default for kms drivers (i.e. - using the DRIVER_MODESET flag) and hence shouldn't be used any more - for new drivers. - -.. kernel-doc:: drivers/gpu/drm/drm_ioctl.c - :export: - - Misc Utilities ==============
Documentation/gpu/drm-uapi.rst +14 -0
@@ -160,6 +160,20 @@ other hand, a driver requires shared state between clients which is visible to user-space and accessible beyond open-file boundaries, they cannot support render nodes. +IOCTL Support on Device Nodes +============================= + +.. kernel-doc:: drivers/gpu/drm/drm_ioctl.c + :doc: driver specific ioctls + +.. kernel-doc:: include/drm/drm_ioctl.h + :internal: + +.. kernel-doc:: drivers/gpu/drm/drm_ioctl.c + :export: + +.. kernel-doc:: drivers/gpu/drm/drm_ioc32.c + :export: Testing and validation ======================
drivers/gpu/drm/drm_ioc32.c +40 -36
121 lines not on this page · raw message
drivers/gpu/drm/drm_ioctl.c +48 -2
61 lines not on this page · raw message
include/drm/drm_ioctl.h +101 -15
148 lines not on this page · raw message
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/11] drm: document drm_ioctl.[hc]
Quoted 162 lines · Daniel Vetter
Also unify/merge with the existing stuff.
I was a bit torn where to put this, but in the end I decided to put all the ioctl/sysfs/debugfs stuff into
drm-uapi.rst. That means we have a bit a split with the other uapi related stuff used internally, like drm_file.[hc], but I think overall this makes more sense.If it's too confusing we can always add more cross-links to make it more discoverable. But the auto-sprinkling of links kernel-doc already does seems sufficient.
Also for prettier docs and more cross-links, switch the internal defines over to an enum, as usual.
v2: Update kerneldoc fro
drm_compat_ioctltoo (caught by 0day), plus a bit more drive-by polish.v3: Fix typo, spotted by xerpi on irc (Sergi).
Cc Sergi Granell <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- Documentation/gpu/drm-internals.rst | 50 ---------------- Documentation/gpu/drm-uapi.rst | 14 +++++ drivers/gpu/drm/drm_ioc32.c | 76 ++++++++++++----------- drivers/gpu/drm/drm_ioctl.c | 50 +++++++++++++++- include/drm/drm_ioctl.h | 116 +++++++++++++++++++++++++++++++----- 5 files changed, 203 insertions(+), 103 deletions(-)Documentation/gpu/drm-internals.rst +0
-50@@ -255,56 +255,6 @@ File Operations .. kernel-doc:: drivers/gpu/drm/drm_file.c :export: -IOCTLs ------- - -struct drm_ioctl_desc \*ioctls; int num_ioctls; - Driver-specific ioctls descriptors table. - -Driver-specific ioctls numbers start at DRM_COMMAND_BASE. The ioctls -descriptors table is indexed by the ioctl number offset from the base -value. Drivers can use the DRM_IOCTL_DEF_DRV() macro to initialize -the table entries. - -:: - - DRM_IOCTL_DEF_DRV(ioctl, func, flags) - -``ioctl`` is the ioctl name. Drivers must define the DRM_##ioctl and -DRM_IOCTL_##ioctl macros to the ioctl number offset from -DRM_COMMAND_BASE and the ioctl number respectively. The first macro is -private to the device while the second must be exposed to userspace in a -public header. - -``func`` is a pointer to the ioctl handler function compatible with the -``drm_ioctl_t`` type. - -:: - - typedef int drm_ioctl_t(struct drm_device *dev, void *data, - struct drm_file *file_priv); - -``flags`` is a bitmask combination of the following values. It restricts -how the ioctl is allowed to be called. - -- DRM_AUTH - Only authenticated callers allowed - -- DRM_MASTER - The ioctl can only be called on the master file handle - -- DRM_ROOT_ONLY - Only callers with the SYSADMIN capability allowed - -- DRM_CONTROL_ALLOW - The ioctl can only be called on a control - device - -- DRM_UNLOCKED - The ioctl handler will be called without locking the - DRM global mutex. This is the enforced default for kms drivers (i.e. - using the DRIVER_MODESET flag) and hence shouldn't be used any more - for new drivers. - -.. kernel-doc:: drivers/gpu/drm/drm_ioctl.c - :export: - - Misc Utilities ==============Documentation/gpu/drm-uapi.rst +14
-0@@ -160,6 +160,20 @@ other hand, a driver requires shared state between clients which is visible to user-space and accessible beyond open-file boundaries, they cannot support render nodes. +IOCTL Support on Device Nodes +============================= + +.. kernel-doc:: drivers/gpu/drm/drm_ioctl.c + :doc: driver specific ioctls + +.. kernel-doc:: include/drm/drm_ioctl.h + :internal: + +.. kernel-doc:: drivers/gpu/drm/drm_ioctl.c + :export: + +.. kernel-doc:: drivers/gpu/drm/drm_ioc32.c + :export: Testing and validation ======================drivers/gpu/drm/drm_ioc32.c +12
-12@@ -1,4 +1,4 @@ -/** +/* * \file drm_ioc32.c * * 32-bit ioctl compatibility routines for the DRM. @@ -72,15 +72,15 @@#define DRM_IOCTL_MODE_ADDFB232 DRM_IOWR(0xb8, drm_mode_fb_cmd232_t)typedef struct drm_version_32 { -int version_major;/**< Major version */ -int version_minor;/**< Minor version */ -int version_patchlevel;/**< Patch level */ -u32 name_len;/**< Length of name buffer */ -u32 name;/**< Name of driver */ -u32 date_len;/**< Length of date buffer */ -u32 date;/**< User-space buffer to hold date */ -u32 desc_len;/**< Length of desc buffer */ -u32 desc;/**< User-space buffer to hold desc */ +int version_major;/* Major version */ +int version_minor;/* Minor version */ +int version_patchlevel;/* Patch level */ +u32 name_len;/* Length of name buffer */ +u32 name;/* Name of driver */ +u32 date_len;/* Length of date buffer */ +u32 date;/* User-space buffer to hold date */ +u32 desc_len;/* Length of desc buffer */ +u32 desc;/* User-space buffer to hold desc */ }drm_version32_t ; static int compat_drm_version(struct file *file, unsigned int cmd,@@ -126,8 +126,8 @@ static int compat_drm_version(struct file *file, unsigned int cmd, }typedef struct drm_unique32 { -u32 unique_len;/**< Length of unique */ -u32 unique;/**< Unique name for driver instantiation */ +u32 unique_len;/* Length of unique */ +u32 unique;/* Unique name for driver instantiation */ }drm_unique32_t ; static int compat_drm_getunique(struct file *file, unsigned int cmd,
drivers/gpu/drm/drm_ioc32.c static int compat_drm_setunique(struct file *file, unsigned int cmd, · line 183
Quoted 10 lines
drivers/gpu/drm/drm_ioc32.c +1
-6@@ -180,12 +180,12 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd, } typedef struct drm_map32 { - u32 offset; /**< Requested physical address (0 for SAREA)*/ - u32 size; /**< Requested physical size (bytes) */ - enum drm_map_type type; /**< Type of memory to map */ - enum drm_map_flags flags; /**< Flags */ - u32 handle; /**< User-space: "Handle" to pass to mmap() */ - int mtrr; /**< MTRR slot used */ + u32 offset; /* Requested physical address (0 for SAREA)*/
/\
Missing space here
Quoted 287 lines
drivers/gpu/drm/drm_ioc32.c +27
-18+u32 size;/* Requested physical size (bytes) */ +enum drm_map_type type;/* Type of memory to map */ +enum drm_map_flags flags;/* Flags */ +u32 handle;/* User-space: "Handle" to pass to mmap() */ +int mtrr;/* MTRR slot used */ } drm_map32_t; static int compat_drm_getmap(struct file *file, unsigned int cmd,@@ -286,12 +286,12 @@ static int compat_drm_rmmap(struct file *file, unsigned int cmd, }typedef struct drm_client32 { -int idx;/**< Which client desired? */ -int auth;/**< Is client authenticated? */ -u32 pid;/**< Process ID */ -u32 uid;/**< User ID */ -u32 magic;/**< Magic */ -u32 iocs;/**< Ioctl count */ +int idx;/* Which client desired? */ +int auth;/* Is client authenticated? */ +u32 pid;/* Process ID */ +u32 uid;/* User ID */ +u32 magic;/* Magic */ +u32 iocs;/* Ioctl count */ }drm_client32_t ; static int compat_drm_getclient(struct file *file, unsigned int cmd,@@ -366,12 +366,12 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd, }typedef struct drm_buf_desc32 { -int count;/**< Number of buffers of this size */ -int size;/**< Size in bytes */ -int low_mark;/**< Low water mark */ -int high_mark;/**< High water mark */ +int count;/* Number of buffers of this size */ +int size;/* Size in bytes */ +int low_mark;/* Low water mark */ +int high_mark;/* High water mark */ int flags; -u32 agp_start;/**< Start address in the AGP aperture */ +u32 agp_start;/* Start address in the AGP aperture */ }drm_buf_desc32_t ; static int compat_drm_addbufs(struct file *file, unsigned int cmd,@@ -1111,13 +1111,18 @@ static drm_ioctl_compat_t *drm_compat_ioctls[] = { };/** -* Called whenever a 32-bit process running under a 64-bit kernel -* performs an ioctl on /dev/drm. +* drm_compat_ioctl - 32bit IOCTL compatibility handler for DRM drivers +* @filp: file this ioctl is called on +* @cmd: ioctl cmd number +* @arg: user argument +* +* Compatibility handler for 32 bit userspace running on 64 kernels. All actual +* IOCTL handling is forwarded to drm_ioctl(), while marshalling structures as +* appropriate. Note that this only handles DRM core IOCTLs, if the driver has +* botched IOCTL itself, it must handle those by wrapping this function. * -* \param file_priv DRM file private. -* \param cmd command. -* \param arg user argument. -* \return zero on success or negative number on failure. +* Returns: +* Zero on success, negative error code on failure. */ long drm_compat_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {@@ -1141,5 +1146,4 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)return ret; } -EXPORT_SYMBOL (drm_compat_ioctl);drivers/gpu/drm/drm_ioctl.c +48
-2@@ -647,13 +647,59 @@ static const struct drm_ioctl_desc drm_ioctls[] = {#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )/** +* DOC: driver specific ioctls +* +* First things first, driver private IOCTLs should only be needed for drivers +* supporting rendering. Kernel modesetting is all standardized, and extended +* through properties. There are a few exceptions in some existing drivers, +* which define IOCTL for use by the display DRM master, but they all predate +* properties. +* +* Now if you do have a render driver you always have to support it through +* driver private properties. There's a few steps needed to wire all the things +* up. +* +* First you need to define the structure for your IOCTL in your driver private +* UAPI header in ``include/uapi/drm/my_driver_drm.h``:: +* +* struct my_driver_operation { +* u32 some_thing; +* u32 another_thing; +* }; +* +* Please make sure that you follow all the best practices from +* ``Documentation/ioctl/botching-up-ioctls.txt``. Note that drm_ioctl() +* automatically zero-extends structures, hence make sure you can add more stuff +* at the end, i.e. don't put a variable sized array there. +* +* Then you need to define your IOCTL number, using one of DRM_IO(), DRM_IOR(), +* DRM_IOW() or DRM_IOWR(). It must start with the DRM_IOCTL\_ prefix:: +* +* ##define DRM_IOCTL_MY_DRIVER_OPERATION \ +* DRM_IOW(DRM_COMMAND_BASE, struct my_driver_operation) +* +* DRM driver private IOCTL must be in the range from DRM_COMMAND_BASE to +* DRM_COMMAND_END. Finally you need an array of &struct drm_ioctl_desc to wire +* up the handlers and set the access rights: +* +* static const struct drm_ioctl_desc my_driver_ioctls[] = { +* DRM_IOCTL_DEF_DRV(MY_DRIVER_OPERATION, my_driver_operation, +* DRM_AUTH|DRM_RENDER_ALLOW), +* }; +* +* And then assign this to the &drm_driver.ioctls field in your driver +* structure. +*/ + +/** * drm_ioctl - ioctl callback implementation for DRM drivers * @filp: file this ioctl is called on * @cmd: ioctl cmd number * @arg: user argument * -* Looks up the ioctl function in the ::ioctls table, checking for root -* previleges if so required, and dispatches to the respective function. +* Looks up the ioctl function in the DRM core and the driver dispatch table, +* stored in &drm_driver.ioctls. It checks for necessary permission by calling +* drm_ioctl_permit(), and dispatches to the respective function. * * Returns: * Zero on success, negative error code on failure. include/drm/drm_ioctl.h +96
-14@@ -33,6 +33,7 @@#define _DRM_IOCTL_H_#include <linux/types.h> +#include <linux/bitops.h> #include <asm/ioctl.h> @@ -41,41 +42,126 @@ struct drm_file;struct file ;/** -* Ioctl function type. +* drm_ioctl_t - DRM ioctl function type. +* @dev: DRM device inode +* @data: private pointer of the ioctl call +* @file_priv: DRM file this ioctl was made on * -* \param inode device inode. -* \param file_priv DRM file private pointer. -* \param cmd command. -* \param arg argument. +* This is the DRM ioctl typedef. Note that drm_ioctl() has alrady copied @data +* into kernel-space, and will also copy it back, depending upon the read/write +* settings in the ioctl command code. */ typedef int drm_ioctl_t (struct drm_device *dev,void *data,struct drm_file *file_priv); +/** +* drm_ioctl_compat_t - compatibility DRM ioctl function type. +* @filp: file pointer +* @cmd: ioctl command code +* @arg: DRM file this ioctl was made on +* +* Just a typedef to make declaring an array of compatibility handlers easier. +* New drivers shouldn't screw up the structure layout for their ioctl +* structures and hence never need this. +*/ typedef int drm_ioctl_compat_t (struct file *filp,unsigned int cmd,unsigned long arg);#define DRM_IOCTL_NR (n) _IOC_NR(n)#define DRM_MAJOR 226 -#define DRM_AUTH 0x1 -#define DRM_MASTER 0x2 -#define DRM_ROOT_ONLY 0x4 -#define DRM_CONTROL_ALLOW 0x8 -#define DRM_UNLOCKED 0x10 -#define DRM_RENDER_ALLOW 0x20 +/** +* enum drm_ioctl_flags - DRM ioctl flags +* +* Various flags that can be set in &drm_ioctl_desc.flags to control how +* userspace can use a given ioctl. +*/ +enum drm_ioctl_flags { +/** +* @DRM_AUTH: +* +* This is for ioctl which are used for rendering, and require that the +* file descriptor is either for a render node, or if it's a +* legacy/primary node, then it must be authenticated. +*/ +DRM_AUTH =BIT (0 ), +/** +* @DRM_MASTER: +* +* This must be set for any ioctl which can change the modeset or +* display state. Userspace must call the ioctl through a primary node, +* while it is the active master. +* +* Note that read-only modeset ioctl can also be called by +* unauthenticated clients, or when a master is not the currently active +* one. +*/ +DRM_MASTER =BIT (1 ), +/** +* @DRM_ROOT_ONLY: +* +* Anything that could potentially wreak a master file descriptor needs +* to have this flag set. Current that's only for the SETMASTER and +* DROPMASTER ioctl, which e.g. logind can call to force a non-behaving +* master (display compositor) into compliance. +* +* This is equivalent to callers with the SYSADMIN capability. +*/ +DRM_ROOT_ONLY =BIT (2 ), +/** +* @DRM_CONTROL_ALLOW: +* +* Deprecated, do not use. Control nodes are in the process of getting +* removed. +*/ +DRM_CONTROL_ALLOW =BIT (3 ), +/** +* @DRM_UNLOCKED: +* +* Whether &drm_ioctl_desc.func should be called with the DRM BKL held +* or not. Enforced as the default for all modern drivers, hence there +* should never be a need to set this flag. +*/ +DRM_UNLOCKED =BIT (4 ), +/** +* @DRM_RENDER_ALLOW: +* +* This is used for all ioctl needed for rendering only, for drivers +* which support render nodes. This should be all new render drivers, +* and hence it should be always set for any ioctl with DRM_AUTH set. +* Note though that read-only query ioctl might have this set, but have +* not set DRM_AUTH because they do not require authentication. +*/ +DRM_RENDER_ALLOW =BIT (5 ), +}; +/** +* struct drm_ioctl_desc - DRM driver ioctl entry +* @cmd: ioctl command number, without flags +* @flags: a bitmask of &enum drm_ioctl_flags +* @func: handler for this ioctl +* @name: user-readable name for debug output +* +* For convenience it's easier to create these using the DRM_IOCTL_DEF_DRV() +* macro. +*/ struct drm_ioctl_desc {unsigned int cmd; -int flags; +enum drm_ioctl_flags flags;drm_ioctl_t *func;const char *name; };/** -* Creates a driver or general drm_ioctl_desc array entry for the given -* ioctl, for use by drm_ioctl(). +* DRM_IOCTL_DEF_DRV() - helper macro to fill out a &struct drm_ioctl_desc +* @ioctl: ioctl command suffix +* @_func: handler for the ioctl
include/drm/drm_ioctl.h struct drm_file; · line 167
Quoted 10 lines
include/drm/drm_ioctl.h +5
-1+* @_flags: a bitmask of &enum drm_ioctl_flags +* +* Small helper macro to create a &struct drm_ioctl_desc entry. The ioctl +* command number is constructed by prepending ``DRM_IOCTL\_`` and passing that +* to DRM_IOCTL_NR(). */ -#define DRM_IOCTL_DEF_DRV (ioctl, _func, _flags) \ [DRM_IOCTL_NR(DRM_IOCTL_##ioctl) - DRM_COMMAND_BASE] = { \ .cmd = DRM_IOCTL_##ioctl, \
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/11 drm/vblank: Switch drm_driver->get_vblank_timestamp to return a bool
In reply to Daniel VetterThere's really no reason for anything more:
- Calling this while the crtc vblank stuff isn't set up is a driver bug. Those places arlready DRM_ERROR.
- Calling this when the crtc is off is either a driver bug (callin drm_crtc_handle_vblank at the wrong time) or a core bug (for anything else). Again, we DRM_ERROR.
- EINVAL is checked at higher levels already, and if we'd use struct drm_crtc * instead of (dev, pipe) it would be real obvious that those are again core bugs.
The only valid failure mode is crap hardware that couldn't sample a useful timestamp, to ask the core to just grab a not-so-accurate timestampe. Bool is perfectly fine for that.
v2: Also fix up the one caller, I lost that in the shuffling (Jani).
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 8 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 14 ++++----- drivers/gpu/drm/drm_irq.c | 49 ++++++++++++------------------- drivers/gpu/drm/i915/i915_irq.c | 8 ++--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 12 ++++---- drivers/gpu/drm/nouveau/nouveau_display.c | 4 +-- drivers/gpu/drm/nouveau/nouveau_display.h | 4 +-- drivers/gpu/drm/radeon/radeon_drv.c | 8 ++--- drivers/gpu/drm/radeon/radeon_kms.c | 14 ++++----- drivers/gpu/drm/vc4/vc4_crtc.c | 2 +- drivers/gpu/drm/vc4/vc4_drv.h | 2 +- include/drm/drmP.h | 1 - include/drm/drm_drv.h | 7 ++--- include/drm/drm_irq.h | 10 +++---- 14 files changed, 64 insertions(+), 79 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -4
@@ -1913,10 +1913,10 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon);u32 amdgpu_get_vblank_counter_kms (struct drm_device *dev,unsigned int pipe);int amdgpu_enable_vblank_kms (struct drm_device *dev,unsigned int pipe);void amdgpu_disable_vblank_kms (struct drm_device *dev,unsigned int pipe); -int amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -unsigned flags); +bool amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, +int *max_error, +struct timeval *vblank_time, +unsigned flags);long amdgpu_kms_compat_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +7 -7
@@ -951,19 +951,19 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)* * Gets the timestamp on the requested crtc based on the * scanout position. (all asics). -* Returns postive status flags on success, negative error on failure. +* Returns true on success, false on failure. */ -int amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -unsigned flags) +bool amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, +int *max_error, +struct timeval *vblank_time, +unsigned flags) {struct drm_crtc *crtc;struct amdgpu_device *adev = dev->dev_private;if (pipe >= dev->num_crtcs) {DRM_ERROR ("Invalid crtc %u\n" , pipe); -return -EINVAL ; +return false; }/* Get associated drm_crtc: */
@@ -972,7 +972,7 @@ int amdgpu_get_vblank_timestamp_kms(struct drm_device *dev, unsigned int pipe,/* This can occur on driver load if some component fails to * initialize completely and driver is unloaded */ DRM_ERROR ("Uninitialized crtc %d\n" , pipe); -return -EINVAL ; +return false; }/* Helper routine in DRM core does all the work: */
drivers/gpu/drm/drm_irq.c +18 -31
107 lines not on this page · raw message
drivers/gpu/drm/i915/i915_irq.c +4 -4
@@ -964,7 +964,7 @@ int intel_get_crtc_scanline(struct intel_crtc *crtc)return position; } -static int i915_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe, +static bool i915_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time,unsigned flags)
@@ -974,19 +974,19 @@ static int i915_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,if (pipe >=INTEL_INFO (dev_priv)->num_pipes) {DRM_ERROR ("Invalid crtc %u\n" , pipe); -return -EINVAL ; +return false; }/* Get drm_crtc to timestamp: */ crtc =intel_get_crtc_for_pipe (dev_priv, pipe);if (crtc ==NULL ) {DRM_ERROR ("Invalid crtc %u\n" , pipe); -return -EINVAL ; +return false; }if (!crtc->base.hwmode.crtc_clock) {DRM_DEBUG_KMS ("crtc %u is disabled\n" , pipe); -return -EBUSY ; +return false; }/* Helper routine in DRM core does all the work: */
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +6 -6
@@ -595,23 +595,23 @@ static int mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,return ret; } -static int mdp5_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -unsigned flags) +static bool mdp5_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe, +int *max_error, +struct timeval *vblank_time, +unsigned flags) {struct msm_drm_private *priv = dev->dev_private;struct drm_crtc *crtc;if (pipe <0 || pipe >= priv->num_crtcs) {DRM_ERROR ("Invalid crtc %d\n" , pipe); -return -EINVAL ; +return false; } crtc = priv->crtcs[pipe];if (!crtc) {DRM_ERROR ("Invalid crtc %d\n" , pipe); -return -EINVAL ; +return false; } return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error,
drivers/gpu/drm/nouveau/nouveau_display.c +2 -2
@@ -156,7 +156,7 @@ nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe,return 0 ; } -int +bool nouveau_display_vblstamp (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *time,unsigned flags) {
@@ -174,7 +174,7 @@ nouveau_display_vblstamp(struct drm_device *dev, unsigned int pipe, } } -return -EINVAL ; +return false; } static void
drivers/gpu/drm/nouveau/nouveau_display.h +2 -2
@@ -71,8 +71,8 @@ void nouveau_display_vblank_disable(struct drm_device *, unsigned int);int nouveau_display_scanoutpos (struct drm_device *,unsigned int ,unsigned int ,int *,int *,ktime_t *,ktime_t *,const struct drm_display_mode *); -int nouveau_display_vblstamp (struct drm_device *,unsigned int ,int *, -struct timeval *,unsigned ); +bool nouveau_display_vblstamp (struct drm_device *,unsigned int ,int *, +struct timeval *,unsigned ); int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event,
drivers/gpu/drm/radeon/radeon_drv.c +4 -4
@@ -115,10 +115,10 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);u32 radeon_get_vblank_counter_kms (struct drm_device *dev,unsigned int pipe);int radeon_enable_vblank_kms (struct drm_device *dev,unsigned int pipe);void radeon_disable_vblank_kms (struct drm_device *dev,unsigned int pipe); -int radeon_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -unsigned flags); +bool radeon_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, +int *max_error, +struct timeval *vblank_time, +unsigned flags);void radeon_driver_irq_preinstall_kms (struct drm_device *dev);int radeon_driver_irq_postinstall_kms (struct drm_device *dev);void radeon_driver_irq_uninstall_kms (struct drm_device *dev);
drivers/gpu/drm/radeon/radeon_kms.c +7 -7
@@ -869,25 +869,25 @@ void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)* * Gets the timestamp on the requested crtc based on the * scanout position. (all asics). -* Returns postive status flags on success, negative error on failure. +* Returns true on success, false on failure. */ -int radeon_get_vblank_timestamp_kms (struct drm_device *dev,int crtc, -int *max_error, -struct timeval *vblank_time, -unsigned flags) +bool radeon_get_vblank_timestamp_kms (struct drm_device *dev,int crtc, +int *max_error, +struct timeval *vblank_time, +unsigned flags) {struct drm_crtc *drmcrtc;struct radeon_device *rdev = dev->dev_private;if (crtc <0 || crtc >= dev->num_crtcs) {DRM_ERROR ("Invalid crtc %d\n" , crtc); -return -EINVAL ; +return false; }/* Get associated drm_crtc: */ drmcrtc = &rdev->mode_info.crtcs[crtc]->base;if (!drmcrtc) -return -EINVAL ; +return false;/* Helper routine in DRM core does all the work: */ return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error,
drivers/gpu/drm/vc4/vc4_crtc.c +1 -1
@@ -270,7 +270,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,return ret; } -int vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id, +bool vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id,int *max_error,struct timeval *vblank_time,unsigned flags) {
drivers/gpu/drm/vc4/vc4_drv.h +1 -1
@@ -450,7 +450,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, unsigned int flags, int *vpos, int *hpos, ktime_t *stime, ktime_t *etime, const struct drm_display_mode *mode); -int vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id, +bool vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id,int *max_error,struct timeval *vblank_time,unsigned flags);
include/drm/drmP.h +0 -1
@@ -323,7 +323,6 @@ struct pci_controller;/* Flags and return codes for get_vblank_timestamp() driver function. */ #define DRM_CALLED_FROM_VBLIRQ 1 -#define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0)/* get_scanout_position() return flags */ #define DRM_SCANOUTPOS_VALID (1 << 0)
include/drm/drm_drv.h +3 -4
@@ -316,11 +316,10 @@ struct drm_driver {* * Returns: * -* Zero if timestamping isn't supported in current display mode or a -* negative number on failure. A positive status code on success, -* which describes how the vblank_time timestamp was computed. +* True on success, false on failure, which means the core should +* fallback to a simple timestamp taken in drm_crtc_handle_vblank(). */ -int (*get_vblank_timestamp) (struct drm_device *dev,unsigned int pipe, +bool (*get_vblank_timestamp) (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time,unsigned flags);
include/drm/drm_irq.h +5 -5
@@ -153,11 +153,11 @@ void drm_crtc_vblank_on(struct drm_crtc *crtc);void drm_vblank_cleanup (struct drm_device *dev);u32 drm_accurate_vblank_count (struct drm_crtc *crtc); -int drm_calc_vbltimestamp_from_scanoutpos (struct drm_device *dev, -unsigned int pipe,int *max_error, -struct timeval *vblank_time, -unsigned flags, -const struct drm_display_mode *mode); +bool drm_calc_vbltimestamp_from_scanoutpos (struct drm_device *dev, +unsigned int pipe,int *max_error, +struct timeval *vblank_time, +unsigned flags, +const struct drm_display_mode *mode);void drm_calc_timestamping_constants (struct drm_crtc *crtc,const struct drm_display_mode *mode);
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 05/11] drm/vblank: Switch drm_driver->get_vblank_timestamp to return a bool
Quoted 3 lines · Daniel Vetter
There's really no reason for anything more:
- Calling this while the crtc vblank stuff isn't set up is a driver bug. Those places arlreadyDRM_ERROR.
s/arlready/already/
Quoted 1 line
- Calling this when the crtc is off is either a driver bug (callin
s/callin/calling/
Quoted 9 lines
drm_crtc_handle_vblankat the wrong time) or a core bug (for anything else). Again, weDRM_ERROR.
- EINVAL is checked at higher levels already, and if we'd use structdrm_crtc* instead of (dev, pipe) it would be real obvious that those are again core bugs.The only valid failure mode is crap hardware that couldn't sample a useful timestamp, to ask the core to just grab a not-so-accurate timestampe. Bool is perfectly fine for that.
s/timestampe/timestamp/
Quoted 13 lines
v2: Also fix up the one caller, I lost that in the shuffling (Jani).
Cc Jani Nikula <[email protected]>Cc Mario Kleiner <[email protected]>Cc Eric Anholt <[email protected]>Cc Rob Clark <[email protected]>Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Cc Ben Skeggs <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 8 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 14 ++++----- drivers/gpu/drm/drm_irq.c | 49 ++++++++++++------------------- drivers/gpu/drm/i915/i915_irq.c | 8 ++--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 12 ++++---- drivers/gpu/drm/nouveau/nouveau_display.c | 4 +-- drivers/gpu/drm/nouveau/nouveau_display.h | 4 +-- drivers/gpu/drm/radeon/radeon_drv.c | 8 ++--- drivers/gpu/drm/radeon/radeon_kms.c | 14 ++++----- drivers/gpu/drm/vc4/vc4_crtc.c | 2 +- drivers/gpu/drm/vc4/vc4_drv.h | 2 +- include/drm/drmP.h | 1 - include/drm/drm_drv.h | 7 ++--- include/drm/drm_irq.h | 10 +++---- 14 files changed, 64 insertions(+), 79 deletions(-)
[...]
With the commit log typo fixes,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 20170404095304.17599-1-daniel.vetter-/[email protected]
PATCH 6/11 drm/vblank: Switch to bool in_vblank_irq in get_vblank_timestamp
It's overkill to have a flag parameter which is essentially used just as a boolean. This takes care of core + adjusting drivers.
Adjusting the scanout position callback is a bit harder, since radeon also supplies it's own driver-private flags in there.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 6 ++--- drivers/gpu/drm/drm_irq.c | 41 +++++++++++++++++-------------- drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 4 +-- drivers/gpu/drm/nouveau/nouveau_display.c | 5 ++-- drivers/gpu/drm/nouveau/nouveau_display.h | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_kms.c | 4 +-- drivers/gpu/drm/vc4/vc4_crtc.c | 4 +-- drivers/gpu/drm/vc4/vc4_drv.h | 2 +- include/drm/drm_drv.h | 11 ++++----- include/drm/drm_irq.h | 2 +- 13 files changed, 46 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
@@ -1916,7 +1916,7 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);bool amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags); +bool in_vblank_irq);long amdgpu_kms_compat_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -3
@@ -947,7 +947,7 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)* @crtc: crtc to get the timestamp for * @max_error: max error * @vblank_time: time value -* @flags: flags passed to the driver +* @in_vblank_irq: called from drm_handle_vblank() * * Gets the timestamp on the requested crtc based on the * scanout position. (all asics).
@@ -956,7 +956,7 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)bool amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags) +bool in_vblank_irq) {struct drm_crtc *crtc;struct amdgpu_device *adev = dev->dev_private;
@@ -977,7 +977,7 @@ bool amdgpu_get_vblank_timestamp_kms(struct drm_device *dev, unsigned int pipe,/* Helper routine in DRM core does all the work: */ return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, flags, + vblank_time, in_vblank_irq, &crtc->hwmode); }
drivers/gpu/drm/drm_irq.c +22 -19
136 lines not on this page · raw message
drivers/gpu/drm/i915/i915_irq.c +2 -2
@@ -967,7 +967,7 @@ int intel_get_crtc_scanline(struct intel_crtc *crtc)static bool i915_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags) +bool in_vblank_irq) {struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_crtc *crtc;
@@ -991,7 +991,7 @@ static bool i915_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,/* Helper routine in DRM core does all the work: */ return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, flags, + vblank_time, in_vblank_irq, &crtc->base.hwmode); }
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +2 -2
@@ -598,7 +598,7 @@ static int mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,static bool mdp5_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags) +bool in_vblank_irq) {struct msm_drm_private *priv = dev->dev_private;struct drm_crtc *crtc;
@@ -615,7 +615,7 @@ static bool mdp5_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe, }return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, flags, + vblank_time, in_vblank_irq, &crtc->mode); }
drivers/gpu/drm/nouveau/nouveau_display.c +3 -2
@@ -158,7 +158,7 @@ nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe,bool nouveau_display_vblstamp (struct drm_device *dev,unsigned int pipe, -int *max_error,struct timeval *time,unsigned flags) +int *max_error,struct timeval *time,bool in_vblank_irq) {struct drm_crtc *crtc;
@@ -170,7 +170,8 @@ nouveau_display_vblstamp(struct drm_device *dev, unsigned int pipe,else mode = &crtc->hwmode;return drm_calc_vbltimestamp_from_scanoutpos (dev, - pipe, max_error, time, flags, mode); + pipe, max_error, time, in_vblank_irq, + mode); } }
drivers/gpu/drm/nouveau/nouveau_display.h +1 -1
@@ -72,7 +72,7 @@ int nouveau_display_scanoutpos(struct drm_device *, unsigned int, unsigned int, int *, int *, ktime_t *, ktime_t *, const struct drm_display_mode *);bool nouveau_display_vblstamp (struct drm_device *,unsigned int ,int *, -struct timeval *,unsigned ); +struct timeval *,bool ); int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event,
drivers/gpu/drm/radeon/radeon_drv.c +1 -1
@@ -118,7 +118,7 @@ void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);bool radeon_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags); +bool in_vblank_irq);void radeon_driver_irq_preinstall_kms (struct drm_device *dev);int radeon_driver_irq_postinstall_kms (struct drm_device *dev);void radeon_driver_irq_uninstall_kms (struct drm_device *dev);
drivers/gpu/drm/radeon/radeon_kms.c +2 -2
@@ -874,7 +874,7 @@ void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)bool radeon_get_vblank_timestamp_kms (struct drm_device *dev,int crtc,int *max_error,struct timeval *vblank_time, -unsigned flags) +bool in_vblank_irq) {struct drm_crtc *drmcrtc;struct radeon_device *rdev = dev->dev_private;
@@ -891,7 +891,7 @@ bool radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc,/* Helper routine in DRM core does all the work: */ return drm_calc_vbltimestamp_from_scanoutpos (dev, crtc, max_error, - vblank_time, flags, + vblank_time, in_vblank_irq, &drmcrtc->hwmode); }
drivers/gpu/drm/vc4/vc4_crtc.c +2 -2
@@ -272,14 +272,14 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,bool vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id,int *max_error,struct timeval *vblank_time, -unsigned flags) +bool in_vblank_irq) {struct drm_crtc *crtc =drm_crtc_from_index (dev, crtc_id);struct drm_crtc_state *state = crtc->state;/* Helper routine in DRM core does all the work: */ return drm_calc_vbltimestamp_from_scanoutpos (dev, crtc_id, max_error, - vblank_time, flags, + vblank_time, in_vblank_irq, &state->adjusted_mode); }
drivers/gpu/drm/vc4/vc4_drv.h +1 -1
@@ -452,7 +452,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, const struct drm_display_mode *mode);bool vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id,int *max_error,struct timeval *vblank_time, -unsigned flags); +bool in_vblank_irq);/* vc4_debugfs.c */ int vc4_debugfs_init (struct drm_minor *minor);
include/drm/drm_drv.h +5 -6
@@ -308,11 +308,10 @@ struct drm_driver {* Returns true upper bound on error for timestamp. * vblank_time: * Target location for returned vblank timestamp. -* flags: -* 0 = Defaults, no special treatment needed. -* DRM_CALLED_FROM_VBLIRQ = Function is called from vblank -* irq handler. Some drivers need to apply some workarounds -* for gpu-specific vblank irq quirks if flag is set. +* in_vblank_irq: +* True when called from drm_crtc_handle_vblank(). Some drivers +* need to apply some workarounds for gpu-specific vblank irq quirks +* if flag is set. * * Returns: *
@@ -322,7 +321,7 @@ struct drm_driver {bool (*get_vblank_timestamp) (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags); +bool in_vblank_irq);/* these have to be filled in */
include/drm/drm_irq.h +1 -1
@@ -156,7 +156,7 @@ u32 drm_accurate_vblank_count(struct drm_crtc *crtc);bool drm_calc_vbltimestamp_from_scanoutpos (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags, +bool in_vblank_irq,const struct drm_display_mode *mode);void drm_calc_timestamping_constants (struct drm_crtc *crtc,const struct drm_display_mode *mode);
Signature · 6 lines
2.11.0 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [PATCH 06/11] drm/vblank: Switch to bool in_vblank_irq in get_vblank_timestamp
Quoted 415 lines · Daniel Vetter
It's overkill to have a flag parameter which is essentially used just as a boolean. This takes care of core + adjusting drivers.
Adjusting the scanout position callback is a bit harder, since radeon also supplies it's own driver-private flags in there.
Cc Mario Kleiner <[email protected]>Cc Eric Anholt <[email protected]>Cc Rob Clark <[email protected]>Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Cc Ben Skeggs <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 6 ++--- drivers/gpu/drm/drm_irq.c | 41 +++++++++++++++++-------------- drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 4 +-- drivers/gpu/drm/nouveau/nouveau_display.c | 5 ++-- drivers/gpu/drm/nouveau/nouveau_display.h | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_kms.c | 4 +-- drivers/gpu/drm/vc4/vc4_crtc.c | 4 +-- drivers/gpu/drm/vc4/vc4_drv.h | 2 +- include/drm/drm_drv.h | 11 ++++----- include/drm/drm_irq.h | 2 +- 13 files changed, 46 insertions(+), 43 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-1@@ -1916,7 +1916,7 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);bool amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags); +bool in_vblank_irq);long amdgpu_kms_compat_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3
-3@@ -947,7 +947,7 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)* @crtc: crtc to get the timestamp for * @max_error: max error * @vblank_time: time value -* @flags: flags passed to the driver +* @in_vblank_irq: called from drm_handle_vblank() * * Gets the timestamp on the requested crtc based on the * scanout position. (all asics). @@ -956,7 +956,7 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)bool amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags) +bool in_vblank_irq) {struct drm_crtc *crtc;struct amdgpu_device *adev = dev->dev_private;@@ -977,7 +977,7 @@ bool amdgpu_get_vblank_timestamp_kms(struct drm_device *dev, unsigned int pipe,/* Helper routine in DRM core does all the work: */ return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, flags, + vblank_time, in_vblank_irq, &crtc->hwmode); }drivers/gpu/drm/drm_irq.c +22
-19@@ -54,7 +54,7 @@static bool drm_get_last_vbltimestamp (struct drm_device *dev,unsigned int pipe, -struct timeval *tvblank,unsigned flags); +struct timeval *tvblank,bool in_vblank_irq);static unsigned int drm_timestamp_precision =20 ;/* Default to 20 usecs. */ @@ -138,7 +138,7 @@ static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe*/ do { cur_vblank =__get_vblank_counter (dev, pipe); - rc =drm_get_last_vbltimestamp (dev, pipe, &t_vblank,0 ); + rc =drm_get_last_vbltimestamp (dev, pipe, &t_vblank, false); }while (cur_vblank !=__get_vblank_counter (dev, pipe) && --count >0 );/* @@ -171,7 +171,7 @@ static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe* device vblank fields. */ static void drm_update_vblank_count (struct drm_device *dev,unsigned int pipe, -unsigned long flags) +bool in_vblank_irq) {struct drm_vblank_crtc *vblank = &dev->vblank[pipe];u32 cur_vblank, diff;@@ -194,7 +194,7 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,*/ do { cur_vblank =__get_vblank_counter (dev, pipe); - rc =drm_get_last_vbltimestamp (dev, pipe, &t_vblank, flags); + rc =drm_get_last_vbltimestamp (dev, pipe, &t_vblank, in_vblank_irq); }while (cur_vblank !=__get_vblank_counter (dev, pipe) && --count >0 );if (dev->max_vblank_count !=0 ) {@@ -214,13 +214,13 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,*/ diff =DIV_ROUND_CLOSEST_ULL (diff_ns, framedur_ns); -if (diff ==0 && flags &DRM_CALLED_FROM_VBLIRQ ) +if (diff ==0 && in_vblank_irq)DRM_DEBUG_VBL ("crtc %u: Redundant vblirq ignored." " diff_ns = %lld, framedur_ns = %d)\n" , pipe, (long long ) diff_ns, framedur_ns); }else {/* some kind of default for drivers w/o accurate vbl timestamping */ - diff = (flags &DRM_CALLED_FROM_VBLIRQ ) !=0 ; + diff = in_vblank_irq ?1 :0 ; }/* @@ -253,7 +253,7 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,* Otherwise reinitialize delayed at next vblank interrupt and assign 0 * for now, to mark the vblanktimestamp as invalid. */ -if (!rc && (flags &DRM_CALLED_FROM_VBLIRQ ) ==0 ) +if (!rc && in_vblank_irq) t_vblank = (struct timeval ) {0 ,0 };store_vblank (dev, pipe, diff, &t_vblank, cur_vblank);@@ -291,7 +291,7 @@ u32 drm_accurate_vblank_count(struct drm_crtc *crtc)spin_lock_irqsave (&dev->vblank_time_lock, flags); -drm_update_vblank_count (dev, pipe,0 ); +drm_update_vblank_count (dev, pipe, false); vblank =drm_vblank_count (dev, pipe);spin_unlock_irqrestore (&dev->vblank_time_lock, flags);@@ -349,7 +349,7 @@ static void vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)* this time. This makes the count account for the entire time * between drm_crtc_vblank_on() and drm_crtc_vblank_off(). */ -drm_update_vblank_count (dev, pipe,0 ); +drm_update_vblank_count (dev, pipe, false);spin_unlock_irqrestore (&dev->vblank_time_lock, irqflags); }@@ -700,9 +700,10 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);* @max_error: Desired maximum allowable error in timestamps (nanosecs) * On return contains true maximum error of timestamp * @vblank_time: Pointer to struct timeval which should receive the timestamp -* @flags: Flags to pass to driver: -* 0 = Default, -* DRM_CALLED_FROM_VBLIRQ = If function is called from vbl IRQ handler +* @in_vblank_irq: +* True when called from drm_crtc_handle_vblank(). Some drivers +* need to apply some workarounds for gpu-specific vblank irq quirks +* if flag is set. * @mode: mode which defines the scanout timings * * Implements calculation of exact vblank timestamps from given drm_display_mode @@ -732,7 +733,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,unsigned int pipe, int *max_error, struct timeval *vblank_time, - unsigned flags, + bool in_vblank_irq, const struct drm_display_mode *mode) { struct timeval tv_etime;@@ -740,6 +741,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,unsigned int vbl_status;int vpos, hpos, i;int delta_ns, duration_ns; +unsigned flags = in_vblank_irq ?DRM_CALLED_FROM_VBLIRQ :0 ;if (pipe >= dev->num_crtcs) {DRM_ERROR ("Invalid crtc %u\n" , pipe);@@ -843,9 +845,10 @@ static struct timeval get_drm_timestamp(void)* @dev: DRM device * @pipe: index of CRTC whose vblank timestamp to retrieve * @tvblank: Pointer to target struct timeval which should receive the timestamp -* @flags: Flags to pass to driver: -* 0 = Default, -* DRM_CALLED_FROM_VBLIRQ = If function is called from vbl IRQ handler +* @in_vblank_irq: +* True when called from drm_crtc_handle_vblank(). Some drivers +* need to apply some workarounds for gpu-specific vblank irq quirks +* if flag is set. * * Fetches the system timestamp corresponding to the time of the most recent * vblank interval on specified CRTC. May call into kms-driver to @@ -859,7 +862,7 @@ static struct timeval get_drm_timestamp(void)*/ static bool drm_get_last_vbltimestamp (struct drm_device *dev,unsigned int pipe, -struct timeval *tvblank,unsigned flags) +struct timeval *tvblank,bool in_vblank_irq) {bool ret = false;@@ -869,7 +872,7 @@ drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,/* Query driver if possible and precision timestamping enabled. */ if (dev->driver->get_vblank_timestamp && (max_error >0 )) ret = dev->driver->get_vblank_timestamp (dev, pipe, &max_error, - tvblank, flags); + tvblank, in_vblank_irq);/* GPU high precision timestamp query unsupported or failed. * Return current monotonic/gettimeofday timestamp as best estimate. @@ -1745,7 +1748,7 @@ bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)return false; } -drm_update_vblank_count (dev, pipe,DRM_CALLED_FROM_VBLIRQ ); +drm_update_vblank_count (dev, pipe, true);spin_unlock (&dev->vblank_time_lock);drivers/gpu/drm/i915/i915_irq.c +2
-2@@ -967,7 +967,7 @@ int intel_get_crtc_scanline(struct intel_crtc *crtc)static bool i915_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags) +bool in_vblank_irq) {struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_crtc *crtc;@@ -991,7 +991,7 @@ static bool i915_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,/* Helper routine in DRM core does all the work: */ return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, flags, + vblank_time, in_vblank_irq, &crtc->base.hwmode); }drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +2
-2@@ -598,7 +598,7 @@ static int mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,static bool mdp5_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags) +bool in_vblank_irq) {struct msm_drm_private *priv = dev->dev_private;struct drm_crtc *crtc;@@ -615,7 +615,7 @@ static bool mdp5_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe, }return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, flags, + vblank_time, in_vblank_irq, &crtc->mode); }drivers/gpu/drm/nouveau/nouveau_display.c +3
-2@@ -158,7 +158,7 @@ nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe,bool nouveau_display_vblstamp (struct drm_device *dev,unsigned int pipe, -int *max_error,struct timeval *time,unsigned flags) +int *max_error,struct timeval *time,bool in_vblank_irq) {struct drm_crtc *crtc;@@ -170,7 +170,8 @@ nouveau_display_vblstamp(struct drm_device *dev, unsigned int pipe,else mode = &crtc->hwmode;return drm_calc_vbltimestamp_from_scanoutpos (dev, - pipe, max_error, time, flags, mode); + pipe, max_error, time, in_vblank_irq, + mode); } }drivers/gpu/drm/nouveau/nouveau_display.h +1
-1@@ -72,7 +72,7 @@ int nouveau_display_scanoutpos(struct drm_device *, unsigned int, unsigned int, int *, int *, ktime_t *, ktime_t *, const struct drm_display_mode *);bool nouveau_display_vblstamp (struct drm_device *,unsigned int ,int *, -struct timeval *,unsigned ); +struct timeval *,bool ); int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event,drivers/gpu/drm/radeon/radeon_drv.c +1
-1@@ -118,7 +118,7 @@ void radeon_disable_vblank_kms(struct drm_device *dev, unsigned int pipe);bool radeon_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags); +bool in_vblank_irq);void radeon_driver_irq_preinstall_kms (struct drm_device *dev);int radeon_driver_irq_postinstall_kms (struct drm_device *dev);void radeon_driver_irq_uninstall_kms (struct drm_device *dev);drivers/gpu/drm/radeon/radeon_kms.c +2
-2@@ -874,7 +874,7 @@ void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)bool radeon_get_vblank_timestamp_kms (struct drm_device *dev,int crtc,int *max_error,struct timeval *vblank_time, -unsigned flags) +bool in_vblank_irq) {struct drm_crtc *drmcrtc;struct radeon_device *rdev = dev->dev_private;@@ -891,7 +891,7 @@ bool radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc,/* Helper routine in DRM core does all the work: */ return drm_calc_vbltimestamp_from_scanoutpos (dev, crtc, max_error, - vblank_time, flags, + vblank_time, in_vblank_irq, &drmcrtc->hwmode); }drivers/gpu/drm/vc4/vc4_crtc.c +2
-2@@ -272,14 +272,14 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,bool vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id,int *max_error,struct timeval *vblank_time, -unsigned flags) +bool in_vblank_irq) {struct drm_crtc *crtc =drm_crtc_from_index (dev, crtc_id);struct drm_crtc_state *state = crtc->state;/* Helper routine in DRM core does all the work: */ return drm_calc_vbltimestamp_from_scanoutpos (dev, crtc_id, max_error, - vblank_time, flags, + vblank_time, in_vblank_irq, &state->adjusted_mode); }drivers/gpu/drm/vc4/vc4_drv.h +1
-1@@ -452,7 +452,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, const struct drm_display_mode *mode);bool vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id,int *max_error,struct timeval *vblank_time, -unsigned flags); +bool in_vblank_irq);/* vc4_debugfs.c */ int vc4_debugfs_init (struct drm_minor *minor);include/drm/drm_drv.h +5
-6@@ -308,11 +308,10 @@ struct drm_driver {* Returns true upper bound on error for timestamp. * vblank_time: * Target location for returned vblank timestamp. -* flags: -* 0 = Defaults, no special treatment needed. -* DRM_CALLED_FROM_VBLIRQ = Function is called from vblank -* irq handler. Some drivers need to apply some workarounds -* for gpu-specific vblank irq quirks if flag is set. +* in_vblank_irq: +* True when called from drm_crtc_handle_vblank(). Some drivers +* need to apply some workarounds for gpu-specific vblank irq quirks +* if flag is set. * * Returns: * @@ -322,7 +321,7 @@ struct drm_driver {bool (*get_vblank_timestamp) (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags); +bool in_vblank_irq);/* these have to be filled in */ include/drm/drm_irq.h +0
-0
include/drm/drm_irq.h u32 drm_accurate_vblank_count(struct drm_crtc *crtc); · line 162
Quoted 8 lines
include/drm/drm_irq.h +1
-1@@ -156,7 +156,7 @@ u32 drm_accurate_vblank_count(struct drm_crtc *crtc);bool drm_calc_vbltimestamp_from_scanoutpos (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -unsigned flags, +bool in_vblank_irq,const struct drm_display_mode *mode);void drm_calc_timestamping_constants (struct drm_crtc *crtc,const struct drm_display_mode *mode);
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/11 drm/vblank: drop the mode argument from drm_calc_vbltimestamp_from_scanoutpos
In reply to a message not in the archiveIf we restrict this helper to only kms drivers (which is the case) we can look up the correct mode easily ourselves. But it's a bit tricky:
- All legacy drivers look at crtc->hwmode. But that is update already at the beginning of the modeset helper, which means when we disable a pipe. Hence the final timestamps might be a bit off. But since this is an existing bug I'm not going to change it, but just try to be bug-for-bug compatible with the current code. This only applies to radeon&amdgpu.
- i915 tries to get it perfect by updating crtc->hwmode when the pipe is off (i.e. vblank->enabled = false).
- All other atomic drivers look at crtc->state->adjusted_mode. Those that look at state->requested_mode simply don't adjust their mode, so it's the same. That has two problems: Accessing crtc->state from interrupt handling code is unsafe, and it's updated before we shut down the pipe. For nonblocking modesets it's even worse.
For atomic drivers try to implement what i915 does. To do that we add a new hwmode field to the vblank structure, and update it from drm_calc_timestamping_constants(). For atomic drivers that's called from the right spot by the helper library already, so all fine. But for safety let's enforce that.
For legacy driver this function is only called at the end (oh the fun), which is broken, so again let's not bother and just stay bug-for-bug compatible.
The benefit is that we can use drm_calc_vbltimestamp_from_scanoutpos directly to implement ->get_vblank_timestamp in every driver, deleting a lot of code.
v2: Completely new approach, trying to mimick the i915 solution.
v3: Fixup kerneldoc.
v4: Drop the WARN_ON to check that the vblank is off, atomic helpers currently unconditionally call this. Recomputing the same stuff should be harmless.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 41 ------------------------------- drivers/gpu/drm/drm_irq.c | 27 +++++++++++++++++--- drivers/gpu/drm/i915/i915_irq.c | 33 +------------------------ drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 26 +------------------- drivers/gpu/drm/nouveau/nouveau_display.c | 22 ----------------- drivers/gpu/drm/nouveau/nouveau_display.h | 2 -- drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 6 +---- drivers/gpu/drm/radeon/radeon_kms.c | 37 ---------------------------- drivers/gpu/drm/vc4/vc4_crtc.c | 13 ---------- drivers/gpu/drm/vc4/vc4_drv.c | 2 +- drivers/gpu/drm/vc4/vc4_drv.h | 3 --- include/drm/drm_irq.h | 15 +++++++++-- 15 files changed, 42 insertions(+), 193 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -4
@@ -1913,10 +1913,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon);u32 amdgpu_get_vblank_counter_kms (struct drm_device *dev,unsigned int pipe);int amdgpu_enable_vblank_kms (struct drm_device *dev,unsigned int pipe);void amdgpu_disable_vblank_kms (struct drm_device *dev,unsigned int pipe); -bool amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq);long amdgpu_kms_compat_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
@@ -725,7 +725,7 @@ static struct drm_driver kms_driver = { .get_vblank_counter = amdgpu_get_vblank_counter_kms, .enable_vblank = amdgpu_enable_vblank_kms, .disable_vblank = amdgpu_disable_vblank_kms, - .get_vblank_timestamp = amdgpu_get_vblank_timestamp_kms, + .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos, .get_scanout_position = amdgpu_get_crtc_scanoutpos,#if defined(CONFIG_DEBUG_FS ) .debugfs_init = amdgpu_debugfs_init,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -41
47 lines not on this page · raw message
drivers/gpu/drm/drm_irq.c +23 -4
@@ -684,6 +684,7 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc, vblank->linedur_ns = linedur_ns; vblank->framedur_ns = framedur_ns; + vblank->hwmode = *mode; DRM_DEBUG("crtc %u: hwmode: htotal %d, vtotal %d, vdisplay %d\n", crtc->base.id, mode->crtc_htotal,
@@ -704,7 +705,6 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);* True when called from drm_crtc_handle_vblank(). Some drivers * need to apply some workarounds for gpu-specific vblank irq quirks * if flag is set. -* @mode: mode which defines the scanout timings * * Implements calculation of exact vblank timestamps from given drm_display_mode * timings and current video scanout position of a CRTC. This can be called from
@@ -724,6 +724,13 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);* returns as no operation if a doublescan or interlaced video mode is * active. Higher level code is expected to handle this. * +* This function can be used to implement the &drm_driver.get_vblank_timestamp +* directly, if the driver implements the &drm_driver.get_scanout_position hook. +* +* Note that atomic drivers must call drm_calc_timestamping_constants() before +* enabling a CRTC. The atomic helpers already take care of that in +* drm_atomic_helper_update_legacy_modeset_state(). +* * Returns: * * Returns true on success, and false on failure, i.e. when no accurate
@@ -733,17 +740,24 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,unsigned int pipe, int *max_error, struct timeval *vblank_time, - bool in_vblank_irq, - const struct drm_display_mode *mode) + bool in_vblank_irq) { struct timeval tv_etime;ktime_t stime, etime;unsigned int vbl_status; +struct drm_crtc *crtc; +const struct drm_display_mode *mode; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];int vpos, hpos, i;int delta_ns, duration_ns;unsigned flags = in_vblank_irq ?DRM_CALLED_FROM_VBLIRQ :0 ; -if (pipe >= dev->num_crtcs) { +if (!drm_core_check_feature (dev,DRIVER_MODESET )) +return false; + + crtc =drm_crtc_from_index (dev, pipe); + +if (pipe >= dev->num_crtcs || !crtc) {DRM_ERROR ("Invalid crtc %u\n" , pipe);return false; }
@@ -754,6 +768,11 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,return false; } +if (drm_drv_uses_atomic_modeset (dev)) + mode = &vblank->hwmode; +else + mode = &crtc->hwmode; +/* If mode timing undefined, just return as no-op: * Happens during initial modesetting of a crtc. */
drivers/gpu/drm/i915/i915_irq.c +1 -32
@@ -964,37 +964,6 @@ int intel_get_crtc_scanline(struct intel_crtc *crtc)return position; } -static bool i915_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq) -{ -struct drm_i915_private *dev_priv =to_i915 (dev); -struct intel_crtc *crtc; - -if (pipe >=INTEL_INFO (dev_priv)->num_pipes) { -DRM_ERROR ("Invalid crtc %u\n" , pipe); -return false; - } - -/* Get drm_crtc to timestamp: */ - crtc =intel_get_crtc_for_pipe (dev_priv, pipe); -if (crtc ==NULL ) { -DRM_ERROR ("Invalid crtc %u\n" , pipe); -return false; - } - -if (!crtc->base.hwmode.crtc_clock) { -DRM_DEBUG_KMS ("crtc %u is disabled\n" , pipe); -return false; - } - -/* Helper routine in DRM core does all the work: */ -return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, in_vblank_irq, - &crtc->base.hwmode); -} -static void ironlake_rps_change_irq_handler (struct drm_i915_private *dev_priv) {u32 busy_up, busy_down, max_avg, min_avg;
@@ -4329,7 +4298,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv) dev_priv->hotplug.hpd_storm_threshold =HPD_STORM_DEFAULT_THRESHOLD ; - dev->driver->get_vblank_timestamp = i915_get_vblank_timestamp; + dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos; dev->driver->get_scanout_position = i915_get_crtc_scanoutpos;if (IS_CHERRYVIEW (dev_priv)) {
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +1 -25
@@ -595,30 +595,6 @@ static int mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,return ret; } -static bool mdp5_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq) -{ -struct msm_drm_private *priv = dev->dev_private; -struct drm_crtc *crtc; - -if (pipe <0 || pipe >= priv->num_crtcs) { -DRM_ERROR ("Invalid crtc %d\n" , pipe); -return false; - } - - crtc = priv->crtcs[pipe]; -if (!crtc) { -DRM_ERROR ("Invalid crtc %d\n" , pipe); -return false; - } - -return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, in_vblank_irq, - &crtc->mode); -} -static u32 mdp5_get_vblank_counter (struct drm_device *dev,unsigned int pipe) {struct msm_drm_private *priv = dev->dev_private;
@@ -728,7 +704,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) dev->mode_config.max_width =0xffff ; dev->mode_config.max_height =0xffff ; - dev->driver->get_vblank_timestamp = mdp5_get_vblank_timestamp; + dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos; dev->driver->get_scanout_position = mdp5_get_scanoutpos; dev->driver->get_vblank_counter = mdp5_get_vblank_counter; dev->max_vblank_count =0xffffffff ;
drivers/gpu/drm/nouveau/nouveau_display.c +0 -22
@@ -156,28 +156,6 @@ nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe,return 0 ; } -bool -nouveau_display_vblstamp (struct drm_device *dev,unsigned int pipe, -int *max_error,struct timeval *time,bool in_vblank_irq) -{ -struct drm_crtc *crtc; - -list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { -if (nouveau_crtc (crtc)->index == pipe) { -struct drm_display_mode *mode; -if (drm_drv_uses_atomic_modeset (dev)) - mode = &crtc->state->adjusted_mode; -else - mode = &crtc->hwmode; -return drm_calc_vbltimestamp_from_scanoutpos (dev, - pipe, max_error, time, in_vblank_irq, - mode); - } - } - -return false; -} -static void nouveau_display_vblank_fini (struct drm_device *dev) {
drivers/gpu/drm/nouveau/nouveau_display.h +0 -2
@@ -71,8 +71,6 @@ void nouveau_display_vblank_disable(struct drm_device *, unsigned int);int nouveau_display_scanoutpos (struct drm_device *,unsigned int ,unsigned int ,int *,int *,ktime_t *,ktime_t *,const struct drm_display_mode *); -bool nouveau_display_vblstamp (struct drm_device *,unsigned int ,int *, -struct timeval *,bool ); int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event,
drivers/gpu/drm/nouveau/nouveau_drm.c +1 -1
@@ -978,7 +978,7 @@ driver_stub = { .enable_vblank = nouveau_display_vblank_enable, .disable_vblank = nouveau_display_vblank_disable, .get_scanout_position = nouveau_display_scanoutpos, - .get_vblank_timestamp = nouveau_display_vblstamp, + .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos, .ioctls = nouveau_ioctls, .num_ioctls = ARRAY_SIZE(nouveau_ioctls),
drivers/gpu/drm/radeon/radeon_drv.c +1 -5
@@ -115,10 +115,6 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);u32 radeon_get_vblank_counter_kms (struct drm_device *dev,unsigned int pipe);int radeon_enable_vblank_kms (struct drm_device *dev,unsigned int pipe);void radeon_disable_vblank_kms (struct drm_device *dev,unsigned int pipe); -bool radeon_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq);void radeon_driver_irq_preinstall_kms (struct drm_device *dev);int radeon_driver_irq_postinstall_kms (struct drm_device *dev);void radeon_driver_irq_uninstall_kms (struct drm_device *dev);
@@ -544,7 +540,7 @@ static struct drm_driver kms_driver = { .get_vblank_counter = radeon_get_vblank_counter_kms, .enable_vblank = radeon_enable_vblank_kms, .disable_vblank = radeon_disable_vblank_kms, - .get_vblank_timestamp = radeon_get_vblank_timestamp_kms, + .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos, .get_scanout_position = radeon_get_crtc_scanoutpos, .irq_preinstall = radeon_driver_irq_preinstall_kms, .irq_postinstall = radeon_driver_irq_postinstall_kms,
drivers/gpu/drm/radeon/radeon_kms.c +0 -37
@@ -858,43 +858,6 @@ void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)spin_unlock_irqrestore (&rdev->irq.lock, irqflags); } -/** -* radeon_get_vblank_timestamp_kms - get vblank timestamp -* -* @dev: drm dev pointer -* @crtc: crtc to get the timestamp for -* @max_error: max error -* @vblank_time: time value -* @flags: flags passed to the driver -* -* Gets the timestamp on the requested crtc based on the -* scanout position. (all asics). -* Returns true on success, false on failure. -*/ -bool radeon_get_vblank_timestamp_kms (struct drm_device *dev,int crtc, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq) -{ -struct drm_crtc *drmcrtc; -struct radeon_device *rdev = dev->dev_private; - -if (crtc <0 || crtc >= dev->num_crtcs) { -DRM_ERROR ("Invalid crtc %d\n" , crtc); -return false; - } - -/* Get associated drm_crtc: */ - drmcrtc = &rdev->mode_info.crtcs[crtc]->base; -if (!drmcrtc) -return false; - -/* Helper routine in DRM core does all the work: */ -return drm_calc_vbltimestamp_from_scanoutpos (dev, crtc, max_error, - vblank_time, in_vblank_irq, - &drmcrtc->hwmode); -} -const struct drm_ioctl_desc radeon_ioctls_kms[] = {DRM_IOCTL_DEF_DRV (RADEON_CP_INIT , drm_invalid_op,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (RADEON_CP_START , drm_invalid_op,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),
drivers/gpu/drm/vc4/vc4_crtc.c +0 -13
@@ -270,19 +270,6 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,return ret; } -bool vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id, -int *max_error,struct timeval *vblank_time, -bool in_vblank_irq) -{ -struct drm_crtc *crtc =drm_crtc_from_index (dev, crtc_id); -struct drm_crtc_state *state = crtc->state; - -/* Helper routine in DRM core does all the work: */ -return drm_calc_vbltimestamp_from_scanoutpos (dev, crtc_id, max_error, - vblank_time, in_vblank_irq, - &state->adjusted_mode); -} -static void vc4_crtc_destroy (struct drm_crtc *crtc) {drm_crtc_cleanup (crtc);
drivers/gpu/drm/vc4/vc4_drv.c +1 -1
@@ -154,7 +154,7 @@ static struct drm_driver vc4_drm_driver = { .irq_uninstall = vc4_irq_uninstall, .get_scanout_position = vc4_crtc_get_scanoutpos, - .get_vblank_timestamp = vc4_crtc_get_vblank_timestamp, + .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,#if defined(CONFIG_DEBUG_FS ) .debugfs_init = vc4_debugfs_init,
drivers/gpu/drm/vc4/vc4_drv.h +0 -3
@@ -450,9 +450,6 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, unsigned int flags, int *vpos, int *hpos, ktime_t *stime, ktime_t *etime, const struct drm_display_mode *mode); -bool vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id, -int *max_error,struct timeval *vblank_time, -bool in_vblank_irq);/* vc4_debugfs.c */ int vc4_debugfs_init (struct drm_minor *minor);
include/drm/drm_irq.h +13 -2
@@ -121,6 +121,18 @@ struct drm_vblank_crtc {* drm_calc_timestamping_constants(). */ int linedur_ns; + +/** +* @hwmode: +* +* Cache of the current hardware display mode. Only valide when @enabled +* is set. This is used by helpers like +* drm_calc_vbltimestamp_from_scanoutpos(). We can't just access the +* hardware mode by e.g. looking at &drm_crtc_state.adjusted_mode, +* because that one is really hard to get at from interrupt context. +*/ +struct drm_display_mode hwmode; +/** * @enabled: Tracks the enabling state of the corresponding &drm_crtc to * avoid double-disabling and hence corrupting saved state. Needed by
@@ -156,8 +168,7 @@ u32 drm_accurate_vblank_count(struct drm_crtc *crtc);bool drm_calc_vbltimestamp_from_scanoutpos (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -bool in_vblank_irq, -const struct drm_display_mode *mode); +bool in_vblank_irq);void drm_calc_timestamping_constants (struct drm_crtc *crtc,const struct drm_display_mode *mode);
Signature · 6 lines
2.11.0 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [PATCH 08/11] drm/vblank: drop the mode argument from drm_calc_vbltimestamp_from_scanoutpos
Quoted 4 lines · Daniel Vetter
If we restrict this helper to only kms drivers (which is the case) we can look up the correct mode easily ourselves. But it's a bit tricky:
- All legacy drivers look at
crtc->hwmode. But that is update already
is updated ?
Quoted 500 lines
at the beginning of the modeset helper, which means when we disable a pipe. Hence the final timestamps might be a bit off. But since this is an existing bug I'm not going to change it, but just try to be bug-for-bug compatible with the current code. This only applies to radeon&amdgpu.
- i915 tries to get it perfect by updating
crtc->hwmodewhen the pipe is off (i.e.vblank->enabled= false).- All other atomic drivers look at
crtc->state->adjusted_mode. Those that look atstate->requested_modesimply don't adjust their mode, so it's the same. That has two problems: Accessingcrtc->statefrom interrupt handling code is unsafe, and it's updated before we shut down the pipe. For nonblocking modesets it's even worse.For atomic drivers try to implement what i915 does. To do that we add a new hwmode field to the vblank structure, and update it from
drm_calc_timestamping_constants(). For atomic drivers that's called from the right spot by the helper library already, so all fine. But for safety let's enforce that.For legacy driver this function is only called at the end (oh the fun), which is broken, so again let's not bother and just stay bug-for-bug compatible.
The benefit is that we can use
drm_calc_vbltimestamp_from_scanoutposdirectly to implement ->get_vblank_timestamp in every driver, deleting a lot of code.v2: Completely new approach, trying to mimick the i915 solution.
v3: Fixup kerneldoc.
v4: Drop the
WARN_ONto check that the vblank is off, atomic helpers currently unconditionally call this. Recomputing the same stuff should be harmless.Cc Mario Kleiner <[email protected]>Cc Eric Anholt <[email protected]>Cc Rob Clark <[email protected]>Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Cc Ben Skeggs <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 41 ------------------------------- drivers/gpu/drm/drm_irq.c | 27 +++++++++++++++++--- drivers/gpu/drm/i915/i915_irq.c | 33 +------------------------ drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 26 +------------------- drivers/gpu/drm/nouveau/nouveau_display.c | 22 ----------------- drivers/gpu/drm/nouveau/nouveau_display.h | 2 -- drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 6 +---- drivers/gpu/drm/radeon/radeon_kms.c | 37 ---------------------------- drivers/gpu/drm/vc4/vc4_crtc.c | 13 ---------- drivers/gpu/drm/vc4/vc4_drv.c | 2 +- drivers/gpu/drm/vc4/vc4_drv.h | 3 --- include/drm/drm_irq.h | 15 +++++++++-- 15 files changed, 42 insertions(+), 193 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-4@@ -1913,10 +1913,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon);u32 amdgpu_get_vblank_counter_kms (struct drm_device *dev,unsigned int pipe);int amdgpu_enable_vblank_kms (struct drm_device *dev,unsigned int pipe);void amdgpu_disable_vblank_kms (struct drm_device *dev,unsigned int pipe); -bool amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq);long amdgpu_kms_compat_ioctl (struct file *filp,unsigned int cmd,unsigned long arg);drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-1@@ -725,7 +725,7 @@ static struct drm_driver kms_driver = { .get_vblank_counter = amdgpu_get_vblank_counter_kms, .enable_vblank = amdgpu_enable_vblank_kms, .disable_vblank = amdgpu_disable_vblank_kms, - .get_vblank_timestamp = amdgpu_get_vblank_timestamp_kms, + .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos, .get_scanout_position = amdgpu_get_crtc_scanoutpos,#if defined(CONFIG_DEBUG_FS ) .debugfs_init = amdgpu_debugfs_init,drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-41@@ -940,47 +940,6 @@ void amdgpu_disable_vblank_kms(struct drm_device *dev, unsigned int pipe)amdgpu_irq_put (adev, &adev->crtc_irq, idx); } -/** -* amdgpu_get_vblank_timestamp_kms - get vblank timestamp -* -* @dev: drm dev pointer -* @crtc: crtc to get the timestamp for -* @max_error: max error -* @vblank_time: time value -* @in_vblank_irq: called from drm_handle_vblank() -* -* Gets the timestamp on the requested crtc based on the -* scanout position. (all asics). -* Returns true on success, false on failure. -*/ -bool amdgpu_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq) -{ -struct drm_crtc *crtc; -struct amdgpu_device *adev = dev->dev_private; - -if (pipe >= dev->num_crtcs) { -DRM_ERROR ("Invalid crtc %u\n" , pipe); -return false; - } - -/* Get associated drm_crtc: */ - crtc = &adev->mode_info.crtcs[pipe]->base; -if (!crtc) { -/* This can occur on driver load if some component fails to -* initialize completely and driver is unloaded */ -DRM_ERROR ("Uninitialized crtc %d\n" , pipe); -return false; - } - -/* Helper routine in DRM core does all the work: */ -return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, in_vblank_irq, - &crtc->hwmode); -} -const struct drm_ioctl_desc amdgpu_ioctls_kms[] = {DRM_IOCTL_DEF_DRV (AMDGPU_GEM_CREATE , amdgpu_gem_create_ioctl,DRM_AUTH |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (AMDGPU_CTX , amdgpu_ctx_ioctl,DRM_AUTH |DRM_RENDER_ALLOW ),drivers/gpu/drm/drm_irq.c +23
-4@@ -684,6 +684,7 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc, vblank->linedur_ns = linedur_ns; vblank->framedur_ns = framedur_ns; + vblank->hwmode = *mode; DRM_DEBUG("crtc %u: hwmode: htotal %d, vtotal %d, vdisplay %d\n", crtc->base.id, mode->crtc_htotal,@@ -704,7 +705,6 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);* True when called from drm_crtc_handle_vblank(). Some drivers * need to apply some workarounds for gpu-specific vblank irq quirks * if flag is set. -* @mode: mode which defines the scanout timings * * Implements calculation of exact vblank timestamps from given drm_display_mode * timings and current video scanout position of a CRTC. This can be called from @@ -724,6 +724,13 @@ EXPORT_SYMBOL(drm_calc_timestamping_constants);* returns as no operation if a doublescan or interlaced video mode is * active. Higher level code is expected to handle this. * +* This function can be used to implement the &drm_driver.get_vblank_timestamp +* directly, if the driver implements the &drm_driver.get_scanout_position hook. +* +* Note that atomic drivers must call drm_calc_timestamping_constants() before +* enabling a CRTC. The atomic helpers already take care of that in +* drm_atomic_helper_update_legacy_modeset_state(). +* * Returns: * * Returns true on success, and false on failure, i.e. when no accurate @@ -733,17 +740,24 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,unsigned int pipe, int *max_error, struct timeval *vblank_time, - bool in_vblank_irq, - const struct drm_display_mode *mode) + bool in_vblank_irq) { struct timeval tv_etime;ktime_t stime, etime;unsigned int vbl_status; +struct drm_crtc *crtc; +const struct drm_display_mode *mode; +struct drm_vblank_crtc *vblank = &dev->vblank[pipe];int vpos, hpos, i;int delta_ns, duration_ns;unsigned flags = in_vblank_irq ?DRM_CALLED_FROM_VBLIRQ :0 ; -if (pipe >= dev->num_crtcs) { +if (!drm_core_check_feature (dev,DRIVER_MODESET )) +return false; + + crtc =drm_crtc_from_index (dev, pipe); + +if (pipe >= dev->num_crtcs || !crtc) {DRM_ERROR ("Invalid crtc %u\n" , pipe);return false; }@@ -754,6 +768,11 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,return false; } +if (drm_drv_uses_atomic_modeset (dev)) + mode = &vblank->hwmode; +else + mode = &crtc->hwmode; +/* If mode timing undefined, just return as no-op: * Happens during initial modesetting of a crtc. */ drivers/gpu/drm/i915/i915_irq.c +1
-32@@ -964,37 +964,6 @@ int intel_get_crtc_scanline(struct intel_crtc *crtc)return position; } -static bool i915_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq) -{ -struct drm_i915_private *dev_priv =to_i915 (dev); -struct intel_crtc *crtc; - -if (pipe >=INTEL_INFO (dev_priv)->num_pipes) { -DRM_ERROR ("Invalid crtc %u\n" , pipe); -return false; - } - -/* Get drm_crtc to timestamp: */ - crtc =intel_get_crtc_for_pipe (dev_priv, pipe); -if (crtc ==NULL ) { -DRM_ERROR ("Invalid crtc %u\n" , pipe); -return false; - } - -if (!crtc->base.hwmode.crtc_clock) { -DRM_DEBUG_KMS ("crtc %u is disabled\n" , pipe); -return false; - } - -/* Helper routine in DRM core does all the work: */ -return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, in_vblank_irq, - &crtc->base.hwmode); -} -static void ironlake_rps_change_irq_handler (struct drm_i915_private *dev_priv) {u32 busy_up, busy_down, max_avg, min_avg;@@ -4329,7 +4298,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv) dev_priv->hotplug.hpd_storm_threshold =HPD_STORM_DEFAULT_THRESHOLD ; - dev->driver->get_vblank_timestamp = i915_get_vblank_timestamp; + dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos; dev->driver->get_scanout_position = i915_get_crtc_scanoutpos;if (IS_CHERRYVIEW (dev_priv)) {drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +1
-25@@ -595,30 +595,6 @@ static int mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,return ret; } -static bool mdp5_get_vblank_timestamp (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq) -{ -struct msm_drm_private *priv = dev->dev_private; -struct drm_crtc *crtc; - -if (pipe <0 || pipe >= priv->num_crtcs) { -DRM_ERROR ("Invalid crtc %d\n" , pipe); -return false; - } - - crtc = priv->crtcs[pipe]; -if (!crtc) { -DRM_ERROR ("Invalid crtc %d\n" , pipe); -return false; - } - -return drm_calc_vbltimestamp_from_scanoutpos (dev, pipe, max_error, - vblank_time, in_vblank_irq, - &crtc->mode); -} -static u32 mdp5_get_vblank_counter (struct drm_device *dev,unsigned int pipe) {struct msm_drm_private *priv = dev->dev_private;@@ -728,7 +704,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) dev->mode_config.max_width =0xffff ; dev->mode_config.max_height =0xffff ; - dev->driver->get_vblank_timestamp = mdp5_get_vblank_timestamp; + dev->driver->get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos; dev->driver->get_scanout_position = mdp5_get_scanoutpos; dev->driver->get_vblank_counter = mdp5_get_vblank_counter; dev->max_vblank_count =0xffffffff ;drivers/gpu/drm/nouveau/nouveau_display.c +0
-22@@ -156,28 +156,6 @@ nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe,return 0 ; } -bool -nouveau_display_vblstamp (struct drm_device *dev,unsigned int pipe, -int *max_error,struct timeval *time,bool in_vblank_irq) -{ -struct drm_crtc *crtc; - -list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { -if (nouveau_crtc (crtc)->index == pipe) { -struct drm_display_mode *mode; -if (drm_drv_uses_atomic_modeset (dev)) - mode = &crtc->state->adjusted_mode; -else - mode = &crtc->hwmode; -return drm_calc_vbltimestamp_from_scanoutpos (dev, - pipe, max_error, time, in_vblank_irq, - mode); - } - } - -return false; -} -static void nouveau_display_vblank_fini (struct drm_device *dev) {drivers/gpu/drm/nouveau/nouveau_display.h +0
-2@@ -71,8 +71,6 @@ void nouveau_display_vblank_disable(struct drm_device *, unsigned int);int nouveau_display_scanoutpos (struct drm_device *,unsigned int ,unsigned int ,int *,int *,ktime_t *,ktime_t *,const struct drm_display_mode *); -bool nouveau_display_vblstamp (struct drm_device *,unsigned int ,int *, -struct timeval *,bool ); int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event,drivers/gpu/drm/nouveau/nouveau_drm.c +1
-1@@ -978,7 +978,7 @@ driver_stub = { .enable_vblank = nouveau_display_vblank_enable, .disable_vblank = nouveau_display_vblank_disable, .get_scanout_position = nouveau_display_scanoutpos, - .get_vblank_timestamp = nouveau_display_vblstamp, + .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos, .ioctls = nouveau_ioctls, .num_ioctls = ARRAY_SIZE(nouveau_ioctls),drivers/gpu/drm/radeon/radeon_drv.c +1
-5@@ -115,10 +115,6 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);u32 radeon_get_vblank_counter_kms (struct drm_device *dev,unsigned int pipe);int radeon_enable_vblank_kms (struct drm_device *dev,unsigned int pipe);void radeon_disable_vblank_kms (struct drm_device *dev,unsigned int pipe); -bool radeon_get_vblank_timestamp_kms (struct drm_device *dev,unsigned int pipe, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq);void radeon_driver_irq_preinstall_kms (struct drm_device *dev);int radeon_driver_irq_postinstall_kms (struct drm_device *dev);void radeon_driver_irq_uninstall_kms (struct drm_device *dev);@@ -544,7 +540,7 @@ static struct drm_driver kms_driver = { .get_vblank_counter = radeon_get_vblank_counter_kms, .enable_vblank = radeon_enable_vblank_kms, .disable_vblank = radeon_disable_vblank_kms, - .get_vblank_timestamp = radeon_get_vblank_timestamp_kms, + .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos, .get_scanout_position = radeon_get_crtc_scanoutpos, .irq_preinstall = radeon_driver_irq_preinstall_kms, .irq_postinstall = radeon_driver_irq_postinstall_kms,drivers/gpu/drm/radeon/radeon_kms.c +0
-37@@ -858,43 +858,6 @@ void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)spin_unlock_irqrestore (&rdev->irq.lock, irqflags); } -/** -* radeon_get_vblank_timestamp_kms - get vblank timestamp -* -* @dev: drm dev pointer -* @crtc: crtc to get the timestamp for -* @max_error: max error -* @vblank_time: time value -* @flags: flags passed to the driver -* -* Gets the timestamp on the requested crtc based on the -* scanout position. (all asics). -* Returns true on success, false on failure. -*/ -bool radeon_get_vblank_timestamp_kms (struct drm_device *dev,int crtc, -int *max_error, -struct timeval *vblank_time, -bool in_vblank_irq) -{ -struct drm_crtc *drmcrtc; -struct radeon_device *rdev = dev->dev_private; - -if (crtc <0 || crtc >= dev->num_crtcs) { -DRM_ERROR ("Invalid crtc %d\n" , crtc); -return false; - } - -/* Get associated drm_crtc: */ - drmcrtc = &rdev->mode_info.crtcs[crtc]->base; -if (!drmcrtc) -return false; - -/* Helper routine in DRM core does all the work: */ -return drm_calc_vbltimestamp_from_scanoutpos (dev, crtc, max_error, - vblank_time, in_vblank_irq, - &drmcrtc->hwmode); -} -const struct drm_ioctl_desc radeon_ioctls_kms[] = {DRM_IOCTL_DEF_DRV (RADEON_CP_INIT , drm_invalid_op,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (RADEON_CP_START , drm_invalid_op,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),drivers/gpu/drm/vc4/vc4_crtc.c +0
-13@@ -270,19 +270,6 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,return ret; } -bool vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id, -int *max_error,struct timeval *vblank_time, -bool in_vblank_irq) -{ -struct drm_crtc *crtc =drm_crtc_from_index (dev, crtc_id); -struct drm_crtc_state *state = crtc->state; - -/* Helper routine in DRM core does all the work: */ -return drm_calc_vbltimestamp_from_scanoutpos (dev, crtc_id, max_error, - vblank_time, in_vblank_irq, - &state->adjusted_mode); -} -static void vc4_crtc_destroy (struct drm_crtc *crtc) {drm_crtc_cleanup (crtc);drivers/gpu/drm/vc4/vc4_drv.c +1
-1@@ -154,7 +154,7 @@ static struct drm_driver vc4_drm_driver = { .irq_uninstall = vc4_irq_uninstall, .get_scanout_position = vc4_crtc_get_scanoutpos, - .get_vblank_timestamp = vc4_crtc_get_vblank_timestamp, + .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,#if defined(CONFIG_DEBUG_FS ) .debugfs_init = vc4_debugfs_init,drivers/gpu/drm/vc4/vc4_drv.h +0
-3@@ -450,9 +450,6 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, unsigned int flags, int *vpos, int *hpos, ktime_t *stime, ktime_t *etime, const struct drm_display_mode *mode); -bool vc4_crtc_get_vblank_timestamp (struct drm_device *dev,unsigned int crtc_id, -int *max_error,struct timeval *vblank_time, -bool in_vblank_irq);/* vc4_debugfs.c */ int vc4_debugfs_init (struct drm_minor *minor);include/drm/drm_irq.h +0
-0
include/drm/drm_irq.h struct drm_vblank_crtc { · line 128
Quoted 8 lines
include/drm/drm_irq.h +5
-0@@ -121,6 +121,18 @@ struct drm_vblank_crtc {* drm_calc_timestamping_constants(). */ int linedur_ns; + +/** +* @hwmode: +* +* Cache of the current hardware display mode. Only valide when @enabled
s/valide/valid/
include/drm/drm_irq.h struct drm_vblank_crtc { · line 132
Quoted 4 lines
include/drm/drm_irq.h +4
-0+* is set. This is used by helpers like +* drm_calc_vbltimestamp_from_scanoutpos(). We can't just access the +* hardware mode by e.g. looking at &drm_crtc_state.adjusted_mode, +* because that one is really hard to get at from interrupt context.
s/at from/from/
Quoted 8 lines
include/drm/drm_irq.h +3
-0+*/ +struct drm_display_mode hwmode; +/** * @enabled: Tracks the enabling state of the corresponding &drm_crtc to * avoid double-disabling and hence corrupting saved state. Needed by
include/drm/drm_irq.h u32 drm_accurate_vblank_count(struct drm_crtc *crtc); · line 174
Quoted 9 lines
include/drm/drm_irq.h +1
-2@@ -156,8 +168,7 @@ u32 drm_accurate_vblank_count(struct drm_crtc *crtc);bool drm_calc_vbltimestamp_from_scanoutpos (struct drm_device *dev,unsigned int pipe,int *max_error,struct timeval *vblank_time, -bool in_vblank_irq, -const struct drm_display_mode *mode); +bool in_vblank_irq);void drm_calc_timestamping_constants (struct drm_crtc *crtc,const struct drm_display_mode *mode);
With the typo fixes,
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/11 drm/vblank: Simplify the get_scanout_position helper hook
In reply to a message not in the archive- We can drop the different return value flags, the only caller only cares about whether the scanout position is valid or not. Also, it's entirely undefined what "accurate" means, if we'd really care we should probably wire the max_error through. But since we never even report this to userspace it's kinda moot.
- Drop all the fancy input flags, there's really only the "called from vblank irq" one. Well except for radeon/amdgpu, which added their own private flags.
Since amdgpu/radoen also use the scanoutposition function internally I just gave them a tiny wrapper, plus copies of all the old #defines they need. Everyone else gets simplified code.
Note how we could remove a lot of error conditions if we'd move this helper hook to drm_crtc_helper_funcs and would pass it a crtc directly.
v2: Make it compile on arm.
v3: Squash in fixup from 0day.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 3 +++ drivers/gpu/drm/drm_irq.c | 16 ++++++++-------- drivers/gpu/drm/i915/i915_irq.c | 19 ++++++------------- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 19 +++++++------------ drivers/gpu/drm/nouveau/nouveau_display.c | 18 ++++++++---------- drivers/gpu/drm/nouveau/nouveau_display.h | 6 +++--- drivers/gpu/drm/radeon/radeon_drv.c | 12 +++++++++++- drivers/gpu/drm/radeon/radeon_mode.h | 3 +++ drivers/gpu/drm/vc4/vc4_crtc.c | 21 ++++++++++----------- drivers/gpu/drm/vc4/vc4_drv.h | 8 ++++---- include/drm/drmP.h | 8 -------- include/drm/drm_drv.h | 26 ++++++++++---------------- 13 files changed, 84 insertions(+), 87 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +11 -1
@@ -711,6 +711,16 @@ static const struct file_operations amdgpu_driver_kms_fops = {#endif }; +static bool +amdgpu_get_crtc_scanout_position (struct drm_device *dev,unsigned int pipe, +bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode) +{ +return amdgpu_get_crtc_scanoutpos (dev, pipe,0 , vpos, hpos, + stime, etime, mode); +} +static struct drm_driver kms_driver = { .driver_features = DRIVER_USE_AGP |
@@ -726,7 +736,7 @@ static struct drm_driver kms_driver = { .enable_vblank = amdgpu_enable_vblank_kms, .disable_vblank = amdgpu_disable_vblank_kms, .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos, - .get_scanout_position = amdgpu_get_crtc_scanoutpos, + .get_scanout_position = amdgpu_get_crtc_scanout_position,#if defined(CONFIG_DEBUG_FS ) .debugfs_init = amdgpu_debugfs_init,#endif
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +3 -0
@@ -534,6 +534,9 @@ struct amdgpu_framebuffer { ((em) == ATOM_ENCODER_MODE_DP_MST))/* Driver internal use only flags of amdgpu_get_crtc_scanoutpos() */ +#define DRM_SCANOUTPOS_VALID (1 << 0) +#define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) +#define DRM_SCANOUTPOS_ACCURATE (1 << 2)#define USE_REAL_VBLANKSTART (1 << 30)#define GET_DISTANCE_TO_VBLANKSTART (1 << 31)
drivers/gpu/drm/drm_irq.c +8 -8
@@ -744,13 +744,12 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, {struct timeval tv_etime;ktime_t stime, etime; -unsigned int vbl_status; +bool vbl_status;struct drm_crtc *crtc;const struct drm_display_mode *mode;struct drm_vblank_crtc *vblank = &dev->vblank[pipe];int vpos, hpos, i;int delta_ns, duration_ns; -unsigned flags = in_vblank_irq ?DRM_CALLED_FROM_VBLIRQ :0 ;if (!drm_core_check_feature (dev,DRIVER_MODESET ))return false;
@@ -793,15 +792,16 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,* Get vertical and horizontal scanout position vpos, hpos, * and bounding timestamps stime, etime, pre/post query. */ - vbl_status = dev->driver->get_scanout_position (dev, pipe, flags, + vbl_status = dev->driver->get_scanout_position (dev, pipe, + in_vblank_irq, &vpos, &hpos, &stime, &etime, mode);/* Return as no-op if scanout query unsupported or failed. */ -if (!(vbl_status &DRM_SCANOUTPOS_VALID )) { -DRM_DEBUG ("crtc %u : scanoutpos query failed [0x%x].\n" , - pipe, vbl_status); +if (!vbl_status) { +DRM_DEBUG ("crtc %u : scanoutpos query failed.\n" , + pipe);return false; }
@@ -840,8 +840,8 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, etime =ktime_sub_ns (etime, delta_ns); *vblank_time =ktime_to_timeval (etime); -DRM_DEBUG_VBL ("crtc %u : v 0x%x p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n" , - pipe, vbl_status, hpos, vpos, +DRM_DEBUG_VBL ("crtc %u : v p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n" , + pipe, hpos, vpos, (long )tv_etime.tv_sec, (long )tv_etime.tv_usec, (long )vblank_time->tv_sec, (long )vblank_time->tv_usec, duration_ns/1000 , i);
drivers/gpu/drm/i915/i915_irq.c +6 -13
@@ -827,10 +827,10 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)return (position + crtc->scanline_offset) % vtotal; } -static int i915_get_crtc_scanoutpos (struct drm_device *dev,unsigned int pipe, -unsigned int flags,int *vpos,int *hpos, -ktime_t *stime,ktime_t *etime, -const struct drm_display_mode *mode) +static bool i915_get_crtc_scanoutpos (struct drm_device *dev,unsigned int pipe, +bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode) {struct drm_i915_private *dev_priv =to_i915 (dev); struct intel_crtc *intel_crtc = intel_get_crtc_for_pipe(dev_priv,
@@ -838,13 +838,12 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,int position;int vbl_start, vbl_end, hsync_start, htotal, vtotal;bool in_vbl = true; -int ret =0 ;unsigned long irqflags;if (WARN_ON (!mode->crtc_clock)) {DRM_DEBUG_DRIVER ("trying to get scanoutpos for disabled " "pipe %c\n" ,pipe_name (pipe)); -return 0 ; +return false; } htotal = mode->crtc_htotal;
@@ -859,8 +858,6 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, vtotal /=2 ; } - ret |=DRM_SCANOUTPOS_VALID |DRM_SCANOUTPOS_ACCURATE ; -/* * Lock uncore.lock, as we will do multiple timing critical raw * register reads, potentially with preemption disabled, so the
@@ -944,11 +941,7 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, *hpos = position - (*vpos * htotal); } -/* In vblank? */ -if (in_vbl) - ret |=DRM_SCANOUTPOS_IN_VBLANK ; - -return ret; +return true; }int intel_get_crtc_scanline (struct intel_crtc *crtc)
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +7 -12
@@ -530,31 +530,28 @@ static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)return NULL ; } -static int mdp5_get_scanoutpos (struct drm_device *dev,unsigned int pipe, -unsigned int flags,int *vpos,int *hpos, -ktime_t *stime,ktime_t *etime, -const struct drm_display_mode *mode) +static bool mdp5_get_scanoutpos (struct drm_device *dev,unsigned int pipe, +bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode) {struct msm_drm_private *priv = dev->dev_private;struct drm_crtc *crtc;struct drm_encoder *encoder;int line, vsw, vbp, vactive_start, vactive_end, vfp_end; -int ret =0 ; crtc = priv->crtcs[pipe];if (!crtc) {DRM_ERROR ("Invalid crtc %d\n" , pipe); -return 0 ; +return false; } encoder =get_encoder_from_crtc (crtc);if (!encoder) {DRM_ERROR ("no encoder found for crtc %d\n" , pipe); -return 0 ; +return false; } - ret |=DRM_SCANOUTPOS_VALID |DRM_SCANOUTPOS_ACCURATE ; - vsw = mode->crtc_vsync_end - mode->crtc_vsync_start; vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
@@ -578,10 +575,8 @@ static int mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,if (line < vactive_start) { line -= vactive_start; - ret |=DRM_SCANOUTPOS_IN_VBLANK ; }else if (line > vactive_end) { line = line - vfp_end - vactive_start; - ret |=DRM_SCANOUTPOS_IN_VBLANK ; }else { line -= vactive_start; }
@@ -592,7 +587,7 @@ static int mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe,if (etime) *etime =ktime_get (); -return ret; +return true; }static u32 mdp5_get_vblank_counter (struct drm_device *dev,unsigned int pipe)
drivers/gpu/drm/nouveau/nouveau_display.c +8 -10
@@ -98,7 +98,7 @@ calc(int blanks, int blanke, int total, int line)return line; } -static int +static bool nouveau_display_scanoutpos_head (struct drm_crtc *crtc,int *vpos,int *hpos,ktime_t *stime,ktime_t *etime) {
@@ -111,16 +111,16 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos, };struct nouveau_display *disp =nouveau_display (crtc->dev);struct drm_vblank_crtc *vblank = &crtc->dev->vblank[drm_crtc_index (crtc)]; -int ret, retry =1 ; +int retry =1 ; +bool ret = false; do { ret = nvif_mthd(&disp->disp, 0, &args, sizeof(args)); if (ret != 0) - return 0; + return false; if (args.scan.vline) { - ret |= DRM_SCANOUTPOS_ACCURATE; - ret |= DRM_SCANOUTPOS_VALID; + ret = true; break; }
@@ -133,14 +133,12 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos,if (stime) *stime =ns_to_ktime (args.scan.time[0 ]);if (etime) *etime =ns_to_ktime (args.scan.time[1 ]); -if (*vpos <0 ) - ret |=DRM_SCANOUTPOS_IN_VBLANK ;return ret; } -int +bool nouveau_display_scanoutpos (struct drm_device *dev,unsigned int pipe, -unsigned int flags,int *vpos,int *hpos, +bool in_vblank_irq,int *vpos,int *hpos,ktime_t *stime,ktime_t *etime,const struct drm_display_mode *mode) {
@@ -153,7 +151,7 @@ nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe, } } -return 0 ; +return false; } static void
drivers/gpu/drm/nouveau/nouveau_display.h +3 -3
@@ -68,9 +68,9 @@ int nouveau_display_suspend(struct drm_device *dev, bool runtime);void nouveau_display_resume (struct drm_device *dev,bool runtime);int nouveau_display_vblank_enable (struct drm_device *,unsigned int );void nouveau_display_vblank_disable (struct drm_device *,unsigned int ); -int nouveau_display_scanoutpos (struct drm_device *,unsigned int , -unsigned int ,int *,int *,ktime_t *, -ktime_t *,const struct drm_display_mode *); +bool nouveau_display_scanoutpos (struct drm_device *,unsigned int , +bool ,int *,int *,ktime_t *, +ktime_t *,const struct drm_display_mode *); int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event,
drivers/gpu/drm/radeon/radeon_drv.c +11 -1
@@ -526,6 +526,16 @@ static const struct file_operations radeon_driver_kms_fops = {#endif }; +static bool +radeon_get_crtc_scanout_position (struct drm_device *dev,unsigned int pipe, +bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode) +{ +return radeon_get_crtc_scanoutpos (dev, pipe,0 , vpos, hpos, + stime, etime, mode); +} +static struct drm_driver kms_driver = { .driver_features = DRIVER_USE_AGP |
@@ -541,7 +551,7 @@ static struct drm_driver kms_driver = { .enable_vblank = radeon_enable_vblank_kms, .disable_vblank = radeon_disable_vblank_kms, .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos, - .get_scanout_position = radeon_get_crtc_scanoutpos, + .get_scanout_position = radeon_get_crtc_scanout_position, .irq_preinstall = radeon_driver_irq_preinstall_kms, .irq_postinstall = radeon_driver_irq_postinstall_kms, .irq_uninstall = radeon_driver_irq_uninstall_kms,
drivers/gpu/drm/radeon/radeon_mode.h +3 -0
@@ -691,6 +691,9 @@ struct atom_voltage_table };/* Driver internal use only flags of radeon_get_crtc_scanoutpos() */ +#define DRM_SCANOUTPOS_VALID (1 << 0) +#define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) +#define DRM_SCANOUTPOS_ACCURATE (1 << 2)#define USE_REAL_VBLANKSTART (1 << 30)#define GET_DISTANCE_TO_VBLANKSTART (1 << 31)
drivers/gpu/drm/vc4/vc4_crtc.c +10 -11
@@ -151,10 +151,10 @@ int vc4_crtc_debugfs_regs(struct seq_file *m, void *unused) }#endif -int vc4_crtc_get_scanoutpos (struct drm_device *dev,unsigned int crtc_id, -unsigned int flags,int *vpos,int *hpos, -ktime_t *stime,ktime_t *etime, -const struct drm_display_mode *mode) +bool vc4_crtc_get_scanoutpos (struct drm_device *dev,unsigned int crtc_id, +bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode) {struct vc4_dev *vc4 =to_vc4_dev (dev);struct drm_crtc *crtc =drm_crtc_from_index (dev, crtc_id);
@@ -162,7 +162,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,u32 val;int fifo_lines;int vblank_lines; -int ret =0 ; +bool ret = false;/* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */
@@ -198,7 +198,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, fifo_lines = vc4_crtc->cob_size / mode->crtc_hdisplay;if (fifo_lines >0 ) - ret |=DRM_SCANOUTPOS_VALID ; + ret = true;/* HVS more than fifo_lines into frame for compositing? */ if (*vpos > fifo_lines) {
@@ -216,7 +216,6 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,*/ *vpos -= fifo_lines +1 ; - ret |=DRM_SCANOUTPOS_ACCURATE ;return ret; }
@@ -229,10 +228,9 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,* We can't get meaningful readings wrt. scanline position of the PV * and need to make things up in a approximative but consistent way. */ - ret |=DRM_SCANOUTPOS_IN_VBLANK ; vblank_lines = mode->vtotal - mode->vdisplay; -if (flags &DRM_CALLED_FROM_VBLIRQ ) { +if (in_vblank_irq) {/* * Assume the irq handler got called close to first * line of vblank, so PV has about a full vblank
@@ -254,9 +252,10 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,* we are at the very beginning of vblank, as the hvs just * started refilling, and the stime and etime timestamps * truly correspond to start of vblank. +* +* Unfortunately there's no way to report this to upper levels +* and make it more useful. */ -if ((val &SCALER_DISPSTATX_FULL ) !=SCALER_DISPSTATX_FULL ) - ret |=DRM_SCANOUTPOS_ACCURATE ; }else {/* * No clue where we are inside vblank. Return a vpos of zero,
drivers/gpu/drm/vc4/vc4_drv.h +4 -4
@@ -446,10 +446,10 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *arg);extern struct platform_driver vc4_crtc_driver;bool vc4_event_pending (struct drm_crtc *crtc);int vc4_crtc_debugfs_regs (struct seq_file *m,void *arg); -int vc4_crtc_get_scanoutpos (struct drm_device *dev,unsigned int crtc_id, -unsigned int flags,int *vpos,int *hpos, -ktime_t *stime,ktime_t *etime, -const struct drm_display_mode *mode); +bool vc4_crtc_get_scanoutpos (struct drm_device *dev,unsigned int crtc_id, +bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode);/* vc4_debugfs.c */ int vc4_debugfs_init (struct drm_minor *minor);
include/drm/drmP.h +0 -8
@@ -321,14 +321,6 @@ struct pci_controller;#define DRM_IF_VERSION (maj, min) (maj << 16 | min) -/* Flags and return codes for get_vblank_timestamp() driver function. */ -#define DRM_CALLED_FROM_VBLIRQ 1 - -/* get_scanout_position() return flags */ -#define DRM_SCANOUTPOS_VALID (1 << 0) -#define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) -#define DRM_SCANOUTPOS_ACCURATE (1 << 2) -/** * DRM device structure. This structure represent a complete card that * may contain multiple heads.
include/drm/drm_drv.h +10 -16
@@ -241,8 +241,10 @@ struct drm_driver {* DRM device. * pipe: * Id of the crtc to query. -* flags: -* Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0). +* in_vblank_irq: +* True when called from drm_crtc_handle_vblank(). Some drivers +* need to apply some workarounds for gpu-specific vblank irq quirks +* if flag is set. * vpos: * Target location for current vertical scanout position. * hpos:
@@ -263,16 +265,8 @@ struct drm_driver {* * Returns: * -* Flags, or'ed together as follows: -* -* DRM_SCANOUTPOS_VALID: -* Query successful. -* DRM_SCANOUTPOS_INVBL: -* Inside vblank. -* DRM_SCANOUTPOS_ACCURATE: Returned position is accurate. A lack of -* this flag means that returned position may be offset by a -* constant but unknown small number of scanlines wrt. real scanout -* position. +* True on success, false if a reliable scanout position counter could +* not be read out. * * FIXME: *
@@ -280,10 +274,10 @@ struct drm_driver {* move it to &struct drm_crtc_helper_funcs, like all the other * helper-internal hooks. */ -int (*get_scanout_position) (struct drm_device *dev,unsigned int pipe, -unsigned int flags,int *vpos,int *hpos, -ktime_t *stime,ktime_t *etime, -const struct drm_display_mode *mode); +bool (*get_scanout_position) (struct drm_device *dev,unsigned int pipe, +bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode);/** * @get_vblank_timestamp:
Signature · 6 lines
2.11.0 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [PATCH 09/11] drm/vblank: Simplify the get_scanout_position helper hook
Quoted 47 lines · Daniel Vetter
- We can drop the different return value flags, the only caller only cares about whether the scanout position is valid or not. Also, it's entirely undefined what "accurate" means, if we'd really care we should probably wire the
max_errorthrough. But since we never even report this to userspace it's kinda moot.- Drop all the fancy input flags, there's really only the "called from vblank irq" one. Well except for radeon/amdgpu, which added their own private flags.
Since amdgpu/radoen also use the scanoutposition function internally I just gave them a tiny wrapper, plus copies of all the old #defines they need. Everyone else gets simplified code.
Note how we could remove a lot of error conditions if we'd move this helper hook to
drm_crtc_helper_funcsand would pass it a crtc directly.v2: Make it compile on arm.
v3: Squash in fixup from 0day.
Cc Mario Kleiner <[email protected]>Cc Eric Anholt <[email protected]>Cc Rob Clark <[email protected]>Cc Alex Deucher <[email protected]>Cc Christian König <[email protected]>Cc Ben Skeggs <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 3 +++ drivers/gpu/drm/drm_irq.c | 16 ++++++++-------- drivers/gpu/drm/i915/i915_irq.c | 19 ++++++------------- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 19 +++++++------------ drivers/gpu/drm/nouveau/nouveau_display.c | 18 ++++++++---------- drivers/gpu/drm/nouveau/nouveau_display.h | 6 +++--- drivers/gpu/drm/radeon/radeon_drv.c | 12 +++++++++++- drivers/gpu/drm/radeon/radeon_mode.h | 3 +++ drivers/gpu/drm/vc4/vc4_crtc.c | 21 ++++++++++----------- drivers/gpu/drm/vc4/vc4_drv.h | 8 ++++---- include/drm/drmP.h | 8 -------- include/drm/drm_drv.h | 26 ++++++++++---------------- 13 files changed, 84 insertions(+), 87 deletions(-)
[...]
Quoted 46 lines
drivers/gpu/drm/vc4/vc4_crtc.c +6
-7@@ -151,10 +151,10 @@ int vc4_crtc_debugfs_regs(struct seq_file *m, void *unused) }#endif -int vc4_crtc_get_scanoutpos (struct drm_device *dev,unsigned int crtc_id, -unsigned int flags,int *vpos,int *hpos, -ktime_t *stime,ktime_t *etime, -const struct drm_display_mode *mode) +bool vc4_crtc_get_scanoutpos (struct drm_device *dev,unsigned int crtc_id, +bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode) {struct vc4_dev *vc4 =to_vc4_dev (dev);struct drm_crtc *crtc =drm_crtc_from_index (dev, crtc_id);@@ -162,7 +162,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,u32 val;int fifo_lines;int vblank_lines; -int ret =0 ; +bool ret = false;/* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */ @@ -198,7 +198,7 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, fifo_lines = vc4_crtc->cob_size / mode->crtc_hdisplay;if (fifo_lines >0 ) - ret |=DRM_SCANOUTPOS_VALID ; + ret = true;/* HVS more than fifo_lines into frame for compositing? */ if (*vpos > fifo_lines) {@@ -216,7 +216,6 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,*/ *vpos -= fifo_lines +1 ; - ret |=DRM_SCANOUTPOS_ACCURATE ;return ret; }
drivers/gpu/drm/vc4/vc4_crtc.c int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, · line 233
Quoted 8 lines
drivers/gpu/drm/vc4/vc4_crtc.c +1
-2@@ -229,10 +228,9 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,* We can't get meaningful readings wrt. scanline position of the PV * and need to make things up in a approximative but consistent way. */ - ret |=DRM_SCANOUTPOS_IN_VBLANK ; vblank_lines = mode->vtotal - mode->vdisplay; -if (flags &DRM_CALLED_FROM_VBLIRQ ) { +if (in_vblank_irq) {
Shouldn't this go in patch 06/11 ?
Quoted 59 lines
drivers/gpu/drm/vc4/vc4_crtc.c +3
-2/* * Assume the irq handler got called close to first * line of vblank, so PV has about a full vblank @@ -254,9 +252,10 @@ int vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,* we are at the very beginning of vblank, as the hvs just * started refilling, and the stime and etime timestamps * truly correspond to start of vblank. +* +* Unfortunately there's no way to report this to upper levels +* and make it more useful. */ -if ((val &SCALER_DISPSTATX_FULL ) !=SCALER_DISPSTATX_FULL ) - ret |=DRM_SCANOUTPOS_ACCURATE ; }else {/* * No clue where we are inside vblank. Return a vpos of zero, drivers/gpu/drm/vc4/vc4_drv.h +4
-4@@ -446,10 +446,10 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *arg);extern struct platform_driver vc4_crtc_driver;bool vc4_event_pending (struct drm_crtc *crtc);int vc4_crtc_debugfs_regs (struct seq_file *m,void *arg); -int vc4_crtc_get_scanoutpos (struct drm_device *dev,unsigned int crtc_id, -unsigned int flags,int *vpos,int *hpos, -ktime_t *stime,ktime_t *etime, -const struct drm_display_mode *mode); +bool vc4_crtc_get_scanoutpos (struct drm_device *dev,unsigned int crtc_id, +bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode);/* vc4_debugfs.c */ int vc4_debugfs_init (struct drm_minor *minor);include/drm/drmP.h +0
-8@@ -321,14 +321,6 @@ struct pci_controller;#define DRM_IF_VERSION (maj, min) (maj << 16 | min) -/* Flags and return codes for get_vblank_timestamp() driver function. */ -#define DRM_CALLED_FROM_VBLIRQ 1 - -/* get_scanout_position() return flags */ -#define DRM_SCANOUTPOS_VALID (1 << 0) -#define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) -#define DRM_SCANOUTPOS_ACCURATE (1 << 2) -/** * DRM device structure. This structure represent a complete card that * may contain multiple heads. include/drm/drm_drv.h +0
-0
include/drm/drm_drv.h struct drm_driver { · line 247
Quoted 9 lines
include/drm/drm_drv.h +4
-2@@ -241,8 +241,10 @@ struct drm_driver {* DRM device. * pipe: * Id of the crtc to query. -* flags: -* Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0). +* in_vblank_irq: +* True when called from drm_crtc_handle_vblank(). Some drivers +* need to apply some workarounds for gpu-specific vblank irq quirks +* if flag is set.
Same here, should be in 06/11 ?
Quoted 28 lines
include/drm/drm_drv.h +2
-11* vpos: * Target location for current vertical scanout position. * hpos: @@ -263,16 +265,8 @@ struct drm_driver {* * Returns: * -* Flags, or'ed together as follows: -* -* DRM_SCANOUTPOS_VALID: -* Query successful. -* DRM_SCANOUTPOS_INVBL: -* Inside vblank. -* DRM_SCANOUTPOS_ACCURATE: Returned position is accurate. A lack of -* this flag means that returned position may be offset by a -* constant but unknown small number of scanlines wrt. real scanout -* position. +* True on success, false if a reliable scanout position counter could +* not be read out. * * FIXME: * @@ -280,10 +274,10 @@ struct drm_driver {* move it to &struct drm_crtc_helper_funcs, like all the other * helper-internal hooks. */ - int (*get_scanout_position) (struct drm_device *dev, unsigned int pipe,
include/drm/drm_drv.h struct drm_driver { · line 283
Quoted 10 lines
include/drm/drm_drv.h +4
-3- unsigned int flags, int *vpos, int *hpos, - ktime_t *stime, ktime_t *etime, - const struct drm_display_mode *mode); +bool (*get_scanout_position) (struct drm_device *dev,unsigned int pipe, +bool in_vblank_irq,int *vpos,int *hpos, +ktime_t *stime,ktime_t *etime, +const struct drm_display_mode *mode);/** * @get_vblank_timestamp:
PATCH 7/11 drm/vblank: Add FIXME comments about moving the vblank ts hooks
In reply to Daniel VetterThis is going to be a bit too much, but good to have at least a small note about where this should all head towards.
--- include/drm/drm_drv.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
include/drm/drm_drv.h +10 -0
@@ -274,6 +274,11 @@ struct drm_driver {* constant but unknown small number of scanlines wrt. real scanout * position. * +* FIXME: +* +* Since this is a helper to implement @get_vblank_timestamp, we should +* move it to &struct drm_crtc_helper_funcs, like all the other +* helper-internal hooks. */ int (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, unsigned int flags, int *vpos, int *hpos,
@@ -317,6 +322,11 @@ struct drm_driver {* * True on success, false on failure, which means the core should * fallback to a simple timestamp taken in drm_crtc_handle_vblank(). +* +* FIXME: +* +* We should move this hook to &struct drm_crtc_funcs like all the other +* vblank hooks. */ bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, int *max_error,
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 07/11] drm/vblank: Add FIXME comments about moving the vblank ts hooks
Quoted 27 lines · Daniel Vetter
This is going to be a bit too much, but good to have at least a small note about where this should all head towards.
Signed-off-by Daniel Vetter <[email protected]>--- include/drm/drm_drv.h | 10 ++++++++++ 1 file changed, 10 insertions(+)include/drm/drm_drv.h +5
-0@@ -274,6 +274,11 @@ struct drm_driver {* constant but unknown small number of scanlines wrt. real scanout * position. * +* FIXME: +* +* Since this is a helper to implement @get_vblank_timestamp, we should +* move it to &struct drm_crtc_helper_funcs, like all the other +* helper-internal hooks. */ int (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, unsigned int flags, int *vpos, int *hpos,@@ -317,6 +322,11 @@ struct drm_driver {*
include/drm/drm_drv.h struct drm_driver { · line 332
Quoted 10 lines
include/drm/drm_drv.h +5
-0* True on success, false on failure, which means the core should * fallback to a simple timestamp taken in drm_crtc_handle_vblank(). +* +* FIXME: +* +* We should move this hook to &struct drm_crtc_funcs like all the other +* vblank hooks. */ bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, int *max_error,
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/11 drm/vblank: Lock down vblank->hwmode more
In reply to Daniel VetterIn the previous patch we've implemented hwmode tracking a la i915 for the vblank timestamp calculations. But that was just the basic semantics, i915 has some nice sanity checks to make sure we keep getting this right. Move them over too.
--- drivers/gpu/drm/drm_irq.c | 8 +++++++- drivers/gpu/drm/i915/i915_irq.c | 10 ++++++---- drivers/gpu/drm/i915/intel_display.c | 11 ++--------- 3 files changed, 15 insertions(+), 14 deletions(-)
drivers/gpu/drm/drm_irq.c +7 -1
@@ -775,8 +775,10 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,/* If mode timing undefined, just return as no-op: * Happens during initial modesetting of a crtc. */ -if (mode->crtc_clock ==0 ) { +if (WARN_ON (mode->crtc_clock ==0 )) {DRM_DEBUG ("crtc %u: Noop due to uninitialized mode.\n" , pipe); +WARN_ON (drm_drv_uses_atomic_modeset (dev)); +return false; }
@@ -1336,6 +1338,10 @@ void drm_crtc_vblank_off(struct drm_crtc *crtc)send_vblank_event (dev, e, seq, &now); }spin_unlock_irqrestore (&dev->event_lock, irqflags); + +/* Will be reset by the modeset helpers when re-enabling the crtc by +* calling drm_calc_timestamping_constants(). */ + vblank->hwmode.crtc_clock =0 ; }EXPORT_SYMBOL (drm_crtc_vblank_off);
drivers/gpu/drm/i915/i915_irq.c +6 -4
@@ -720,9 +720,7 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)struct drm_i915_private *dev_priv =to_i915 (dev);i915_reg_t high_frame, low_frame;u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal; -struct intel_crtc *intel_crtc =intel_get_crtc_for_pipe (dev_priv, - pipe); -const struct drm_display_mode *mode = &intel_crtc->base.hwmode; +const struct drm_display_mode *mode = &dev->vblank[pipe].hwmode;unsigned long irqflags; htotal = mode->crtc_htotal;
@@ -779,13 +777,17 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc) {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -const struct drm_display_mode *mode = &crtc->base.hwmode; +const struct drm_display_mode *mode; +struct drm_vblank_crtc *vblank;enum pipe pipe = crtc->pipe;int position, vtotal;if (!crtc->active)return -1 ; + vblank = &crtc->base.dev->vblank[drm_crtc_index (&crtc->base)]; + mode = &vblank->hwmode; + vtotal = mode->crtc_vtotal;if (mode->flags &DRM_MODE_FLAG_INTERLACE ) vtotal /=2 ;
drivers/gpu/drm/i915/intel_display.c +2 -9
@@ -11461,12 +11461,6 @@ intel_modeset_update_crtc_state(struct drm_atomic_state *state)for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {to_intel_crtc (crtc)->config =to_intel_crtc_state (new_crtc_state); -/* Update hwmode for vblank functions */ -if (new_crtc_state->active) - crtc->hwmode = new_crtc_state->adjusted_mode; -else - crtc->hwmode.crtc_clock =0 ; -/* * Update legacy state to satisfy fbc code. This can * be removed when fbc uses the atomic state.
@@ -15471,8 +15465,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)to_intel_crtc_state (crtc->base.state);int pixclk =0 ; - crtc->base.hwmode = crtc_state->base.adjusted_mode; -memset (&crtc->base.mode,0 ,sizeof (crtc->base.mode));if (crtc_state->base.active) {intel_mode_from_pipe_config (&crtc->base.mode, crtc_state);
@@ -15502,7 +15494,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)if (IS_BROADWELL (dev_priv) && crtc_state->ips_enabled) pixclk =DIV_ROUND_UP (pixclk *100 ,95 ); -drm_calc_timestamping_constants (&crtc->base, &crtc->base.hwmode); +drm_calc_timestamping_constants (&crtc->base, + &crtc_state->base.adjusted_mode);update_scanline_offset (crtc); }
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/11] drm/vblank: Lock down vblank->hwmode more
Quoted 102 lines · Daniel Vetter
In the previous patch we've implemented hwmode tracking a la i915 for the vblank timestamp calculations. But that was just the basic semantics, i915 has some nice sanity checks to make sure we keep getting this right. Move them over too.
Cc Ville Syrjälä <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_irq.c | 8 +++++++- drivers/gpu/drm/i915/i915_irq.c | 10 ++++++---- drivers/gpu/drm/i915/intel_display.c | 11 ++--------- 3 files changed, 15 insertions(+), 14 deletions(-)drivers/gpu/drm/drm_irq.c +7
-1@@ -775,8 +775,10 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,/* If mode timing undefined, just return as no-op: * Happens during initial modesetting of a crtc. */ -if (mode->crtc_clock ==0 ) { +if (WARN_ON (mode->crtc_clock ==0 )) {DRM_DEBUG ("crtc %u: Noop due to uninitialized mode.\n" , pipe); +WARN_ON (drm_drv_uses_atomic_modeset (dev)); +return false; }@@ -1336,6 +1338,10 @@ void drm_crtc_vblank_off(struct drm_crtc *crtc)send_vblank_event (dev, e, seq, &now); }spin_unlock_irqrestore (&dev->event_lock, irqflags); + +/* Will be reset by the modeset helpers when re-enabling the crtc by +* calling drm_calc_timestamping_constants(). */ + vblank->hwmode.crtc_clock =0 ; }EXPORT_SYMBOL (drm_crtc_vblank_off);drivers/gpu/drm/i915/i915_irq.c +6
-4@@ -720,9 +720,7 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)struct drm_i915_private *dev_priv =to_i915 (dev);i915_reg_t high_frame, low_frame;u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal; -struct intel_crtc *intel_crtc =intel_get_crtc_for_pipe (dev_priv, - pipe); -const struct drm_display_mode *mode = &intel_crtc->base.hwmode; +const struct drm_display_mode *mode = &dev->vblank[pipe].hwmode;unsigned long irqflags; htotal = mode->crtc_htotal;@@ -779,13 +777,17 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc) {struct drm_device *dev = crtc->base.dev;struct drm_i915_private *dev_priv =to_i915 (dev); -const struct drm_display_mode *mode = &crtc->base.hwmode; +const struct drm_display_mode *mode; +struct drm_vblank_crtc *vblank;enum pipe pipe = crtc->pipe;int position, vtotal;if (!crtc->active)return -1 ; + vblank = &crtc->base.dev->vblank[drm_crtc_index (&crtc->base)]; + mode = &vblank->hwmode; + vtotal = mode->crtc_vtotal;if (mode->flags &DRM_MODE_FLAG_INTERLACE ) vtotal /=2 ;drivers/gpu/drm/i915/intel_display.c +0
-8@@ -11461,12 +11461,6 @@ intel_modeset_update_crtc_state(struct drm_atomic_state *state)for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {to_intel_crtc (crtc)->config =to_intel_crtc_state (new_crtc_state); -/* Update hwmode for vblank functions */ -if (new_crtc_state->active) - crtc->hwmode = new_crtc_state->adjusted_mode; -else - crtc->hwmode.crtc_clock =0 ; -/* * Update legacy state to satisfy fbc code. This can * be removed when fbc uses the atomic state. @@ -15471,8 +15465,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)to_intel_crtc_state (crtc->base.state);int pixclk =0 ; - crtc->base.hwmode = crtc_state->base.adjusted_mode; -memset (&crtc->base.mode,0 ,sizeof (crtc->base.mode));if (crtc_state->base.active) {intel_mode_from_pipe_config (&crtc->base.mode, crtc_state);
drivers/gpu/drm/i915/intel_display.c static void intel_modeset_readout_hw_state(struct drm_device *dev) · line 15501
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +2
-1@@ -15502,7 +15494,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)if (IS_BROADWELL (dev_priv) && crtc_state->ips_enabled) pixclk =DIV_ROUND_UP (pixclk *100 ,95 ); -drm_calc_timestamping_constants (&crtc->base, &crtc->base.hwmode); +drm_calc_timestamping_constants (&crtc->base, + &crtc_state->base.adjusted_mode);update_scanline_offset (crtc); }
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/11 drm/doc: Small markup fixup
In reply to Daniel VetterDrive-by cleanup.
--- drivers/gpu/drm/drm_probe_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_probe_helper.c +1 -1
@@ -44,7 +44,7 @@* * This library provides some helper code for output probing. It provides an * implementation of the core &drm_connector_funcs.fill_modes interface with -* drm_helper_probe_single_connector_modes. +* drm_helper_probe_single_connector_modes(). * * It also provides support for polling connectors with a work item and for * generic hotplug interrupt handling where the driver doesn't or cannot keep
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 11/11] drm/doc: Small markup fixup
Quoted 13 lines · Daniel Vetter
Drive-by cleanup.
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_probe_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_probe_helper.c +0
-0
drivers/gpu/drm/drm_probe_helper.c line 50
Quoted 8 lines
drivers/gpu/drm/drm_probe_helper.c +1
-1@@ -44,7 +44,7 @@* * This library provides some helper code for output probing. It provides an * implementation of the core &drm_connector_funcs.fill_modes interface with -* drm_helper_probe_single_connector_modes. +* drm_helper_probe_single_connector_modes(). * * It also provides support for polling connectors with a work item and for * generic hotplug interrupt handling where the driver doesn't or cannot keep
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter
AppliedRe: [PATCH 11/11] drm/doc: Small markup fixup
Quoted 8 lines · Neil Armstrong
Quoted 7 lines · Daniel Vetter
Drive-by cleanup.
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_probe_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 6 lines
drivers/gpu/drm/drm_probe_helper.c +0
-0drivers/gpu/drm/drm_probe_helper.c line 50
Quoted 8 lines
drivers/gpu/drm/drm_probe_helper.c +1
-1@@ -44,7 +44,7 @@* * This library provides some helper code for output probing. It provides an * implementation of the core &drm_connector_funcs.fill_modes interface with -* drm_helper_probe_single_connector_modes. +* drm_helper_probe_single_connector_modes(). * * It also provides support for polling connectors with a work item and for * generic hotplug interrupt handling where the driver doesn't or cannot keep Reviewed-by Neil Armstrong <[email protected]>
I merged the non-vblank patches to drm-misc, thanks a lot for your review. For the vblank patches I'd like to get some additional review from Ville/Chris or Mauro, will take all your feedback in on the next round.
Thanks, Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [01/11] drm: update todo.rst
In reply to Daniel Vetter== Series Details ==
== Series Details ==
Series: series starting with [01/11] drm: update todo.rst
URL : https://patchwork.freedesktop.org/series/22416/
State : success
== Summary ==
Series 22416v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/22416/revisions/1/mbox/
Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
fail -> PASS (fi-snb-2600) fdo#100007
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
fail -> PASS (fi-snb-2600)fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time: 429s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time: 429s fi-bsw-n3050 total:278 pass:239 dwarn:0 dfail:0 fail:0 skip:39 time: 578s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time: 510s fi-bxt-t5700 total:278 pass:258 dwarn:0 dfail:0 fail:0 skip:20 time: 547s fi-byt-j1900 total:278 pass:251 dwarn:0 dfail:0 fail:0 skip:27 time: 491s fi-byt-n2820 total:278 pass:247 dwarn:0 dfail:0 fail:0 skip:31 time: 480s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 410s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 409s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time: 419s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 495s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 470s fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 461s fi-kbl-7560u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 568s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 449s fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time: 568s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time: 464s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 495s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time: 433s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time: 532s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time: 402s
abec0508865ae60a2bb30ca3ba5ca2c4ac49afc5 drm-tip: 2017y-04m-04d-08h-52m-39s UTC integration manifest b5be21f drm/doc: Small markup fixup
5c9a503 drm/vblank: Lock down vblank->hwmode more
3a4ff8c drm/vblank: Simplify the get_scanout_position helper hook
a5c47cc drm/vblank: drop the mode argument from drm_calc_vbltimestamp_from_scanoutpos f5a5684 drm/vblank: Add FIXME comments about moving the vblank ts hooks
b1d1c26 drm/vblank: Switch to bool in_vblank_irq in get_vblank_timestamp
438e065 drm/vblank: Switch drm_driver->get_vblank_timestamp to return a bool
34f0357 drm: document drm_ioctl.[hc]
b0d3172 drm: Extract drm_ioctl.h
5fad68c drm: Consolidate and document sysfs support
90b0b70 drm: update todo.rst
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4388/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 73 lines · Daniel Vetter
Just drive-by, but we have gsoc running so better to update it now.
Great news is that two entries can be removed because essentially all done.
v2: Keep a bunch of the todos, Gabriel is working on them.
Cc Gabriel Krisman Bertazi <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- Documentation/gpu/todo.rst | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-)Documentation/gpu/todo.rst +4
-17@@ -16,7 +16,7 @@ De-midlayer drivers With the recent ``drm_bus`` cleanup patches for 3.17 it is no longer required to have a ``drm_bus`` structure set up. Drivers can directly set up the ``drm_device`` structure instead of relying on bus methods in ``drm_usb.c`` -and ``drm_platform.c``. The goal is to get rid of the driver's ``->load`` / +and ``drm_pci.c``. The goal is to get rid of the driver's ``->load`` / ``->unload`` callbacks and open-code the load/unload sequence properly, using the new two-stage ``drm_device`` setup/teardown.@@ -175,7 +175,7 @@ fine-grained per-buffer object and per-context lockings scheme. Currently the following drivers still use ``struct_mutex``: ``msm``, ``omapdrm`` and ``udl``. -Contact: Daniel Vetter +Contact: Daniel Vetter, respective driver maintainers Switch to drm_connector_list_iter for any connector_list walking ----------------------------------------------------------------@@ -217,6 +217,8 @@ plan is to switch to per-file driver API headers, which will also structure the kerneldoc better. This should also allow more fine-grained ``#include`` directives. +In the end no .c file should need to include ``drmP.h`` anymore. + Contact: Daniel Vetter Add missing kerneldoc for exported functions@@ -244,13 +246,8 @@ be hidden so that driver writers don't accidentally end up using it. And to prevent security issues in those legacy IOCTLs from being exploited on modern drivers. This has multiple possible subtasks: -* Make sure legacy IOCTLs can't be used on modern drivers. * Extract support code for legacy features into a ``drm-legacy.ko`` kernel module and compile it only when one of the legacy drivers is enabled. -* Extract legacy functions into their own headers and remove it that from the - monolithic ``drmP.h`` header. -* Remove any lingering cruft from the OS abstraction layer from modern - drivers. This is mostly done, the only thing left is to split up ``drm_irq.c`` into legacy cruft and the parts needed by modern KMS drivers.@@ -408,23 +405,3 @@ Contact: Noralf Trønnes, Daniel Vetter Outside DRM =========== - -Better kerneldoc ----------------- - -This is pretty much done, but there's some advanced topics: - -Come up with a way to hyperlink to struct members. Currently you can hyperlink -to the struct using ``#struct_name``, but not to a member within. Would need -buy-in from kerneldoc maintainers, and the big question is how to make it work -without totally unsightly
Documentation/gpu/todo.rst Contact: Noralf Trønnes, Daniel Vetter · line 430
Quoted 10 lines
Documentation/gpu/todo.rst +0
-10-``drm_foo_bar_really_long_structure->even_longer_memeber`` all over the text -which breaks text flow. - -Figure out how to integrate the asciidoc support for ascii-diagrams. We have a -few of those (e.g. to describe mode timings), and asciidoc supports converting -some ascii-art dialect into pngs. Would be really pretty to make that work. - -Contact: Daniel Vetter, Jani Nikula - -Jani is working on this already, hopefully lands in 4.8.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx