summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915pipe/intel_batchbuffer.c2
-rw-r--r--src/mesa/drivers/dri/i915pipe/intel_blit.c17
-rw-r--r--src/mesa/drivers/dri/i915pipe/intel_context.c17
-rw-r--r--src/mesa/drivers/dri/i915pipe/intel_screen.c251
-rw-r--r--src/mesa/drivers/dri/i915pipe/intel_screen.h59
-rw-r--r--src/mesa/drivers/dri/i915pipe/intel_tex_copy.c2
-rw-r--r--src/mesa/drivers/dri/i915pipe/intel_tex_format.c2
7 files changed, 97 insertions, 253 deletions
diff --git a/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.c b/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.c
index 9259f2ac050..97e3882bc97 100644
--- a/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i915pipe/intel_batchbuffer.c
@@ -87,7 +87,7 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch)
* Get a new, free batchbuffer.
*/
- batch->size = batch->intel->intelScreen->maxBatchSize;
+ batch->size = BATCH_SZ;
driBOData(batch->buffer, batch->size, NULL, 0);
driBOResetList(&batch->list);
diff --git a/src/mesa/drivers/dri/i915pipe/intel_blit.c b/src/mesa/drivers/dri/i915pipe/intel_blit.c
index 062cd2632c7..5d9cb0cf0f4 100644
--- a/src/mesa/drivers/dri/i915pipe/intel_blit.c
+++ b/src/mesa/drivers/dri/i915pipe/intel_blit.c
@@ -86,8 +86,6 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv,
if (dPriv && dPriv->numClipRects) {
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
- const struct pipe_region *frontRegion
- = intelScreen->front_region;
const struct pipe_region *backRegion
= intel_fb->Base._ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT ?
intel_get_rb_region(&intel_fb->Base, BUFFER_FRONT_LEFT) :
@@ -96,20 +94,19 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv,
const int backHeight = intel_fb->Base.Height;
const int nbox = dPriv->numClipRects;
const drm_clip_rect_t *pbox = dPriv->pClipRects;
- const int pitch = frontRegion->pitch;
+ const int pitch = intelScreen->front.pitch / intelScreen->front.cpp;
const int srcpitch = backRegion->pitch;
- const int cpp = frontRegion->cpp;
+ const int cpp = intelScreen->front.cpp;
int BR13, CMD;
int i;
ASSERT(intel_fb);
ASSERT(intel_fb->Base.Name == 0); /* Not a user-created FBO */
- ASSERT(frontRegion);
ASSERT(backRegion);
- ASSERT(frontRegion->cpp == backRegion->cpp);
+ ASSERT(backRegion->cpp == cpp);
DBG("front pitch %d back pitch %d\n",
- frontRegion->pitch, backRegion->pitch);
+ pitch, backRegion->pitch);
if (cpp == 2) {
BR13 = (pitch * cpp) | (0xCC << 16) | (1 << 24);
@@ -127,7 +124,8 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv,
if (pbox->x1 > pbox->x2 ||
pbox->y1 > pbox->y2 ||
- pbox->x2 > intelScreen->width || pbox->y2 > intelScreen->height)
+ pbox->x2 > intelScreen->front.width ||
+ pbox->y2 > intelScreen->front.height)
continue;
box = *pbox;
@@ -170,7 +168,8 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv,
OUT_BATCH((box.y1 << 16) | box.x1);
OUT_BATCH((box.y2 << 16) | box.x2);
- OUT_RELOC(frontRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
+ OUT_RELOC(intelScreen->front.buffer,
+ DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);
OUT_BATCH((sbox.y1 << 16) | sbox.x1);
OUT_BATCH((srcpitch * cpp) & 0xffff);
diff --git a/src/mesa/drivers/dri/i915pipe/intel_context.c b/src/mesa/drivers/dri/i915pipe/intel_context.c
index bab94e2697d..f0ca5c75c7b 100644
--- a/src/mesa/drivers/dri/i915pipe/intel_context.c
+++ b/src/mesa/drivers/dri/i915pipe/intel_context.c
@@ -337,8 +337,7 @@ intelCreateContext(const __GLcontextModes * mesaVis,
GLcontext *shareCtx = (GLcontext *) sharedContextPrivate;
__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
- drmI830Sarea *saPriv = (drmI830Sarea *)
- (((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset);
+ drmI830Sarea *saPriv = intelScreen->sarea;
int fthrottle_mode;
GLboolean havePools;
@@ -409,7 +408,6 @@ intelCreateContext(const __GLcontextModes * mesaVis,
intel->pipe = intel->ctx.st->pipe;
intel->pipe->screen = intelScreen;
intel->pipe->glctx = ctx;
- intelScreen->pipe = intel->pipe;
intel_init_region_functions(intel->pipe);
/*
@@ -453,11 +451,6 @@ intelCreateContext(const __GLcontextModes * mesaVis,
intel->iw.irq_seq = -1;
intel->irqsEmitted = 0;
- intel->do_irqs = (intel->intelScreen->irq_active &&
- fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS);
-
- intel->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
-
_math_matrix_ctr(&intel->ViewportMatrix);
/* Disable imaging extension until convolution is working in
@@ -598,9 +591,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
if (driDrawPriv->pdraw->swap_interval == (unsigned)-1) {
int i;
- intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0)
- ? driGetDefaultVBlankFlags(&intel->optionCache)
- : VBLANK_FLAG_NO_IRQ;
+ intel_fb->vblank_flags = driGetDefaultVBlankFlags(&intel->optionCache);
(*dri_interface->getUST) (&intel_fb->swap_ust);
driDrawableInitVBlank(driDrawPriv, intel_fb->vblank_flags,
@@ -651,8 +642,8 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
if (dPriv)
DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
- if (sarea->width != intelScreen->width ||
- sarea->height != intelScreen->height) {
+ if (sarea->width != intelScreen->front.width ||
+ sarea->height != intelScreen->front.height) {
intelUpdateScreenRotation(sPriv, sarea);
}
diff --git a/src/mesa/drivers/dri/i915pipe/intel_screen.c b/src/mesa/drivers/dri/i915pipe/intel_screen.c
index 565bfc52430..5b8d6256b57 100644
--- a/src/mesa/drivers/dri/i915pipe/intel_screen.c
+++ b/src/mesa/drivers/dri/i915pipe/intel_screen.c
@@ -65,106 +65,8 @@ PUBLIC const char __driConfigOptions[] =
extern const struct dri_extension card_extensions[];
-/**
- * Map all the memory regions described by the screen.
- * \return GL_TRUE if success, GL_FALSE if error.
- */
-GLboolean
-intelMapScreenRegions(__DRIscreenPrivate * sPriv)
-{
- intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
-
- if (intelScreen->front.handle) {
- if (drmMap(sPriv->fd,
- intelScreen->front.handle,
- intelScreen->front.size,
- (drmAddress *) & intelScreen->front.map) != 0) {
- _mesa_problem(NULL, "drmMap(frontbuffer) failed!");
- return GL_FALSE;
- }
- }
- else {
- _mesa_warning(NULL, "no front buffer handle in intelMapScreenRegions!");
- }
-
- if (0)
- printf("Mappings: front: %p\n", intelScreen->front.map);
- return GL_TRUE;
-}
-
-
-static struct pipe_region *
-intel_recreate_static(struct pipe_context *pipe,
- struct pipe_region *region,
- GLuint mem_type,
- GLuint offset,
- void *virtual,
- GLuint cpp, GLuint pitch, GLuint height)
-{
- if (region) {
- pipe->region_update_static(pipe, region, mem_type, offset,
- virtual, cpp, pitch, height);
- } else {
- region = pipe->region_create_static(pipe, mem_type, offset,
- virtual, cpp, pitch, height);
- }
- return region;
-}
-
-
-/* Create pipe_region structs to describe the static front,back,depth
- * buffers created by the xserver.
- * Only used for real front buffer now.
- *
- * Note that these don't allocate video memory, just describe
- * allocations already made by the X server.
- */
-static void
-intel_recreate_static_regions(intelScreenPrivate *intelScreen)
-{
-/* this is the real front buffer which is only used for blitting to */
- intelScreen->front_region =
- intel_recreate_static(intelScreen->pipe,
- intelScreen->front_region,
- DRM_BO_FLAG_MEM_TT,
- intelScreen->front.offset,
- intelScreen->front.map,
- intelScreen->cpp,
- intelScreen->front.pitch / intelScreen->cpp,
- intelScreen->height);
-
-}
-
-/**
- * Use the information in the sarea to update the screen parameters
- * related to screen rotation. Needs to be called locked.
- */
-void
-intelUpdateScreenRotation(__DRIscreenPrivate * sPriv, drmI830Sarea * sarea)
-{
- intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
-
- intelUnmapScreenRegions(intelScreen);
- intelUpdateScreenFromSAREA(intelScreen, sarea);
- if (!intelMapScreenRegions(sPriv)) {
- fprintf(stderr, "ERROR Remapping screen regions!!!\n");
- }
- intel_recreate_static_regions(intelScreen);
-}
-void
-intelUnmapScreenRegions(intelScreenPrivate * intelScreen)
-{
-#define REALLY_UNMAP 1
- if (intelScreen->front.map) {
-#if REALLY_UNMAP
- if (drmUnmap(intelScreen->front.map, intelScreen->front.size) != 0)
- printf("drmUnmap front failed!\n");
-#endif
- intelScreen->front.map = NULL;
- }
-}
static void
@@ -205,26 +107,60 @@ intelPrintSAREA(const drmI830Sarea * sarea)
}
+
/**
- * A number of the screen parameters are obtained/computed from
- * information in the SAREA. This function updates those parameters.
+ * Use the information in the sarea to update the screen parameters
+ * related to screen rotation. Needs to be called locked.
*/
void
-intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
- drmI830Sarea * sarea)
+intelUpdateScreenRotation(__DRIscreenPrivate * sPriv, drmI830Sarea * sarea)
{
- intelScreen->width = sarea->width;
- intelScreen->height = sarea->height;
+ intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
+ if (intelScreen->front.map) {
+ drmUnmap(intelScreen->front.map, intelScreen->front.size);
+ intelScreen->front.map = NULL;
+ }
+
+ if (intelScreen->front.buffer)
+ driDeleteBuffers(1, &intelScreen->front.buffer);
+
+ intelScreen->front.width = sarea->width;
+ intelScreen->front.height = sarea->height;
intelScreen->front.offset = sarea->front_offset;
- intelScreen->front.pitch = sarea->pitch * intelScreen->cpp;
- intelScreen->front.handle = sarea->front_handle;
+ intelScreen->front.pitch = sarea->pitch * intelScreen->front.cpp;
intelScreen->front.size = sarea->front_size;
+ intelScreen->front.handle = sarea->front_handle;
- if (0)
- intelPrintSAREA(sarea);
+ assert( sarea->front_size >=
+ intelScreen->front.pitch * intelScreen->front.height );
+
+ if (!sarea->front_handle)
+ return;
+
+ if (drmMap(sPriv->fd,
+ sarea->front_handle,
+ intelScreen->front.size,
+ (drmAddress *) & intelScreen->front.map) != 0) {
+ _mesa_problem(NULL, "drmMap(frontbuffer) failed!");
+ return;
+ }
+
+ if (intelScreen->staticPool) {
+ driGenBuffers(intelScreen->staticPool, "static region", 1,
+ &intelScreen->front.buffer, 64,
+ DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_NO_MOVE |
+ DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0);
+
+ driBOSetStatic(intelScreen->front.buffer,
+ intelScreen->front.offset,
+ intelScreen->front.pitch * intelScreen->front.height,
+ intelScreen->front.map, 0);
+ }
}
+
+
GLboolean
intelCreatePools(intelScreenPrivate *intelScreen)
{
@@ -234,7 +170,7 @@ intelCreatePools(intelScreenPrivate *intelScreen)
if (intelScreen->havePools)
return GL_TRUE;
- batchPoolSize /= intelScreen->maxBatchSize;
+ batchPoolSize /= BATCH_SZ;
intelScreen->regionPool = driDRMPoolInit(sPriv->fd);
if (!intelScreen->regionPool)
@@ -251,16 +187,17 @@ intelCreatePools(intelScreenPrivate *intelScreen)
DRM_BO_FLAG_EXE |
DRM_BO_FLAG_MEM_TT |
DRM_BO_FLAG_MEM_LOCAL,
- intelScreen->maxBatchSize,
+ BATCH_SZ,
batchPoolSize, 5);
if (!intelScreen->batchPool) {
fprintf(stderr, "Failed to initialize batch pool - possible incorrect agpgart installed\n");
return GL_FALSE;
}
- intel_recreate_static_regions(intelScreen);
intelScreen->havePools = GL_TRUE;
+ intelUpdateScreenRotation(sPriv, intelScreen->sarea);
+
return GL_TRUE;
}
@@ -270,7 +207,6 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
{
intelScreenPrivate *intelScreen;
I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv;
- drmI830Sarea *sarea;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->
@@ -285,87 +221,30 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
/* Allocate the private area */
intelScreen = (intelScreenPrivate *) CALLOC(sizeof(intelScreenPrivate));
- if (!intelScreen) {
- fprintf(stderr, "\nERROR! Allocating private area failed\n");
+ if (!intelScreen)
return GL_FALSE;
- }
+
/* parse information in __driConfigOptions */
driParseOptionInfo(&intelScreen->optionCache,
__driConfigOptions, __driNConfigOptions);
intelScreen->driScrnPriv = sPriv;
sPriv->private = (void *) intelScreen;
- intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
- sarea = (drmI830Sarea *)
- (((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset);
- intelScreen->maxBatchSize = BATCH_SZ;
+ intelScreen->sarea = (drmI830Sarea *) (((GLubyte *) sPriv->pSAREA) +
+ gDRIPriv->sarea_priv_offset);
intelScreen->deviceID = gDRIPriv->deviceID;
- if (intelScreen->deviceID == PCI_CHIP_I865_G)
- intelScreen->maxBatchSize = 4096;
-
- intelScreen->mem = gDRIPriv->mem;
- intelScreen->cpp = gDRIPriv->cpp;
-
- switch (gDRIPriv->bitsPerPixel) {
- case 16:
- break;
- case 32:
- break;
- default:
- exit(1);
- break;
- }
-
- intelUpdateScreenFromSAREA(intelScreen, sarea);
-
- if (!intelMapScreenRegions(sPriv)) {
- fprintf(stderr, "\nERROR! mapping regions\n");
- _mesa_free(intelScreen);
- sPriv->private = NULL;
- return GL_FALSE;
- }
+ intelScreen->front.cpp = gDRIPriv->cpp;
+ intelScreen->drmMinor = sPriv->drmMinor;
+ assert(gDRIPriv->bitsPerPixel == 16 ||
+ gDRIPriv->bitsPerPixel == 32);
- intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
+ intelUpdateScreenRotation(sPriv, intelScreen->sarea);
if (0)
intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv);
- intelScreen->drmMinor = sPriv->drmMinor;
-
- /* Determine if IRQs are active? */
- {
- int ret;
- drmI830GetParam gp;
-
- gp.param = I830_PARAM_IRQ_ACTIVE;
- gp.value = &intelScreen->irq_active;
-
- ret = drmCommandWriteRead(sPriv->fd, DRM_I830_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmI830GetParam: %d\n", ret);
- return GL_FALSE;
- }
- }
-
- /* Determine if batchbuffers are allowed */
- {
- int ret;
- drmI830GetParam gp;
-
- gp.param = I830_PARAM_ALLOW_BATCHBUFFER;
- gp.value = &intelScreen->allow_batchbuffer;
-
- ret = drmCommandWriteRead(sPriv->fd, DRM_I830_GETPARAM,
- &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drmI830GetParam: (%d) %d\n", gp.param, ret);
- return GL_FALSE;
- }
- }
-
if (glx_enable_extension != NULL) {
(*glx_enable_extension) (psc, "GLX_SGI_swap_control");
(*glx_enable_extension) (psc, "GLX_SGI_video_sync");
@@ -383,7 +262,7 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv)
{
intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private;
- intelUnmapScreenRegions(intelScreen);
+// intelUnmapScreenRegions(intelScreen);
if (intelScreen->havePools) {
driPoolTakeDown(intelScreen->regionPool);
@@ -403,10 +282,6 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
__DRIdrawablePrivate * driDrawPriv,
const __GLcontextModes * mesaVis, GLboolean isPixmap)
{
-#if 0
- intelScreenPrivate *screen = (intelScreenPrivate *) driScrnPriv->private;
-#endif
-
if (isPixmap) {
return GL_FALSE; /* not implemented */
}
@@ -437,16 +312,6 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
= intel_new_renderbuffer_fb(rgbFormat);
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT,
&intel_fb->color_rb[1]->Base);
-
-#if 0
- if (screen->third.handle) {
- struct gl_renderbuffer *tmp_rb = NULL;
-
- intel_fb->color_rb[2]
- = intel_new_renderbuffer_fb(rgbFormat);
- _mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base);
- }
-#endif
}
if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) {
diff --git a/src/mesa/drivers/dri/i915pipe/intel_screen.h b/src/mesa/drivers/dri/i915pipe/intel_screen.h
index de0bea6609b..549587a6f2b 100644
--- a/src/mesa/drivers/dri/i915pipe/intel_screen.h
+++ b/src/mesa/drivers/dri/i915pipe/intel_screen.h
@@ -33,37 +33,30 @@
#include "xmlconfig.h"
#include "dri_bufpool.h"
-typedef struct
-{
- drm_handle_t handle;
- drmSize size; /* region size in bytes */
- char *map; /* memory map */
- int offset; /* from start of video mem, in bytes */
- int pitch; /* row stride, in bytes */
-} intelRegion;
-
-typedef struct
-{
- struct pipe_context *pipe; /** for accessing region functions */
- intelRegion front;
- struct pipe_region *front_region;
+struct intel_screen
+{
+ struct {
+ drm_handle_t handle;
+
+ /* We create a static dri buffer for the frontbuffer.
+ */
+ struct _DriBufferObject *buffer;
+
+ char *map; /* memory map */
+ int offset; /* from start of video mem, in bytes */
+ int pitch; /* row stride, in bytes */
+ int width;
+ int height;
+ int size;
+ int cpp; /* for front and back buffers */
+ } front;
int deviceID;
- int width;
- int height;
- int mem; /* unused */
-
- int cpp; /* for front and back buffers */
-
- __DRIscreenPrivate *driScrnPriv;
- unsigned int sarea_priv_offset;
-
int drmMinor;
- int irq_active;
- int allow_batchbuffer;
-
+ __DRIscreenPrivate *driScrnPriv;
+ drmI830Sarea *sarea;
/**
@@ -74,20 +67,16 @@ typedef struct
struct _DriBufferPool *texPool;
struct _DriBufferPool *regionPool;
struct _DriBufferPool *staticPool;
- unsigned int maxBatchSize;
GLboolean havePools;
- struct intel_context *dummyctxptr;
-} intelScreenPrivate;
-
+ struct intel_context *dummyctxptr;
+};
-extern GLboolean intelMapScreenRegions(__DRIscreenPrivate * sPriv);
-
-extern void intelUnmapScreenRegions(intelScreenPrivate * intelScreen);
+typedef struct intel_screen intelScreenPrivate;
extern void
-intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
- drmI830Sarea * sarea);
+intelUpdateScreenRotation(__DRIscreenPrivate * sPriv, drmI830Sarea * sarea);
+
extern void intelDestroyContext(__DRIcontextPrivate * driContextPriv);
diff --git a/src/mesa/drivers/dri/i915pipe/intel_tex_copy.c b/src/mesa/drivers/dri/i915pipe/intel_tex_copy.c
index 6f4f75079e1..6c49c60966d 100644
--- a/src/mesa/drivers/dri/i915pipe/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/i915pipe/intel_tex_copy.c
@@ -74,7 +74,7 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat)
case GL_RGBA8:
return intel_readbuf_region(intel);
case GL_RGB:
- if (intel->intelScreen->cpp == 2)
+ if (intel->intelScreen->front.cpp == 2)
return intel_readbuf_region(intel);
return NULL;
default:
diff --git a/src/mesa/drivers/dri/i915pipe/intel_tex_format.c b/src/mesa/drivers/dri/i915pipe/intel_tex_format.c
index 6e058dff69f..a11718bb075 100644
--- a/src/mesa/drivers/dri/i915pipe/intel_tex_format.c
+++ b/src/mesa/drivers/dri/i915pipe/intel_tex_format.c
@@ -16,7 +16,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
GLenum format, GLenum type)
{
struct intel_context *intel = intel_context(ctx);
- const GLboolean do32bpt = (intel->intelScreen->cpp == 4);
+ const GLboolean do32bpt = (intel->intelScreen->front.cpp == 4);
switch (internalFormat) {
case 4: