aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Yoo2017-05-09 00:32:30 -0500
committerRichard Yoo2017-05-09 01:08:15 -0500
commitd8ed3020112ded2e210e652f5a8f367d5f847157 (patch)
treea56c761e21902ba6b24df5c5b8168372ab995162 /xf86drmMode.c
parent0da99b8ab0f691ad7ec7f4c5c8a09c5df92486a1 (diff)
parentd4b8344363b4e0f0e831e5722b6df5cc0bb08df8 (diff)
downloadexternal-libgbm-d8ed3020112ded2e210e652f5a8f367d5f847157.tar.gz
external-libgbm-d8ed3020112ded2e210e652f5a8f367d5f847157.tar.xz
external-libgbm-d8ed3020112ded2e210e652f5a8f367d5f847157.zip
Merge tag libdrm-2.4.75 into aosp/master
Below is a brief summary of patches pulled in: 0da99b8a (m/master, aosp/master) Move libdrm.so to vendor partition d4b83443 (tag: libdrm-2.4.75) Bump version for 2.4.75 release dae413e4 (tag: libdrm-2.4.74) Bump version for release 317bdff1 (tag: libdrm-2.4.73) Bump version for release 8cf43127 (tag: libdrm-2.4.72) Bump version for release a44c9c31 (tag: libdrm-2.4.71) Bump version for release 20208455 (tag: android-o-preview-1, tag: android-n-mr2-preview-2, tag: android-n-mr2-preview-1, aosp/sdk-release, aosp/o-preview) add a flag control that private libdrm can be chosen Bug: 35871718 Test: aosp_arm-eng compiles Change-Id: I81985fd41d5c0d8a732705dc2a4bee8eb5d459bb
Diffstat (limited to 'xf86drmMode.c')
-rw-r--r--xf86drmMode.c52
1 files changed, 42 insertions, 10 deletions
diff --git a/xf86drmMode.c b/xf86drmMode.c
index b341f382..e1c99742 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -34,7 +34,7 @@
34 */ 34 */
35 35
36/* 36/*
37 * TODO the types we are after are defined in diffrent headers on diffrent 37 * TODO the types we are after are defined in different headers on different
38 * platforms find which headers to include to get uint32_t 38 * platforms find which headers to include to get uint32_t
39 */ 39 */
40 40
@@ -270,10 +270,10 @@ int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
270 return 0; 270 return 0;
271} 271}
272 272
273int drmModeAddFB2(int fd, uint32_t width, uint32_t height, 273int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
274 uint32_t pixel_format, uint32_t bo_handles[4], 274 uint32_t pixel_format, uint32_t bo_handles[4],
275 uint32_t pitches[4], uint32_t offsets[4], 275 uint32_t pitches[4], uint32_t offsets[4],
276 uint32_t *buf_id, uint32_t flags) 276 uint64_t modifier[4], uint32_t *buf_id, uint32_t flags)
277{ 277{
278 struct drm_mode_fb_cmd2 f; 278 struct drm_mode_fb_cmd2 f;
279 int ret; 279 int ret;
@@ -286,6 +286,8 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
286 memcpy(f.handles, bo_handles, 4 * sizeof(bo_handles[0])); 286 memcpy(f.handles, bo_handles, 4 * sizeof(bo_handles[0]));
287 memcpy(f.pitches, pitches, 4 * sizeof(pitches[0])); 287 memcpy(f.pitches, pitches, 4 * sizeof(pitches[0]));
288 memcpy(f.offsets, offsets, 4 * sizeof(offsets[0])); 288 memcpy(f.offsets, offsets, 4 * sizeof(offsets[0]));
289 if (modifier)
290 memcpy(f.modifier, modifier, 4 * sizeof(modifier[0]));
289 291
290 if ((ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_ADDFB2, &f))) 292 if ((ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_ADDFB2, &f)))
291 return ret; 293 return ret;
@@ -294,6 +296,17 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
294 return 0; 296 return 0;
295} 297}
296 298
299int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
300 uint32_t pixel_format, uint32_t bo_handles[4],
301 uint32_t pitches[4], uint32_t offsets[4],
302 uint32_t *buf_id, uint32_t flags)
303{
304 return drmModeAddFB2WithModifiers(fd, width, height,
305 pixel_format, bo_handles,
306 pitches, offsets, NULL,
307 buf_id, flags);
308}
309
297int drmModeRmFB(int fd, uint32_t bufferId) 310int drmModeRmFB(int fd, uint32_t bufferId)
298{ 311{
299 return DRM_IOCTL(fd, DRM_IOCTL_MODE_RMFB, &bufferId); 312 return DRM_IOCTL(fd, DRM_IOCTL_MODE_RMFB, &bufferId);
@@ -475,12 +488,13 @@ _drmModeGetConnector(int fd, uint32_t connector_id, int probe)
475{ 488{
476 struct drm_mode_get_connector conn, counts; 489 struct drm_mode_get_connector conn, counts;
477 drmModeConnectorPtr r = NULL; 490 drmModeConnectorPtr r = NULL;
491 struct drm_mode_modeinfo stack_mode;
478 492
479 memclear(conn); 493 memclear(conn);
480 conn.connector_id = connector_id; 494 conn.connector_id = connector_id;
481 if (!probe) { 495 if (!probe) {
482 conn.count_modes = 1; 496 conn.count_modes = 1;
483 conn.modes_ptr = VOID2U64(drmMalloc(sizeof(struct drm_mode_modeinfo))); 497 conn.modes_ptr = VOID2U64(&stack_mode);
484 } 498 }
485 499
486 if (drmIoctl(fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn)) 500 if (drmIoctl(fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn))
@@ -504,7 +518,7 @@ retry:
504 goto err_allocs; 518 goto err_allocs;
505 } else { 519 } else {
506 conn.count_modes = 1; 520 conn.count_modes = 1;
507 conn.modes_ptr = VOID2U64(drmMalloc(sizeof(struct drm_mode_modeinfo))); 521 conn.modes_ptr = VOID2U64(&stack_mode);
508 } 522 }
509 523
510 if (conn.count_encoders) { 524 if (conn.count_encoders) {
@@ -525,7 +539,8 @@ retry:
525 counts.count_encoders < conn.count_encoders) { 539 counts.count_encoders < conn.count_encoders) {
526 drmFree(U642VOID(conn.props_ptr)); 540 drmFree(U642VOID(conn.props_ptr));
527 drmFree(U642VOID(conn.prop_values_ptr)); 541 drmFree(U642VOID(conn.prop_values_ptr));
528 drmFree(U642VOID(conn.modes_ptr)); 542 if (U642VOID(conn.modes_ptr) != &stack_mode)
543 drmFree(U642VOID(conn.modes_ptr));
529 drmFree(U642VOID(conn.encoders_ptr)); 544 drmFree(U642VOID(conn.encoders_ptr));
530 545
531 goto retry; 546 goto retry;
@@ -567,7 +582,8 @@ retry:
567err_allocs: 582err_allocs:
568 drmFree(U642VOID(conn.prop_values_ptr)); 583 drmFree(U642VOID(conn.prop_values_ptr));
569 drmFree(U642VOID(conn.props_ptr)); 584 drmFree(U642VOID(conn.props_ptr));
570 drmFree(U642VOID(conn.modes_ptr)); 585 if (U642VOID(conn.modes_ptr) != &stack_mode)
586 drmFree(U642VOID(conn.modes_ptr));
571 drmFree(U642VOID(conn.encoders_ptr)); 587 drmFree(U642VOID(conn.encoders_ptr));
572 588
573 return r; 589 return r;
@@ -885,7 +901,7 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
885 901
886 i = 0; 902 i = 0;
887 while (i < len) { 903 while (i < len) {
888 e = (struct drm_event *) &buffer[i]; 904 e = (struct drm_event *)(buffer + i);
889 switch (e->type) { 905 switch (e->type) {
890 case DRM_EVENT_VBLANK: 906 case DRM_EVENT_VBLANK:
891 if (evctx->version < 1 || 907 if (evctx->version < 1 ||
@@ -932,6 +948,22 @@ int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,
932 return DRM_IOCTL(fd, DRM_IOCTL_MODE_PAGE_FLIP, &flip); 948 return DRM_IOCTL(fd, DRM_IOCTL_MODE_PAGE_FLIP, &flip);
933} 949}
934 950
951int drmModePageFlipTarget(int fd, uint32_t crtc_id, uint32_t fb_id,
952 uint32_t flags, void *user_data,
953 uint32_t target_vblank)
954{
955 struct drm_mode_crtc_page_flip_target flip_target;
956
957 memclear(flip_target);
958 flip_target.fb_id = fb_id;
959 flip_target.crtc_id = crtc_id;
960 flip_target.user_data = VOID2U64(user_data);
961 flip_target.flags = flags;
962 flip_target.sequence = target_vblank;
963
964 return DRM_IOCTL(fd, DRM_IOCTL_MODE_PAGE_FLIP, &flip_target);
965}
966
935int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id, 967int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
936 uint32_t fb_id, uint32_t flags, 968 uint32_t fb_id, uint32_t flags,
937 int32_t crtc_x, int32_t crtc_y, 969 int32_t crtc_x, int32_t crtc_y,