Run indent
This commit is contained in:
parent
106bea5ad1
commit
f9f7a872bf
|
@ -50,22 +50,22 @@
|
||||||
static void
|
static void
|
||||||
crtc_dpms(xf86CrtcPtr crtc, int mode)
|
crtc_dpms(xf86CrtcPtr crtc, int mode)
|
||||||
{
|
{
|
||||||
ScrnInfoPtr pScrn = crtc->scrn;
|
ScrnInfoPtr pScrn = crtc->scrn;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case DPMSModeOn:
|
case DPMSModeOn:
|
||||||
case DPMSModeStandby:
|
case DPMSModeStandby:
|
||||||
case DPMSModeSuspend:
|
case DPMSModeSuspend:
|
||||||
break;
|
break;
|
||||||
case DPMSModeOff:
|
case DPMSModeOff:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
crtc_lock(xf86CrtcPtr crtc)
|
crtc_lock(xf86CrtcPtr crtc)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -87,43 +87,43 @@ static Bool
|
||||||
crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode,
|
crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode,
|
||||||
DisplayModePtr adjusted_mode)
|
DisplayModePtr adjusted_mode)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
|
crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
|
||||||
DisplayModePtr adjusted_mode, int x, int y)
|
DisplayModePtr adjusted_mode, int x, int y)
|
||||||
{
|
{
|
||||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
|
||||||
modesettingPtr ms = modesettingPTR(crtc->scrn);
|
modesettingPtr ms = modesettingPTR(crtc->scrn);
|
||||||
xf86OutputPtr output = config->output[config->compat_output];
|
xf86OutputPtr output = config->output[config->compat_output];
|
||||||
drmModeOutputPtr drm_output = output->driver_private;
|
drmModeOutputPtr drm_output = output->driver_private;
|
||||||
drmModeCrtcPtr drm_crtc = crtc->driver_private;
|
drmModeCrtcPtr drm_crtc = crtc->driver_private;
|
||||||
struct drm_mode_modeinfo drm_mode;
|
struct drm_mode_modeinfo drm_mode;
|
||||||
|
|
||||||
drm_mode.clock = mode->Clock;
|
drm_mode.clock = mode->Clock;
|
||||||
drm_mode.hdisplay = mode->HDisplay;
|
drm_mode.hdisplay = mode->HDisplay;
|
||||||
drm_mode.hsync_start = mode->HSyncStart;
|
drm_mode.hsync_start = mode->HSyncStart;
|
||||||
drm_mode.hsync_end = mode->HSyncEnd;
|
drm_mode.hsync_end = mode->HSyncEnd;
|
||||||
drm_mode.htotal = mode->HTotal;
|
drm_mode.htotal = mode->HTotal;
|
||||||
drm_mode.vdisplay = mode->VDisplay;
|
drm_mode.vdisplay = mode->VDisplay;
|
||||||
drm_mode.vsync_start = mode->VSyncStart;
|
drm_mode.vsync_start = mode->VSyncStart;
|
||||||
drm_mode.vsync_end = mode->VSyncEnd;
|
drm_mode.vsync_end = mode->VSyncEnd;
|
||||||
drm_mode.vtotal = mode->VTotal;
|
drm_mode.vtotal = mode->VTotal;
|
||||||
drm_mode.flags = mode->Flags;
|
drm_mode.flags = mode->Flags;
|
||||||
drm_mode.hskew = mode->HSkew;
|
drm_mode.hskew = mode->HSkew;
|
||||||
drm_mode.vscan = mode->VScan;
|
drm_mode.vscan = mode->VScan;
|
||||||
drm_mode.vrefresh = mode->VRefresh;
|
drm_mode.vrefresh = mode->VRefresh;
|
||||||
strncpy(drm_mode.name, mode->name, DRM_DISPLAY_MODE_LEN);
|
strncpy(drm_mode.name, mode->name, DRM_DISPLAY_MODE_LEN);
|
||||||
|
|
||||||
drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y,
|
drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y,
|
||||||
&drm_output->output_id, 1, &drm_mode);
|
&drm_output->output_id, 1, &drm_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
crtc_load_lut(xf86CrtcPtr crtc)
|
crtc_load_lut(xf86CrtcPtr crtc)
|
||||||
{
|
{
|
||||||
ScrnInfoPtr pScrn = crtc->scrn;
|
ScrnInfoPtr pScrn = crtc->scrn;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -135,81 +135,81 @@ crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue,
|
||||||
static void *
|
static void *
|
||||||
crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
|
crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
|
||||||
{
|
{
|
||||||
ScrnInfoPtr pScrn = crtc->scrn;
|
ScrnInfoPtr pScrn = crtc->scrn;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PixmapPtr
|
static PixmapPtr
|
||||||
crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
|
crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
|
||||||
{
|
{
|
||||||
ScrnInfoPtr pScrn = crtc->scrn;
|
ScrnInfoPtr pScrn = crtc->scrn;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
|
crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
|
||||||
{
|
{
|
||||||
ScrnInfoPtr pScrn = crtc->scrn;
|
ScrnInfoPtr pScrn = crtc->scrn;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
crtc_destroy(xf86CrtcPtr crtc)
|
crtc_destroy(xf86CrtcPtr crtc)
|
||||||
{
|
{
|
||||||
drmModeFreeCrtc(crtc->driver_private);
|
drmModeFreeCrtc(crtc->driver_private);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const xf86CrtcFuncsRec crtc_funcs = {
|
static const xf86CrtcFuncsRec crtc_funcs = {
|
||||||
.dpms = crtc_dpms,
|
.dpms = crtc_dpms,
|
||||||
.save = NULL, /* XXX */
|
.save = NULL, /* XXX */
|
||||||
.restore = NULL, /* XXX */
|
.restore = NULL, /* XXX */
|
||||||
.lock = crtc_lock,
|
.lock = crtc_lock,
|
||||||
.unlock = crtc_unlock,
|
.unlock = crtc_unlock,
|
||||||
.mode_fixup = crtc_mode_fixup,
|
.mode_fixup = crtc_mode_fixup,
|
||||||
.prepare = crtc_prepare,
|
.prepare = crtc_prepare,
|
||||||
.mode_set = crtc_mode_set,
|
.mode_set = crtc_mode_set,
|
||||||
.commit = crtc_commit,
|
.commit = crtc_commit,
|
||||||
.gamma_set = crtc_gamma_set,
|
.gamma_set = crtc_gamma_set,
|
||||||
.shadow_create = crtc_shadow_create,
|
.shadow_create = crtc_shadow_create,
|
||||||
.shadow_allocate = crtc_shadow_allocate,
|
.shadow_allocate = crtc_shadow_allocate,
|
||||||
.shadow_destroy = crtc_shadow_destroy,
|
.shadow_destroy = crtc_shadow_destroy,
|
||||||
// .set_cursor_colors = crtc_set_cursor_colors,
|
// .set_cursor_colors = crtc_set_cursor_colors,
|
||||||
// .set_cursor_position = crtc_set_cursor_position,
|
// .set_cursor_position = crtc_set_cursor_position,
|
||||||
// .show_cursor = crtc_show_cursor,
|
// .show_cursor = crtc_show_cursor,
|
||||||
// .hide_cursor = crtc_hide_cursor,
|
// .hide_cursor = crtc_hide_cursor,
|
||||||
// .load_cursor_image = crtc_load_cursor_image,
|
// .load_cursor_image = crtc_load_cursor_image,
|
||||||
// .load_cursor_argb = crtc_load_cursor_argb,
|
// .load_cursor_argb = crtc_load_cursor_argb,
|
||||||
.destroy = crtc_destroy, /* XXX */
|
.destroy = crtc_destroy, /* XXX */
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
crtc_init(ScrnInfoPtr pScrn)
|
crtc_init(ScrnInfoPtr pScrn)
|
||||||
{
|
{
|
||||||
modesettingPtr ms = modesettingPTR(pScrn);
|
modesettingPtr ms = modesettingPTR(pScrn);
|
||||||
xf86CrtcPtr crtc;
|
xf86CrtcPtr crtc;
|
||||||
drmModeResPtr res;
|
drmModeResPtr res;
|
||||||
drmModeCrtcPtr drm_crtc = NULL;
|
drmModeCrtcPtr drm_crtc = NULL;
|
||||||
int c, k, p;
|
int c, k, p;
|
||||||
|
|
||||||
res = drmModeGetResources(ms->fd);
|
res = drmModeGetResources(ms->fd);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
ErrorF("Failed drmModeGetResources %d\n",errno);
|
ErrorF("Failed drmModeGetResources %d\n", errno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (c = 0; c < res->count_crtcs; c++) {
|
for (c = 0; c < res->count_crtcs; c++) {
|
||||||
drm_crtc = drmModeGetCrtc(ms->fd, res->crtcs[c]);
|
drm_crtc = drmModeGetCrtc(ms->fd, res->crtcs[c]);
|
||||||
if (!drm_crtc)
|
if (!drm_crtc)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
crtc = xf86CrtcCreate(pScrn, &crtc_funcs);
|
crtc = xf86CrtcCreate(pScrn, &crtc_funcs);
|
||||||
if (crtc == NULL)
|
if (crtc == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
crtc->driver_private = drm_crtc;
|
crtc->driver_private = drm_crtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
drmModeFreeResources(res);
|
drmModeFreeResources(res);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,53 +36,55 @@
|
||||||
|
|
||||||
#define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
|
#define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
int lastInstance;
|
{
|
||||||
int refCount;
|
int lastInstance;
|
||||||
ScrnInfoPtr pScrn_1;
|
int refCount;
|
||||||
ScrnInfoPtr pScrn_2;
|
ScrnInfoPtr pScrn_1;
|
||||||
|
ScrnInfoPtr pScrn_2;
|
||||||
} EntRec, *EntPtr;
|
} EntRec, *EntPtr;
|
||||||
|
|
||||||
typedef struct _modesettingRec {
|
typedef struct _modesettingRec
|
||||||
int fd;
|
{
|
||||||
unsigned int fb_id;
|
int fd;
|
||||||
void *virtual;
|
unsigned int fb_id;
|
||||||
drmBO bo;
|
void *virtual;
|
||||||
|
drmBO bo;
|
||||||
|
|
||||||
EntPtr entityPrivate;
|
EntPtr entityPrivate;
|
||||||
|
|
||||||
void (*PointerMoved)(int, int, int);
|
void (*PointerMoved) (int, int, int);
|
||||||
|
|
||||||
int Chipset;
|
int Chipset;
|
||||||
EntityInfoPtr pEnt;
|
EntityInfoPtr pEnt;
|
||||||
#if XSERVER_LIBPCIACCESS
|
#if XSERVER_LIBPCIACCESS
|
||||||
struct pci_device *PciInfo;
|
struct pci_device *PciInfo;
|
||||||
#else
|
#else
|
||||||
pciVideoPtr PciInfo;
|
pciVideoPtr PciInfo;
|
||||||
PCITAG PciTag;
|
PCITAG PciTag;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Bool noAccel;
|
Bool noAccel;
|
||||||
Bool SWCursor;
|
Bool SWCursor;
|
||||||
CloseScreenProcPtr CloseScreen;
|
CloseScreenProcPtr CloseScreen;
|
||||||
|
|
||||||
Bool directRenderingDisabled; /* DRI disabled in PreInit. */
|
Bool directRenderingDisabled; /* DRI disabled in PreInit. */
|
||||||
Bool directRenderingEnabled; /* DRI enabled this generation. */
|
Bool directRenderingEnabled; /* DRI enabled this generation. */
|
||||||
|
|
||||||
/* Broken-out options. */
|
/* Broken-out options. */
|
||||||
OptionInfoPtr Options;
|
OptionInfoPtr Options;
|
||||||
|
|
||||||
unsigned int SaveGeneration;
|
unsigned int SaveGeneration;
|
||||||
|
|
||||||
/* shadowfb */
|
/* shadowfb */
|
||||||
CARD8 *shadowMem;
|
CARD8 *shadowMem;
|
||||||
Bool shadowFB;
|
Bool shadowFB;
|
||||||
CreateScreenResourcesProcPtr createScreenResources;
|
CreateScreenResourcesProcPtr createScreenResources;
|
||||||
ShadowUpdateProc update;
|
ShadowUpdateProc update;
|
||||||
|
|
||||||
/* exa */
|
/* exa */
|
||||||
ExaDriverPtr pExa;
|
ExaDriverPtr pExa;
|
||||||
drmBO exa_bo;
|
drmBO exa_bo;
|
||||||
} modesettingRec, *modesettingPtr;
|
} modesettingRec, *modesettingPtr;
|
||||||
|
|
||||||
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
|
#define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
|
||||||
|
|
|
@ -102,7 +102,7 @@ ExaSolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
|
ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
|
||||||
int ydir, int alu, Pixel planeMask)
|
int ydir, int alu, Pixel planeMask)
|
||||||
{
|
{
|
||||||
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
|
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
|
||||||
|
|
||||||
|
@ -115,15 +115,15 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
|
ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
|
||||||
int width, int height)
|
int width, int height)
|
||||||
{
|
{
|
||||||
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
|
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
ExaPrepareComposite(int op, PicturePtr pSrcPicture,
|
ExaPrepareComposite(int op, PicturePtr pSrcPicture,
|
||||||
PicturePtr pMaskPicture, PicturePtr pDstPicture,
|
PicturePtr pMaskPicture, PicturePtr pDstPicture,
|
||||||
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
|
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pDst->drawable.pScreen;
|
ScreenPtr pScreen = pDst->drawable.pScreen;
|
||||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||||
|
@ -133,7 +133,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
ExaUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
|
ExaUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
|
||||||
int src_pitch)
|
int src_pitch)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pDst->drawable.pScreen;
|
ScreenPtr pScreen = pDst->drawable.pScreen;
|
||||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||||
|
@ -143,7 +143,7 @@ ExaUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
|
ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
|
||||||
int dstX, int dstY, int width, int height)
|
int dstX, int dstY, int width, int height)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pDst->drawable.pScreen;
|
ScreenPtr pScreen = pDst->drawable.pScreen;
|
||||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||||
|
@ -151,8 +151,8 @@ ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
ExaCheckComposite(int op,
|
ExaCheckComposite(int op,
|
||||||
PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
PicturePtr pSrcPicture, PicturePtr pMaskPicture,
|
||||||
PicturePtr pDstPicture)
|
PicturePtr pDstPicture)
|
||||||
{
|
{
|
||||||
DrawablePtr pDraw = pSrcPicture->pDrawable;
|
DrawablePtr pDraw = pSrcPicture->pDrawable;
|
||||||
int w = pDraw->width;
|
int w = pDraw->width;
|
||||||
|
@ -173,17 +173,17 @@ ExaPixmapIsOffscreen(PixmapPtr p)
|
||||||
void
|
void
|
||||||
ExaClose(ScrnInfoPtr pScrn)
|
ExaClose(ScrnInfoPtr pScrn)
|
||||||
{
|
{
|
||||||
modesettingPtr ms = modesettingPTR(pScrn);
|
modesettingPtr ms = modesettingPTR(pScrn);
|
||||||
|
|
||||||
exaDriverFini(pScrn->pScreen);
|
exaDriverFini(pScrn->pScreen);
|
||||||
|
|
||||||
drmBOUnreference(ms->fd, &ms->exa_bo);
|
drmBOUnreference(ms->fd, &ms->exa_bo);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExaDriverPtr
|
ExaDriverPtr
|
||||||
ExaInit(ScrnInfoPtr pScrn)
|
ExaInit(ScrnInfoPtr pScrn)
|
||||||
{
|
{
|
||||||
modesettingPtr ms = modesettingPTR(pScrn);
|
modesettingPtr ms = modesettingPTR(pScrn);
|
||||||
ExaDriverPtr pExa;
|
ExaDriverPtr pExa;
|
||||||
|
|
||||||
pExa = exaDriverAlloc();
|
pExa = exaDriverAlloc();
|
||||||
|
@ -192,7 +192,9 @@ ExaInit(ScrnInfoPtr pScrn)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a 256KB offscreen area */
|
/* Create a 256KB offscreen area */
|
||||||
drmBOCreate(ms->fd, 256 * 1024, 0, NULL, DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MEM_TT, DRM_BO_HINT_DONT_FENCE, &ms->exa_bo);
|
drmBOCreate(ms->fd, 256 * 1024, 0, NULL,
|
||||||
|
DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MEM_TT,
|
||||||
|
DRM_BO_HINT_DONT_FENCE, &ms->exa_bo);
|
||||||
|
|
||||||
memset(pExa, 0, sizeof(*pExa));
|
memset(pExa, 0, sizeof(*pExa));
|
||||||
pExa->exa_major = 2;
|
pExa->exa_major = 2;
|
||||||
|
@ -203,8 +205,8 @@ ExaInit(ScrnInfoPtr pScrn)
|
||||||
pExa->pixmapOffsetAlign = 8;
|
pExa->pixmapOffsetAlign = 8;
|
||||||
pExa->pixmapPitchAlign = 32 * 4;
|
pExa->pixmapPitchAlign = 32 * 4;
|
||||||
pExa->flags = EXA_OFFSCREEN_PIXMAPS;
|
pExa->flags = EXA_OFFSCREEN_PIXMAPS;
|
||||||
pExa->maxX = 8191; /* FIXME */
|
pExa->maxX = 8191; /* FIXME */
|
||||||
pExa->maxY = 8191; /* FIXME */
|
pExa->maxY = 8191; /* FIXME */
|
||||||
pExa->WaitMarker = ExaWaitMarker;
|
pExa->WaitMarker = ExaWaitMarker;
|
||||||
pExa->MarkSync = ExaMarkSync;
|
pExa->MarkSync = ExaMarkSync;
|
||||||
pExa->PrepareSolid = ExaPrepareSolid;
|
pExa->PrepareSolid = ExaPrepareSolid;
|
||||||
|
|
|
@ -69,20 +69,20 @@ restore(xf86OutputPtr output)
|
||||||
static int
|
static int
|
||||||
mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
|
mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
|
||||||
{
|
{
|
||||||
return MODE_OK;
|
return MODE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
|
mode_fixup(xf86OutputPtr output, DisplayModePtr mode,
|
||||||
DisplayModePtr adjusted_mode)
|
DisplayModePtr adjusted_mode)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prepare(xf86OutputPtr output)
|
prepare(xf86OutputPtr output)
|
||||||
{
|
{
|
||||||
dpms(output, DPMSModeOff);
|
dpms(output, DPMSModeOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -94,69 +94,69 @@ mode_set(xf86OutputPtr output, DisplayModePtr mode,
|
||||||
static void
|
static void
|
||||||
commit(xf86OutputPtr output)
|
commit(xf86OutputPtr output)
|
||||||
{
|
{
|
||||||
dpms(output, DPMSModeOn);
|
dpms(output, DPMSModeOn);
|
||||||
|
|
||||||
if (output->scrn->pScreen != NULL)
|
if (output->scrn->pScreen != NULL)
|
||||||
xf86_reload_cursors(output->scrn->pScreen);
|
xf86_reload_cursors(output->scrn->pScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static xf86OutputStatus
|
static xf86OutputStatus
|
||||||
detect(xf86OutputPtr output)
|
detect(xf86OutputPtr output)
|
||||||
{
|
{
|
||||||
drmModeOutputPtr drm_output = output->driver_private;
|
drmModeOutputPtr drm_output = output->driver_private;
|
||||||
|
|
||||||
switch (drm_output->connection) {
|
switch (drm_output->connection) {
|
||||||
case DRM_MODE_CONNECTED:
|
case DRM_MODE_CONNECTED:
|
||||||
return XF86OutputStatusConnected;
|
return XF86OutputStatusConnected;
|
||||||
case DRM_MODE_DISCONNECTED:
|
case DRM_MODE_DISCONNECTED:
|
||||||
return XF86OutputStatusDisconnected;
|
return XF86OutputStatusDisconnected;
|
||||||
default:
|
default:
|
||||||
return XF86OutputStatusUnknown;
|
return XF86OutputStatusUnknown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DisplayModePtr
|
static DisplayModePtr
|
||||||
get_modes(xf86OutputPtr output)
|
get_modes(xf86OutputPtr output)
|
||||||
{
|
{
|
||||||
drmModeOutputPtr drm_output = output->driver_private;
|
drmModeOutputPtr drm_output = output->driver_private;
|
||||||
struct drm_mode_modeinfo *drm_mode = NULL;
|
struct drm_mode_modeinfo *drm_mode = NULL;
|
||||||
DisplayModePtr modes = NULL, mode = NULL;
|
DisplayModePtr modes = NULL, mode = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < drm_output->count_modes; i++) {
|
for (i = 0; i < drm_output->count_modes; i++) {
|
||||||
drm_mode = &drm_output->modes[i];
|
drm_mode = &drm_output->modes[i];
|
||||||
if (drm_mode) {
|
if (drm_mode) {
|
||||||
mode = xcalloc(1, sizeof(DisplayModeRec));
|
mode = xcalloc(1, sizeof(DisplayModeRec));
|
||||||
if (!mode)
|
if (!mode)
|
||||||
continue;
|
continue;
|
||||||
mode->type = 0;
|
mode->type = 0;
|
||||||
mode->Clock = drm_mode->clock;
|
mode->Clock = drm_mode->clock;
|
||||||
mode->HDisplay = drm_mode->hdisplay;
|
mode->HDisplay = drm_mode->hdisplay;
|
||||||
mode->HSyncStart = drm_mode->hsync_start;
|
mode->HSyncStart = drm_mode->hsync_start;
|
||||||
mode->HSyncEnd = drm_mode->hsync_end;
|
mode->HSyncEnd = drm_mode->hsync_end;
|
||||||
mode->HTotal = drm_mode->htotal;
|
mode->HTotal = drm_mode->htotal;
|
||||||
mode->VDisplay = drm_mode->vdisplay;
|
mode->VDisplay = drm_mode->vdisplay;
|
||||||
mode->VSyncStart = drm_mode->vsync_start;
|
mode->VSyncStart = drm_mode->vsync_start;
|
||||||
mode->VSyncEnd = drm_mode->vsync_end;
|
mode->VSyncEnd = drm_mode->vsync_end;
|
||||||
mode->VTotal = drm_mode->vtotal;
|
mode->VTotal = drm_mode->vtotal;
|
||||||
mode->Flags = drm_mode->flags;
|
mode->Flags = drm_mode->flags;
|
||||||
mode->HSkew = drm_mode->hskew;
|
mode->HSkew = drm_mode->hskew;
|
||||||
mode->VScan = drm_mode->vscan;
|
mode->VScan = drm_mode->vscan;
|
||||||
mode->VRefresh = xf86ModeVRefresh(mode);
|
mode->VRefresh = xf86ModeVRefresh(mode);
|
||||||
mode->Private = (void *)drm_mode;
|
mode->Private = (void *)drm_mode;
|
||||||
xf86SetModeDefaultName(mode);
|
xf86SetModeDefaultName(mode);
|
||||||
modes = xf86ModesAdd(modes, mode);
|
modes = xf86ModesAdd(modes, mode);
|
||||||
xf86PrintModeline(0, mode);
|
xf86PrintModeline(0, mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return modes;
|
return modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
destroy(xf86OutputPtr output)
|
destroy(xf86OutputPtr output)
|
||||||
{
|
{
|
||||||
drmModeFreeOutput(output->driver_private);
|
drmModeFreeOutput(output->driver_private);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -170,7 +170,7 @@ create_resources(xf86OutputPtr output)
|
||||||
static Bool
|
static Bool
|
||||||
set_property(xf86OutputPtr output, Atom property, RRPropertyValuePtr value)
|
set_property(xf86OutputPtr output, Atom property, RRPropertyValuePtr value)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif /* RANDR_12_INTERFACE */
|
#endif /* RANDR_12_INTERFACE */
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ set_property(xf86OutputPtr output, Atom property, RRPropertyValuePtr value)
|
||||||
static Bool
|
static Bool
|
||||||
get_property(xf86OutputPtr output, Atom property)
|
get_property(xf86OutputPtr output, Atom property)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif /* RANDR_13_INTERFACE */
|
#endif /* RANDR_13_INTERFACE */
|
||||||
|
|
||||||
|
@ -186,100 +186,102 @@ get_property(xf86OutputPtr output, Atom property)
|
||||||
static xf86CrtcPtr
|
static xf86CrtcPtr
|
||||||
get_crtc(xf86OutputPtr output)
|
get_crtc(xf86OutputPtr output)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const xf86OutputFuncsRec output_funcs = {
|
static const xf86OutputFuncsRec output_funcs = {
|
||||||
.create_resources = create_resources,
|
.create_resources = create_resources,
|
||||||
.dpms = dpms,
|
.dpms = dpms,
|
||||||
.save = save,
|
.save = save,
|
||||||
.restore = restore,
|
.restore = restore,
|
||||||
.mode_valid = mode_valid,
|
.mode_valid = mode_valid,
|
||||||
.mode_fixup = mode_fixup,
|
.mode_fixup = mode_fixup,
|
||||||
.prepare = prepare,
|
.prepare = prepare,
|
||||||
.mode_set = mode_set,
|
.mode_set = mode_set,
|
||||||
.commit = commit,
|
.commit = commit,
|
||||||
.detect = detect,
|
.detect = detect,
|
||||||
.get_modes = get_modes,
|
.get_modes = get_modes,
|
||||||
#ifdef RANDR_12_INTERFACE
|
#ifdef RANDR_12_INTERFACE
|
||||||
.set_property = set_property,
|
.set_property = set_property,
|
||||||
#endif
|
#endif
|
||||||
#ifdef RANDR_13_INTERFACE
|
#ifdef RANDR_13_INTERFACE
|
||||||
.get_property = get_property,
|
.get_property = get_property,
|
||||||
#endif
|
#endif
|
||||||
.destroy = destroy,
|
.destroy = destroy,
|
||||||
#ifdef RANDR_GET_CRTC_INTERFACE
|
#ifdef RANDR_GET_CRTC_INTERFACE
|
||||||
.get_crtc = get_crtc,
|
.get_crtc = get_crtc,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
output_init(ScrnInfoPtr pScrn)
|
output_init(ScrnInfoPtr pScrn)
|
||||||
{
|
{
|
||||||
modesettingPtr ms = modesettingPTR(pScrn);
|
modesettingPtr ms = modesettingPTR(pScrn);
|
||||||
xf86OutputPtr output;
|
xf86OutputPtr output;
|
||||||
drmModeResPtr res;
|
drmModeResPtr res;
|
||||||
drmModeOutputPtr drm_output = NULL;
|
drmModeOutputPtr drm_output = NULL;
|
||||||
drmModeCrtcPtr crtc;
|
drmModeCrtcPtr crtc;
|
||||||
char *name;
|
char *name;
|
||||||
int o, v, p;
|
int o, v, p;
|
||||||
|
|
||||||
res = drmModeGetResources(ms->fd);
|
res = drmModeGetResources(ms->fd);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
DRV_ERROR("Failed drmModeGetResources\n");
|
DRV_ERROR("Failed drmModeGetResources\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (o = 0; o < res->count_outputs; o++) {
|
for (o = 0; o < res->count_outputs; o++) {
|
||||||
drm_output = drmModeGetOutput(ms->fd, res->outputs[o]);
|
drm_output = drmModeGetOutput(ms->fd, res->outputs[o]);
|
||||||
if (!drm_output)
|
if (!drm_output)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
for (p = 0; p < drm_output->count_props; p++) {
|
for (p = 0; p < drm_output->count_props; p++) {
|
||||||
drmModePropertyPtr prop;
|
drmModePropertyPtr prop;
|
||||||
|
|
||||||
prop = drmModeGetProperty(ms->fd, drm_output->props[p]);
|
prop = drmModeGetProperty(ms->fd, drm_output->props[p]);
|
||||||
|
|
||||||
name = NULL;
|
name = NULL;
|
||||||
if (prop) {
|
if (prop) {
|
||||||
ErrorF("VALUES %d\n",prop->count_values);
|
ErrorF("VALUES %d\n", prop->count_values);
|
||||||
|
|
||||||
for (v=0;v<prop->count_values;v++)
|
for (v = 0; v < prop->count_values; v++)
|
||||||
ErrorF("%s %lld\n", prop->name, prop->values[v]);
|
ErrorF("%s %lld\n", prop->name, prop->values[v]);
|
||||||
|
|
||||||
for (v=0;v<prop->count_enums;v++) {
|
for (v = 0; v < prop->count_enums; v++) {
|
||||||
ErrorF("%s %s\n", prop->name, prop->enums[v].name);
|
ErrorF("%s %s\n", prop->name, prop->enums[v].name);
|
||||||
if (drm_output->prop_values[p] == prop->enums[v].value) {
|
if (drm_output->prop_values[p] == prop->enums[v].value) {
|
||||||
if (!strncmp("Connector Type", prop->name, 14)) {
|
if (!strncmp("Connector Type", prop->name, 14)) {
|
||||||
ErrorF("WE'VE GOT %s\n",prop->enums[v].name);
|
ErrorF("WE'VE GOT %s\n", prop->enums[v].name);
|
||||||
name = xalloc(strlen(prop->enums[v].name));
|
name = xalloc(strlen(prop->enums[v].name));
|
||||||
strncpy(name, prop->enums[v].name, strlen(name));
|
strncpy(name, prop->enums[v].name, strlen(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
if (name)
|
||||||
if (name) break;
|
break;
|
||||||
}
|
}
|
||||||
if (name) break;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
output = xf86OutputCreate(pScrn, &output_funcs, name);
|
output = xf86OutputCreate(pScrn, &output_funcs, name);
|
||||||
if (!output)
|
if (!output)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
output->possible_crtcs = drm_output->crtcs;
|
output->possible_crtcs = drm_output->crtcs;
|
||||||
output->possible_clones = drm_output->clones;
|
output->possible_clones = drm_output->clones;
|
||||||
output->driver_private = drm_output;
|
output->driver_private = drm_output;
|
||||||
output->subpixel_order = SubPixelHorizontalRGB;
|
output->subpixel_order = SubPixelHorizontalRGB;
|
||||||
output->interlaceAllowed = FALSE;
|
output->interlaceAllowed = FALSE;
|
||||||
output->doubleScanAllowed = FALSE;
|
output->doubleScanAllowed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
drmModeFreeResources(res);
|
drmModeFreeResources(res);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue