summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-07-23 00:04:49 +0100
committerThomas White <taw@bitwiz.org.uk>2009-07-23 00:04:49 +0100
commitfa0b953a1a137a9706b9bea15aa7e30a67d0a086 (patch)
tree971e7238b58e97532ae68542501f10c345295284
parentb0150bab10528c49384b5e3fd29f3ec9e9115e05 (diff)
Make glamo-kms-driver.c compile
-rw-r--r--src/glamo-dri2.h28
-rw-r--r--src/glamo-kms-driver.c101
-rw-r--r--src/glamo-kms-exa.h1
-rw-r--r--src/glamo.h3
4 files changed, 89 insertions, 44 deletions
diff --git a/src/glamo-dri2.h b/src/glamo-dri2.h
new file mode 100644
index 0000000..8ec99b9
--- /dev/null
+++ b/src/glamo-dri2.h
@@ -0,0 +1,28 @@
+/*
+ * DRI for the SMedia Glamo3362 X.org Driver
+ *
+ * Copyright 2009 Thomas White <taw@bitwiz.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#include "xf86.h"
+
+extern void driScreenInit(ScreenPtr pScreen);
+extern void driCloseScreen(ScreenPtr pScreen);
+extern void driLock(ScreenPtr pScreen);
+extern void driUnlock(ScreenPtr pScreen);
diff --git a/src/glamo-kms-driver.c b/src/glamo-kms-driver.c
index 0c923c0..2741253 100644
--- a/src/glamo-kms-driver.c
+++ b/src/glamo-kms-driver.c
@@ -65,10 +65,12 @@
#include "xf86str.h"
#include "xf86RAC.h"
#include "xf86drm.h"
+#include "micmap.h"
#include "glamo.h"
#include "glamo-kms-driver.h"
#include "glamo-kms-exa.h"
+#include "glamo-dri2.h"
static const char *fbSymbols[] = {
@@ -78,9 +80,6 @@ static const char *fbSymbols[] = {
};
-static int modesettingEntityIndex = -1;
-
-
/* Return TRUE if KMS can be used */
Bool GlamoKernelModesettingAvailable()
{
@@ -106,29 +105,44 @@ Bool GlamoKernelModesettingAvailable()
}
+void GlamoKMSAdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86OutputPtr output = config->output[config->compat_output];
+ xf86CrtcPtr crtc = output->crtc;
+
+ if (crtc && crtc->enabled) {
+ crtc->funcs->mode_set(crtc,
+ pScrn->currentMode,
+ pScrn->currentMode,
+ x, y);
+ crtc->x = output->initial_x + x;
+ crtc->y = output->initial_y + y;
+ }
+}
+
+
static Bool CreateFrontBuffer(ScrnInfoPtr pScrn)
{
GlamoPtr pGlamo = GlamoPTR(pScrn);
ScreenPtr pScreen = pScrn->pScreen;
PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen);
- Bool fbAccessDisabled;
- int flags;
+ unsigned int flags;
- pGlamo->noEvict = TRUE;
pScreen->ModifyPixmapHeader(rootPixmap,
pScrn->virtualX, pScrn->virtualY,
pScrn->depth, pScrn->bitsPerPixel,
pScrn->displayWidth * pScrn->bitsPerPixel/8,
NULL);
- pGlamo->noEvict = FALSE;
- drmModeAddFB(ms->fd,
+ drmModeAddFB(pGlamo->drm_fd,
pScrn->virtualX,
pScrn->virtualY,
pScrn->depth,
pScrn->bitsPerPixel,
pScrn->displayWidth * pScrn->bitsPerPixel / 8,
- driGetPixmapHandle(rootPixmap, &flags), &ms->fb_id);
+ driGetPixmapHandle(rootPixmap, &flags), &pGlamo->fb_id);
pScrn->frameX0 = 0;
pScrn->frameY0 = 0;
@@ -143,10 +157,6 @@ static Bool CreateFrontBuffer(ScrnInfoPtr pScrn)
static Bool crtc_resize(ScrnInfoPtr pScrn, int width, int height)
{
GlamoPtr pGlamo = GlamoPTR(pScrn);
- ScreenPtr pScreen = pScrn->pScreen;
- PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen);
- Bool fbAccessDisabled;
- CARD8 *fbstart;
if ( (width == pScrn->virtualX) && (height == pScrn->virtualY) )
return TRUE; /* Nothing to do */
@@ -283,15 +293,45 @@ static Bool GlamoKMSCloseScreen(int scrnIndex, ScreenPtr pScreen)
}
+static Bool GlamoKMSCreateScreenResources(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ GlamoPtr pGlamo = GlamoPTR(pScrn);
+ PixmapPtr rootPixmap;
+ Bool ret;
+ unsigned int flags;
+
+ pScreen->CreateScreenResources = pGlamo->createScreenResources;
+ ret = pScreen->CreateScreenResources(pScreen);
+ pScreen->CreateScreenResources = GlamoKMSCreateScreenResources;
+
+ rootPixmap = pScreen->GetScreenPixmap(pScreen);
+
+ if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, NULL))
+ FatalError("Couldn't adjust screen pixmap\n");
+
+ drmModeAddFB(pGlamo->drm_fd,
+ pScrn->virtualX,
+ pScrn->virtualY,
+ pScrn->depth,
+ pScrn->bitsPerPixel,
+ pScrn->displayWidth * pScrn->bitsPerPixel / 8,
+ driGetPixmapHandle(rootPixmap, &flags), &pGlamo->fb_id);
+
+ GlamoKMSAdjustFrame(pScrn->scrnIndex,
+ pScrn->frameX0, pScrn->frameY0,
+ 0);
+
+ return ret;
+}
+
+
Bool GlamoKMSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
char **argv)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
GlamoPtr pGlamo = GlamoPTR(pScrn);
VisualPtr visual;
- unsigned long sys_mem;
- int c;
- MessageType from;
/* Deal with server regeneration */
if ( pGlamo->drm_fd < 0 ) {
@@ -342,7 +382,7 @@ Bool GlamoKMSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
fbPictureInit(pScreen, NULL, 0);
pGlamo->createScreenResources = pScreen->CreateScreenResources;
- pScreen->CreateScreenResources = CreateScreenResources;
+ pScreen->CreateScreenResources = GlamoKMSCreateScreenResources;
xf86SetBlackWhitePixels(pScreen);
@@ -353,13 +393,6 @@ Bool GlamoKMSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc,
xf86SetSilkenMouse(pScreen);
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
- /* Need to extend HWcursor support to handle mask interleave */
- if (!ms->SWCursor) {
- xf86_cursors_init(pScreen, 64, 64,
- HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
- HARDWARE_CURSOR_ARGB);
- }
-
/* Must force it before EnterVT, so we are in control of VT and
* later memory should be bound when allocating, e.g rotate_mem */
pScrn->vtSema = TRUE;
@@ -391,24 +424,6 @@ Bool GlamoKMSSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
}
-void GlamoKMSAdjustFrame(int scrnIndex, int x, int y, int flags)
-{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- xf86OutputPtr output = config->output[config->compat_output];
- xf86CrtcPtr crtc = output->crtc;
-
- if (crtc && crtc->enabled) {
- crtc->funcs->mode_set(crtc,
- pScrn->currentMode,
- pScrn->currentMode,
- x, y);
- crtc->x = output->initial_x + x;
- crtc->y = output->initial_y + y;
- }
-}
-
-
Bool GlamoKMSEnterVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
@@ -445,8 +460,6 @@ void GlamoKMSLeaveVT(int scrnIndex, int flags)
xf86CrtcPtr crtc = config->crtc[o];
- cursor_destroy(crtc);
-
if ( crtc->rotatedPixmap || crtc->rotatedData ) {
crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap,
crtc->rotatedData);
diff --git a/src/glamo-kms-exa.h b/src/glamo-kms-exa.h
index be8e805..45b8eb7 100644
--- a/src/glamo-kms-exa.h
+++ b/src/glamo-kms-exa.h
@@ -24,3 +24,4 @@
extern void *GlamoKMSExaInit(ScrnInfoPtr pScrn);
extern void GlamoKMSExaClose(ScrnInfoPtr pScrn);
+extern unsigned int driGetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags);
diff --git a/src/glamo.h b/src/glamo.h
index cf1bf5d..aac39d5 100644
--- a/src/glamo.h
+++ b/src/glamo.h
@@ -135,8 +135,11 @@ typedef struct {
/* Use hardware acceleration */
Bool accel;
+ /* Things to do with DRI */
int drm_fd;
unsigned int SaveGeneration;
+ unsigned int fb_id;
+ CreateScreenResourcesProcPtr createScreenResources;
uint16_t *colormap;
} GlamoRec, *GlamoPtr;