backends/drm: explicitly initialize all fields of drmModeModeInfo

This commit is contained in:
Xaver Hugl 2022-07-24 00:05:04 +02:00
parent bf6990da45
commit f0d59b078b

View file

@ -445,20 +445,22 @@ std::shared_ptr<DrmConnectorMode> DrmConnector::generateMode(const QSize &size,
{ {
auto modeInfo = libxcvt_gen_mode_info(size.width(), size.height(), refreshRate, false, false); auto modeInfo = libxcvt_gen_mode_info(size.width(), size.height(), refreshRate, false, false);
drmModeModeInfo mode; drmModeModeInfo mode{
mode.vdisplay = modeInfo->vdisplay; .clock = uint32_t(modeInfo->dot_clock),
mode.hdisplay = modeInfo->hdisplay; .hdisplay = uint16_t(modeInfo->hdisplay),
mode.clock = modeInfo->dot_clock; .hsync_start = modeInfo->hsync_start,
mode.hsync_start = modeInfo->hsync_start; .hsync_end = modeInfo->hsync_end,
mode.hsync_end = modeInfo->hsync_end; .htotal = modeInfo->htotal,
mode.htotal = modeInfo->htotal; .vdisplay = uint16_t(modeInfo->vdisplay),
mode.vsync_start = modeInfo->vsync_start; .vsync_start = modeInfo->vsync_start,
mode.vsync_end = modeInfo->vsync_end; .vsync_end = modeInfo->vsync_end,
mode.vtotal = modeInfo->vtotal; .vtotal = modeInfo->vtotal,
mode.vrefresh = modeInfo->vrefresh; .vscan = 1,
mode.flags = modeInfo->mode_flags; .vrefresh = uint32_t(modeInfo->vrefresh),
.flags = modeInfo->mode_flags,
.type = DRM_MODE_TYPE_USERDEF,
};
mode.type = DRM_MODE_TYPE_USERDEF;
sprintf(mode.name, "%dx%d@%d", size.width(), size.height(), mode.vrefresh); sprintf(mode.name, "%dx%d@%d", size.width(), size.height(), mode.vrefresh);
free(modeInfo); free(modeInfo);