dm: vdisplay: Add physical monitor id check.
vdisplay use physical monitor id(pscreen index) to locate the monitor. The max index value always is the physical monitor number - 1. For example, there are 4 physical monitors connected. The monitor id should be 0, 1, 2 and 3. We need check monitor id that user inputs and make sure it is in a correct range. Tracked-On: #7988 Signed-off-by: Sun Peng <peng.p.sun@linux.intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
This commit is contained in:
parent
ddf35fb016
commit
6f22afd9e9
|
@ -1151,6 +1151,7 @@ int
|
|||
gfx_ui_init()
|
||||
{
|
||||
SDL_SysWMinfo info;
|
||||
int num_pscreen;
|
||||
|
||||
setenv("SDL_VIDEO_X11_FORCE_EGL", "1", 1);
|
||||
setenv("SDL_OPENGL_ES_DRIVER", "1", 1);
|
||||
|
@ -1162,6 +1163,14 @@ gfx_ui_init()
|
|||
return -1;
|
||||
}
|
||||
|
||||
num_pscreen = SDL_GetNumVideoDisplays();
|
||||
if (vdpy.pscreen_id >= num_pscreen) {
|
||||
pr_err("Monitor id %d is out of avalble range [0~%d].\n",
|
||||
vdpy.pscreen_id, num_pscreen);
|
||||
SDL_Quit();
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_GetDisplayBounds(vdpy.pscreen_id, &vdpy.pscreen_rect);
|
||||
|
||||
if (vdpy.pscreen_rect.w < VDPY_MIN_WIDTH ||
|
||||
|
|
Loading…
Reference in New Issue