From 46810bd66750288bf04cab0806ae03ae2e0c9deb Mon Sep 17 00:00:00 2001 From: Eric Chanudet Date: Tue, 16 Jul 2019 16:30:13 -0400 Subject: [PATCH] drm: Initialize offset with psurface. Also memset() the psurface. This used to let uninitialized values being printed through DRM_DEBUG. Signed-off-by: Eric Chanudet (cherry picked from commit 694546b3afcdcb9d50725f05a5cc166b1e385ee1) Signed-off-by: Eric Chanudet --- plugins/drm/src/drm-plugin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/drm/src/drm-plugin.c b/plugins/drm/src/drm-plugin.c index 58fed36..15172dc 100644 --- a/plugins/drm/src/drm-plugin.c +++ b/plugins/drm/src/drm-plugin.c @@ -276,7 +276,7 @@ INTERNAL surfman_psurface_t drmp_get_psurface_from_surface(surfman_plugin_t *plu (void) plugin; struct drm_surface *s; - s = malloc(sizeof (*s)); + s = calloc(1, sizeof (*s)); if (!s) { DRM_ERR("Could not allocate memory (%s).", strerror(errno)); return NULL; @@ -292,6 +292,7 @@ INTERNAL surfman_psurface_t drmp_get_psurface_from_surface(surfman_plugin_t *plu } s->fb.pitch = surfman_surface->stride; s->fb.size = surfman_surface->page_count * XC_PAGE_SIZE; + s->fb.offset = surfman_surface->offset; s->fb.map = surface_map(surfman_surface); s->domid = surfman_surface->pages_domid;