blob: 19ae27f2a3c0b5574b0a20014c5d7b48d3b8aaa1 [file] [log] [blame]
Dhaval Patel14d46ce2017-01-17 16:28:12 -08001/*
2 * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
3 * Copyright (C) 2013 Red Hat
4 * Author: Rob Clark <robdclark@gmail.com>
Abhijit Kulkarni40e38162016-06-26 22:12:09 -04005 *
Dhaval Patel14d46ce2017-01-17 16:28:12 -08006 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
Abhijit Kulkarni40e38162016-06-26 22:12:09 -04009 *
Dhaval Patel14d46ce2017-01-17 16:28:12 -080010 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program. If not, see <http://www.gnu.org/licenses/>.
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040017 */
18
19#ifndef _SDE_CRTC_H_
20#define _SDE_CRTC_H_
21
Clarence Ipa18d4832017-03-13 12:35:44 -070022#include <linux/kthread.h>
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040023#include "drm_crtc.h"
Clarence Ip7a753bb2016-07-07 11:47:44 -040024#include "msm_prop.h"
Clarence Ip24f80662016-06-13 19:05:32 -040025#include "sde_fence.h"
Clarence Ip7a753bb2016-07-07 11:47:44 -040026#include "sde_kms.h"
Alan Kwong9aa061c2016-11-06 21:17:12 -050027#include "sde_core_perf.h"
Alan Kwongcdb2f282017-03-18 13:42:06 -070028#include "sde_hw_blk.h"
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040029
Clarence Ip8f7366c2016-07-05 12:15:26 -040030#define SDE_CRTC_NAME_SIZE 12
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040031
Alan Kwong628d19e2016-10-31 13:50:13 -040032/* define the maximum number of in-flight frame events */
33#define SDE_CRTC_FRAME_EVENT_SIZE 2
34
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040035/**
Dhaval Patel4d424602017-02-18 19:40:14 -080036 * enum sde_crtc_client_type: crtc client type
37 * @RT_CLIENT: RealTime client like video/cmd mode display
38 * voting through apps rsc
39 * @NRT_CLIENT: Non-RealTime client like WB display
40 * voting through apps rsc
41 * @RT_RSC_CLIENT: Realtime display RSC voting client
42 */
43enum sde_crtc_client_type {
44 RT_CLIENT,
45 NRT_CLIENT,
46 RT_RSC_CLIENT,
47};
48
49/**
Lloyd Atkinsone7bcdd22016-08-11 10:53:37 -040050 * struct sde_crtc_mixer: stores the map for each virtual pipeline in the CRTC
51 * @hw_lm: LM HW Driver context
52 * @hw_ctl: CTL Path HW driver context
Gopikrishnaiah Anandane0e5e0c2016-05-25 11:05:33 -070053 * @hw_dspp: DSPP HW driver context
Lloyd Atkinsone7bcdd22016-08-11 10:53:37 -040054 * @encoder: Encoder attached to this lm & ctl
Dhaval Patel48c76022016-09-01 17:51:23 -070055 * @mixer_op_mode: mixer blending operation mode
56 * @flush_mask: mixer flush mask for ctl, mixer and pipe
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040057 */
58struct sde_crtc_mixer {
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040059 struct sde_hw_mixer *hw_lm;
Lloyd Atkinsonc44a52e2016-08-16 16:40:17 -040060 struct sde_hw_ctl *hw_ctl;
Gopikrishnaiah Anandane0e5e0c2016-05-25 11:05:33 -070061 struct sde_hw_dspp *hw_dspp;
Lloyd Atkinsone7bcdd22016-08-11 10:53:37 -040062 struct drm_encoder *encoder;
Dhaval Patel48c76022016-09-01 17:51:23 -070063 u32 mixer_op_mode;
64 u32 flush_mask;
Abhijit Kulkarni40e38162016-06-26 22:12:09 -040065};
66
67/**
Alan Kwong628d19e2016-10-31 13:50:13 -040068 * struct sde_crtc_frame_event: stores crtc frame event for crtc processing
69 * @work: base work structure
70 * @crtc: Pointer to crtc handling this event
71 * @list: event list
72 * @ts: timestamp at queue entry
73 * @event: event identifier
74 */
75struct sde_crtc_frame_event {
76 struct kthread_work work;
77 struct drm_crtc *crtc;
78 struct list_head list;
79 ktime_t ts;
80 u32 event;
81};
82
83/**
Clarence Ipa18d4832017-03-13 12:35:44 -070084 * struct sde_crtc_event - event callback tracking structure
85 * @list: Linked list tracking node
86 * @kt_work: Kthread worker structure
87 * @sde_crtc: Pointer to associated sde_crtc structure
88 * @cb_func: Pointer to callback function
89 * @usr: Pointer to user data to be provided to the callback
90 */
91struct sde_crtc_event {
92 struct list_head list;
93 struct kthread_work kt_work;
94 void *sde_crtc;
95
Gopikrishnaiah Anandanb6b401f2017-03-14 16:39:49 -070096 void (*cb_func)(struct drm_crtc *crtc, void *usr);
Clarence Ipa18d4832017-03-13 12:35:44 -070097 void *usr;
98};
99
100/*
101 * Maximum number of free event structures to cache
102 */
103#define SDE_CRTC_MAX_EVENT_COUNT 16
104
105/**
Abhijit Kulkarni40e38162016-06-26 22:12:09 -0400106 * struct sde_crtc - virtualized CRTC data structure
107 * @base : Base drm crtc structure
108 * @name : ASCII description of this crtc
Abhijit Kulkarni40e38162016-06-26 22:12:09 -0400109 * @num_ctls : Number of ctl paths in use
110 * @num_mixers : Number of mixers in use
111 * @mixer : List of active mixers
Lloyd Atkinson9eabe7a2016-09-14 13:39:15 -0400112 * @event : Pointer to last received drm vblank event. If there is a
113 * pending vblank event, this will be non-null.
Abhijit Kulkarni40e38162016-06-26 22:12:09 -0400114 * @vsync_count : Running count of received vsync events
Lloyd Atkinsone5c2c0b2016-07-05 12:23:29 -0400115 * @drm_requested_vblank : Whether vblanks have been enabled in the encoder
Clarence Ip7a753bb2016-07-07 11:47:44 -0400116 * @property_info : Opaque structure for generic property support
117 * @property_defaults : Array of default values for generic property support
Dhaval Patel39323d42017-03-01 23:48:24 -0800118 * @output_fence : output release fence context
Clarence Ip8f7366c2016-07-05 12:15:26 -0400119 * @stage_cfg : H/w mixer stage configuration
120 * @debugfs_root : Parent of debugfs node
Alan Kwong07da0982016-11-04 12:57:45 -0400121 * @vblank_cb_count : count of vblank callback since last reset
122 * @vblank_cb_time : ktime at vblank count reset
123 * @vblank_refcount : reference count for vblank enable request
Clarence Ip7f70ce42017-03-20 06:53:46 -0700124 * @suspend : whether or not a suspend operation is in progress
Gopikrishnaiah Anandane0e5e0c2016-05-25 11:05:33 -0700125 * @feature_list : list of color processing features supported on a crtc
126 * @active_list : list of color processing features are active
127 * @dirty_list : list of color processing features are dirty
Gopikrishnaiah Anandan9ba43782017-01-31 18:23:08 -0800128 * @ad_dirty: list containing ad properties that are dirty
129 * @ad_active: list containing ad properties that are active
Dhaval Patel3fbe6bf2016-10-20 20:00:41 -0700130 * @crtc_lock : crtc lock around create, destroy and access.
Alan Kwong628d19e2016-10-31 13:50:13 -0400131 * @frame_pending : Whether or not an update is pending
132 * @frame_events : static allocation of in-flight frame events
133 * @frame_event_list : available frame event list
134 * @spin_lock : spin lock for frame event, transaction status, etc...
Clarence Ipa18d4832017-03-13 12:35:44 -0700135 * @event_thread : Pointer to event handler thread
136 * @event_worker : Event worker queue
137 * @event_cache : Local cache of event worker structures
138 * @event_free_list : List of available event structures
139 * @event_lock : Spinlock around event handling code
Dhaval Patelf9245d62017-03-28 16:24:00 -0700140 * @misr_enable : boolean entry indicates misr enable/disable status.
Abhijit Kulkarni40e38162016-06-26 22:12:09 -0400141 */
142struct sde_crtc {
143 struct drm_crtc base;
Clarence Ip8f7366c2016-07-05 12:15:26 -0400144 char name[SDE_CRTC_NAME_SIZE];
Lloyd Atkinson11f34442016-08-11 11:19:52 -0400145
Abhijit Kulkarni40e38162016-06-26 22:12:09 -0400146 /* HW Resources reserved for the crtc */
Lloyd Atkinsonc44a52e2016-08-16 16:40:17 -0400147 u32 num_ctls;
148 u32 num_mixers;
Lloyd Atkinsone7bcdd22016-08-11 10:53:37 -0400149 struct sde_crtc_mixer mixers[CRTC_DUAL_MIXERS];
Abhijit Kulkarni40e38162016-06-26 22:12:09 -0400150
Abhijit Kulkarni40e38162016-06-26 22:12:09 -0400151 struct drm_pending_vblank_event *event;
Abhijit Kulkarni40e38162016-06-26 22:12:09 -0400152 u32 vsync_count;
Clarence Ip8f7366c2016-07-05 12:15:26 -0400153
Clarence Ip7a753bb2016-07-07 11:47:44 -0400154 struct msm_property_info property_info;
155 struct msm_property_data property_data[CRTC_PROP_COUNT];
Dhaval Patele4a5dda2016-10-13 19:29:30 -0700156 struct drm_property_blob *blob_info;
Clarence Ip7a753bb2016-07-07 11:47:44 -0400157
Clarence Ip24f80662016-06-13 19:05:32 -0400158 /* output fence support */
Dhaval Patel39323d42017-03-01 23:48:24 -0800159 struct sde_fence_context output_fence;
Clarence Ip24f80662016-06-13 19:05:32 -0400160
Clarence Ip8f7366c2016-07-05 12:15:26 -0400161 struct sde_hw_stage_cfg stage_cfg;
162 struct dentry *debugfs_root;
Gopikrishnaiah Anandane0e5e0c2016-05-25 11:05:33 -0700163
Alan Kwong07da0982016-11-04 12:57:45 -0400164 u32 vblank_cb_count;
165 ktime_t vblank_cb_time;
166 atomic_t vblank_refcount;
Clarence Ip7f70ce42017-03-20 06:53:46 -0700167 bool suspend;
Alan Kwong07da0982016-11-04 12:57:45 -0400168
Gopikrishnaiah Anandane0e5e0c2016-05-25 11:05:33 -0700169 struct list_head feature_list;
170 struct list_head active_list;
171 struct list_head dirty_list;
Gopikrishnaiah Anandan9ba43782017-01-31 18:23:08 -0800172 struct list_head ad_dirty;
173 struct list_head ad_active;
Gopikrishnaiah Anandande2c81b2017-03-15 12:41:29 -0700174 struct list_head user_event_list;
Dhaval Patel3fbe6bf2016-10-20 20:00:41 -0700175
176 struct mutex crtc_lock;
Alan Kwong628d19e2016-10-31 13:50:13 -0400177
178 atomic_t frame_pending;
179 struct sde_crtc_frame_event frame_events[SDE_CRTC_FRAME_EVENT_SIZE];
180 struct list_head frame_event_list;
181 spinlock_t spin_lock;
Clarence Ipa18d4832017-03-13 12:35:44 -0700182
183 /* for handling internal event thread */
184 struct task_struct *event_thread;
185 struct kthread_worker event_worker;
186 struct sde_crtc_event event_cache[SDE_CRTC_MAX_EVENT_COUNT];
187 struct list_head event_free_list;
188 spinlock_t event_lock;
Dhaval Patelf9245d62017-03-28 16:24:00 -0700189 bool misr_enable;
Abhijit Kulkarni40e38162016-06-26 22:12:09 -0400190};
191
192#define to_sde_crtc(x) container_of(x, struct sde_crtc, base)
193
Clarence Ip7a753bb2016-07-07 11:47:44 -0400194/**
Alan Kwongcdb2f282017-03-18 13:42:06 -0700195 * struct sde_crtc_res_ops - common operations for crtc resources
196 * @get: get given resource
197 * @put: put given resource
198 */
199struct sde_crtc_res_ops {
200 void *(*get)(void *val, u32 type, u64 tag);
201 void (*put)(void *val);
202};
203
204/* crtc resource type (0x0-0xffff reserved for hw block type */
205#define SDE_CRTC_RES_ROT_OUT_FBO 0x10000
206#define SDE_CRTC_RES_ROT_OUT_FB 0x10001
207#define SDE_CRTC_RES_ROT_PLANE 0x10002
208#define SDE_CRTC_RES_ROT_IN_FB 0x10003
209
210#define SDE_CRTC_RES_FLAG_FREE BIT(0)
211
212/**
213 * struct sde_crtc_res - definition of crtc resources
214 * @list: list of crtc resource
215 * @type: crtc resource type
216 * @tag: unique identifier per type
217 * @refcount: reference/usage count
218 * @ops: callback operations
219 * @val: resource handle associated with type/tag
220 * @flags: customization flags
221 */
222struct sde_crtc_res {
223 struct list_head list;
224 u32 type;
225 u64 tag;
226 atomic_t refcount;
227 struct sde_crtc_res_ops ops;
228 void *val;
229 u32 flags;
230};
231
232/**
233 * sde_crtc_respool - crtc resource pool
234 * @sequence_id: sequence identifier, incremented per state duplication
235 * @res_list: list of resource managed by this resource pool
236 * @ops: resource operations for parent resource pool
237 */
238struct sde_crtc_respool {
239 u32 sequence_id;
240 struct list_head res_list;
241 struct sde_crtc_res_ops ops;
242};
243
244/**
Clarence Ip7a753bb2016-07-07 11:47:44 -0400245 * struct sde_crtc_state - sde container for atomic crtc state
246 * @base: Base drm crtc state structure
Clarence Ip0d0e96d2016-10-24 18:13:13 -0400247 * @connectors : Currently associated drm connectors
248 * @num_connectors: Number of associated drm connectors
Alan Kwong67a3f792016-11-01 23:16:53 -0400249 * @intf_mode : Interface mode of the primary connector
Dhaval Patel4d424602017-02-18 19:40:14 -0800250 * @rsc_client : sde rsc client when mode is valid
Clarence Ip7a753bb2016-07-07 11:47:44 -0400251 * @property_values: Current crtc property values
Clarence Ipcae1bb62016-07-07 12:07:13 -0400252 * @input_fence_timeout_ns : Cached input fence timeout, in ns
Clarence Ip7a753bb2016-07-07 11:47:44 -0400253 * @property_blobs: Reference pointers for blob properties
Veera Sundaram Sankaran3171ff82017-01-04 14:34:47 -0800254 * @num_dim_layers: Number of dim layers
255 * @dim_layer: Dim layer configs
Alan Kwong9aa061c2016-11-06 21:17:12 -0500256 * @cur_perf: current performance state
257 * @new_perf: new performance state
Alan Kwong4dd64c82017-02-04 18:41:51 -0800258 * @sbuf_cfg: stream buffer configuration
Alan Kwong4aacd532017-02-04 18:51:33 -0800259 * @sbuf_prefill_line: number of line for inline rotator prefetch
Clarence Ip7a753bb2016-07-07 11:47:44 -0400260 */
261struct sde_crtc_state {
262 struct drm_crtc_state base;
Clarence Ip0d0e96d2016-10-24 18:13:13 -0400263
264 struct drm_connector *connectors[MAX_CONNECTORS];
265 int num_connectors;
Alan Kwong67a3f792016-11-01 23:16:53 -0400266 enum sde_intf_mode intf_mode;
Dhaval Patel4d424602017-02-18 19:40:14 -0800267 struct sde_rsc_client *rsc_client;
Dhaval Patel82c8dbc2017-02-18 23:15:10 -0800268 bool rsc_update;
Clarence Ip0d0e96d2016-10-24 18:13:13 -0400269
Clarence Ip7a753bb2016-07-07 11:47:44 -0400270 uint64_t property_values[CRTC_PROP_COUNT];
Clarence Ipcae1bb62016-07-07 12:07:13 -0400271 uint64_t input_fence_timeout_ns;
Clarence Ip7a753bb2016-07-07 11:47:44 -0400272 struct drm_property_blob *property_blobs[CRTC_PROP_COUNT];
Veera Sundaram Sankaran3171ff82017-01-04 14:34:47 -0800273 uint32_t num_dim_layers;
274 struct sde_hw_dim_layer dim_layer[SDE_MAX_DIM_LAYERS];
Alan Kwong9aa061c2016-11-06 21:17:12 -0500275
276 struct sde_core_perf_params cur_perf;
277 struct sde_core_perf_params new_perf;
Alan Kwong4dd64c82017-02-04 18:41:51 -0800278 struct sde_ctl_sbuf_cfg sbuf_cfg;
Alan Kwong4aacd532017-02-04 18:51:33 -0800279 u64 sbuf_prefill_line;
Alan Kwongcdb2f282017-03-18 13:42:06 -0700280
281 struct sde_crtc_respool rp;
Clarence Ip7a753bb2016-07-07 11:47:44 -0400282};
283
284#define to_sde_crtc_state(x) \
285 container_of(x, struct sde_crtc_state, base)
286
287/**
288 * sde_crtc_get_property - query integer value of crtc property
289 * @S: Pointer to crtc state
290 * @X: Property index, from enum msm_mdp_crtc_property
291 * Returns: Integer value of requested property
292 */
293#define sde_crtc_get_property(S, X) \
294 ((S) && ((X) < CRTC_PROP_COUNT) ? ((S)->property_values[(X)]) : 0)
295
Dhaval Patel48c76022016-09-01 17:51:23 -0700296static inline int sde_crtc_mixer_width(struct sde_crtc *sde_crtc,
297 struct drm_display_mode *mode)
298{
299 if (!sde_crtc || !mode)
300 return 0;
301
302 return sde_crtc->num_mixers == CRTC_DUAL_MIXERS ?
303 mode->hdisplay / CRTC_DUAL_MIXERS : mode->hdisplay;
304}
305
306static inline uint32_t get_crtc_split_width(struct drm_crtc *crtc)
307{
308 struct drm_display_mode *mode;
309 struct sde_crtc *sde_crtc;
310
Veera Sundaram Sankaran3171ff82017-01-04 14:34:47 -0800311 if (!crtc || !crtc->state)
Dhaval Patel48c76022016-09-01 17:51:23 -0700312 return 0;
313
314 sde_crtc = to_sde_crtc(crtc);
315 mode = &crtc->state->adjusted_mode;
316 return sde_crtc_mixer_width(sde_crtc, mode);
317}
318
Veera Sundaram Sankaran3171ff82017-01-04 14:34:47 -0800319static inline uint32_t get_crtc_mixer_height(struct drm_crtc *crtc)
320{
321 struct drm_display_mode *mode;
322
323 if (!crtc || !crtc->state)
324 return 0;
325
326 mode = &crtc->state->adjusted_mode;
327 return mode->vdisplay;
328}
329
Lloyd Atkinson9eabe7a2016-09-14 13:39:15 -0400330/**
331 * sde_crtc_vblank - enable or disable vblanks for this crtc
332 * @crtc: Pointer to drm crtc object
333 * @en: true to enable vblanks, false to disable
334 */
335int sde_crtc_vblank(struct drm_crtc *crtc, bool en);
336
337/**
338 * sde_crtc_commit_kickoff - trigger kickoff of the commit for this crtc
339 * @crtc: Pointer to drm crtc object
340 */
341void sde_crtc_commit_kickoff(struct drm_crtc *crtc);
342
343/**
Clarence Ip0d0e96d2016-10-24 18:13:13 -0400344 * sde_crtc_prepare_commit - callback to prepare for output fences
Lloyd Atkinson9eabe7a2016-09-14 13:39:15 -0400345 * @crtc: Pointer to drm crtc object
Clarence Ip0d0e96d2016-10-24 18:13:13 -0400346 * @old_state: Pointer to drm crtc old state object
Lloyd Atkinson9eabe7a2016-09-14 13:39:15 -0400347 */
Clarence Ip0d0e96d2016-10-24 18:13:13 -0400348void sde_crtc_prepare_commit(struct drm_crtc *crtc,
349 struct drm_crtc_state *old_state);
350
351/**
352 * sde_crtc_complete_commit - callback signalling completion of current commit
353 * @crtc: Pointer to drm crtc object
354 * @old_state: Pointer to drm crtc old state object
355 */
356void sde_crtc_complete_commit(struct drm_crtc *crtc,
357 struct drm_crtc_state *old_state);
Lloyd Atkinson9eabe7a2016-09-14 13:39:15 -0400358
359/**
360 * sde_crtc_init - create a new crtc object
361 * @dev: sde device
362 * @plane: base plane
363 * @Return: new crtc object or error
364 */
365struct drm_crtc *sde_crtc_init(struct drm_device *dev, struct drm_plane *plane);
366
367/**
Lloyd Atkinson9eabe7a2016-09-14 13:39:15 -0400368 * sde_crtc_cancel_pending_flip - complete flip for clients on lastclose
369 * @crtc: Pointer to drm crtc object
370 * @file: client to cancel's file handle
371 */
372void sde_crtc_cancel_pending_flip(struct drm_crtc *crtc, struct drm_file *file);
373
Clarence Ip0d0e96d2016-10-24 18:13:13 -0400374/**
Gopikrishnaiah Anandande2c81b2017-03-15 12:41:29 -0700375 * sde_crtc_register_custom_event - api for enabling/disabling crtc event
376 * @kms: Pointer to sde_kms
377 * @crtc_drm: Pointer to crtc object
378 * @event: Event that client is interested
379 * @en: Flag to enable/disable the event
380 */
381int sde_crtc_register_custom_event(struct sde_kms *kms,
382 struct drm_crtc *crtc_drm, u32 event, bool en);
383
384/**
385 * sde_crtc_get_intf_mode - get interface mode of the given crtc
Alan Kwong9aa061c2016-11-06 21:17:12 -0500386 * @crtc: Pointert to crtc
387 */
Alan Kwong3e985f02017-02-12 15:08:44 -0800388enum sde_intf_mode sde_crtc_get_intf_mode(struct drm_crtc *crtc);
Alan Kwong9aa061c2016-11-06 21:17:12 -0500389
390/**
Dhaval Patel4d424602017-02-18 19:40:14 -0800391 * sde_crtc_get_client_type - check the crtc type- rt, nrt, rsc, etc.
Alan Kwong9aa061c2016-11-06 21:17:12 -0500392 * @crtc: Pointer to crtc
393 */
Dhaval Patel82c8dbc2017-02-18 23:15:10 -0800394static inline enum sde_crtc_client_type sde_crtc_get_client_type(
395 struct drm_crtc *crtc)
Alan Kwong9aa061c2016-11-06 21:17:12 -0500396{
397 struct sde_crtc_state *cstate =
398 crtc ? to_sde_crtc_state(crtc->state) : NULL;
399
Dhaval Patel82c8dbc2017-02-18 23:15:10 -0800400 if (!cstate)
401 return NRT_CLIENT;
402
403 return cstate->rsc_client ? RT_RSC_CLIENT :
404 (cstate->intf_mode == INTF_MODE_WB_LINE ? NRT_CLIENT : RT_CLIENT);
Alan Kwong9aa061c2016-11-06 21:17:12 -0500405}
406
407/**
408 * sde_crtc_is_enabled - check if sde crtc is enabled or not
409 * @crtc: Pointer to crtc
410 */
411static inline bool sde_crtc_is_enabled(struct drm_crtc *crtc)
412{
413 return crtc ? crtc->enabled : false;
414}
415
Clarence Ipa18d4832017-03-13 12:35:44 -0700416/**
417 * sde_crtc_event_queue - request event callback
418 * @crtc: Pointer to drm crtc structure
419 * @func: Pointer to callback function
420 * @usr: Pointer to user data to be passed to callback
421 * Returns: Zero on success
422 */
423int sde_crtc_event_queue(struct drm_crtc *crtc,
Gopikrishnaiah Anandanb6b401f2017-03-14 16:39:49 -0700424 void (*func)(struct drm_crtc *crtc, void *usr), void *usr);
Clarence Ipa18d4832017-03-13 12:35:44 -0700425
Alan Kwongcdb2f282017-03-18 13:42:06 -0700426/**
427 * sde_crtc_res_add - add given resource to resource pool in crtc state
428 * @state: Pointer to drm crtc state
429 * @type: Resource type
430 * @tag: Search tag for given resource
431 * @val: Resource handle
432 * @ops: Resource callback operations
433 * return: 0 if success; error code otherwise
434 */
435int sde_crtc_res_add(struct drm_crtc_state *state, u32 type, u64 tag,
436 void *val, struct sde_crtc_res_ops *ops);
437
438/**
439 * sde_crtc_res_get - get given resource from resource pool in crtc state
440 * @state: Pointer to drm crtc state
441 * @type: Resource type
442 * @tag: Search tag for given resource
443 * return: Resource handle if success; pointer error or null otherwise
444 */
445void *sde_crtc_res_get(struct drm_crtc_state *state, u32 type, u64 tag);
446
447/**
448 * sde_crtc_res_put - return given resource to resource pool in crtc state
449 * @state: Pointer to drm crtc state
450 * @type: Resource type
451 * @tag: Search tag for given resource
452 * return: None
453 */
454void sde_crtc_res_put(struct drm_crtc_state *state, u32 type, u64 tag);
455
Abhijit Kulkarni40e38162016-06-26 22:12:09 -0400456#endif /* _SDE_CRTC_H_ */