2003-11-14 17:48:57 +01:00
|
|
|
/* all driver need this */
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_XORG_CONFIG_H
|
|
|
|
#include <xorg-config.h>
|
|
|
|
#endif
|
|
|
|
|
2006-03-29 03:05:09 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "xf86.h"
|
|
|
|
#include "xf86_OSproc.h"
|
|
|
|
|
|
|
|
/* pci stuff */
|
|
|
|
#include "xf86PciInfo.h"
|
|
|
|
#include "xf86Pci.h"
|
|
|
|
|
|
|
|
#include "xf86cmap.h"
|
|
|
|
|
|
|
|
#include "fbdevhw.h"
|
|
|
|
#include "fbpriv.h"
|
|
|
|
|
2009-07-16 16:51:27 +02:00
|
|
|
#define PAGE_MASK (~(getpagesize() - 1))
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
#include "globals.h"
|
2009-07-15 08:51:05 +02:00
|
|
|
#include <X11/extensions/dpmsconst.h>
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
#define DEBUG 0
|
|
|
|
|
2004-05-06 19:31:17 +02:00
|
|
|
#define PAGE_MASK (~(getpagesize() - 1))
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
#if DEBUG
|
|
|
|
# define TRACE_ENTER(str) ErrorF("fbdevHW: " str " %d\n",pScrn->scrnIndex)
|
|
|
|
#else
|
|
|
|
# define TRACE_ENTER(str)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
static MODULESETUPPROTO(fbdevhwSetup);
|
|
|
|
|
|
|
|
static XF86ModuleVersionInfo fbdevHWVersRec =
|
|
|
|
{
|
|
|
|
"fbdevhw",
|
|
|
|
MODULEVENDORSTRING,
|
|
|
|
MODINFOSTRING1,
|
|
|
|
MODINFOSTRING2,
|
2004-04-23 21:54:30 +02:00
|
|
|
XORG_VERSION_CURRENT,
|
2003-11-14 17:48:57 +01:00
|
|
|
0, 0, 2,
|
|
|
|
ABI_CLASS_VIDEODRV,
|
|
|
|
ABI_VIDEODRV_VERSION,
|
|
|
|
MOD_CLASS_NONE,
|
|
|
|
{0,0,0,0}
|
|
|
|
};
|
|
|
|
|
2006-06-05 05:00:24 +02:00
|
|
|
_X_EXPORT XF86ModuleData fbdevhwModuleData = {
|
|
|
|
&fbdevHWVersRec,
|
|
|
|
fbdevhwSetup,
|
|
|
|
NULL
|
|
|
|
};
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
static pointer
|
|
|
|
fbdevhwSetup(pointer module, pointer opts, int *errmaj, int *errmin)
|
|
|
|
{
|
2009-07-16 16:51:53 +02:00
|
|
|
return (pointer)1;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/mman.h>
|
2006-02-13 05:56:27 +01:00
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* our private data, and two functions to allocate/free this */
|
|
|
|
|
|
|
|
#define FBDEVHWPTRLVAL(p) (p)->privates[fbdevHWPrivateIndex].ptr
|
|
|
|
#define FBDEVHWPTR(p) ((fbdevHWPtr)(FBDEVHWPTRLVAL(p)))
|
|
|
|
|
|
|
|
static int fbdevHWPrivateIndex = -1;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
/* framebuffer device: filename (/dev/fb*), handle, more */
|
|
|
|
char* device;
|
|
|
|
int fd;
|
|
|
|
void* fbmem;
|
|
|
|
unsigned int fbmem_len;
|
|
|
|
unsigned int fboff;
|
|
|
|
char* mmio;
|
|
|
|
unsigned int mmio_len;
|
|
|
|
|
|
|
|
/* current hardware state */
|
|
|
|
struct fb_fix_screeninfo fix;
|
|
|
|
struct fb_var_screeninfo var;
|
|
|
|
|
|
|
|
/* saved video mode */
|
|
|
|
struct fb_var_screeninfo saved_var;
|
|
|
|
|
|
|
|
/* FIXME: unused??? [geert] */
|
|
|
|
struct fb_cmap saved_cmap;
|
|
|
|
unsigned short *saved_red;
|
|
|
|
unsigned short *saved_green;
|
|
|
|
unsigned short *saved_blue;
|
|
|
|
|
|
|
|
/* buildin video mode */
|
|
|
|
DisplayModeRec buildin;
|
|
|
|
|
|
|
|
} fbdevHWRec, *fbdevHWPtr;
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWGetRec(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr;
|
|
|
|
|
|
|
|
if (fbdevHWPrivateIndex < 0)
|
|
|
|
fbdevHWPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
|
|
|
|
|
|
|
|
if (FBDEVHWPTR(pScrn) != NULL)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
fPtr = FBDEVHWPTRLVAL(pScrn) = xnfcalloc(sizeof(fbdevHWRec), 1);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWFreeRec(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
if (fbdevHWPrivateIndex < 0)
|
|
|
|
return;
|
|
|
|
if (FBDEVHWPTR(pScrn) == NULL)
|
|
|
|
return;
|
|
|
|
xfree(FBDEVHWPTR(pScrn));
|
|
|
|
FBDEVHWPTRLVAL(pScrn) = NULL;
|
|
|
|
}
|
|
|
|
|
2009-01-05 10:24:24 +01:00
|
|
|
int
|
|
|
|
fbdevHWGetFD(ScrnInfoPtr pScrn)
|
|
|
|
{
|
2009-02-04 00:07:02 +01:00
|
|
|
fbdevHWPtr fPtr;
|
|
|
|
|
|
|
|
fbdevHWGetRec(pScrn);
|
|
|
|
fPtr = FBDEVHWPTR(pScrn);
|
2009-01-05 10:24:24 +01:00
|
|
|
|
|
|
|
return fPtr->fd;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* some helpers for printing debug informations */
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
static void
|
|
|
|
print_fbdev_mode(char *txt, struct fb_var_screeninfo *var)
|
|
|
|
{
|
|
|
|
ErrorF( "fbdev %s mode:\t%d %d %d %d %d %d %d %d %d %d %d:%d:%d\n",
|
|
|
|
txt,var->pixclock,
|
|
|
|
var->xres, var->right_margin, var->hsync_len, var->left_margin,
|
|
|
|
var->yres, var->lower_margin, var->vsync_len, var->upper_margin,
|
|
|
|
var->bits_per_pixel,
|
|
|
|
var->red.length, var->green.length, var->blue.length);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
print_xfree_mode(char *txt, DisplayModePtr mode)
|
|
|
|
{
|
|
|
|
ErrorF( "xfree %s mode:\t%d %d %d %d %d %d %d %d %d\n",
|
|
|
|
txt,mode->Clock,
|
|
|
|
mode->HDisplay, mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
|
|
|
|
mode->VDisplay, mode->VSyncStart, mode->VSyncEnd, mode->VTotal);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* Convert timings between the XFree and the Frame Buffer Device */
|
|
|
|
|
|
|
|
static void
|
|
|
|
xfree2fbdev_fblayout(ScrnInfoPtr pScrn, struct fb_var_screeninfo *var)
|
|
|
|
{
|
2006-12-31 17:23:31 +01:00
|
|
|
var->xres_virtual = pScrn->displayWidth ? pScrn->displayWidth :
|
|
|
|
pScrn->virtualX;
|
2003-11-14 17:48:57 +01:00
|
|
|
var->yres_virtual = pScrn->virtualY;
|
|
|
|
var->bits_per_pixel = pScrn->bitsPerPixel;
|
2007-01-19 18:30:21 +01:00
|
|
|
if (pScrn->defaultVisual == TrueColor ||
|
|
|
|
pScrn->defaultVisual == DirectColor) {
|
|
|
|
var->red.length = pScrn->weight.red;
|
|
|
|
var->green.length = pScrn->weight.green;
|
|
|
|
var->blue.length = pScrn->weight.blue;
|
|
|
|
} else {
|
|
|
|
var->red.length = 8;
|
|
|
|
var->green.length = 8;
|
|
|
|
var->blue.length = 8;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
xfree2fbdev_timing(DisplayModePtr mode, struct fb_var_screeninfo *var)
|
|
|
|
{
|
|
|
|
var->xres = mode->HDisplay;
|
|
|
|
var->yres = mode->VDisplay;
|
|
|
|
if (var->xres_virtual < var->xres)
|
|
|
|
var->xres_virtual = var->xres;
|
|
|
|
if (var->yres_virtual < var->yres)
|
|
|
|
var->yres_virtual = var->yres;
|
|
|
|
var->xoffset = var->yoffset = 0;
|
|
|
|
var->pixclock = mode->Clock ? 1000000000/mode->Clock : 0;
|
|
|
|
var->right_margin = mode->HSyncStart-mode->HDisplay;
|
|
|
|
var->hsync_len = mode->HSyncEnd-mode->HSyncStart;
|
|
|
|
var->left_margin = mode->HTotal-mode->HSyncEnd;
|
|
|
|
var->lower_margin = mode->VSyncStart-mode->VDisplay;
|
|
|
|
var->vsync_len = mode->VSyncEnd-mode->VSyncStart;
|
|
|
|
var->upper_margin = mode->VTotal-mode->VSyncEnd;
|
|
|
|
var->sync = 0;
|
|
|
|
if (mode->Flags & V_PHSYNC)
|
|
|
|
var->sync |= FB_SYNC_HOR_HIGH_ACT;
|
|
|
|
if (mode->Flags & V_PVSYNC)
|
|
|
|
var->sync |= FB_SYNC_VERT_HIGH_ACT;
|
|
|
|
if (mode->Flags & V_PCSYNC)
|
|
|
|
var->sync |= FB_SYNC_COMP_HIGH_ACT;
|
|
|
|
if (mode->Flags & V_BCAST)
|
|
|
|
var->sync |= FB_SYNC_BROADCAST;
|
|
|
|
if (mode->Flags & V_INTERLACE)
|
|
|
|
var->vmode = FB_VMODE_INTERLACED;
|
|
|
|
else if (mode->Flags & V_DBLSCAN)
|
|
|
|
var->vmode = FB_VMODE_DOUBLE;
|
|
|
|
else
|
|
|
|
var->vmode = FB_VMODE_NONINTERLACED;
|
|
|
|
}
|
|
|
|
|
2006-12-30 10:18:28 +01:00
|
|
|
static Bool
|
2007-01-19 18:28:05 +01:00
|
|
|
fbdev_modes_equal(struct fb_var_screeninfo *set, struct fb_var_screeninfo *req)
|
2006-12-30 10:18:28 +01:00
|
|
|
{
|
2007-01-19 18:28:05 +01:00
|
|
|
return (set->xres_virtual >= req->xres_virtual &&
|
2007-08-30 22:57:41 +02:00
|
|
|
set->yres_virtual >= req->yres_virtual &&
|
2007-01-19 18:28:05 +01:00
|
|
|
set->bits_per_pixel == req->bits_per_pixel &&
|
|
|
|
set->red.length == req->red.length &&
|
|
|
|
set->green.length == req->green.length &&
|
|
|
|
set->blue.length == req->blue.length &&
|
|
|
|
set->xres == req->xres && set->yres == req->yres &&
|
|
|
|
set->right_margin == req->right_margin &&
|
|
|
|
set->hsync_len == req->hsync_len &&
|
|
|
|
set->left_margin == req->left_margin &&
|
|
|
|
set->lower_margin == req->lower_margin &&
|
|
|
|
set->vsync_len == req->vsync_len &&
|
|
|
|
set->upper_margin == req->upper_margin &&
|
|
|
|
set->sync == req->sync && set->vmode == req->vmode);
|
2006-12-30 10:18:28 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static void
|
|
|
|
fbdev2xfree_timing(struct fb_var_screeninfo *var, DisplayModePtr mode)
|
|
|
|
{
|
2007-10-28 09:37:52 +01:00
|
|
|
mode->Clock = var->pixclock ? 1000000000/var->pixclock : 0;
|
2003-11-14 17:48:57 +01:00
|
|
|
mode->HDisplay = var->xres;
|
|
|
|
mode->HSyncStart = mode->HDisplay+var->right_margin;
|
|
|
|
mode->HSyncEnd = mode->HSyncStart+var->hsync_len;
|
|
|
|
mode->HTotal = mode->HSyncEnd+var->left_margin;
|
|
|
|
mode->VDisplay = var->yres;
|
|
|
|
mode->VSyncStart = mode->VDisplay+var->lower_margin;
|
|
|
|
mode->VSyncEnd = mode->VSyncStart+var->vsync_len;
|
|
|
|
mode->VTotal = mode->VSyncEnd+var->upper_margin;
|
|
|
|
mode->Flags = 0;
|
|
|
|
mode->Flags |= var->sync & FB_SYNC_HOR_HIGH_ACT ? V_PHSYNC : V_NHSYNC;
|
|
|
|
mode->Flags |= var->sync & FB_SYNC_VERT_HIGH_ACT ? V_PVSYNC : V_NVSYNC;
|
|
|
|
mode->Flags |= var->sync & FB_SYNC_COMP_HIGH_ACT ? V_PCSYNC : V_NCSYNC;
|
|
|
|
if (var->sync & FB_SYNC_BROADCAST)
|
|
|
|
mode->Flags |= V_BCAST;
|
|
|
|
if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED)
|
|
|
|
mode->Flags |= V_INTERLACE;
|
|
|
|
else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
|
|
|
|
mode->Flags |= V_DBLSCAN;
|
|
|
|
mode->SynthClock = mode->Clock;
|
|
|
|
mode->CrtcHDisplay = mode->HDisplay;
|
|
|
|
mode->CrtcHSyncStart = mode->HSyncStart;
|
|
|
|
mode->CrtcHSyncEnd = mode->HSyncEnd;
|
|
|
|
mode->CrtcHTotal = mode->HTotal;
|
|
|
|
mode->CrtcVDisplay = mode->VDisplay;
|
|
|
|
mode->CrtcVSyncStart = mode->VSyncStart;
|
|
|
|
mode->CrtcVSyncEnd = mode->VSyncEnd;
|
|
|
|
mode->CrtcVTotal = mode->VTotal;
|
|
|
|
mode->CrtcHAdjusted = FALSE;
|
|
|
|
mode->CrtcVAdjusted = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* open correct framebuffer device */
|
|
|
|
|
2006-06-07 23:09:02 +02:00
|
|
|
/**
|
|
|
|
* Try to find the framebuffer device for a given PCI device
|
|
|
|
*/
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
2006-06-07 23:09:02 +02:00
|
|
|
fbdev_open_pci(struct pci_device * pPci, char **namep)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2006-06-07 23:09:02 +02:00
|
|
|
struct fb_fix_screeninfo fix;
|
|
|
|
char filename[256];
|
|
|
|
int fd,i,j;
|
|
|
|
|
|
|
|
|
|
|
|
/* There are two ways to that we can determine which fb device is
|
|
|
|
* associated with this PCI device. The more modern way is to look in
|
|
|
|
* the sysfs directory for the PCI device for a file named
|
2008-05-12 20:53:37 +02:00
|
|
|
* "graphics/fb*"
|
2006-06-07 23:09:02 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
sprintf(filename,
|
2008-05-12 20:53:37 +02:00
|
|
|
"/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics/fb%d",
|
2006-06-07 23:09:02 +02:00
|
|
|
pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
|
|
|
|
|
|
|
|
fd = open(filename, O_RDONLY, 0);
|
|
|
|
if (fd != -1) {
|
|
|
|
close(fd);
|
|
|
|
sprintf(filename, "/dev/fb%d", i);
|
|
|
|
|
|
|
|
fd = open(filename, O_RDWR, 0);
|
|
|
|
if (fd != -1) {
|
|
|
|
if (ioctl(fd, FBIOGET_FSCREENINFO, (void*) & fix) != -1) {
|
|
|
|
if (namep) {
|
|
|
|
*namep = xnfalloc(16);
|
|
|
|
strncpy(*namep,fix.id,16);
|
|
|
|
}
|
|
|
|
|
|
|
|
return fd;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2009-07-16 16:51:08 +02:00
|
|
|
close(fd);
|
2006-06-07 23:09:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* The other way is to examine the resources associated with each fb
|
|
|
|
* device and see if there is a match with the PCI device. This technique
|
|
|
|
* has some problems on certain mixed 64-bit / 32-bit architectures.
|
|
|
|
* There is a flaw in the fb_fix_screeninfo structure in that it only
|
|
|
|
* returns the low 32-bits of the address of the resources associated with
|
|
|
|
* a device. However, on a mixed architecture the base addresses of PCI
|
|
|
|
* devices, even for 32-bit applications, may be higher than 0x0f0000000.
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
sprintf(filename,"/dev/fb%d",i);
|
|
|
|
if (-1 == (fd = open(filename,O_RDWR,0))) {
|
|
|
|
xf86DrvMsg(-1, X_WARNING,
|
|
|
|
"open %s: %s\n", filename, strerror(errno));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)&fix)) {
|
|
|
|
close(fd);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
for (j = 0; j < 6; j++) {
|
|
|
|
const pciaddr_t res_start = pPci->regions[j].base_addr;
|
|
|
|
const pciaddr_t res_end = res_start + pPci->regions[j].size;
|
|
|
|
|
|
|
|
if ((0 != fix.smem_len &&
|
|
|
|
(pciaddr_t) fix.smem_start >= res_start &&
|
|
|
|
(pciaddr_t) fix.smem_start < res_end) ||
|
|
|
|
(0 != fix.mmio_len &&
|
|
|
|
(pciaddr_t) fix.mmio_start >= res_start &&
|
|
|
|
(pciaddr_t) fix.mmio_start < res_end))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (j == 6) {
|
|
|
|
close(fd);
|
|
|
|
continue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2006-06-07 23:09:02 +02:00
|
|
|
if (namep) {
|
|
|
|
*namep = xnfalloc(16);
|
|
|
|
strncpy(*namep,fix.id,16);
|
|
|
|
}
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (namep)
|
|
|
|
*namep = NULL;
|
2005-08-26 08:29:15 +02:00
|
|
|
|
2006-06-07 23:09:02 +02:00
|
|
|
xf86DrvMsg(-1, X_ERROR,
|
|
|
|
"Unable to find a valid framebuffer device\n");
|
|
|
|
return -1;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
fbdev_open(int scrnIndex, char *dev, char** namep)
|
|
|
|
{
|
|
|
|
struct fb_fix_screeninfo fix;
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
/* try argument (from XF86Config) first */
|
|
|
|
if (dev) {
|
|
|
|
fd = open(dev,O_RDWR,0);
|
|
|
|
} else {
|
|
|
|
/* second: environment variable */
|
|
|
|
dev = getenv("FRAMEBUFFER");
|
|
|
|
if ((NULL == dev) || ((fd = open(dev,O_RDWR,0)) == -1)) {
|
|
|
|
/* last try: default device */
|
|
|
|
dev = "/dev/fb0";
|
|
|
|
fd = open(dev,O_RDWR,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fd == -1) {
|
|
|
|
xf86DrvMsg(scrnIndex, X_ERROR,
|
|
|
|
"open %s: %s\n", dev, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (namep) {
|
|
|
|
if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)(&fix))) {
|
|
|
|
*namep = NULL;
|
|
|
|
xf86DrvMsg(scrnIndex, X_ERROR,
|
|
|
|
"FBIOGET_FSCREENINFO: %s\n", strerror(errno));
|
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
*namep = xnfalloc(16);
|
|
|
|
strncpy(*namep,fix.id,16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2006-06-07 23:09:02 +02:00
|
|
|
fbdevHWProbe(struct pci_device * pPci, char *device,char **namep)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
if (pPci)
|
|
|
|
fd = fbdev_open_pci(pPci,namep);
|
|
|
|
else
|
|
|
|
fd = fbdev_open(-1,device,namep);
|
|
|
|
|
|
|
|
if (-1 == fd)
|
|
|
|
return FALSE;
|
|
|
|
close(fd);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2006-06-07 23:09:02 +02:00
|
|
|
fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device * pPci, char *device)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr;
|
|
|
|
|
|
|
|
TRACE_ENTER("Init");
|
|
|
|
|
|
|
|
fbdevHWGetRec(pScrn);
|
|
|
|
fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
/* open device */
|
|
|
|
if (pPci)
|
|
|
|
fPtr->fd = fbdev_open_pci(pPci,NULL);
|
|
|
|
else
|
|
|
|
fPtr->fd = fbdev_open(pScrn->scrnIndex,device,NULL);
|
|
|
|
if (-1 == fPtr->fd) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"Failed to open framebuffer device, consult warnings"
|
|
|
|
" and/or errors above for possible reasons\n"
|
|
|
|
"\t(you may have to look at the server log to see"
|
|
|
|
" warnings)\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get current fb device settings */
|
|
|
|
if (-1 == ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"ioctl FBIOGET_FSCREENINFO: %s\n",
|
|
|
|
strerror(errno));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (-1 == ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->var))) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"ioctl FBIOGET_VSCREENINFO: %s\n",
|
|
|
|
strerror(errno));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we can use the current settings as "buildin mode" */
|
|
|
|
fbdev2xfree_timing(&fPtr->var, &fPtr->buildin);
|
|
|
|
fPtr->buildin.name = "current";
|
|
|
|
fPtr->buildin.next = &fPtr->buildin;
|
|
|
|
fPtr->buildin.prev = &fPtr->buildin;
|
|
|
|
fPtr->buildin.type |= M_T_BUILTIN;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
char*
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWGetName(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
return fPtr->fix.id;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
if (fbbpp)
|
|
|
|
*fbbpp = fPtr->var.bits_per_pixel;
|
|
|
|
|
|
|
|
if (fPtr->fix.visual == FB_VISUAL_TRUECOLOR ||
|
|
|
|
fPtr->fix.visual == FB_VISUAL_DIRECTCOLOR)
|
|
|
|
return fPtr->var.red.length+fPtr->var.green.length+
|
|
|
|
fPtr->var.blue.length;
|
|
|
|
else
|
|
|
|
return fPtr->var.bits_per_pixel;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWGetLineLength(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
if (fPtr->fix.line_length)
|
|
|
|
return fPtr->fix.line_length;
|
|
|
|
else
|
|
|
|
return fPtr->var.xres_virtual*fPtr->var.bits_per_pixel/8;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWGetType(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
return fPtr->fix.type;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWGetVidmem(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
return fPtr->fix.smem_len;
|
|
|
|
}
|
|
|
|
|
2006-12-30 10:18:28 +01:00
|
|
|
static Bool
|
|
|
|
fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
struct fb_var_screeninfo req_var = fPtr->var, set_var;
|
|
|
|
|
2006-12-30 16:44:31 +01:00
|
|
|
TRACE_ENTER("SetMode");
|
2006-12-30 10:18:28 +01:00
|
|
|
|
|
|
|
xfree2fbdev_fblayout(pScrn, &req_var);
|
|
|
|
xfree2fbdev_timing(mode, &req_var);
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
print_xfree_mode("init", mode);
|
|
|
|
print_fbdev_mode("init", &req_var);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
set_var = req_var;
|
|
|
|
|
|
|
|
if (check)
|
|
|
|
set_var.activate = FB_ACTIVATE_TEST;
|
|
|
|
|
|
|
|
if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void*)(&set_var))) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!fbdev_modes_equal(&set_var, &req_var)) {
|
|
|
|
if (!check)
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"FBIOPUT_VSCREENINFO succeeded but modified "
|
|
|
|
"mode\n");
|
|
|
|
#if DEBUG
|
|
|
|
print_fbdev_mode("returned", &set_var);
|
|
|
|
#endif
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-12-30 16:44:31 +01:00
|
|
|
if (!check)
|
|
|
|
fPtr->var = set_var;
|
2006-12-30 10:18:28 +01:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWSetVideoModes(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
char **modename;
|
2003-11-25 20:29:01 +01:00
|
|
|
DisplayModePtr mode,this,last = pScrn->modes;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
TRACE_ENTER("VerifyModes");
|
|
|
|
if (NULL == pScrn->display->modes)
|
|
|
|
return;
|
|
|
|
|
2006-12-30 10:18:28 +01:00
|
|
|
pScrn->virtualX = pScrn->display->virtualX;
|
|
|
|
pScrn->virtualY = pScrn->display->virtualY;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
for (modename = pScrn->display->modes; *modename != NULL; modename++) {
|
|
|
|
for (mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next)
|
|
|
|
if (0 == strcmp(mode->name,*modename))
|
|
|
|
break;
|
|
|
|
if (NULL == mode) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
|
|
|
"\tmode \"%s\" not found\n", *modename);
|
|
|
|
continue;
|
|
|
|
}
|
2006-12-30 10:18:28 +01:00
|
|
|
|
|
|
|
if (!fbdevHWSetMode(pScrn, mode, TRUE)) {
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
|
|
|
"\tmode \"%s\" test failed\n", *modename);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
|
|
|
"\tmode \"%s\" ok\n", *modename);
|
2006-12-30 10:18:28 +01:00
|
|
|
|
|
|
|
if (pScrn->virtualX < mode->HDisplay)
|
|
|
|
pScrn->virtualX = mode->HDisplay;
|
|
|
|
if (pScrn->virtualY < mode->VDisplay)
|
|
|
|
pScrn->virtualY = mode->VDisplay;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if (NULL == pScrn->modes) {
|
2008-01-12 04:57:42 +01:00
|
|
|
this = pScrn->modes = xf86DuplicateMode(mode);
|
2003-11-14 17:48:57 +01:00
|
|
|
this->next = this;
|
|
|
|
this->prev = this;
|
|
|
|
} else {
|
2008-01-12 04:57:42 +01:00
|
|
|
this = xf86DuplicateMode(mode);
|
2003-11-14 17:48:57 +01:00
|
|
|
this->next = pScrn->modes;
|
|
|
|
this->prev = last;
|
|
|
|
last->next = this;
|
|
|
|
pScrn->modes->prev = this;
|
|
|
|
}
|
|
|
|
last = this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DisplayModePtr
|
|
|
|
fbdevHWGetBuildinMode(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
return &fPtr->buildin;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWUseBuildinMode(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
TRACE_ENTER("UseBuildinMode");
|
|
|
|
pScrn->modes = &fPtr->buildin;
|
|
|
|
pScrn->virtualX = pScrn->display->virtualX;
|
|
|
|
pScrn->virtualY = pScrn->display->virtualY;
|
|
|
|
if (pScrn->virtualX < fPtr->buildin.HDisplay)
|
|
|
|
pScrn->virtualX = fPtr->buildin.HDisplay;
|
|
|
|
if (pScrn->virtualY < fPtr->buildin.VDisplay)
|
|
|
|
pScrn->virtualY = fPtr->buildin.VDisplay;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
static void
|
2003-11-14 17:48:57 +01:00
|
|
|
calculateFbmem_len(fbdevHWPtr fPtr)
|
|
|
|
{
|
|
|
|
fPtr->fboff = (unsigned long) fPtr->fix.smem_start & ~PAGE_MASK;
|
|
|
|
fPtr->fbmem_len = (fPtr->fboff+fPtr->fix.smem_len+~PAGE_MASK) &
|
|
|
|
PAGE_MASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void*
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWMapVidmem(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
TRACE_ENTER("MapVidmem");
|
|
|
|
if (NULL == fPtr->fbmem) {
|
|
|
|
calculateFbmem_len(fPtr);
|
|
|
|
fPtr->fbmem = mmap(NULL, fPtr->fbmem_len, PROT_READ | PROT_WRITE,
|
|
|
|
MAP_SHARED, fPtr->fd, 0);
|
|
|
|
if (-1 == (long)fPtr->fbmem) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"mmap fbmem: %s\n", strerror(errno));
|
|
|
|
fPtr->fbmem = NULL;
|
|
|
|
} else {
|
|
|
|
/* Perhaps we'd better add fboff to fbmem and return 0 in
|
|
|
|
fbdevHWLinearOffset()? Of course we then need to mask
|
|
|
|
fPtr->fbmem with PAGE_MASK in fbdevHWUnmapVidmem() as
|
|
|
|
well. [geert] */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pScrn->memPhysBase = (unsigned long)fPtr->fix.smem_start & (unsigned long)(PAGE_MASK);
|
|
|
|
pScrn->fbOffset = (unsigned long)fPtr->fix.smem_start & (unsigned long)(~PAGE_MASK);
|
|
|
|
return fPtr->fbmem;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWLinearOffset(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
TRACE_ENTER("LinearOffset");
|
|
|
|
return fPtr->fboff;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWUnmapVidmem(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
TRACE_ENTER("UnmapVidmem");
|
|
|
|
if (NULL != fPtr->fbmem) {
|
|
|
|
if (-1 == munmap(fPtr->fbmem, fPtr->fbmem_len))
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"munmap fbmem: %s\n", strerror(errno));
|
|
|
|
fPtr->fbmem = NULL;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void*
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWMapMMIO(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
unsigned int mmio_off;
|
|
|
|
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
TRACE_ENTER("MapMMIO");
|
|
|
|
if (NULL == fPtr->mmio) {
|
|
|
|
/* tell the kernel not to use accels to speed up console scrolling */
|
|
|
|
fPtr->var.accel_flags = 0;
|
|
|
|
if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->var))) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
mmio_off = (unsigned long) fPtr->fix.mmio_start & ~PAGE_MASK;
|
|
|
|
fPtr->mmio_len = (mmio_off+fPtr->fix.mmio_len+~PAGE_MASK) &
|
|
|
|
PAGE_MASK;
|
|
|
|
if (NULL == fPtr->fbmem)
|
|
|
|
calculateFbmem_len(fPtr);
|
|
|
|
fPtr->mmio = mmap(NULL, fPtr->mmio_len, PROT_READ | PROT_WRITE,
|
|
|
|
MAP_SHARED, fPtr->fd, fPtr->fbmem_len);
|
|
|
|
if (-1 == (long)fPtr->mmio) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"mmap mmio: %s\n", strerror(errno));
|
|
|
|
fPtr->mmio = NULL;
|
|
|
|
} else
|
|
|
|
fPtr->mmio += mmio_off;
|
|
|
|
}
|
|
|
|
return fPtr->mmio;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWUnmapMMIO(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
TRACE_ENTER("UnmapMMIO");
|
|
|
|
if (NULL != fPtr->mmio) {
|
|
|
|
if (-1 == munmap((void *)((unsigned long)fPtr->mmio & PAGE_MASK), fPtr->mmio_len))
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"munmap mmio: %s\n", strerror(errno));
|
|
|
|
fPtr->mmio = NULL;
|
|
|
|
/* FIXME: restore var.accel_flags [geert] */
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
pScrn->vtSema = TRUE;
|
|
|
|
|
|
|
|
/* set */
|
2006-12-30 10:18:28 +01:00
|
|
|
if (!fbdevHWSetMode(pScrn, mode, FALSE))
|
2003-11-14 17:48:57 +01:00
|
|
|
return FALSE;
|
2006-12-30 10:18:28 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* read back */
|
|
|
|
if (0 != ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"FBIOGET_FSCREENINFO: %s\n", strerror(errno));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (0 != ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->var))) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"FBIOGET_VSCREENINFO: %s\n", strerror(errno));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2006-12-31 17:59:44 +01:00
|
|
|
|
2007-01-19 18:30:21 +01:00
|
|
|
if (pScrn->defaultVisual == TrueColor ||
|
|
|
|
pScrn->defaultVisual == DirectColor) {
|
|
|
|
/* XXX: This is a hack, but it should be a NOP for all the setups that
|
|
|
|
* worked before and actually seems to fix some others...
|
|
|
|
*/
|
|
|
|
pScrn->offset.red = fPtr->var.red.offset;
|
|
|
|
pScrn->offset.green = fPtr->var.green.offset;
|
|
|
|
pScrn->offset.blue = fPtr->var.blue.offset;
|
|
|
|
pScrn->mask.red = ((1 << fPtr->var.red.length) - 1) << fPtr->var.red.offset;
|
|
|
|
pScrn->mask.green = ((1 << fPtr->var.green.length) - 1) << fPtr->var.green.offset;
|
|
|
|
pScrn->mask.blue = ((1 << fPtr->var.blue.length) - 1) << fPtr->var.blue.offset;
|
|
|
|
}
|
2006-12-31 17:59:44 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* video mode save/restore */
|
|
|
|
|
|
|
|
/* TODO: colormap */
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWSave(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
TRACE_ENTER("Save");
|
|
|
|
if (0 != ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->saved_var)))
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"FBIOGET_VSCREENINFO: %s\n", strerror(errno));
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWRestore(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
TRACE_ENTER("Restore");
|
|
|
|
if (0 != ioctl(fPtr->fd,FBIOPUT_VSCREENINFO,(void*)(&fPtr->saved_var)))
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* callback for xf86HandleColormaps */
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
|
|
|
|
LOCO *colors, VisualPtr pVisual)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
struct fb_cmap cmap;
|
|
|
|
unsigned short red,green,blue;
|
|
|
|
int i;
|
|
|
|
|
2004-08-04 14:21:48 +02:00
|
|
|
TRACE_ENTER("LoadPalette");
|
2003-11-14 17:48:57 +01:00
|
|
|
cmap.len = 1;
|
|
|
|
cmap.red = &red;
|
|
|
|
cmap.green = &green;
|
|
|
|
cmap.blue = &blue;
|
|
|
|
cmap.transp = NULL;
|
|
|
|
for (i = 0; i < numColors; i++) {
|
|
|
|
cmap.start = indices[i];
|
|
|
|
red = (colors[indices[i]].red << 8) |
|
|
|
|
colors[indices[i]].red;
|
|
|
|
green = (colors[indices[i]].green << 8) |
|
|
|
|
colors[indices[i]].green;
|
|
|
|
blue = (colors[indices[i]].blue << 8) |
|
|
|
|
colors[indices[i]].blue;
|
|
|
|
if (-1 == ioctl(fPtr->fd,FBIOPUTCMAP,(void*)&cmap))
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"FBIOPUTCMAP: %s\n", strerror(errno));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* these can be hooked directly into ScrnInfoRec */
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
ModeStatus
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
|
|
|
|
{
|
|
|
|
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
|
|
|
|
|
|
|
|
TRACE_ENTER("ValidMode");
|
2006-12-30 10:18:28 +01:00
|
|
|
|
|
|
|
if (!fbdevHWSetMode(pScrn, mode, TRUE))
|
2003-11-14 17:48:57 +01:00
|
|
|
return MODE_BAD;
|
2006-12-30 10:18:28 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
return MODE_OK;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
|
|
|
|
{
|
|
|
|
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
|
|
|
|
|
|
|
|
TRACE_ENTER("SwitchMode");
|
2006-12-30 10:18:28 +01:00
|
|
|
|
|
|
|
if (!fbdevHWSetMode(pScrn, mode, FALSE))
|
2003-11-14 17:48:57 +01:00
|
|
|
return FALSE;
|
2006-12-30 10:18:28 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWAdjustFrame(int scrnIndex, int x, int y, int flags)
|
|
|
|
{
|
|
|
|
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
|
|
|
|
TRACE_ENTER("AdjustFrame");
|
2003-11-25 20:29:01 +01:00
|
|
|
if ( x < 0 || x + fPtr->var.xres > fPtr->var.xres_virtual ||
|
|
|
|
y < 0 || y + fPtr->var.yres > fPtr->var.yres_virtual )
|
|
|
|
return;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
fPtr->var.xoffset = x;
|
|
|
|
fPtr->var.yoffset = y;
|
|
|
|
if (-1 == ioctl(fPtr->fd,FBIOPAN_DISPLAY,(void*)&fPtr->var))
|
2005-06-29 17:19:14 +02:00
|
|
|
xf86DrvMsgVerb(scrnIndex, X_WARNING, 5,
|
2003-11-14 17:48:57 +01:00
|
|
|
"FBIOPAN_DISPLAY: %s\n", strerror(errno));
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWEnterVT(int scrnIndex, int flags)
|
|
|
|
{
|
|
|
|
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
|
|
|
|
|
|
|
|
TRACE_ENTER("EnterVT");
|
|
|
|
if (!fbdevHWModeInit(pScrn, pScrn->currentMode))
|
|
|
|
return FALSE;
|
|
|
|
fbdevHWAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWLeaveVT(int scrnIndex, int flags)
|
|
|
|
{
|
|
|
|
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
|
|
|
|
|
|
|
|
TRACE_ENTER("LeaveVT");
|
|
|
|
fbdevHWRestore(pScrn);
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags)
|
|
|
|
{
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
unsigned long fbmode;
|
|
|
|
|
2004-08-04 14:21:48 +02:00
|
|
|
TRACE_ENTER("DPMSSet");
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!pScrn->vtSema)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case DPMSModeOn:
|
|
|
|
fbmode = 0;
|
|
|
|
break;
|
|
|
|
case DPMSModeStandby:
|
|
|
|
fbmode = 2;
|
|
|
|
break;
|
|
|
|
case DPMSModeSuspend:
|
|
|
|
fbmode = 3;
|
|
|
|
break;
|
|
|
|
case DPMSModeOff:
|
|
|
|
fbmode = 4;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)fbmode))
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"FBIOBLANK: %s\n", strerror(errno));
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2003-11-14 17:48:57 +01:00
|
|
|
fbdevHWSaveScreen(ScreenPtr pScreen, int mode)
|
|
|
|
{
|
|
|
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
|
|
|
fbdevHWPtr fPtr = FBDEVHWPTR(pScrn);
|
|
|
|
unsigned long unblank;
|
|
|
|
|
2004-08-04 14:21:48 +02:00
|
|
|
TRACE_ENTER("HWSaveScreen");
|
2003-11-14 17:48:57 +01:00
|
|
|
if (!pScrn->vtSema)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
unblank = xf86IsUnblank(mode);
|
|
|
|
|
|
|
|
if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)(1-unblank))) {
|
|
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
|
|
"FBIOBLANK: %s\n", strerror(errno));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-07-30 22:30:57 +02:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
xf86SwitchModeProc *
|
2004-07-31 03:21:19 +02:00
|
|
|
fbdevHWSwitchModeWeak(void) { return fbdevHWSwitchMode; }
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
xf86AdjustFrameProc *
|
2004-07-31 03:21:19 +02:00
|
|
|
fbdevHWAdjustFrameWeak(void) { return fbdevHWAdjustFrame; }
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
xf86EnterVTProc *
|
2004-07-31 03:21:19 +02:00
|
|
|
fbdevHWEnterVTWeak(void) { return fbdevHWEnterVT; }
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
xf86LeaveVTProc *
|
2004-07-31 03:21:19 +02:00
|
|
|
fbdevHWLeaveVTWeak(void) { return fbdevHWLeaveVT; }
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
xf86ValidModeProc *
|
2004-07-31 03:21:19 +02:00
|
|
|
fbdevHWValidModeWeak(void) { return fbdevHWValidMode; }
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
xf86DPMSSetProc *
|
2004-07-31 03:21:19 +02:00
|
|
|
fbdevHWDPMSSetWeak(void) { return fbdevHWDPMSSet; }
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
xf86LoadPaletteProc *
|
2004-07-31 03:21:19 +02:00
|
|
|
fbdevHWLoadPaletteWeak(void) { return fbdevHWLoadPalette; }
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
SaveScreenProcPtr
|
2004-07-31 03:21:19 +02:00
|
|
|
fbdevHWSaveScreenWeak(void) { return fbdevHWSaveScreen; }
|