diff options
| author | Alan Kwong <akwong@codeaurora.org> | 2016-10-21 20:51:17 -0400 |
|---|---|---|
| committer | Alan Kwong <akwong@codeaurora.org> | 2016-11-11 16:07:14 -0500 |
| commit | df86a7b92a14daf9d73e9ad2e4bfeac2ca329bdc (patch) | |
| tree | fb870caad45f33919d5278aa5dd389a63374eeb7 /drivers/gpu | |
| parent | 57e7b8e0a34af679d5a18a3eaeaef7eaf449b389 (diff) | |
drm/msm/sde: separate plane/encoder/crtc functions into headers
Currently, plane/encoder/crtc function prototypes reside in the
kms header. To improve code separation and reduce overlap changes,
separate plane/encoder/crtc functions from kms header into their
corresponding headers.
Change-Id: Id3a7098ada887538ac0635f381c553a516237e7a
Signed-off-by: Alan Kwong <akwong@codeaurora.org>
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_crtc.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_crtc.h | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_encoder.h | 93 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_encoder_phys.h | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_kms.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_kms.h | 139 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_plane.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_plane.h | 95 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_rm.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/sde/sde_wb.h | 1 |
10 files changed, 202 insertions, 140 deletions
diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.c b/drivers/gpu/drm/msm/sde/sde_crtc.c index a610f4b8d2a3..8766617415f1 100644 --- a/drivers/gpu/drm/msm/sde/sde_crtc.c +++ b/drivers/gpu/drm/msm/sde/sde_crtc.c @@ -24,7 +24,10 @@ #include "sde_hw_lm.h" #include "sde_hw_ctl.h" #include "sde_crtc.h" +#include "sde_plane.h" #include "sde_color_processing.h" +#include "sde_encoder.h" +#include "sde_connector.h" /* default input fence timeout, in ms */ #define SDE_CRTC_INPUT_FENCE_TIMEOUT 2000 diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.h b/drivers/gpu/drm/msm/sde/sde_crtc.h index c58bb097e8e6..995c26bb89ce 100644 --- a/drivers/gpu/drm/msm/sde/sde_crtc.h +++ b/drivers/gpu/drm/msm/sde/sde_crtc.h @@ -187,7 +187,7 @@ void sde_crtc_complete_commit(struct drm_crtc *crtc, * sde_crtc_init - create a new crtc object * @dev: sde device * @plane: base plane - * @Return: new crtc object or error + * @Return: new crtc object or error */ struct drm_crtc *sde_crtc_init(struct drm_device *dev, struct drm_plane *plane); diff --git a/drivers/gpu/drm/msm/sde/sde_encoder.h b/drivers/gpu/drm/msm/sde/sde_encoder.h new file mode 100644 index 000000000000..fccc2649dc59 --- /dev/null +++ b/drivers/gpu/drm/msm/sde/sde_encoder.h @@ -0,0 +1,93 @@ +/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __SDE_ENCODER_H__ +#define __SDE_ENCODER_H__ + +#include <drm/drm_crtc.h> + +#include "msm_prop.h" +#include "sde_hw_mdss.h" + +/** + * Encoder functions and data types + * @intfs: Interfaces this encoder is using, INTF_MODE_NONE if unused + * @wbs: Writebacks this encoder is using, INTF_MODE_NONE if unused + * @needs_cdm: Encoder requests a CDM based on pixel format conversion needs + * @display_num_of_h_tiles: + */ +struct sde_encoder_hw_resources { + enum sde_intf_mode intfs[INTF_MAX]; + enum sde_intf_mode wbs[WB_MAX]; + bool needs_cdm; + u32 display_num_of_h_tiles; +}; + +/** + * sde_encoder_get_hw_resources - Populate table of required hardware resources + * @encoder: encoder pointer + * @hw_res: resource table to populate with encoder required resources + * @conn_state: report hw reqs based on this proposed connector state + */ +void sde_encoder_get_hw_resources(struct drm_encoder *encoder, + struct sde_encoder_hw_resources *hw_res, + struct drm_connector_state *conn_state); + +/** + * sde_encoder_register_vblank_callback - provide callback to encoder that + * will be called on the next vblank. + * @encoder: encoder pointer + * @cb: callback pointer, provide NULL to deregister and disable IRQs + * @data: user data provided to callback + */ +void sde_encoder_register_vblank_callback(struct drm_encoder *encoder, + void (*cb)(void *), void *data); + +/** + * sde_encoder_schedule_kickoff - Register a callback with the encoder to + * trigger a double buffer flip of the ctl path (i.e. ctl flush and start) + * at the appropriate time. + * Immediately: if no previous commit is outstanding. + * Delayed: Save the callback, and return. Does not block. Callback will + * be triggered later. E.g. cmd encoder will trigger at pp_done irq + * irq if it outstanding. + * @encoder: encoder pointer + */ +void sde_encoder_schedule_kickoff(struct drm_encoder *encoder); + +/** + * sde_encoder_wait_nxt_committed - Wait for hardware to have flushed the + * current pending frames to hardware at a vblank or ctl_start + * Encoders will map this differently depending on irqs + * vid mode -> vsync_irq + * @encoder: encoder pointer + * Returns: 0 on success, -EWOULDBLOCK if already signaled, error otherwise + */ +int sde_encoder_wait_for_commit_done(struct drm_encoder *drm_encoder); + +/** + * sde_encoder_init - initialize virtual encoder object + * @dev: Pointer to drm device structure + * @disp_info: Pointer to display information structure + * Returns: Pointer to newly created drm encoder + */ +struct drm_encoder *sde_encoder_init( + struct drm_device *dev, + struct msm_display_info *disp_info); + +/** + * sde_encoder_destroy - destroy previously initialized virtual encoder + * @drm_enc: Pointer to previously created drm encoder structure + */ +void sde_encoder_destroy(struct drm_encoder *drm_enc); + +#endif /* __SDE_ENCODER_H__ */ diff --git a/drivers/gpu/drm/msm/sde/sde_encoder_phys.h b/drivers/gpu/drm/msm/sde/sde_encoder_phys.h index 5dc0b290ef13..4de4693bf570 100644 --- a/drivers/gpu/drm/msm/sde/sde_encoder_phys.h +++ b/drivers/gpu/drm/msm/sde/sde_encoder_phys.h @@ -22,6 +22,8 @@ #include "sde_hw_top.h" #include "sde_hw_wb.h" #include "sde_hw_cdm.h" +#include "sde_encoder.h" +#include "sde_connector.h" #define SDE_ENCODER_NAME_MAX 16 diff --git a/drivers/gpu/drm/msm/sde/sde_kms.c b/drivers/gpu/drm/msm/sde/sde_kms.c index 8dc74d9e8312..3f42e28e108c 100644 --- a/drivers/gpu/drm/msm/sde/sde_kms.c +++ b/drivers/gpu/drm/msm/sde/sde_kms.c @@ -29,6 +29,10 @@ #include "sde_hw_util.h" #include "sde_hw_intf.h" #include "sde_hw_vbif.h" +#include "sde_vbif.h" +#include "sde_encoder.h" +#include "sde_plane.h" +#include "sde_crtc.h" #define CREATE_TRACE_POINTS #include "sde_trace.h" diff --git a/drivers/gpu/drm/msm/sde/sde_kms.h b/drivers/gpu/drm/msm/sde/sde_kms.h index 1256048f9645..96c3f37b5d3e 100644 --- a/drivers/gpu/drm/msm/sde/sde_kms.h +++ b/drivers/gpu/drm/msm/sde/sde_kms.h @@ -22,8 +22,6 @@ #include "sde_hw_interrupts.h" #include "sde_hw_wb.h" #include "sde_hw_top.h" -#include "sde_connector.h" -#include "sde_crtc.h" #include "sde_rm.h" #include "sde_power_handle.h" #include "sde_irq.h" @@ -107,20 +105,6 @@ struct sde_irq { struct dentry *debugfs_file; }; -/** - * Encoder functions and data types - * @intfs: Interfaces this encoder is using, INTF_MODE_NONE if unused - * @wbs: Writebacks this encoder is using, INTF_MODE_NONE if unused - * @needs_cdm: Encoder requests a CDM based on pixel format conversion needs - * @display_num_of_h_tiles: - */ -struct sde_encoder_hw_resources { - enum sde_intf_mode intfs[INTF_MAX]; - enum sde_intf_mode wbs[WB_MAX]; - bool needs_cdm; - u32 display_num_of_h_tiles; -}; - struct sde_kms { struct msm_kms base; struct drm_device *dev; @@ -163,42 +147,6 @@ struct vsync_info { #define to_sde_kms(x) container_of(x, struct sde_kms, base) -struct sde_plane_state { - struct drm_plane_state base; - - /* aligned with property */ - uint64_t property_values[PLANE_PROP_COUNT]; - - /* blob properties */ - struct drm_property_blob *property_blobs[PLANE_PROP_BLOBCOUNT]; - - /* dereferenced input fence pointer */ - void *input_fence; - - /* assigned by crtc blender */ - enum sde_stage stage; - - /* bitmask for which pipe h/w config functions need to be updated */ - uint32_t dirty; - - /* whether the current update is still pending */ - bool pending : 1; -}; - -#define to_sde_plane_state(x) \ - container_of(x, struct sde_plane_state, base) - -/** - * sde_plane_get_property - Query integer value of plane property - * - * @S: Pointer to plane state - * @X: Property index, from enum msm_mdp_plane_property - * - * Return: Integer value of requested property - */ -#define sde_plane_get_property(S, X) \ - ((S) && ((X) < PLANE_PROP_COUNT) ? ((S)->property_values[(X)]) : 0) - /** * sde_is_custom_client - whether or not to enable non-standard customizations * @@ -402,91 +350,4 @@ void sde_kms_info_stop(struct sde_kms_info *info); int sde_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); void sde_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); -/** - * Plane functions - */ -enum sde_sspp sde_plane_pipe(struct drm_plane *plane); -void sde_plane_flush(struct drm_plane *plane); -struct drm_plane *sde_plane_init(struct drm_device *dev, - uint32_t pipe, bool primary_plane, - unsigned long possible_crtcs); - -/** - * sde_plane_wait_input_fence - wait for input fence object - * @plane: Pointer to DRM plane object - * @wait_ms: Wait timeout value - * Returns: Zero on success - */ -int sde_plane_wait_input_fence(struct drm_plane *plane, uint32_t wait_ms); - -/** - * sde_plane_color_fill - Enables color fill on plane - * @plane: Pointer to DRM plane object - * @color: RGB fill color value, [23..16] Blue, [15..8] Green, [7..0] Red - * @alpha: 8-bit fill alpha value, 255 selects 100% alpha - * - * Returns: 0 on success - */ -int sde_plane_color_fill(struct drm_plane *plane, - uint32_t color, uint32_t alpha); - -/** - * sde_encoder_get_hw_resources - Populate table of required hardware resources - * @encoder: encoder pointer - * @hw_res: resource table to populate with encoder required resources - * @conn_state: report hw reqs based on this proposed connector state - */ -void sde_encoder_get_hw_resources(struct drm_encoder *encoder, - struct sde_encoder_hw_resources *hw_res, - struct drm_connector_state *conn_state); - -/** - * sde_encoder_register_vblank_callback - provide callback to encoder that - * will be called on the next vblank. - * @encoder: encoder pointer - * @cb: callback pointer, provide NULL to deregister and disable IRQs - * @data: user data provided to callback - */ -void sde_encoder_register_vblank_callback(struct drm_encoder *encoder, - void (*cb)(void *), void *data); - -/** - * sde_encoder_schedule_kickoff - Register a callback with the encoder to - * trigger a double buffer flip of the ctl path (i.e. ctl flush and start) - * at the appropriate time. - * Immediately: if no previous commit is outstanding. - * Delayed: Save the callback, and return. Does not block. Callback will - * be triggered later. E.g. cmd encoder will trigger at pp_done irq - * irq if it outstanding. - * @encoder: encoder pointer - */ -void sde_encoder_schedule_kickoff(struct drm_encoder *encoder); - -/** - * sde_encoder_wait_nxt_committed - Wait for hardware to have flushed the - * current pending frames to hardware at a vblank or ctl_start - * Encoders will map this differently depending on irqs - * vid mode -> vsync_irq - * @encoder: encoder pointer - * - * Return: 0 on success, -EWOULDBLOCK if already signaled, error otherwise - */ -int sde_encoder_wait_for_commit_done(struct drm_encoder *drm_encoder); - -/** - * sde_encoder_init - initialize virtual encoder object - * @dev: Pointer to drm device structure - * @disp_info: Pointer to display information structure - * Returns: Pointer to newly created drm encoder - */ -struct drm_encoder *sde_encoder_init( - struct drm_device *dev, - struct msm_display_info *disp_info); - -/** - * sde_encoder_destroy - destroy previously initialized virtual encoder - * @drm_enc: Pointer to previously created drm encoder structure - */ -void sde_encoder_destroy(struct drm_encoder *drm_enc); - #endif /* __sde_kms_H__ */ diff --git a/drivers/gpu/drm/msm/sde/sde_plane.c b/drivers/gpu/drm/msm/sde/sde_plane.c index 2d860a544d1a..d97d89624689 100644 --- a/drivers/gpu/drm/msm/sde/sde_plane.c +++ b/drivers/gpu/drm/msm/sde/sde_plane.c @@ -24,6 +24,7 @@ #include "sde_trace.h" #include "sde_crtc.h" #include "sde_vbif.h" +#include "sde_plane.h" #define SDE_DEBUG_PLANE(pl, fmt, ...) SDE_DEBUG("plane%d " fmt,\ (pl) ? (pl)->base.base.id : -1, ##__VA_ARGS__) diff --git a/drivers/gpu/drm/msm/sde/sde_plane.h b/drivers/gpu/drm/msm/sde/sde_plane.h new file mode 100644 index 000000000000..e756e25a48fa --- /dev/null +++ b/drivers/gpu/drm/msm/sde/sde_plane.h @@ -0,0 +1,95 @@ +/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _SDE_PLANE_H_ +#define _SDE_PLANE_H_ + +#include <drm/drm_crtc.h> + +#include "msm_prop.h" +#include "sde_hw_mdss.h" + +/** + * struct sde_plane_state: Define sde extension of drm plane state object + * @base: base drm plane state object + * @property_values: cached plane property values + * @property_blobs: blob properties + * @input_fence: dereferenced input fence pointer + * @stage: assigned by crtc blender + * @dirty: bitmask for which pipe h/w config functions need to be updated + * @pending: whether the current update is still pending + */ +struct sde_plane_state { + struct drm_plane_state base; + uint64_t property_values[PLANE_PROP_COUNT]; + struct drm_property_blob *property_blobs[PLANE_PROP_BLOBCOUNT]; + void *input_fence; + enum sde_stage stage; + uint32_t dirty; + bool pending; +}; + +#define to_sde_plane_state(x) \ + container_of(x, struct sde_plane_state, base) + +/** + * sde_plane_get_property - Query integer value of plane property + * @S: Pointer to plane state + * @X: Property index, from enum msm_mdp_plane_property + * Returns: Integer value of requested property + */ +#define sde_plane_get_property(S, X) \ + ((S) && ((X) < PLANE_PROP_COUNT) ? ((S)->property_values[(X)]) : 0) + +/** + * sde_plane_pipe - return sspp identifier for the given plane + * @plane: Pointer to DRM plane object + * Returns: sspp identifier of the given plane + */ +enum sde_sspp sde_plane_pipe(struct drm_plane *plane); + +/** + * sde_plane_flush - final plane operations before commit flush + * @plane: Pointer to drm plane structure + */ +void sde_plane_flush(struct drm_plane *plane); + +/** + * sde_plane_init - create new sde plane for the given pipe + * @dev: Pointer to DRM device + * @pipe: sde hardware pipe identifier + * @primary_plane: true if this pipe is primary plane for crtc + * @possible_crtcs: bitmask of crtc that can be attached to the given pipe + */ +struct drm_plane *sde_plane_init(struct drm_device *dev, + uint32_t pipe, bool primary_plane, + unsigned long possible_crtcs); + +/** + * sde_plane_wait_input_fence - wait for input fence object + * @plane: Pointer to DRM plane object + * @wait_ms: Wait timeout value + * Returns: Zero on success + */ +int sde_plane_wait_input_fence(struct drm_plane *plane, uint32_t wait_ms); + +/** + * sde_plane_color_fill - enables color fill on plane + * @plane: Pointer to DRM plane object + * @color: RGB fill color value, [23..16] Blue, [15..8] Green, [7..0] Red + * @alpha: 8-bit fill alpha value, 255 selects 100% alpha + * Returns: 0 on success + */ +int sde_plane_color_fill(struct drm_plane *plane, + uint32_t color, uint32_t alpha); + +#endif /* _SDE_PLANE_H_ */ diff --git a/drivers/gpu/drm/msm/sde/sde_rm.c b/drivers/gpu/drm/msm/sde/sde_rm.c index b17ac828d110..e1e63dda5437 100644 --- a/drivers/gpu/drm/msm/sde/sde_rm.c +++ b/drivers/gpu/drm/msm/sde/sde_rm.c @@ -21,6 +21,8 @@ #include "sde_hw_pingpong.h" #include "sde_hw_intf.h" #include "sde_hw_wb.h" +#include "sde_encoder.h" +#include "sde_connector.h" #define RESERVED_BY_OTHER(h, r) \ ((h)->rsvp && ((h)->rsvp->enc_id != (r)->enc_id)) diff --git a/drivers/gpu/drm/msm/sde/sde_wb.h b/drivers/gpu/drm/msm/sde/sde_wb.h index a2afc1635824..4e335956db55 100644 --- a/drivers/gpu/drm/msm/sde/sde_wb.h +++ b/drivers/gpu/drm/msm/sde/sde_wb.h @@ -17,6 +17,7 @@ #include "msm_kms.h" #include "sde_kms.h" +#include "sde_connector.h" /** * struct sde_wb_device - Writeback device context |
