Merge tag 'drm-misc-next-2017-04-07' of git://anongit.freedesktop.org/git/drm-misc into drm-next

Last drm-misc-next pull req for 4.12

Core changes:
 - fb_helper checkpatch cleanup and simplified _add_one_connector() (Thierry)
 - drm_ioctl and drm_sysfs improved/gained documentation (Daniel)
 - [ABI] Repurpose reserved field in drm_event_vblank for crtc_id (Ander)
 - Plumb acquire ctx through legacy paths to avoid lock_all and legacy_backoff
   (Daniel)
 - Add connector_atomic_check to check conn constraints on modeset (Maarten)
 - Add drm_of_find_panel_or_bridge to remove boilerplate in drivers (Rob)

Driver changes:
 - meson moved to drm-misc (Neil)
 - Added support for Amlogic GX SoCs in dw-hdmi (Neil)
 - Rockchip unbind actually cleans up the things bind initializes (Jeffy)
 - A couple misc fixes in virtio, dw-hdmi

NOTE: this also includes a backmerge of drm-next as well rc5 (we needed vmwgfx
      as well as the new synopsys media formats)

* tag 'drm-misc-next-2017-04-07' of git://anongit.freedesktop.org/git/drm-misc: (77 commits)
  Revert "drm: Don't allow interruptions when opening debugfs/crc"
  drm: Only take cursor locks when the cursor plane exists
  drm/vmwgfx: Fix fbdev emulation using legacy functions
  drm/rockchip: Shutdown all crtcs when unbinding drm
  drm/rockchip: Reorder drm bind/unbind sequence
  drm/rockchip: analogix_dp: Disable clock when unbinding
  drm/rockchip: vop: Unprepare clocks when unbinding
  drm/rockchip: vop: Enable pm domain before vop_initial
  drm/rockchip: cdn-dp: Don't unregister audio dev when unbinding
  drm/rockchip: cdn-dp: Don't try to release firmware when not loaded
  drm: bridge: analogix: Destroy connector & encoder when unbinding
  drm: bridge: analogix: Disable clock when unbinding
  drm: bridge: analogix: Unregister dp aux when unbinding
  drm: bridge: analogix: Detach panel when unbinding analogix dp
  drm: Don't allow interruptions when opening debugfs/crc
  drm/virtio: don't leak bo on drm_gem_object_init failure
  drm: bridge: dw-hdmi: fix input format/encoding from plat_data
  drm: omap: use common OF graph helpers
  drm: convert drivers to use drm_of_find_panel_or_bridge
  drm: convert drivers to use of_graph_get_remote_node
  ...
This commit is contained in:
Dave Airlie
2017-04-11 07:41:10 +10:00
133개의 변경된 파일6064개의 추가작업 그리고 1997개의 파일을 삭제

파일 보기

@@ -14,6 +14,67 @@
struct dw_hdmi;
/**
* DOC: Supported input formats and encodings
*
* Depending on the Hardware configuration of the Controller IP, it supports
* a subset of the following input formats and encodings on its internal
* 48bit bus.
*
* +----------------------+----------------------------------+------------------------------+
* + Format Name + Format Code + Encodings +
* +----------------------+----------------------------------+------------------------------+
* + RGB 4:4:4 8bit + ``MEDIA_BUS_FMT_RGB888_1X24`` + ``V4L2_YCBCR_ENC_DEFAULT`` +
* +----------------------+----------------------------------+------------------------------+
* + RGB 4:4:4 10bits + ``MEDIA_BUS_FMT_RGB101010_1X30`` + ``V4L2_YCBCR_ENC_DEFAULT`` +
* +----------------------+----------------------------------+------------------------------+
* + RGB 4:4:4 12bits + ``MEDIA_BUS_FMT_RGB121212_1X36`` + ``V4L2_YCBCR_ENC_DEFAULT`` +
* +----------------------+----------------------------------+------------------------------+
* + RGB 4:4:4 16bits + ``MEDIA_BUS_FMT_RGB161616_1X48`` + ``V4L2_YCBCR_ENC_DEFAULT`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:4:4 8bit + ``MEDIA_BUS_FMT_YUV8_1X24`` + ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* + + + or ``V4L2_YCBCR_ENC_XV601`` +
* + + + or ``V4L2_YCBCR_ENC_XV709`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:4:4 10bits + ``MEDIA_BUS_FMT_YUV10_1X30`` + ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* + + + or ``V4L2_YCBCR_ENC_XV601`` +
* + + + or ``V4L2_YCBCR_ENC_XV709`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:4:4 12bits + ``MEDIA_BUS_FMT_YUV12_1X36`` + ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* + + + or ``V4L2_YCBCR_ENC_XV601`` +
* + + + or ``V4L2_YCBCR_ENC_XV709`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:4:4 16bits + ``MEDIA_BUS_FMT_YUV16_1X48`` + ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* + + + or ``V4L2_YCBCR_ENC_XV601`` +
* + + + or ``V4L2_YCBCR_ENC_XV709`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:2:2 8bit + ``MEDIA_BUS_FMT_UYVY8_1X16`` + ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:2:2 10bits + ``MEDIA_BUS_FMT_UYVY10_1X20`` + ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:2:2 12bits + ``MEDIA_BUS_FMT_UYVY12_1X24`` + ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:2:0 8bit + ``MEDIA_BUS_FMT_UYYVYY8_0_5X24`` + ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:2:0 10bits + ``MEDIA_BUS_FMT_UYYVYY10_0_5X30``+ ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:2:0 12bits + ``MEDIA_BUS_FMT_UYYVYY12_0_5X36``+ ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* +----------------------+----------------------------------+------------------------------+
* + YCbCr 4:2:0 16bits + ``MEDIA_BUS_FMT_UYYVYY16_0_5X48``+ ``V4L2_YCBCR_ENC_601`` +
* + + + or ``V4L2_YCBCR_ENC_709`` +
* +----------------------+----------------------------------+------------------------------+
*/
enum {
DW_HDMI_RES_8,
DW_HDMI_RES_10,
@@ -56,12 +117,17 @@ struct dw_hdmi_phy_ops {
struct drm_display_mode *mode);
void (*disable)(struct dw_hdmi *hdmi, void *data);
enum drm_connector_status (*read_hpd)(struct dw_hdmi *hdmi, void *data);
void (*update_hpd)(struct dw_hdmi *hdmi, void *data,
bool force, bool disabled, bool rxsense);
void (*setup_hpd)(struct dw_hdmi *hdmi, void *data);
};
struct dw_hdmi_plat_data {
struct regmap *regm;
enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
struct drm_display_mode *mode);
unsigned long input_bus_format;
unsigned long input_bus_encoding;
/* Vendor PHY support */
const struct dw_hdmi_phy_ops *phy_ops;
@@ -84,6 +150,8 @@ void dw_hdmi_unbind(struct device *dev);
int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder,
const struct dw_hdmi_plat_data *plat_data);
void dw_hdmi_setup_rx_sense(struct device *dev, bool hpd, bool rx_sense);
void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate);
void dw_hdmi_audio_enable(struct dw_hdmi *hdmi);
void dw_hdmi_audio_disable(struct dw_hdmi *hdmi);

파일 보기

@@ -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 */

파일 보기

@@ -160,7 +160,6 @@ struct __drm_connnectors_state {
* @dev: parent DRM device
* @allow_modeset: allow full modeset
* @legacy_cursor_update: hint to enforce legacy cursor IOCTL semantics
* @legacy_set_config: Disable conflicting encoders instead of failing with -EINVAL.
* @planes: pointer to array of structures with per-plane data
* @crtcs: pointer to array of CRTC pointers
* @num_connector: size of the @connectors and @connector_states arrays
@@ -173,7 +172,6 @@ struct drm_atomic_state {
struct drm_device *dev;
bool allow_modeset : 1;
bool legacy_cursor_update : 1;
bool legacy_set_config : 1;
struct __drm_planes_state *planes;
struct __drm_crtcs_state *crtcs;
int num_connector;

파일 보기

@@ -176,7 +176,8 @@ void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector,
struct drm_connector_state *state);
int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
u16 *red, u16 *green, u16 *blue,
uint32_t size);
uint32_t size,
struct drm_modeset_acquire_ctx *ctx);
/**
* drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC

파일 보기

@@ -32,6 +32,7 @@
struct drm_device;
struct drm_connector_helper_funcs;
struct drm_modeset_acquire_ctx;
struct drm_device;
struct drm_crtc;
struct drm_encoder;
@@ -382,6 +383,11 @@ struct drm_connector_funcs {
* the helper library vtable purely for historical reasons. The only DRM
* core entry point to probe connector state is @fill_modes.
*
* Note that the helper library will already hold
* &drm_mode_config.connection_mutex. Drivers which need to grab additional
* locks to avoid races with concurrent modeset changes need to use
* &drm_connector_helper_funcs.detect_ctx instead.
*
* RETURNS:
*
* drm_connector_status indicating the connector's status.

파일 보기

@@ -322,7 +322,8 @@ struct drm_crtc_funcs {
* hooks.
*/
int (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
uint32_t size);
uint32_t size,
struct drm_modeset_acquire_ctx *ctx);
/**
* @destroy:
@@ -782,15 +783,6 @@ struct drm_crtc {
*/
spinlock_t commit_lock;
/**
* @acquire_ctx:
*
* Per-CRTC implicit acquire context used by atomic drivers for legacy
* IOCTLs, so that atomic drivers can get at the locking acquire
* context.
*/
struct drm_modeset_acquire_ctx *acquire_ctx;
#ifdef CONFIG_DEBUG_FS
/**
* @debugfs_entry:

파일 보기

@@ -67,6 +67,9 @@ int drm_helper_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
int drm_helper_probe_single_connector_modes(struct drm_connector
*connector, uint32_t maxX,
uint32_t maxY);
int drm_helper_probe_detect(struct drm_connector *connector,
struct drm_modeset_acquire_ctx *ctx,
bool force);
void drm_kms_helper_poll_init(struct drm_device *dev);
void drm_kms_helper_poll_fini(struct drm_device *dev);
bool drm_helper_hpd_irq_event(struct drm_device *dev);

파일 보기

@@ -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
* @_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, \

파일 보기

@@ -747,12 +747,44 @@ struct drm_connector_helper_funcs {
* This callback is used by the probe helpers in e.g.
* drm_helper_probe_single_connector_modes().
*
* To avoid races with concurrent connector state updates, the helper
* libraries always call this with the &drm_mode_config.connection_mutex
* held. Because of this it's safe to inspect &drm_connector->state.
*
* RETURNS:
*
* The number of modes added by calling drm_mode_probed_add().
*/
int (*get_modes)(struct drm_connector *connector);
/**
* @detect_ctx:
*
* Check to see if anything is attached to the connector. The parameter
* force is set to false whilst polling, true when checking the
* connector due to a user request. force can be used by the driver to
* avoid expensive, destructive operations during automated probing.
*
* This callback is optional, if not implemented the connector will be
* considered as always being attached.
*
* This is the atomic version of &drm_connector_funcs.detect.
*
* To avoid races against concurrent connector state updates, the
* helper libraries always call this with ctx set to a valid context,
* and &drm_mode_config.connection_mutex will always be locked with
* the ctx parameter set to this ctx. This allows taking additional
* locks as required.
*
* RETURNS:
*
* &drm_connector_status indicating the connector's status,
* or the error code returned by drm_modeset_lock(), -EDEADLK.
*/
int (*detect_ctx)(struct drm_connector *connector,
struct drm_modeset_acquire_ctx *ctx,
bool force);
/**
* @mode_valid:
*
@@ -771,6 +803,10 @@ struct drm_connector_helper_funcs {
* CRTC helpers will not call this function. Drivers therefore must
* still fully validate any mode passed in in a modeset request.
*
* To avoid races with concurrent connector state updates, the helper
* libraries always call this with the &drm_mode_config.connection_mutex
* held. Because of this it's safe to inspect &drm_connector->state.
*
* RETURNS:
*
* Either &drm_mode_status.MODE_OK or one of the failure reasons in &enum
@@ -836,6 +872,40 @@ struct drm_connector_helper_funcs {
*/
struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector,
struct drm_connector_state *connector_state);
/**
* @atomic_check:
*
* This hook is used to validate connector state. This function is
* called from &drm_atomic_helper_check_modeset, and is called when
* a connector property is set, or a modeset on the crtc is forced.
*
* Because &drm_atomic_helper_check_modeset may be called multiple times,
* this function should handle being called multiple times as well.
*
* This function is also allowed to inspect any other object's state and
* can add more state objects to the atomic commit if needed. Care must
* be taken though to ensure that state check and compute functions for
* these added states are all called, and derived state in other objects
* all updated. Again the recommendation is to just call check helpers
* until a maximal configuration is reached.
*
* NOTE:
*
* This function is called in the check phase of an atomic update. The
* driver is not allowed to change anything outside of the free-standing
* state objects passed-in or assembled in the overall &drm_atomic_state
* update tracking structure.
*
* RETURNS:
*
* 0 on success, -EINVAL if the state or the transition can't be
* supported, -ENOMEM on memory allocation failure and -EDEADLK if an
* attempt to obtain another state object ran into a &drm_modeset_lock
* deadlock.
*/
int (*atomic_check)(struct drm_connector *connector,
struct drm_connector_state *state);
};
/**

파일 보기

@@ -121,12 +121,7 @@ struct drm_plane;
void drm_modeset_lock_all(struct drm_device *dev);
void drm_modeset_unlock_all(struct drm_device *dev);
void drm_modeset_lock_crtc(struct drm_crtc *crtc,
struct drm_plane *plane);
void drm_modeset_unlock_crtc(struct drm_crtc *crtc);
void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
struct drm_modeset_acquire_ctx *
drm_modeset_legacy_acquire_ctx(struct drm_crtc *crtc);
int drm_modeset_lock_all_ctx(struct drm_device *dev,
struct drm_modeset_acquire_ctx *ctx);

파일 보기

@@ -8,6 +8,8 @@ struct component_match;
struct device;
struct drm_device;
struct drm_encoder;
struct drm_panel;
struct drm_bridge;
struct device_node;
#ifdef CONFIG_OF
@@ -23,6 +25,10 @@ int drm_of_component_probe(struct device *dev,
int drm_of_encoder_active_endpoint(struct device_node *node,
struct drm_encoder *encoder,
struct of_endpoint *endpoint);
int drm_of_find_panel_or_bridge(const struct device_node *np,
int port, int endpoint,
struct drm_panel **panel,
struct drm_bridge **bridge);
#else
static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
struct device_node *port)
@@ -52,6 +58,13 @@ static inline int drm_of_encoder_active_endpoint(struct device_node *node,
{
return -EINVAL;
}
static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
int port, int endpoint,
struct drm_panel **panel,
struct drm_bridge **bridge)
{
return -EINVAL;
}
#endif
static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,

파일 보기

@@ -192,7 +192,7 @@ void drm_panel_remove(struct drm_panel *panel);
int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector);
int drm_panel_detach(struct drm_panel *panel);
#ifdef CONFIG_OF
#if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
struct drm_panel *of_drm_find_panel(const struct device_node *np);
#else
static inline struct drm_panel *of_drm_find_panel(const struct device_node *np)

파일 보기

@@ -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