summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qxl.h8
-rw-r--r--src/qxl_cursor.c4
-rw-r--r--src/qxl_driver.c42
-rw-r--r--src/uxa/uxa-accel.c14
-rw-r--r--src/uxa/uxa-glyphs.c18
-rw-r--r--src/uxa/uxa-priv.h5
-rw-r--r--src/uxa/uxa-render.c4
-rw-r--r--src/uxa/uxa.c10
8 files changed, 52 insertions, 53 deletions
diff --git a/src/qxl.h b/src/qxl.h
index 40f70a5..678a0f2 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -810,19 +810,11 @@ void qxl_surface_copy (qxl_surface_t *dest,
int dest_x1, int dest_y1,
int width, int height);
-#if HAS_DEVPRIVATEKEYREC
extern DevPrivateKeyRec uxa_pixmap_index;
-#else
-extern int uxa_pixmap_index;
-#endif
static inline qxl_surface_t *get_surface (PixmapPtr pixmap)
{
-#if HAS_DEVPRIVATEKEYREC
return dixGetPrivate(&pixmap->devPrivates, &uxa_pixmap_index);
-#else
- return dixLookupPrivate(&pixmap->devPrivates, &uxa_pixmap_index);
-#endif
}
static inline void set_surface (PixmapPtr pixmap, qxl_surface_t *surface)
diff --git a/src/qxl_cursor.c b/src/qxl_cursor.c
index 1e19eba..475796e 100644
--- a/src/qxl_cursor.c
+++ b/src/qxl_cursor.c
@@ -176,7 +176,7 @@ qxl_cursor_init(ScreenPtr pScreen)
{
xf86CursorInfoPtr cursor;
- cursor = xcalloc(1, sizeof(xf86CursorInfoRec));
+ cursor = calloc(1, sizeof(xf86CursorInfoRec));
if (!cursor)
return;
@@ -192,5 +192,5 @@ qxl_cursor_init(ScreenPtr pScreen)
cursor->ShowCursor = qxl_show_cursor;
if (!xf86InitCursor(pScreen, cursor))
- xfree(cursor);
+ free(cursor);
}
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index bb20522..9c1377d 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -284,7 +284,7 @@ qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
pScrn->vtSema = FALSE;
ErrorF ("Freeing %p\n", qxl->fb);
- xfree(qxl->fb);
+ free(qxl->fb);
qxl->fb = NULL;
pScreen->CreateScreenResources = qxl->create_screen_resources;
@@ -404,6 +404,8 @@ qxl_switch_mode(int scrnIndex, DisplayModePtr p, int flags)
qxl_reset (qxl);
+ ErrorF ("done reset\n");
+
qxl->primary = qxl_surface_create_primary (qxl, m);
qxl->current_mode = m;
qxl->bytes_per_pixel = (qxl->pScrn->bitsPerPixel + 7) / 8;
@@ -860,11 +862,7 @@ qxl_create_gc (GCPtr pGC)
return TRUE;
}
-#if HAS_DEVPRIVATEKEYREC
DevPrivateKeyRec uxa_pixmap_index;
-#else
-int uxa_pixmap_index;
-#endif
static Bool
unaccel (void)
@@ -1008,8 +1006,6 @@ qxl_done_copy (PixmapPtr dest)
static void
qxl_set_screen_pixmap (PixmapPtr pixmap)
{
- ErrorF ("asdf\n");
-
pixmap->drawable.pScreen->devPrivate = pixmap;
}
@@ -1070,14 +1066,14 @@ static Bool
setup_uxa (qxl_screen_t *qxl, ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
-
- if (!dixRequestPrivate(&uxa_pixmap_index, 0))
+
+ if (!dixRegisterPrivateKey(&uxa_pixmap_index, PRIVATE_PIXMAP, 0))
return FALSE;
qxl->uxa = uxa_driver_alloc();
if (qxl->uxa == NULL)
return FALSE;
-
+
memset(qxl->uxa, 0, sizeof(*qxl->uxa));
qxl->uxa->uxa_major = 1;
@@ -1124,6 +1120,8 @@ setup_uxa (qxl_screen_t *qxl, ScreenPtr screen)
return FALSE;
}
+
+
#if 0
uxa_set_fallback_debug(screen, FALSE);
#endif
@@ -1174,12 +1172,14 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn->displayWidth = pScrn->virtualX;
- qxl->fb = xcalloc (pScrn->virtualY * pScrn->displayWidth, 4);
+ qxl->fb = calloc (pScrn->virtualY * pScrn->displayWidth, 4);
if (!qxl->fb)
goto out;
ErrorF ("allocated %d x %d %p\n", pScrn->virtualX, pScrn->virtualY, qxl->fb);
+ pScreen->totalPixmapSize = 100;
+
if (!fbScreenInit(pScreen, qxl->fb,
pScrn->virtualX, pScrn->virtualY,
pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
@@ -1208,6 +1208,7 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Set up resources */
qxl_reset (qxl);
+ ErrorF ("done reset\n");
qxl->io_pages = (void *)((unsigned long)qxl->ram);
qxl->io_pages_physical = (void *)((unsigned long)qxl->ram_physical);
@@ -1227,6 +1228,16 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* xf86DPMSInit(pScreen, xf86DPMSSet, 0); */
pScreen->SaveScreen = qxl_blank_screen;
+
+ /* Note: this must be done before setup_uxa(), because it
+ * calls DamageSetup() which registers a pixmap private.
+ *
+ * That will trigger an assert if _dixInitPrivates has
+ * been called, which setup_uxa() eventually does.
+ */
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+ if (!miCreateDefColormap(pScreen))
+ goto out;
setup_uxa (qxl, pScreen);
@@ -1236,11 +1247,6 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
qxl->close_screen = pScreen->CloseScreen;
pScreen->CloseScreen = qxl_close_screen;
- miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
-
- if (!miCreateDefColormap(pScreen))
- goto out;
-
qxl_cursor_init (pScreen);
CHECK_POINT();
@@ -1535,9 +1541,9 @@ qxl_pre_init(ScrnInfoPtr pScrn, int flags)
out:
if (clockRanges)
- xfree(clockRanges);
+ free(clockRanges);
if (qxl)
- xfree(qxl);
+ free(qxl);
return FALSE;
}
diff --git a/src/uxa/uxa-accel.c b/src/uxa/uxa-accel.c
index 49870ed..62034c2 100644
--- a/src/uxa/uxa-accel.c
+++ b/src/uxa/uxa-accel.c
@@ -661,7 +661,7 @@ uxa_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
return;
}
- prect = xalloc(sizeof(xRectangle) * npt);
+ prect = malloc(sizeof(xRectangle) * npt);
if (!prect)
return;
for (i = 0; i < npt; i++) {
@@ -675,7 +675,7 @@ uxa_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
prect[i].height = 1;
}
pGC->ops->PolyFillRect(pDrawable, pGC, npt, prect);
- xfree(prect);
+ free(prect);
}
/**
@@ -698,7 +698,7 @@ uxa_poly_lines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
return;
}
- prect = xalloc(sizeof(xRectangle) * (npt - 1));
+ prect = malloc(sizeof(xRectangle) * (npt - 1));
if (!prect)
return;
x1 = ppt[0].x;
@@ -714,7 +714,7 @@ uxa_poly_lines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
}
if (x1 != x2 && y1 != y2) {
- xfree(prect);
+ free(prect);
uxa_check_poly_lines(pDrawable, pGC, mode, npt, ppt);
return;
}
@@ -738,7 +738,7 @@ uxa_poly_lines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
y1 = y2;
}
pGC->ops->PolyFillRect(pDrawable, pGC, npt - 1, prect);
- xfree(prect);
+ free(prect);
}
/**
@@ -767,7 +767,7 @@ uxa_poly_segment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg)
}
}
- prect = xalloc(sizeof(xRectangle) * nseg);
+ prect = malloc(sizeof(xRectangle) * nseg);
if (!prect)
return;
for (i = 0; i < nseg; i++) {
@@ -795,7 +795,7 @@ uxa_poly_segment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg)
}
}
pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect);
- xfree(prect);
+ free(prect);
}
static Bool uxa_fill_region_solid(DrawablePtr pDrawable, RegionPtr pRegion,
diff --git a/src/uxa/uxa-glyphs.c b/src/uxa/uxa-glyphs.c
index a592fda..8bd4fc8 100644
--- a/src/uxa/uxa-glyphs.c
+++ b/src/uxa/uxa-glyphs.c
@@ -83,16 +83,16 @@ struct uxa_glyph {
uint16_t size, pos;
};
-static int uxa_glyph_index;
+static DevPrivateKeyRec uxa_glyph_key;
static inline struct uxa_glyph *uxa_glyph_get_private(GlyphPtr glyph)
{
- return dixLookupPrivate(&glyph->devPrivates, &uxa_glyph_index);
+ return dixGetPrivate(&glyph->devPrivates, &uxa_glyph_key);
}
static inline void uxa_glyph_set_private(GlyphPtr glyph, struct uxa_glyph *priv)
{
- dixSetPrivate(&glyph->devPrivates, &uxa_glyph_index, priv);
+ dixSetPrivate(&glyph->devPrivates, &uxa_glyph_key, priv);
}
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
@@ -109,7 +109,7 @@ static void uxa_unrealize_glyph_caches(ScreenPtr pScreen)
FreePicture(cache->picture, 0);
if (cache->glyphs)
- xfree(cache->glyphs);
+ free(cache->glyphs);
}
}
@@ -172,7 +172,7 @@ static Bool uxa_realize_glyph_caches(ScreenPtr pScreen)
ValidatePicture(picture);
cache->picture = picture;
- cache->glyphs = xcalloc(sizeof(GlyphPtr), GLYPH_CACHE_SIZE);
+ cache->glyphs = calloc(sizeof(GlyphPtr), GLYPH_CACHE_SIZE);
if (!cache->glyphs)
goto bail;
@@ -190,7 +190,7 @@ bail:
Bool uxa_glyphs_init(ScreenPtr pScreen)
{
- if (!dixRequestPrivate(&uxa_glyph_index, 0))
+ if (!dixRegisterPrivateKey(&uxa_glyph_key, PRIVATE_GLYPH, 0))
return FALSE;
if (!uxa_realize_glyph_caches(pScreen))
@@ -286,7 +286,7 @@ uxa_glyph_unrealize(ScreenPtr pScreen,
priv->cache->glyphs[priv->pos] = NULL;
uxa_glyph_set_private(pGlyph, NULL);
- xfree(priv);
+ free(priv);
}
/* Cut and paste from render/glyph.c - probably should export it instead */
@@ -588,7 +588,7 @@ uxa_glyph_cache(ScreenPtr screen, GlyphPtr glyph, int *out_x, int *out_y)
GlyphPtr evicted = cache->glyphs[pos + s];
if (evicted != NULL) {
if (priv != NULL)
- xfree(priv);
+ free(priv);
priv = uxa_glyph_get_private(evicted);
uxa_glyph_set_private(evicted, NULL);
@@ -602,7 +602,7 @@ uxa_glyph_cache(ScreenPtr screen, GlyphPtr glyph, int *out_x, int *out_y)
}
if (priv == NULL) {
- priv = xalloc(sizeof(struct uxa_glyph));
+ priv = malloc(sizeof(struct uxa_glyph));
if (priv == NULL)
return NULL;
}
diff --git a/src/uxa/uxa-priv.h b/src/uxa/uxa-priv.h
index 3ea6810..21c1623 100644
--- a/src/uxa/uxa-priv.h
+++ b/src/uxa/uxa-priv.h
@@ -158,11 +158,10 @@ typedef struct {
(PixmapWidthPaddingInfo[d].padRoundUp+1)))
#endif
-extern int uxa_screen_index;
+extern DevPrivateKeyRec uxa_screen_index;
static inline uxa_screen_t *uxa_get_screen(ScreenPtr screen)
{
- return (uxa_screen_t *) dixLookupPrivate(&screen->devPrivates,
- &uxa_screen_index);
+ return dixGetPrivate (&screen->devPrivates, &uxa_screen_index);
}
/** Align an offset to an arbitrary alignment */
diff --git a/src/uxa/uxa-render.c b/src/uxa/uxa-render.c
index beb7f7c..ac80c45 100644
--- a/src/uxa/uxa-render.c
+++ b/src/uxa/uxa-render.c
@@ -911,7 +911,7 @@ _pixman_region_init_rectangles(pixman_region16_t *region,
int i;
if (num_rects > sizeof(stack_boxes) / sizeof(stack_boxes[0])) {
- boxes = xalloc(sizeof(pixman_box16_t) * num_rects);
+ boxes = malloc(sizeof(pixman_box16_t) * num_rects);
if (boxes == NULL)
return FALSE;
}
@@ -926,7 +926,7 @@ _pixman_region_init_rectangles(pixman_region16_t *region,
ret = pixman_region_init_rects(region, boxes, num_rects);
if (boxes != stack_boxes)
- xfree(boxes);
+ free(boxes);
return ret;
}
diff --git a/src/uxa/uxa.c b/src/uxa/uxa.c
index bfc700d..da67b8d 100644
--- a/src/uxa/uxa.c
+++ b/src/uxa/uxa.c
@@ -39,7 +39,7 @@
#include "dixfontstr.h"
#include "uxa.h"
-int uxa_screen_index;
+DevPrivateKeyRec uxa_screen_index;
/**
* uxa_get_drawable_pixmap() returns a backing pixmap for a given drawable.
@@ -431,7 +431,7 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
}
#endif
- xfree(uxa_screen);
+ free(uxa_screen);
return (*pScreen->CloseScreen) (i, pScreen);
}
@@ -448,7 +448,7 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
*/
uxa_driver_t *uxa_driver_alloc(void)
{
- return xcalloc(1, sizeof(uxa_driver_t));
+ return calloc(1, sizeof(uxa_driver_t));
}
/**
@@ -493,7 +493,9 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
"non-NULL\n", screen->myNum);
return FALSE;
}
- uxa_screen = xcalloc(sizeof(uxa_screen_t), 1);
+ if (!dixRegisterPrivateKey(&uxa_screen_index, PRIVATE_SCREEN, 0))
+ return FALSE;
+ uxa_screen = calloc(sizeof(uxa_screen_t), 1);
if (!uxa_screen) {
LogMessage(X_WARNING,