mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 05:30:24 +00:00
dm: vdisplay: multi-vdisplay support.
Allow one VM have more than 1 virtual display for output. Till now, the max virtual display number is 2. So guest VM can use dual display for mirror and extend desktop mode. To specify multi-vdisplay, need use acrn-dm parameters like this: For fullscreen mode: virtio-gpu,geometry=fullscreen:monitor_id1,geometry=fullscreen:monitor_id2 For window mode: virtio-gpu,geometry=<width>x<height>+<x_off>+<y_off>,geometry=<width>x<height>+<x_off>+<y_off> v1->v2: add pscreen_id outputs for easier debugging. 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
ac294c59dd
commit
65f479c73b
@ -32,7 +32,7 @@
|
|||||||
#define VDPY_MIN_WIDTH 640
|
#define VDPY_MIN_WIDTH 640
|
||||||
#define VDPY_MIN_HEIGHT 480
|
#define VDPY_MIN_HEIGHT 480
|
||||||
#define transto_10bits(color) (uint16_t)(color * 1024 + 0.5)
|
#define transto_10bits(color) (uint16_t)(color * 1024 + 0.5)
|
||||||
#define VSCREEN_MAX_NUM 1
|
#define VSCREEN_MAX_NUM 2
|
||||||
|
|
||||||
static unsigned char default_raw_argb[VDPY_DEFAULT_WIDTH * VDPY_DEFAULT_HEIGHT * 4];
|
static unsigned char default_raw_argb[VDPY_DEFAULT_WIDTH * VDPY_DEFAULT_HEIGHT * 4];
|
||||||
|
|
||||||
@ -1323,7 +1323,7 @@ gfx_ui_deinit()
|
|||||||
|
|
||||||
int vdpy_parse_cmd_option(const char *opts)
|
int vdpy_parse_cmd_option(const char *opts)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str, *stropts, *tmp;
|
||||||
int snum, error;
|
int snum, error;
|
||||||
struct vscreen *vscr;
|
struct vscreen *vscr;
|
||||||
|
|
||||||
@ -1331,10 +1331,12 @@ int vdpy_parse_cmd_option(const char *opts)
|
|||||||
vdpy.vscrs = calloc(VSCREEN_MAX_NUM, sizeof(struct vscreen));
|
vdpy.vscrs = calloc(VSCREEN_MAX_NUM, sizeof(struct vscreen));
|
||||||
vdpy.vscrs_num = 0;
|
vdpy.vscrs_num = 0;
|
||||||
|
|
||||||
str = strcasestr(opts, "geometry=");
|
stropts = strdup(opts);
|
||||||
|
while ((str = strsep(&stropts, ",")) != NULL) {
|
||||||
vscr = vdpy.vscrs + vdpy.vscrs_num;
|
vscr = vdpy.vscrs + vdpy.vscrs_num;
|
||||||
if (opts && strcasestr(opts, "geometry=fullscreen")) {
|
tmp = strcasestr(str, "geometry=");
|
||||||
snum = sscanf(str, "geometry=fullscreen:%d", &vscr->pscreen_id);
|
if (str && strcasestr(str, "geometry=fullscreen")) {
|
||||||
|
snum = sscanf(tmp, "geometry=fullscreen:%d", &vscr->pscreen_id);
|
||||||
if (snum != 1) {
|
if (snum != 1) {
|
||||||
vscr->pscreen_id = 0;
|
vscr->pscreen_id = 0;
|
||||||
}
|
}
|
||||||
@ -1343,10 +1345,11 @@ int vdpy_parse_cmd_option(const char *opts)
|
|||||||
vscr->guest_width = VDPY_MAX_WIDTH;
|
vscr->guest_width = VDPY_MAX_WIDTH;
|
||||||
vscr->guest_height = VDPY_MAX_HEIGHT;
|
vscr->guest_height = VDPY_MAX_HEIGHT;
|
||||||
vscr->is_fullscreen = true;
|
vscr->is_fullscreen = true;
|
||||||
|
pr_info("virtual display: fullscreen on monitor %d.\n",
|
||||||
|
vscr->pscreen_id);
|
||||||
vdpy.vscrs_num++;
|
vdpy.vscrs_num++;
|
||||||
pr_info("virtual display: fullscreen.\n");
|
} else if (str && strcasestr(str, "geometry=")) {
|
||||||
} else if (opts && strcasestr(opts, "geometry=")) {
|
snum = sscanf(tmp, "geometry=%dx%d+%d+%d",
|
||||||
snum = sscanf(str, "geometry=%dx%d+%d+%d",
|
|
||||||
&vscr->guest_width, &vscr->guest_height,
|
&vscr->guest_width, &vscr->guest_height,
|
||||||
&vscr->org_x, &vscr->org_y);
|
&vscr->org_x, &vscr->org_y);
|
||||||
if (snum != 4) {
|
if (snum != 4) {
|
||||||
@ -1355,9 +1358,18 @@ int vdpy_parse_cmd_option(const char *opts)
|
|||||||
error = -1;
|
error = -1;
|
||||||
}
|
}
|
||||||
vscr->is_fullscreen = false;
|
vscr->is_fullscreen = false;
|
||||||
|
vscr->pscreen_id = 0;
|
||||||
|
pr_info("virtual display: windowed on monitor %d.\n",
|
||||||
|
vscr->pscreen_id);
|
||||||
vdpy.vscrs_num++;
|
vdpy.vscrs_num++;
|
||||||
pr_info("virtual display: windowed.\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vdpy.vscrs_num > VSCREEN_MAX_NUM) {
|
||||||
|
pr_err("%d virtual displays are too many that acrn-dm can't support!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(stropts);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user