mirror of
https://github.com/X11Libre/xf86-video-vmware.git
synced 2026-03-23 17:19:24 +00:00
use new pixmap lifecycle api
Use server's new lifecycle API. That's an important step in order to decouple ourselves from the old, fragile proc wrapping. Without it, the driver might not work on newer Xservers anymore. For old Xservers adding a fallback. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
@@ -617,7 +617,7 @@ saa_early_close_screen(CLOSE_SCREEN_ARGS_DECL)
|
||||
* is the last chance we have of releasing our resources
|
||||
* associated with the Pixmap. So do it first.
|
||||
*/
|
||||
dixDestroyPixmap(pScreen->devPrivate, 0);
|
||||
dixPixmapPut(pScreen->devPrivate);
|
||||
pScreen->devPrivate = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ saa_create_alpha_picture(ScreenPtr pScreen,
|
||||
PicturePtr pDst,
|
||||
PictFormatPtr pPictFormat, CARD16 width, CARD16 height)
|
||||
{
|
||||
PixmapPtr pPixmap;
|
||||
PicturePtr pPicture;
|
||||
GCPtr pGC;
|
||||
int error;
|
||||
@@ -61,13 +60,12 @@ saa_create_alpha_picture(ScreenPtr pScreen,
|
||||
return 0;
|
||||
}
|
||||
|
||||
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
|
||||
pPictFormat->depth, 0);
|
||||
PixmapPtr pPixmap = dixPixmapCreate(pScreen, width, height, pPictFormat->depth, 0);
|
||||
if (!pPixmap)
|
||||
return 0;
|
||||
pGC = GetScratchGC(pPixmap->drawable.depth, pScreen);
|
||||
if (!pGC) {
|
||||
dixDestroyPixmap(pPixmap, 0);
|
||||
dixPixmapPut(pPixmap);
|
||||
return 0;
|
||||
}
|
||||
ValidateGC(&pPixmap->drawable, pGC);
|
||||
@@ -79,7 +77,7 @@ saa_create_alpha_picture(ScreenPtr pScreen,
|
||||
FreeScratchGC(pGC);
|
||||
pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat,
|
||||
0, 0, serverClient, &error);
|
||||
dixDestroyPixmap(pPixmap, 0);
|
||||
dixPixmapPut(pPixmap);
|
||||
return pPicture;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,4 +60,41 @@
|
||||
|
||||
#define XF86_SCRN_ARG(x) (x)
|
||||
|
||||
#ifndef XORG_API_DIX_PIXMAP_LIFETIME
|
||||
static inline PixmapPtr dixPixmapCreate(ScreenPtr pScreen,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
uint32_t depth,
|
||||
uint32_t usage_hint)
|
||||
{
|
||||
if (!pScreen) {
|
||||
LogMessage(X_ERROR, "dixCreatePixmap() called on NULL screen\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!pScreen->CreatePixmap) {
|
||||
LogMessage(X_ERROR, "dixCreatePixmap() screen->CreatePixmap is NULL\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
|
||||
}
|
||||
|
||||
PixmapPtr dixPixmapGet(PixmapPtr pPixmap)
|
||||
{
|
||||
if (pPixmap)
|
||||
pPixmap->refcnt++;
|
||||
return pPixmap;
|
||||
}
|
||||
|
||||
void dixPixmapPut(PixmapPtr pPixmap)
|
||||
{
|
||||
if (pPixmap)
|
||||
dixDestroyPixmap(pPixmap, 0);
|
||||
}
|
||||
|
||||
#else
|
||||
#include "dix_pixmap.h"
|
||||
#endif /* XORG_API_DIX_PIXMAP_LIFETIME */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -269,8 +269,7 @@ crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
|
||||
* is used as scanout by a crtc.
|
||||
*/
|
||||
|
||||
return pScreen->CreatePixmap(pScreen, width, height,
|
||||
rootpix->drawable.depth, 0);
|
||||
return dixPixmapCreate(pScreen, width, height, rootpix->drawable.depth, 0);
|
||||
}
|
||||
|
||||
static PixmapPtr
|
||||
@@ -288,7 +287,7 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
|
||||
return;
|
||||
|
||||
pScreen = rotate_pixmap->drawable.pScreen;
|
||||
dixDestroyPixmap(rotate_pixmap, 0);
|
||||
dixPixmapPut(rotate_pixmap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -110,11 +110,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for
|
||||
if (buffer->attachment != DRI2BufferFakeFrontLeft ||
|
||||
&pPixmap->drawable != pDraw) {
|
||||
|
||||
pPixmap = (*pScreen->CreatePixmap)(pScreen,
|
||||
pDraw->width,
|
||||
pDraw->height,
|
||||
depth,
|
||||
0);
|
||||
pPixmap = dixPixmapCreate(pScreen, pDraw->width, pDraw->height, depth, 0);
|
||||
if (pPixmap == NullPixmap)
|
||||
return FALSE;
|
||||
|
||||
@@ -134,8 +130,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for
|
||||
buffer->format = pDraw->bitsPerPixel;
|
||||
if (!private->pPixmap) {
|
||||
private->dri2_depth = 0;
|
||||
private->pPixmap = pPixmap;
|
||||
pPixmap->refcnt++;
|
||||
private->pPixmap = dixPixmapGet(pPixmap);
|
||||
}
|
||||
return TRUE;
|
||||
case DRI2BufferStencil:
|
||||
@@ -182,10 +177,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer, unsigned int for
|
||||
break;
|
||||
}
|
||||
|
||||
if (!private->pPixmap) {
|
||||
private->pPixmap = pPixmap;
|
||||
pPixmap->refcnt++;
|
||||
}
|
||||
private->pPixmap = dixPixmapGet(pPixmap);
|
||||
|
||||
if (!srf) {
|
||||
depth = (format) ? vmwgfx_color_format_to_depth(format) :
|
||||
@@ -243,7 +235,7 @@ dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
|
||||
WSBMLISTDELINIT(&vpix->sync_x_head);
|
||||
|
||||
private->srf = NULL;
|
||||
dixDestroyPixmap(private->pPixmap, 0);
|
||||
dixPixmapPut(private->pPixmap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -97,13 +97,12 @@ vmwgfx_dri3_pixmap_from_fd(ScreenPtr screen, int fd,
|
||||
struct xa_surface *srf;
|
||||
struct vmwgfx_saa_pixmap *vpix;
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
|
||||
PixmapPtr pixmap;
|
||||
|
||||
if (width == 0 || height == 0 ||
|
||||
depth < 15 || bpp != BitsPerPixel(depth) || stride < width * bpp / 8)
|
||||
return NULL;
|
||||
|
||||
pixmap = screen->CreatePixmap(screen, width, height, depth, 0);
|
||||
PixmapPtr pixmap = dixPixmapCreate(screen, width, height, depth, 0);
|
||||
if (!pixmap) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DRI3 pixmap creation failed.\n");
|
||||
return NULL;
|
||||
@@ -143,7 +142,7 @@ vmwgfx_dri3_pixmap_from_fd(ScreenPtr screen, int fd,
|
||||
out_no_damage:
|
||||
xa_surface_unref(srf);
|
||||
out_bad_format:
|
||||
dixDestroyPixmap(pixmap, 0);
|
||||
dixPixmapPut(pixmap);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1549,7 +1549,7 @@ vmwgfx_scanout_ref(struct vmwgfx_screen_entry *entry,
|
||||
&vpix->fb_id) != 0)
|
||||
goto out_no_fb;;
|
||||
}
|
||||
pixmap->refcnt += 1;
|
||||
dixPixmapGet(pixmap);
|
||||
WSBMLISTADDTAIL(&entry->scanout_head, &vpix->scanout_list);
|
||||
return vpix->fb_id;
|
||||
|
||||
@@ -1591,7 +1591,7 @@ vmwgfx_scanout_unref(struct vmwgfx_screen_entry *entry)
|
||||
}
|
||||
|
||||
entry->pixmap = NULL;
|
||||
dixDestroyPixmap(pixmap, 0);
|
||||
dixPixmapPut(pixmap);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user