summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-04-19 14:56:27 -0400
committerChris Michael <cp.michael@samsung.com>2017-04-19 14:58:11 -0400
commitc4b22eb59c8003a2975b26186a818fc4f1aefb1b (patch)
tree86c57056e85237381b8cae9db46747ef9d635bba /src/lib/ecore_drm2
parent8eb1e925ae1abf6c58b26003435f07662bd381d9 (diff)
ecore-drm2: Iterate plane formats properly
This patch addresses an issue where plane formats were not being properly copied into our Plane State structure and causing any usage of our atomic code paths to crash and burn @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_drm2')
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_device.c9
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_private.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index 74284c4502..a771091a52 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -527,6 +527,8 @@ _drm2_atomic_state_fill(Ecore_Drm2_Atomic_State *state, int fd)
527 state->plane_states = calloc(state->planes, sizeof(Ecore_Drm2_Plane_State)); 527 state->plane_states = calloc(state->planes, sizeof(Ecore_Drm2_Plane_State));
528 if (state->plane_states) 528 if (state->plane_states)
529 { 529 {
530 unsigned int f = 0;
531
530 for (i = 0; i < state->planes; i++) 532 for (i = 0; i < state->planes; i++)
531 { 533 {
532 drmModePlanePtr plane; 534 drmModePlanePtr plane;
@@ -539,8 +541,11 @@ _drm2_atomic_state_fill(Ecore_Drm2_Atomic_State *state, int fd)
539 pstate->obj_id = pres->planes[i]; 541 pstate->obj_id = pres->planes[i];
540 pstate->mask = plane->possible_crtcs; 542 pstate->mask = plane->possible_crtcs;
541 pstate->num_formats = plane->count_formats; 543 pstate->num_formats = plane->count_formats;
542 memcpy(pstate->formats, plane->formats, 544
543 plane->count_formats * sizeof(plane->formats[0])); 545 pstate->formats = calloc(plane->count_formats, sizeof(uint32_t));
546
547 for (f = 0; f < plane->count_formats; f++)
548 pstate->formats[f] = plane->formats[f];
544 549
545 sym_drmModeFreePlane(plane); 550 sym_drmModeFreePlane(plane);
546 551
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 7bc69bf460..73e61f2431 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -649,7 +649,7 @@ typedef struct _Ecore_Drm2_Plane_State
649 uint32_t supported_rotations; 649 uint32_t supported_rotations;
650 650
651 uint32_t num_formats; 651 uint32_t num_formats;
652 uint32_t formats[]; 652 uint32_t *formats;
653} Ecore_Drm2_Plane_State; 653} Ecore_Drm2_Plane_State;
654 654
655struct _Ecore_Drm2_Atomic_State 655struct _Ecore_Drm2_Atomic_State