aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/kdrive')
-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
-rw-r--r--xorg-server/hw/kdrive/fake/Makefile.am1
-rw-r--r--xorg-server/hw/kdrive/fake/fake.c2
-rw-r--r--xorg-server/hw/kdrive/fbdev/Makefile.am1
-rw-r--r--xorg-server/hw/kdrive/fbdev/fbdev.c2
-rw-r--r--xorg-server/hw/kdrive/src/kshadow.c2
-rw-r--r--xorg-server/hw/kdrive/src/kxv.c4
9 files changed, 35 insertions, 22 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;
}
diff --git a/xorg-server/hw/kdrive/fake/Makefile.am b/xorg-server/hw/kdrive/fake/Makefile.am
index 14c99c3cc..d28bd2752 100644
--- a/xorg-server/hw/kdrive/fake/Makefile.am
+++ b/xorg-server/hw/kdrive/fake/Makefile.am
@@ -18,6 +18,7 @@ Xfake_SOURCES = \
Xfake_LDADD = \
libfake.la \
+ @KDRIVE_MAIN_LIB@ \
@KDRIVE_LIBS@
Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
diff --git a/xorg-server/hw/kdrive/fake/fake.c b/xorg-server/hw/kdrive/fake/fake.c
index 90e3ec9a6..04a727897 100644
--- a/xorg-server/hw/kdrive/fake/fake.c
+++ b/xorg-server/hw/kdrive/fake/fake.c
@@ -158,7 +158,7 @@ fakeMapFramebuffer(KdScreenInfo * screen)
priv->bytes_per_line =
((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
free(priv->base);
- priv->base = malloc(priv->bytes_per_line * screen->height);
+ priv->base = xallocarray(priv->bytes_per_line, screen->height);
if (scrpriv->shadow) {
if (!KdShadowFbAlloc
diff --git a/xorg-server/hw/kdrive/fbdev/Makefile.am b/xorg-server/hw/kdrive/fbdev/Makefile.am
index 7e8ba024c..d550c1391 100644
--- a/xorg-server/hw/kdrive/fbdev/Makefile.am
+++ b/xorg-server/hw/kdrive/fbdev/Makefile.am
@@ -16,6 +16,7 @@ Xfbdev_SOURCES = \
Xfbdev_LDADD = \
libfbdev.la \
+ @KDRIVE_MAIN_LIB@ \
@KDRIVE_LIBS@
Xfbdev_DEPENDENCIES = \
diff --git a/xorg-server/hw/kdrive/fbdev/fbdev.c b/xorg-server/hw/kdrive/fbdev/fbdev.c
index 95f64cbef..23f750924 100644
--- a/xorg-server/hw/kdrive/fbdev/fbdev.c
+++ b/xorg-server/hw/kdrive/fbdev/fbdev.c
@@ -677,7 +677,7 @@ fbdevCreateColormap(ColormapPtr pmap)
case FB_VISUAL_STATIC_PSEUDOCOLOR:
pVisual = pmap->pVisual;
nent = pVisual->ColormapEntries;
- pdefs = malloc(nent * sizeof(xColorItem));
+ pdefs = xallocarray(nent, sizeof(xColorItem));
if (!pdefs)
return FALSE;
for (i = 0; i < nent; i++)
diff --git a/xorg-server/hw/kdrive/src/kshadow.c b/xorg-server/hw/kdrive/src/kshadow.c
index 828ea19a6..7f1e2ee19 100644
--- a/xorg-server/hw/kdrive/src/kshadow.c
+++ b/xorg-server/hw/kdrive/src/kshadow.c
@@ -36,7 +36,7 @@ KdShadowFbAlloc(KdScreenInfo * screen, Bool rotate)
/* use fb computation for width */
paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
- buf = malloc(paddedWidth * height);
+ buf = xallocarray(paddedWidth, height);
if (!buf)
return FALSE;
if (screen->fb.shadow)
diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c
index 369db3332..844deca0d 100644
--- a/xorg-server/hw/kdrive/src/kxv.c
+++ b/xorg-server/hw/kdrive/src/kxv.c
@@ -327,8 +327,8 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr infoPtr, int number)
void *moreSpace;
totFormat *= 2;
- moreSpace = realloc(pFormat,
- totFormat * sizeof(XvFormatRec));
+ moreSpace = reallocarray(pFormat, totFormat,
+ sizeof(XvFormatRec));
if (!moreSpace)
break;
pFormat = moreSpace;