aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive/ephyr
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/kdrive/ephyr')
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdriext.c4
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrinit.c11
-rw-r--r--xorg-server/hw/kdrive/ephyr/hostx.c30
3 files changed, 28 insertions, 17 deletions
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
index 3d5cf7721..748b608c2 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
@@ -431,8 +431,8 @@ EphyrDuplicateVisual(unsigned int a_screen,
* extend the list of visual IDs in that entry,
* so to add a_new_id in there.
*/
- vids = realloc(cur_depth->vids,
- (cur_depth->numVids + 1) * sizeof(VisualID));
+ vids = reallocarray(cur_depth->vids,
+ cur_depth->numVids + 1, sizeof(VisualID));
if (!vids) {
EPHYR_LOG_ERROR("failed to realloc numids\n");
goto out;
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
index 897aa1955..8fbaf1d44 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
@@ -52,6 +52,13 @@ void processScreenOrOutputArg(const char *screen_size, const char *output, char
void processOutputArg(const char *output, char *parent_id);
void processScreenArg(const char *screen_size, char *parent_id);
+int
+main(int argc, char *argv[], char *envp[])
+{
+ hostx_use_resname(basename(argv[0]), 0);
+ return dix_main(argc, argv, envp);
+}
+
void
InitCard(char *name)
{
@@ -209,10 +216,6 @@ ddxProcessArgument(int argc, char **argv, int i)
EPHYR_DBG("mark argv[%d]='%s'", i, argv[i]);
- if (i == 1) {
- hostx_use_resname(basename(argv[0]), 0);
- }
-
if (!strcmp(argv[i], "-parent")) {
if (i + 1 < argc) {
int j;
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c
index c67ff60d3..dc265d545 100644
--- a/xorg-server/hw/kdrive/ephyr/hostx.c
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
@@ -129,8 +129,8 @@ hostx_add_screen(KdScreenInfo *screen, unsigned long win_id, int screen_num, Boo
int index = HostX.n_screens;
HostX.n_screens += 1;
- HostX.screens = realloc(HostX.screens,
- HostX.n_screens * sizeof(HostX.screens[0]));
+ HostX.screens = reallocarray(HostX.screens,
+ HostX.n_screens, sizeof(HostX.screens[0]));
HostX.screens[index] = screen;
scrpriv->screen = screen;
@@ -177,7 +177,7 @@ hostx_set_win_title(KdScreenInfo *screen, const char *extra_text)
memset(buf, 0, BUF_LEN + 1);
snprintf(buf, BUF_LEN, "Xephyr on %s.%d %s",
- HostX.server_dpy_name,
+ HostX.server_dpy_name ? HostX.server_dpy_name : ":0",
scrpriv->mynum, (extra_text != NULL) ? extra_text : "");
xcb_icccm_set_wm_name(HostX.conn,
@@ -798,7 +798,7 @@ hostx_screen_init(KdScreenInfo *screen,
}
EPHYR_DBG("host_screen=%p x=%d, y=%d, wxh=%dx%d, buffer_height=%d",
- host_screen, x, y, width, height, buffer_height);
+ screen, x, y, width, height, buffer_height);
if (scrpriv->ximg != NULL) {
/* Free up the image data if previously used
@@ -866,8 +866,13 @@ hostx_screen_init(KdScreenInfo *screen,
~0,
NULL);
+ /* Match server byte order so that the image can be converted to
+ * the native byte order by xcb_image_put() before drawing */
+ if (host_depth_matches_server(scrpriv))
+ scrpriv->ximg->byte_order = IMAGE_BYTE_ORDER;
+
scrpriv->ximg->data =
- malloc(scrpriv->ximg->stride * buffer_height);
+ xallocarray(scrpriv->ximg->stride, buffer_height);
}
{
@@ -933,7 +938,7 @@ hostx_screen_init(KdScreenInfo *screen,
*bits_per_pixel = scrpriv->server_depth;
EPHYR_DBG("server bpp %i", bytes_per_pixel);
- scrpriv->fb_data = malloc (stride * buffer_height);
+ scrpriv->fb_data = xallocarray (stride, buffer_height);
return scrpriv->fb_data;
}
}
@@ -1034,8 +1039,11 @@ hostx_paint_rect(KdScreenInfo *screen,
sx, sy, dx, dy, width, height, FALSE);
}
else {
- xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, scrpriv->ximg,
- dx, dy, 0);
+ /* This is slow and could be done better */
+ xcb_image_t *img = xcb_image_native (HostX.conn, scrpriv->ximg, 1);
+ xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, img, 0, 0, 0);
+ if (scrpriv->ximg != img)
+ xcb_image_destroy(img);
}
xcb_aux_sync(HostX.conn);
@@ -1148,9 +1156,9 @@ hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries)
for (; depths.rem; xcb_depth_next(&depths)) {
xcb_visualtype_t *visuals = xcb_depth_visuals(depths.data);
EphyrHostVisualInfo *tmp_visuals =
- realloc(host_visuals,
- (nb_items + depths.data->visuals_len)
- * sizeof(EphyrHostVisualInfo));
+ reallocarray(host_visuals,
+ nb_items + depths.data->visuals_len,
+ sizeof(EphyrHostVisualInfo));
if (!tmp_visuals) {
goto out;
}