summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2/ecore_drm2_device.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2016-11-14 13:35:38 -0500
committerChris Michael <cp.michael@samsung.com>2016-11-15 08:42:07 -0500
commit8421a373132e4d8ad0f980adac853dde64923a7d (patch)
treea25904ca9cab48c2271ba1efffc76fdd69a81cc5 /src/lib/ecore_drm2/ecore_drm2_device.c
parent0a2c06fc58b4eac4cdcd9f7907e940d1c742dd92 (diff)
ecore-drm2: Make calls to symlink'd libdrm functions
Instead of linking to libdrm and calling drmMode functions, we will instead symlink the functions we need during runtime and call those symlinks. Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm2/ecore_drm2_device.c')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_device.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index 6cd415b481..10294af626 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -156,7 +156,7 @@ _drm2_atomic_usable(int fd)
156 drmVersion *drmver; 156 drmVersion *drmver;
157 Eina_Bool ret = EINA_FALSE; 157 Eina_Bool ret = EINA_FALSE;
158 158
159 drmver = drmGetVersion(fd); 159 drmver = sym_drmGetVersion(fd);
160 if (!drmver) return EINA_FALSE; 160 if (!drmver) return EINA_FALSE;
161 161
162 /* detect driver */ 162 /* detect driver */
@@ -187,7 +187,7 @@ _drm2_atomic_usable(int fd)
187 } 187 }
188 } 188 }
189 189
190 drmFreeVersion(drmver); 190 sym_drmFreeVersion(drmver);
191 191
192 return ret; 192 return ret;
193} 193}
@@ -201,7 +201,7 @@ _drm2_atomic_state_crtc_fill(Ecore_Drm2_Crtc_State *cstate, int fd)
201 DBG("Atomic State Crtc Fill"); 201 DBG("Atomic State Crtc Fill");
202 202
203 oprops = 203 oprops =
204 drmModeObjectGetProperties(fd, cstate->obj_id, DRM_MODE_OBJECT_CRTC); 204 sym_drmModeObjectGetProperties(fd, cstate->obj_id, DRM_MODE_OBJECT_CRTC);
205 if (!oprops) return; 205 if (!oprops) return;
206 206
207 DBG("\tCrtc %d", cstate->obj_id); 207 DBG("\tCrtc %d", cstate->obj_id);
@@ -210,7 +210,7 @@ _drm2_atomic_state_crtc_fill(Ecore_Drm2_Crtc_State *cstate, int fd)
210 { 210 {
211 drmModePropertyPtr prop; 211 drmModePropertyPtr prop;
212 212
213 prop = drmModeGetProperty(fd, oprops->props[i]); 213 prop = sym_drmModeGetProperty(fd, oprops->props[i]);
214 if (!prop) continue; 214 if (!prop) continue;
215 215
216 DBG("\t\tProperty: %s %d", prop->name, i); 216 DBG("\t\tProperty: %s %d", prop->name, i);
@@ -229,7 +229,7 @@ _drm2_atomic_state_crtc_fill(Ecore_Drm2_Crtc_State *cstate, int fd)
229 goto cont; 229 goto cont;
230 } 230 }
231 231
232 bp = drmModeGetPropertyBlob(fd, cstate->mode.value); 232 bp = sym_drmModeGetPropertyBlob(fd, cstate->mode.value);
233 if (!bp) goto cont; 233 if (!bp) goto cont;
234 234
235 if ((!cstate->mode.data) || 235 if ((!cstate->mode.data) ||
@@ -242,10 +242,10 @@ _drm2_atomic_state_crtc_fill(Ecore_Drm2_Crtc_State *cstate, int fd)
242 cstate->mode.len = bp->length; 242 cstate->mode.len = bp->length;
243 243
244 if (cstate->mode.value != 0) 244 if (cstate->mode.value != 0)
245 drmModeCreatePropertyBlob(fd, bp->data, bp->length, 245 sym_drmModeCreatePropertyBlob(fd, bp->data, bp->length,
246 &cstate->mode.value); 246 &cstate->mode.value);
247 247
248 drmModeFreePropertyBlob(bp); 248 sym_drmModeFreePropertyBlob(bp);
249 } 249 }
250 else if (!strcmp(prop->name, "ACTIVE")) 250 else if (!strcmp(prop->name, "ACTIVE"))
251 { 251 {
@@ -255,10 +255,10 @@ _drm2_atomic_state_crtc_fill(Ecore_Drm2_Crtc_State *cstate, int fd)
255 } 255 }
256 256
257cont: 257cont:
258 drmModeFreeProperty(prop); 258 sym_drmModeFreeProperty(prop);
259 } 259 }
260 260
261 drmModeFreeObjectProperties(oprops); 261 sym_drmModeFreeObjectProperties(oprops);
262} 262}
263 263
264static void 264static void
@@ -270,7 +270,7 @@ _drm2_atomic_state_conn_fill(Ecore_Drm2_Connector_State *cstate, int fd)
270 DBG("Atomic State Connector Fill"); 270 DBG("Atomic State Connector Fill");
271 271
272 oprops = 272 oprops =
273 drmModeObjectGetProperties(fd, cstate->obj_id, DRM_MODE_OBJECT_CONNECTOR); 273 sym_drmModeObjectGetProperties(fd, cstate->obj_id, DRM_MODE_OBJECT_CONNECTOR);
274 if (!oprops) return; 274 if (!oprops) return;
275 275
276 DBG("\tConnector: %d", cstate->obj_id); 276 DBG("\tConnector: %d", cstate->obj_id);
@@ -279,7 +279,7 @@ _drm2_atomic_state_conn_fill(Ecore_Drm2_Connector_State *cstate, int fd)
279 { 279 {
280 drmModePropertyPtr prop; 280 drmModePropertyPtr prop;
281 281
282 prop = drmModeGetProperty(fd, oprops->props[i]); 282 prop = sym_drmModeGetProperty(fd, oprops->props[i]);
283 if (!prop) continue; 283 if (!prop) continue;
284 284
285 DBG("\t\tProperty: %s", prop->name); 285 DBG("\t\tProperty: %s", prop->name);
@@ -307,7 +307,7 @@ _drm2_atomic_state_conn_fill(Ecore_Drm2_Connector_State *cstate, int fd)
307 goto cont; 307 goto cont;
308 } 308 }
309 309
310 bp = drmModeGetPropertyBlob(fd, cstate->edid.id); 310 bp = sym_drmModeGetPropertyBlob(fd, cstate->edid.id);
311 if (!bp) goto cont; 311 if (!bp) goto cont;
312 312
313 if ((!cstate->edid.data) || 313 if ((!cstate->edid.data) ||
@@ -320,10 +320,10 @@ _drm2_atomic_state_conn_fill(Ecore_Drm2_Connector_State *cstate, int fd)
320 cstate->edid.len = bp->length; 320 cstate->edid.len = bp->length;
321 321
322 if (cstate->edid.id != 0) 322 if (cstate->edid.id != 0)
323 drmModeCreatePropertyBlob(fd, bp->data, bp->length, 323 sym_drmModeCreatePropertyBlob(fd, bp->data, bp->length,
324 &cstate->edid.id); 324 &cstate->edid.id);
325 325
326 drmModeFreePropertyBlob(bp); 326 sym_drmModeFreePropertyBlob(bp);
327 } 327 }
328 else if (!strcmp(prop->name, "aspect ratio")) 328 else if (!strcmp(prop->name, "aspect ratio"))
329 { 329 {
@@ -339,10 +339,10 @@ _drm2_atomic_state_conn_fill(Ecore_Drm2_Connector_State *cstate, int fd)
339 } 339 }
340 340
341cont: 341cont:
342 drmModeFreeProperty(prop); 342 sym_drmModeFreeProperty(prop);
343 } 343 }
344 344
345 drmModeFreeObjectProperties(oprops); 345 sym_drmModeFreeObjectProperties(oprops);
346} 346}
347 347
348static void 348static void
@@ -355,7 +355,7 @@ _drm2_atomic_state_plane_fill(Ecore_Drm2_Plane_State *pstate, int fd)
355 DBG("Atomic State Plane Fill"); 355 DBG("Atomic State Plane Fill");
356 356
357 oprops = 357 oprops =
358 drmModeObjectGetProperties(fd, pstate->obj_id, DRM_MODE_OBJECT_PLANE); 358 sym_drmModeObjectGetProperties(fd, pstate->obj_id, DRM_MODE_OBJECT_PLANE);
359 if (!oprops) return; 359 if (!oprops) return;
360 360
361 DBG("\tPlane: %d", pstate->obj_id); 361 DBG("\tPlane: %d", pstate->obj_id);
@@ -364,7 +364,7 @@ _drm2_atomic_state_plane_fill(Ecore_Drm2_Plane_State *pstate, int fd)
364 { 364 {
365 drmModePropertyPtr prop; 365 drmModePropertyPtr prop;
366 366
367 prop = drmModeGetProperty(fd, oprops->props[i]); 367 prop = sym_drmModeGetProperty(fd, oprops->props[i]);
368 if (!prop) continue; 368 if (!prop) continue;
369 369
370 DBG("\t\tProperty: %s", prop->name); 370 DBG("\t\tProperty: %s", prop->name);
@@ -472,10 +472,10 @@ _drm2_atomic_state_plane_fill(Ecore_Drm2_Plane_State *pstate, int fd)
472 } 472 }
473 } 473 }
474 474
475 drmModeFreeProperty(prop); 475 sym_drmModeFreeProperty(prop);
476 } 476 }
477 477
478 drmModeFreeObjectProperties(oprops); 478 sym_drmModeFreeObjectProperties(oprops);
479} 479}
480 480
481static void 481static void
@@ -485,10 +485,10 @@ _drm2_atomic_state_fill(Ecore_Drm2_Atomic_State *state, int fd)
485 drmModeResPtr res; 485 drmModeResPtr res;
486 drmModePlaneResPtr pres; 486 drmModePlaneResPtr pres;
487 487
488 res = drmModeGetResources(fd); 488 res = sym_drmModeGetResources(fd);
489 if (!res) return; 489 if (!res) return;
490 490
491 pres = drmModeGetPlaneResources(fd); 491 pres = sym_drmModeGetPlaneResources(fd);
492 if (!pres) goto err; 492 if (!pres) goto err;
493 493
494 state->crtcs = res->count_crtcs; 494 state->crtcs = res->count_crtcs;
@@ -532,23 +532,23 @@ _drm2_atomic_state_fill(Ecore_Drm2_Atomic_State *state, int fd)
532 drmModePlanePtr plane; 532 drmModePlanePtr plane;
533 Ecore_Drm2_Plane_State *pstate; 533 Ecore_Drm2_Plane_State *pstate;
534 534
535 plane = drmModeGetPlane(fd, pres->planes[i]); 535 plane = sym_drmModeGetPlane(fd, pres->planes[i]);
536 if (!plane) continue; 536 if (!plane) continue;
537 537
538 pstate = &state->plane_states[i]; 538 pstate = &state->plane_states[i];
539 pstate->obj_id = pres->planes[i]; 539 pstate->obj_id = pres->planes[i];
540 pstate->mask = plane->possible_crtcs; 540 pstate->mask = plane->possible_crtcs;
541 541
542 drmModeFreePlane(plane); 542 sym_drmModeFreePlane(plane);
543 543
544 _drm2_atomic_state_plane_fill(pstate, fd); 544 _drm2_atomic_state_plane_fill(pstate, fd);
545 } 545 }
546 } 546 }
547 547
548 drmModeFreePlaneResources(pres); 548 sym_drmModeFreePlaneResources(pres);
549 549
550err: 550err:
551 drmModeFreeResources(res); 551 sym_drmModeFreeResources(res);
552} 552}
553 553
554static void 554static void
@@ -614,15 +614,15 @@ ecore_drm2_device_open(Ecore_Drm2_Device *device)
614 _ecore_drm2_use_atomic = _drm2_atomic_usable(device->fd); 614 _ecore_drm2_use_atomic = _drm2_atomic_usable(device->fd);
615 if (_ecore_drm2_use_atomic) 615 if (_ecore_drm2_use_atomic)
616 { 616 {
617 if (drmSetClientCap(device->fd, DRM_CLIENT_CAP_ATOMIC, 1) < 0) 617 if (sym_drmSetClientCap(device->fd, DRM_CLIENT_CAP_ATOMIC, 1) < 0)
618 { 618 {
619 WRN("Could not enable Atomic Modesetting support"); 619 WRN("Could not enable Atomic Modesetting support");
620 _ecore_drm2_use_atomic = EINA_FALSE; 620 _ecore_drm2_use_atomic = EINA_FALSE;
621 } 621 }
622 else 622 else
623 { 623 {
624 if (drmSetClientCap(device->fd, 624 if (sym_drmSetClientCap(device->fd,
625 DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) < 0) 625 DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1) < 0)
626 WRN("Could not enable Universal Plane support"); 626 WRN("Could not enable Universal Plane support");
627 else 627 else
628 { 628 {
@@ -686,7 +686,7 @@ ecore_drm2_device_clock_id_get(Ecore_Drm2_Device *device)
686 EINA_SAFETY_ON_NULL_RETURN_VAL(device, -1); 686 EINA_SAFETY_ON_NULL_RETURN_VAL(device, -1);
687 EINA_SAFETY_ON_TRUE_RETURN_VAL((device->fd < 0), -1); 687 EINA_SAFETY_ON_TRUE_RETURN_VAL((device->fd < 0), -1);
688 688
689 ret = drmGetCap(device->fd, DRM_CAP_TIMESTAMP_MONOTONIC, &caps); 689 ret = sym_drmGetCap(device->fd, DRM_CAP_TIMESTAMP_MONOTONIC, &caps);
690 if ((ret == 0) && (caps == 1)) 690 if ((ret == 0) && (caps == 1))
691 return CLOCK_MONOTONIC; 691 return CLOCK_MONOTONIC;
692 else 692 else
@@ -705,13 +705,13 @@ ecore_drm2_device_cursor_size_get(Ecore_Drm2_Device *device, int *width, int *he
705 if (width) 705 if (width)
706 { 706 {
707 *width = 64; 707 *width = 64;
708 ret = drmGetCap(device->fd, DRM_CAP_CURSOR_WIDTH, &caps); 708 ret = sym_drmGetCap(device->fd, DRM_CAP_CURSOR_WIDTH, &caps);
709 if (ret == 0) *width = caps; 709 if (ret == 0) *width = caps;
710 } 710 }
711 if (height) 711 if (height)
712 { 712 {
713 *height = 64; 713 *height = 64;
714 ret = drmGetCap(device->fd, DRM_CAP_CURSOR_HEIGHT, &caps); 714 ret = sym_drmGetCap(device->fd, DRM_CAP_CURSOR_HEIGHT, &caps);
715 if (ret == 0) *height = caps; 715 if (ret == 0) *height = caps;
716 } 716 }
717} 717}