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