EntityInfoPtr pEnt;
EntPtr msEnt = NULL;
int max_width, max_height;
+ CustomizerPtr cust;
if (pScrn->numEntities != 1)
return FALSE;
return TRUE;
}
+ cust = (CustomizerPtr) pScrn->driverPrivate;
+ pScrn->driverPrivate = NULL;
+
/* Allocate driverPrivate */
if (!drv_get_rec(pScrn))
return FALSE;
ms = modesettingPTR(pScrn);
ms->SaveGeneration = -1;
ms->pEnt = pEnt;
+ ms->cust = cust;
pScrn->displayWidth = 640; /* default it */
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
VisualPtr visual;
+ CustomizerPtr cust = ms->cust;
if (!drv_init_drm(pScrn)) {
FatalError("Could not init DRM");
if (serverGeneration == 1)
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
- if (ms->winsys_screen_init)
- ms->winsys_screen_init(pScrn);
+ if (cust && cust->winsys_screen_init)
+ cust->winsys_screen_init(cust, ms->fd);
return drv_enter_vt(scrnIndex, 1);
}
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
modesettingPtr ms = modesettingPTR(pScrn);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ CustomizerPtr cust = ms->cust;
int o;
- if (ms->winsys_leave_vt)
- ms->winsys_leave_vt(pScrn);
+ if (cust && cust->winsys_leave_vt)
+ cust->winsys_leave_vt(cust);
for (o = 0; o < config->num_crtc; o++) {
xf86CrtcPtr crtc = config->crtc[o];
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
modesettingPtr ms = modesettingPTR(pScrn);
+ CustomizerPtr cust = ms->cust;
if (drmSetMaster(ms->fd)) {
if (errno == EINVAL) {
if (!xf86SetDesiredModes(pScrn))
return FALSE;
- if (ms->winsys_enter_vt)
- ms->winsys_enter_vt(pScrn);
+ if (cust && cust->winsys_enter_vt)
+ cust->winsys_enter_vt(cust);
return TRUE;
}
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
modesettingPtr ms = modesettingPTR(pScrn);
+ CustomizerPtr cust = ms->cust;
if (pScrn->vtSema) {
drv_leave_vt(scrnIndex, 0);
}
- if (ms->winsys_screen_close)
- ms->winsys_screen_close(pScrn);
+ if (cust && cust->winsys_screen_close)
+ cust->winsys_screen_close(cust);
#ifdef DRI2
if (ms->screen)
return TRUE;
}
+CustomizerPtr xorg_customizer(ScrnInfoPtr pScrn)
+{
+ return modesettingPTR(pScrn)->cust;
+}
+
+Bool xorg_has_gallium(ScrnInfoPtr pScrn)
+{
+ return modesettingPTR(pScrn)->screen != NULL;
+}
+
/* vim: set sw=4 ts=8 sts=4: */
#define XORG_NR_FENCES 3
+typedef struct _CustomizerRec
+{
+ Bool (*winsys_screen_init)(struct _CustomizerRec *cust, int fd);
+ Bool (*winsys_screen_close)(struct _CustomizerRec *cust);
+ Bool (*winsys_enter_vt)(struct _CustomizerRec *cust);
+ Bool (*winsys_leave_vt)(struct _CustomizerRec *cust);
+} CustomizerRec, *CustomizerPtr;
+
typedef struct _modesettingRec
{
/* drm */
Bool accelerate_2d;
Bool debug_fallback;
- /* winsys hocks */
- Bool (*winsys_screen_init)(ScrnInfoPtr pScr);
- Bool (*winsys_screen_close)(ScrnInfoPtr pScr);
- Bool (*winsys_enter_vt)(ScrnInfoPtr pScr);
- Bool (*winsys_leave_vt)(ScrnInfoPtr pScr);
- void *winsys_priv;
+ CustomizerPtr cust;
#ifdef DRM_MODE_FEATURE_DIRTYFB
DamagePtr damage;
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
+CustomizerPtr xorg_customizer(ScrnInfoPtr pScrn);
+
+Bool xorg_has_gallium(ScrnInfoPtr pScrn);
/***********************************************************************
* xorg_exa.c
struct vmw_dma_buffer;
-struct vmw_driver
+struct vmw_customizer
{
+ CustomizerRec base;
+ ScrnInfoPtr pScrn;
+
int fd;
void *cursor_priv;
void *video_priv;
};
-static INLINE struct vmw_driver *
-vmw_driver(ScrnInfoPtr pScrn)
+static INLINE struct vmw_customizer *
+vmw_customizer(CustomizerPtr cust)
{
- modesettingPtr ms = modesettingPTR(pScrn);
- return ms ? (struct vmw_driver *)ms->winsys_priv : NULL;
+ return cust ? (struct vmw_customizer *) cust : NULL;
}
* vmw_video.c
*/
-Bool vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
+Bool vmw_video_init(struct vmw_customizer *vmw);
-Bool vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
+Bool vmw_video_close(struct vmw_customizer *vmw);
-void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
+void vmw_video_stop_all(struct vmw_customizer *vmw);
/***********************************************************************
* vmw_ioctl.c
*/
-int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot);
+int vmw_ioctl_cursor_bypass(struct vmw_customizer *vmw, int xhot, int yhot);
-struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw,
+struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_customizer *vmw,
uint32_t size,
unsigned *handle);
-void * vmw_ioctl_buffer_map(struct vmw_driver *vmw,
+void * vmw_ioctl_buffer_map(struct vmw_customizer *vmw,
struct vmw_dma_buffer *buf);
-void vmw_ioctl_buffer_unmap(struct vmw_driver *vmw,
+void vmw_ioctl_buffer_unmap(struct vmw_customizer *vmw,
struct vmw_dma_buffer *buf);
-void vmw_ioctl_buffer_destroy(struct vmw_driver *vmw,
+void vmw_ioctl_buffer_destroy(struct vmw_customizer *vmw,
struct vmw_dma_buffer *buf);
-int vmw_ioctl_supports_streams(struct vmw_driver *vmw);
+int vmw_ioctl_supports_streams(struct vmw_customizer *vmw);
-int vmw_ioctl_num_streams(struct vmw_driver *vmw,
+int vmw_ioctl_num_streams(struct vmw_customizer *vmw,
uint32_t *ntot, uint32_t *nfree);
-int vmw_ioctl_unref_stream(struct vmw_driver *vmw, uint32_t stream_id);
+int vmw_ioctl_unref_stream(struct vmw_customizer *vmw, uint32_t stream_id);
-int vmw_ioctl_claim_stream(struct vmw_driver *vmw, uint32_t *out);
+int vmw_ioctl_claim_stream(struct vmw_customizer *vmw, uint32_t *out);
#endif
};
static int
-vmw_ioctl_get_param(struct vmw_driver *vmw, uint32_t param, uint64_t *out)
+vmw_ioctl_get_param(struct vmw_customizer *vmw, uint32_t param, uint64_t *out)
{
struct drm_vmw_getparam_arg gp_arg;
int ret;
}
int
-vmw_ioctl_supports_streams(struct vmw_driver *vmw)
+vmw_ioctl_supports_streams(struct vmw_customizer *vmw)
{
uint64_t value;
int ret;
}
int
-vmw_ioctl_num_streams(struct vmw_driver *vmw,
+vmw_ioctl_num_streams(struct vmw_customizer *vmw,
uint32_t *ntot, uint32_t *nfree)
{
uint64_t v1, v2;
}
int
-vmw_ioctl_claim_stream(struct vmw_driver *vmw, uint32_t *out)
+vmw_ioctl_claim_stream(struct vmw_customizer *vmw, uint32_t *out)
{
struct drm_vmw_stream_arg s_arg;
int ret;
}
int
-vmw_ioctl_unref_stream(struct vmw_driver *vmw, uint32_t stream_id)
+vmw_ioctl_unref_stream(struct vmw_customizer *vmw, uint32_t stream_id)
{
struct drm_vmw_stream_arg s_arg;
int ret;
}
int
-vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot)
+vmw_ioctl_cursor_bypass(struct vmw_customizer *vmw, int xhot, int yhot)
{
struct drm_vmw_cursor_bypass_arg arg;
int ret;
}
struct vmw_dma_buffer *
-vmw_ioctl_buffer_create(struct vmw_driver *vmw, uint32_t size, unsigned *handle)
+vmw_ioctl_buffer_create(struct vmw_customizer *vmw, uint32_t size, unsigned *handle)
{
struct vmw_dma_buffer *buf;
union drm_vmw_alloc_dmabuf_arg arg;
}
void
-vmw_ioctl_buffer_destroy(struct vmw_driver *vmw, struct vmw_dma_buffer *buf)
+vmw_ioctl_buffer_destroy(struct vmw_customizer *vmw, struct vmw_dma_buffer *buf)
{
struct drm_vmw_unref_dmabuf_arg arg;
}
void *
-vmw_ioctl_buffer_map(struct vmw_driver *vmw, struct vmw_dma_buffer *buf)
+vmw_ioctl_buffer_map(struct vmw_customizer *vmw, struct vmw_dma_buffer *buf)
{
void *map;
}
void
-vmw_ioctl_buffer_unmap(struct vmw_driver *vmw, struct vmw_dma_buffer *buf)
+vmw_ioctl_buffer_unmap(struct vmw_customizer *vmw, struct vmw_dma_buffer *buf)
{
--buf->map_count;
}
static void
vmw_screen_cursor_load_argb(xf86CrtcPtr crtc, CARD32 *image)
{
- struct vmw_driver *vmw = modesettingPTR(crtc->scrn)->winsys_priv;
+ struct vmw_customizer *vmw =
+ vmw_customizer(xorg_customizer(crtc->scrn));
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
xf86CrtcFuncsPtr funcs = vmw->cursor_priv;
CursorPtr c = config->cursor;
}
static void
-vmw_screen_cursor_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
+vmw_screen_cursor_init(struct vmw_customizer *vmw)
{
+ ScrnInfoPtr pScrn = vmw->pScrn;
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int i;
}
static void
-vmw_screen_cursor_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
+vmw_screen_cursor_close(struct vmw_customizer *vmw)
{
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(vmw->pScrn);
int i;
vmw_ioctl_cursor_bypass(vmw, 0, 0);
}
static Bool
-vmw_screen_init(ScrnInfoPtr pScrn)
+vmw_screen_init(CustomizerPtr cust, int fd)
{
- modesettingPtr ms = modesettingPTR(pScrn);
- struct vmw_driver *vmw;
-
- vmw = xnfcalloc(1, sizeof(*vmw));
- if (!vmw)
- return FALSE;
-
- vmw->fd = ms->fd;
- ms->winsys_priv = vmw;
+ struct vmw_customizer *vmw = vmw_customizer(cust);
- vmw_screen_cursor_init(pScrn, vmw);
+ vmw->fd = fd;
+ vmw_screen_cursor_init(vmw);
/* if gallium is used then we don't need to do anything more. */
- if (ms->screen)
+ if (xorg_has_gallium(vmw->pScrn))
return TRUE;
- vmw_video_init(pScrn, vmw);
+ vmw_video_init(vmw);
return TRUE;
}
static Bool
-vmw_screen_close(ScrnInfoPtr pScrn)
+vmw_screen_close(CustomizerPtr cust)
{
- modesettingPtr ms = modesettingPTR(pScrn);
- struct vmw_driver *vmw = vmw_driver(pScrn);
+ struct vmw_customizer *vmw = vmw_customizer(cust);
if (!vmw)
return TRUE;
- vmw_screen_cursor_close(pScrn, vmw);
+ vmw_screen_cursor_close(vmw);
- vmw_video_close(pScrn, vmw);
-
- ms->winsys_priv = NULL;
- xfree(vmw);
+ vmw_video_close(vmw);
return TRUE;
}
static Bool
-vmw_screen_enter_vt(ScrnInfoPtr pScrn)
+vmw_screen_enter_vt(CustomizerPtr cust)
{
debug_printf("%s: enter\n", __func__);
}
static Bool
-vmw_screen_leave_vt(ScrnInfoPtr pScrn)
+vmw_screen_leave_vt(CustomizerPtr cust)
{
- struct vmw_driver *vmw = vmw_driver(pScrn);
+ struct vmw_customizer *vmw = vmw_customizer(cust);
debug_printf("%s: enter\n", __func__);
- vmw_video_stop_all(pScrn, vmw);
+ vmw_video_stop_all(vmw);
return TRUE;
}
static Bool
vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags)
{
- modesettingPtr ms;
+ struct vmw_customizer *vmw;
+ CustomizerPtr cust;
+
+ vmw = xnfcalloc(1, sizeof(*vmw));
+ if (!vmw)
+ return FALSE;
+
+ cust = &vmw->base;
+
+ cust->winsys_screen_init = vmw_screen_init;
+ cust->winsys_screen_close = vmw_screen_close;
+ cust->winsys_enter_vt = vmw_screen_enter_vt;
+ cust->winsys_leave_vt = vmw_screen_leave_vt;
+ vmw->pScrn = pScrn;
+
+ pScrn->driverPrivate = cust;
pScrn->PreInit = vmw_screen_pre_init_saved;
if (!pScrn->PreInit(pScrn, flags))
return FALSE;
- ms = modesettingPTR(pScrn);
- ms->winsys_screen_init = vmw_screen_init;
- ms->winsys_screen_close = vmw_screen_close;
- ms->winsys_enter_vt = vmw_screen_enter_vt;
- ms->winsys_leave_vt = vmw_screen_leave_vt;
-
return TRUE;
}
/*
* Local functions.
*/
-static XF86VideoAdaptorPtr vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
+static XF86VideoAdaptorPtr vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_customizer *vmw);
static int vmw_video_port_init(ScrnInfoPtr pScrn,
struct vmw_video_port *port,
short height, RegionPtr clipBoxes);
static void vmw_video_port_cleanup(ScrnInfoPtr pScrn, struct vmw_video_port *port);
-static int vmw_video_buffer_alloc(struct vmw_driver *vmw, int size,
+static int vmw_video_buffer_alloc(struct vmw_customizer *vmw, int size,
struct vmw_video_buffer *out);
-static int vmw_video_buffer_free(struct vmw_driver *vmw,
+static int vmw_video_buffer_free(struct vmw_customizer *vmw,
struct vmw_video_buffer *out);
*/
Bool
-vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
+vmw_video_init(struct vmw_customizer *vmw)
{
+ ScrnInfoPtr pScrn = vmw->pScrn;
ScreenPtr pScreen = pScrn->pScreen;
XF86VideoAdaptorPtr *overlayAdaptors, *newAdaptors = NULL;
XF86VideoAdaptorPtr newAdaptor = NULL;
*/
Bool
-vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
+vmw_video_close(struct vmw_customizer *vmw)
{
+ ScrnInfoPtr pScrn = vmw->pScrn;
struct vmw_video_private *video;
int i;
*-----------------------------------------------------------------------------
*/
-void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
+void vmw_video_stop_all(struct vmw_customizer *vmw)
{
+ ScrnInfoPtr pScrn = vmw->pScrn;
struct vmw_video_private *video = vmw->video_priv;
int i;
*/
static XF86VideoAdaptorPtr
-vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
+vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_customizer *vmw)
{
XF86VideoAdaptorPtr adaptor;
struct vmw_video_private *video;
unsigned char *buf, short width,
short height, RegionPtr clipBoxes)
{
- struct vmw_driver *vmw = vmw_driver(pScrn);
+ struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
unsigned short w, h;
int i, ret;
unsigned char *buf, short width,
short height, RegionPtr clipBoxes)
{
- struct vmw_driver *vmw = vmw_driver(pScrn);
+ struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
struct drm_vmw_control_stream_arg arg;
unsigned short w, h;
int size;
static void
vmw_video_port_cleanup(ScrnInfoPtr pScrn, struct vmw_video_port *port)
{
- struct vmw_driver *vmw = vmw_driver(pScrn);
+ struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
uint32 id, colorKey, flags;
Bool isAutoPaintColorkey;
int i;
*/
static int
-vmw_video_buffer_alloc(struct vmw_driver *vmw, int size,
+vmw_video_buffer_alloc(struct vmw_customizer *vmw, int size,
struct vmw_video_buffer *out)
{
out->buf = vmw_ioctl_buffer_create(vmw, size, &out->handle);
*/
static int
-vmw_video_buffer_free(struct vmw_driver *vmw,
+vmw_video_buffer_free(struct vmw_customizer *vmw,
struct vmw_video_buffer *out)
{
if (out->size == 0)
Bool sync, RegionPtr clipBoxes, pointer data,
DrawablePtr dst)
{
- struct vmw_driver *vmw = vmw_driver(pScrn);
+ struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
struct vmw_video_port *port = data;
debug_printf("%s: enter (%u, %u) (%ux%u) (%u, %u) (%ux%u) (%ux%u)\n", __func__,
static void
vmw_xv_stop_video(ScrnInfoPtr pScrn, pointer data, Bool cleanup)
{
- struct vmw_driver *vmw = vmw_driver(pScrn);
+ struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
struct vmw_video_port *port = data;
struct drm_vmw_control_stream_arg arg;
int ret;