Make it actually build the kernel stuff if possible
Fixup the kernel stuff to have a slightly better chance of working. Still need to fixup the EXA pixmap functions.
This commit is contained in:
parent
b1aef6f63c
commit
173b909a71
10
configure.ac
10
configure.ac
|
|
@ -85,12 +85,16 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
|
|||
# Checks for pkg-config packages
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES])
|
||||
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
|
||||
drm_cflags=$(pkg-config --cflags libdrm)
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$XORG_CFLAGS $DRI_CFLAGS $drm_cflags"
|
||||
CPPFLAGS="$XORG_CFLAGS $DRI_CFLAGS $drm_cflags"
|
||||
AC_MSG_CHECKING([whether to include DRI support])
|
||||
if test x$DRI = xauto; then
|
||||
AC_CHECK_FILE([${sdkdir}/dri.h],
|
||||
|
|
@ -101,7 +105,9 @@ if test x$DRI = xauto; then
|
|||
[have_dristruct_h="yes"], [have_dristruct_h="no"])
|
||||
AC_CHECK_FILE([${sdkdir}/damage.h],
|
||||
[have_damage_h="yes"], [have_damage_h="no"])
|
||||
AC_CHECK_HEADER(xf86drmMode.h,[DRM_MODE=yes],[DRM_MODE=no],[#include "stdint.h"])
|
||||
AC_CHECK_HEADER(xf86drmMode.h,
|
||||
[DRM_MODE=yes],[DRM_MODE=no]
|
||||
[#include "stdint.h"])
|
||||
if test "x$DRM_MODE" = xyes; then
|
||||
AC_DEFINE(XF86DRM_MODE,1,[DRM kernel modesetting])
|
||||
fi
|
||||
|
|
@ -116,8 +122,6 @@ if test x$DRI = xauto; then
|
|||
fi
|
||||
AC_MSG_RESULT([$DRI])
|
||||
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$XORG_CFLAGS"
|
||||
AC_CHECK_HEADER(xf86Modes.h,[XMODES=yes],[XMODES=no],[#include "xorg-server.h"])
|
||||
AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
|
||||
[XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef XF86DRM_MODE
|
||||
#include "radeon.h"
|
||||
#include "i830.h"
|
||||
#include "sarea.h"
|
||||
|
||||
static Bool drmmode_resize_fb(ScrnInfoPtr scrn, drmmode_ptr drmmode, int width, int height);
|
||||
|
|
@ -208,9 +208,6 @@ static void
|
|||
drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
|
||||
{
|
||||
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
|
||||
drmmode_ptr drmmode = drmmode_crtc->drmmode;
|
||||
|
||||
int ret;
|
||||
void *ptr;
|
||||
|
||||
/* cursor should be mapped already */
|
||||
|
|
@ -246,7 +243,6 @@ drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
|
|||
{
|
||||
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
|
||||
drmmode_ptr drmmode = drmmode_crtc->drmmode;
|
||||
int ret;
|
||||
int size;
|
||||
unsigned long rotate_pitch;
|
||||
|
||||
|
|
@ -309,7 +305,6 @@ static void
|
|||
drmmode_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
|
||||
{
|
||||
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
|
||||
drmmode_ptr drmmode = drmmode_crtc->drmmode;
|
||||
|
||||
if (rotate_pixmap)
|
||||
FreeScratchPixmapHeader(rotate_pixmap);
|
||||
|
|
@ -354,9 +349,6 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num)
|
|||
{
|
||||
xf86CrtcPtr crtc;
|
||||
drmmode_crtc_private_ptr drmmode_crtc;
|
||||
int cursor_size = 64 * 64 * 4;
|
||||
uint32_t mask;
|
||||
int ret;
|
||||
|
||||
crtc = xf86CrtcCreate(pScrn, &drmmode_crtc_funcs);
|
||||
if (crtc == NULL)
|
||||
|
|
@ -604,15 +596,16 @@ Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, dri_bufmgr *bufm
|
|||
}
|
||||
#endif
|
||||
|
||||
void drmmode_set_fb(ScrnInfoPtr scrn, drmmode_ptr drmmode, int width, int height, int pitch, uint32_t handle)
|
||||
void drmmode_set_fb(ScrnInfoPtr scrn, drmmode_ptr drmmode, int width, int height, int pitch, dri_bo *bo)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = drmModeAddFB(drmmode->fd, width, height, scrn->depth,
|
||||
scrn->bitsPerPixel, pitch, handle, &drmmode->fb_id);
|
||||
scrn->bitsPerPixel, pitch, bo->handle,
|
||||
&drmmode->fb_id);
|
||||
|
||||
if (ret) {
|
||||
ErrorF("Failed to add fb\n");
|
||||
ErrorF("Failed to add fb: %s\n", strerror(-ret));
|
||||
}
|
||||
|
||||
drmmode->mode_fb = drmModeGetFB(drmmode->fd, drmmode->fb_id);
|
||||
|
|
|
|||
|
|
@ -29,11 +29,12 @@
|
|||
|
||||
#ifdef XF86DRM_MODE
|
||||
|
||||
#include "dri_bufmgr.h"
|
||||
#include "xf86drmMode.h"
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
int fb_id;
|
||||
uint32_t fb_id;
|
||||
drmModeResPtr mode_res;
|
||||
drmModeFBPtr mode_fb;
|
||||
int cpp;
|
||||
|
|
@ -63,7 +64,7 @@ typedef struct {
|
|||
|
||||
extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, char *busId, char *driver_name, int cpp);
|
||||
//extern Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, dri_bufmgr *bufmgr);
|
||||
extern void drmmode_set_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int width, int height, int pitch, uint32_t handle);
|
||||
extern void drmmode_set_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int width, int height, int pitch, dri_bo *bo);
|
||||
//extern Bool drmmode_is_rotate_pixmap(ScrnInfoPtr pScrn, pointer pPixData, dri_bo **bo);
|
||||
extern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id, void *ptr, uint32_t handle);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ I830InitDma(ScrnInfoPtr pScrn)
|
|||
info.func = I830_INIT_DMA;
|
||||
|
||||
/* Initialize fields that are used in the absence of GEM */
|
||||
if (!pI830->memory_manager) {
|
||||
if (!pI830->memory_manager && !pI830->use_drm_mode) {
|
||||
info.ring_start = ring->mem->offset + pI830->LinearAddr;
|
||||
info.ring_end = ring->mem->end + pI830->LinearAddr;
|
||||
info.ring_size = ring->mem->size;
|
||||
|
|
|
|||
|
|
@ -1668,7 +1668,7 @@ I830DrmModeInit(ScrnInfoPtr pScrn)
|
|||
pI830->directRenderingDisabled = FALSE;
|
||||
pI830->allocate_classic_textures = FALSE;
|
||||
|
||||
I830InitBufMgr(pScrn);
|
||||
i830_init_bufmgr(pScrn);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -1860,7 +1860,9 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
|
|||
if (!xf86SetDefaultVisual(pScrn, -1))
|
||||
return FALSE;
|
||||
|
||||
hwp = VGAHWPTR(pScrn);
|
||||
if (!pI830->use_drm_mode)
|
||||
hwp = VGAHWPTR(pScrn);
|
||||
|
||||
pI830->cpp = pScrn->bitsPerPixel / 8;
|
||||
|
||||
pI830->preinit = TRUE;
|
||||
|
|
@ -1873,9 +1875,10 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
|
|||
|
||||
I830PreInitCrtcConfig(pScrn);
|
||||
|
||||
if (pI830->use_drm_mode && !I830DrmModeInit(pScrn))
|
||||
return FALSE;
|
||||
else if (!I830AccelMethodInit(pScrn))
|
||||
if (pI830->use_drm_mode) {
|
||||
if (!I830DrmModeInit(pScrn))
|
||||
return FALSE;
|
||||
} else if (!I830AccelMethodInit(pScrn))
|
||||
return FALSE;
|
||||
|
||||
I830XvInit(pScrn);
|
||||
|
|
@ -2910,9 +2913,10 @@ i830_init_bufmgr(ScrnInfoPtr pScrn)
|
|||
{
|
||||
I830Ptr pI830 = I830PTR(pScrn);
|
||||
|
||||
if (pI830->bufmgr) return;
|
||||
if (pI830->bufmgr)
|
||||
return;
|
||||
|
||||
if (pI830->memory_manager) {
|
||||
if (pI830->memory_manager || pI830->use_drm_mode) {
|
||||
int batch_size;
|
||||
|
||||
batch_size = 4096 * 4;
|
||||
|
|
@ -3093,30 +3097,10 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
|
|||
|
||||
if (pI830->use_drm_mode) {
|
||||
#ifdef XF86DRM_MODE
|
||||
uint64_t size;
|
||||
int ret;
|
||||
ret = drmMMInfo(pI830->drmSubFD, DRM_BO_MEM_VRAM, &size);
|
||||
if (ret) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"Kernel memory manager has no VRAM allocation\n");
|
||||
return FALSE;
|
||||
}
|
||||
pI830->stolen_size = size * GTT_PAGE_SIZE;
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
"Kernel stolen allocator is %dkb\n",
|
||||
pI830->stolen_size / KB(1));
|
||||
|
||||
ret = drmMMInfo(pI830->drmSubFD, DRM_BO_MEM_TT, &size);
|
||||
if (ret) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"Kernel memory manager has no TT allocation\n");
|
||||
return FALSE;
|
||||
}
|
||||
pScrn->videoRam = (size * GTT_PAGE_SIZE) / KB(1);
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||
"Kernel AGP allocator is %dkb\n", pScrn->videoRam);
|
||||
pI830->stolen_size = 0;
|
||||
pScrn->videoRam = ~0UL / KB(1);
|
||||
#endif
|
||||
} else {
|
||||
} else {
|
||||
I830AdjustMemory(pScreen);
|
||||
}
|
||||
|
||||
|
|
@ -3308,7 +3292,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
|
|||
DPRINTF(PFX, "assert( if(!I830MapMem(pScrn)) )\n");
|
||||
if (!I830MapMem(pScrn))
|
||||
return FALSE;
|
||||
|
||||
pScrn->memPhysBase = (unsigned long)pI830->FbBase;
|
||||
}
|
||||
|
||||
|
|
@ -3443,7 +3426,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
|
|||
|
||||
#ifdef I830_XV
|
||||
/* Init video */
|
||||
if (pI830->XvEnabled)
|
||||
if (pI830->XvEnabled && !pI830->use_drm_mode)
|
||||
I830InitVideo(pScreen);
|
||||
#endif
|
||||
|
||||
|
|
@ -3682,7 +3665,6 @@ I830EnterVT(int scrnIndex, int flags)
|
|||
|
||||
if (pI830->power_context)
|
||||
OUTREG(PWRCTXA, pI830->power_context->offset | PWRCTX_EN);
|
||||
|
||||
/* Clear the framebuffer */
|
||||
memset(pI830->FbBase + pScrn->fbOffset, 0,
|
||||
pScrn->virtualY * pScrn->displayWidth * pI830->cpp);
|
||||
|
|
|
|||
118
src/i830_exa.c
118
src/i830_exa.c
|
|
@ -465,16 +465,104 @@ i830_transform_is_affine (PictTransformPtr t)
|
|||
return t->matrix[2][0] == 0 && t->matrix[2][1] == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* - Dual head?
|
||||
*/
|
||||
static DevPrivateKey exa_pixmap_key = &exa_pixmap_key;
|
||||
|
||||
static void
|
||||
i830_exa_set_pixmap_bo (PixmapPtr pixmap, dri_bo *bo)
|
||||
{
|
||||
dixSetPrivate(&pixmap->devPrivates, exa_pixmap_key, bo);
|
||||
}
|
||||
|
||||
dri_bo *
|
||||
i830_exa_get_pixmap_bo (PixmapPtr pixmap)
|
||||
{
|
||||
return dixLookupPrivate(&pixmap->devPrivates, exa_pixmap_key);
|
||||
}
|
||||
|
||||
static Bool I830EXAPrepareAccess(PixmapPtr pPix, int index)
|
||||
{
|
||||
dri_bo *bo = i830_exa_get_pixmap_bo(pPix);
|
||||
|
||||
if (bo) {
|
||||
ScreenPtr screen = pPix->drawable.pScreen;
|
||||
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
|
||||
I830Ptr i830 = I830PTR(scrn);
|
||||
|
||||
intel_batch_flush(scrn);
|
||||
if (i830->need_sync) {
|
||||
I830Sync(scrn);
|
||||
i830->need_sync = FALSE;
|
||||
}
|
||||
if (dri_bo_map(bo, 1))
|
||||
return FALSE;
|
||||
pPix->devPrivate.ptr = bo->virtual;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void I830EXAFinishAccess(PixmapPtr pPix, int index)
|
||||
{
|
||||
dri_bo *bo = i830_exa_get_pixmap_bo(pPix);
|
||||
|
||||
if (bo) {
|
||||
ScreenPtr screen = pPix->drawable.pScreen;
|
||||
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
|
||||
I830Ptr i830 = I830PTR(scrn);
|
||||
|
||||
dri_bo_unmap(bo);
|
||||
pPix->devPrivate.ptr = NULL;
|
||||
if (bo == i830->front_buffer->bo)
|
||||
i830->need_flush = TRUE;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
static Bool I830EXAModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
|
||||
int depth, int bitsPerPixel, int devKind,
|
||||
pointer pPixData)
|
||||
{
|
||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
I830Ptr pI830 = I830PTR(pScrn);
|
||||
dri_bo *bo = i830_exa_get_pixmap_bo(pPixmap);
|
||||
|
||||
if (pI830->use_drm_mode &&
|
||||
drmmode_is_rotate_pixmap(pScrn, pPixData, &driver_priv->bo)) {
|
||||
/* this is a rotate pixmap */
|
||||
dri_bo_unmap(bo);
|
||||
dri_bo_reference(bo);
|
||||
miModifyPixmapHeader(pPixmap, width, height, depth,
|
||||
bitsPerPixel, devKind, NULL);
|
||||
}
|
||||
|
||||
if (pPixData == pI830->FbBase + pScrn->fbOffset) {
|
||||
/* this is the front buffer pixmap so set it up as such..*/
|
||||
driver_priv->flags |= I830_EXA_PIXMAP_IS_FRONTBUFFER;
|
||||
|
||||
ErrorF("FRONTBUFFER HANDLE CHANGING %p\n", driver_priv->bo);
|
||||
/* get a reference to the front buffer handle */
|
||||
if (driver_priv->bo)
|
||||
dri_bo_unreference(driver_priv->bo);
|
||||
bo = intel_ttm_bo_create_from_handle(pI830->bufmgr, "front",
|
||||
pI830->front_buffer->bo->handle);
|
||||
|
||||
miModifyPixmapHeader(pPixmap, width, height, depth,
|
||||
bitsPerPixel, devKind, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
Bool
|
||||
I830EXAInit(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
I830Ptr pI830 = I830PTR(pScrn);
|
||||
|
||||
if (!dixRequestPrivate(exa_pixmap_key, 0))
|
||||
return FALSE;
|
||||
|
||||
pI830->EXADriverPtr = exaDriverAlloc();
|
||||
if (pI830->EXADriverPtr == NULL) {
|
||||
pI830->accel = ACCEL_NONE;
|
||||
|
|
@ -495,16 +583,22 @@ I830EXAInit(ScreenPtr pScreen)
|
|||
"EXA compatibility mode. Output rotation rendering "
|
||||
"performance may suffer\n");
|
||||
#endif
|
||||
pI830->EXADriverPtr->memoryBase = pI830->FbBase;
|
||||
if (pI830->exa_offscreen) {
|
||||
pI830->EXADriverPtr->offScreenBase = pI830->exa_offscreen->offset;
|
||||
pI830->EXADriverPtr->memorySize = pI830->exa_offscreen->offset +
|
||||
pI830->exa_offscreen->size;
|
||||
if (!pI830->use_drm_mode) {
|
||||
pI830->EXADriverPtr->memoryBase = pI830->FbBase;
|
||||
if (pI830->exa_offscreen) {
|
||||
pI830->EXADriverPtr->offScreenBase = pI830->exa_offscreen->offset;
|
||||
pI830->EXADriverPtr->memorySize = pI830->exa_offscreen->offset +
|
||||
pI830->exa_offscreen->size;
|
||||
} else {
|
||||
pI830->EXADriverPtr->offScreenBase = pI830->FbMapSize;
|
||||
pI830->EXADriverPtr->memorySize = pI830->FbMapSize;
|
||||
}
|
||||
pI830->EXADriverPtr->flags = EXA_OFFSCREEN_PIXMAPS;
|
||||
} else {
|
||||
pI830->EXADriverPtr->offScreenBase = pI830->FbMapSize;
|
||||
pI830->EXADriverPtr->memorySize = pI830->FbMapSize;
|
||||
pI830->EXADriverPtr->flags = EXA_OFFSCREEN_PIXMAPS | EXA_HANDLES_PIXMAPS;
|
||||
pI830->EXADriverPtr->PrepareAccess = I830EXAPrepareAccess;
|
||||
pI830->EXADriverPtr->FinishAccess = I830EXAFinishAccess;
|
||||
}
|
||||
pI830->EXADriverPtr->flags = EXA_OFFSCREEN_PIXMAPS;
|
||||
|
||||
DPRINTF(PFX, "EXA Mem: memoryBase 0x%x, end 0x%x, offscreen base 0x%x, "
|
||||
"memorySize 0x%x\n",
|
||||
|
|
|
|||
|
|
@ -741,6 +741,8 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
|
|||
|
||||
mem->bo = dri_bo_alloc (pI830->bufmgr, name, size, align);
|
||||
|
||||
ErrorF("alloc'd bo for %s\n", name);
|
||||
|
||||
if (!mem->bo) {
|
||||
xfree(mem->name);
|
||||
xfree(mem);
|
||||
|
|
@ -757,7 +759,7 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
|
|||
mem->lifetime_fixed_offset = TRUE;
|
||||
|
||||
/* Bind it if we currently control the VT */
|
||||
if (pScrn->vtSema) {
|
||||
if (pScrn->vtSema || pI830->use_drm_mode) {
|
||||
if (!i830_bind_memory(pScrn, mem)) {
|
||||
dri_bo_unreference (mem->bo);
|
||||
xfree(mem->name);
|
||||
|
|
@ -1227,8 +1229,10 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
|
|||
|
||||
if (pI830->use_drm_mode) {
|
||||
#ifdef XF86DRM_MODE
|
||||
ErrorF("setting kernel fb to new front buffer\n");
|
||||
ErrorF("front_buffer->bo->size: %ld\n", front_buffer->bo->size);
|
||||
drmmode_set_fb(pScrn, &pI830->drmmode, pScrn->virtualX, fb_height,
|
||||
pScrn->displayWidth * pI830->cpp, &front_buffer->bo);
|
||||
pScrn->displayWidth * pI830->cpp, front_buffer->bo);
|
||||
#endif
|
||||
} else if (pI830->FbBase)
|
||||
memset (pI830->FbBase + front_buffer->offset, 0, size);
|
||||
|
|
@ -1986,12 +1990,14 @@ i830_bind_all_memory(ScrnInfoPtr pScrn)
|
|||
for (mem = pI830->memory_list->next; mem->next != NULL;
|
||||
mem = mem->next)
|
||||
{
|
||||
if (!i830_bind_memory(pScrn, mem)) {
|
||||
if (!mem->bound && !i830_bind_memory(pScrn, mem)) {
|
||||
/* This shouldn't happen */
|
||||
FatalError("Couldn't bind memory for %s\n", mem->name);
|
||||
}
|
||||
}
|
||||
for (mem = pI830->bo_list; mem != NULL; mem = mem->next) {
|
||||
if (mem->bound)
|
||||
continue;
|
||||
if (!mem->lifetime_fixed_offset && !i830_bind_memory(pScrn, mem))
|
||||
FatalError("Couldn't bind memory for BO %s\n", mem->name);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue