summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm/ecore_drm_fb.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-04-08 13:41:35 -0400
committerStefan Schmidt <s.schmidt@samsung.com>2015-04-10 11:09:51 +0200
commit10985880c2297ea325037f2a3e698a24bf809b96 (patch)
tree85fb88beff230024c7d95ae4ad3066b1b16b8d25 /src/lib/ecore_drm/ecore_drm_fb.c
parenta5d180b2826d27a492bc3cce980e437a708ba94f (diff)
ecore-drm: Add 2 new API functions for setting and sending framebuffers
Summary: This adds 2 new API functions we can use from within the evas drm engine to set framebuffers as current, and to call a pageflip on given buffers. @feature Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm/ecore_drm_fb.c')
-rw-r--r--src/lib/ecore_drm/ecore_drm_fb.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_fb.c b/src/lib/ecore_drm/ecore_drm_fb.c
index da6b421d0d..ea466ca301 100644
--- a/src/lib/ecore_drm/ecore_drm_fb.c
+++ b/src/lib/ecore_drm/ecore_drm_fb.c
@@ -162,3 +162,70 @@ ecore_drm_fb_dirty(Ecore_Drm_Fb *fb, Eina_Rectangle *rects, unsigned int count)
162 } 162 }
163#endif 163#endif
164} 164}
165
166EAPI void
167ecore_drm_fb_set(Ecore_Drm_Device *dev, Ecore_Drm_Fb *fb)
168{
169 Ecore_Drm_Output *output;
170 Eina_List *l;
171
172 EINA_SAFETY_ON_NULL_RETURN(dev);
173 EINA_SAFETY_ON_NULL_RETURN(fb);
174
175 if ((fb->w != dev->dumb[0]->w) || (fb->h != dev->dumb[0]->h))
176 {
177 /* we need to copy from fb to dev->dumb */
178 CRIT("Trying to set a Framebuffer of improper size !!");
179 return;
180 }
181
182 EINA_LIST_FOREACH(dev->outputs, l, output)
183 {
184 int x = 0, y = 0;
185
186 if (!output->cloned)
187 {
188 x = output->x;
189 y = output->y;
190 }
191
192 if (drmModeSetCrtc(dev->drm.fd, output->crtc_id, fb->id, x, y,
193 &output->conn_id, 1, &output->current_mode->info))
194 {
195 ERR("Failed to set Mode %dx%d for Output %s: %m",
196 output->current_mode->width, output->current_mode->height,
197 output->name);
198 }
199 }
200}
201
202EAPI void
203ecore_drm_fb_send(Ecore_Drm_Device *dev, Ecore_Drm_Fb *fb, Ecore_Drm_Pageflip_Cb func, void *data)
204{
205 Ecore_Drm_Output *output;
206 Eina_List *l;
207 Ecore_Drm_Pageflip_Callback *cb;
208
209 EINA_SAFETY_ON_NULL_RETURN(dev);
210 EINA_SAFETY_ON_NULL_RETURN(fb);
211 EINA_SAFETY_ON_NULL_RETURN(func);
212
213 if (eina_list_count(dev->outputs) < 1) return;
214
215 if (!(cb = calloc(1, sizeof(Ecore_Drm_Pageflip_Callback))))
216 return;
217
218 cb->func = func;
219 cb->data = data;
220 cb->count = eina_list_count(dev->outputs);
221
222 EINA_LIST_FOREACH(dev->outputs, l, output)
223 {
224 if (drmModePageFlip(dev->drm.fd, output->crtc_id, fb->id,
225 DRM_MODE_PAGE_FLIP_EVENT, cb) < 0)
226 {
227 ERR("Cannot flip crtc %u for connector %u: %m",
228 output->crtc_id, output->conn_id);
229 }
230 }
231}