From fd81433a4efbe658db742b36c0c30c17c6effea6 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Fri, 29 Aug 2008 09:22:41 +0800 Subject: i965: Push/pop instruction state. partial fix for #16882 --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 305100f883..8dce40f25b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -850,20 +850,20 @@ static void emit_sop(struct brw_wm_compile *c, struct brw_reg dst, src0, src1; int i; - brw_push_insn_state(p); for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + brw_push_insn_state(p); brw_CMP(p, brw_null_reg(), cond, src0, src1); brw_set_predicate_control(p, BRW_PREDICATE_NONE); brw_MOV(p, dst, brw_imm_f(0.0)); brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); brw_MOV(p, dst, brw_imm_f(1.0)); + brw_pop_insn_state(p); } } - brw_pop_insn_state(p); } static void emit_slt(struct brw_wm_compile *c, -- cgit v1.2.3 From 6073b49c7915147c28e9887039a51b8e4e2e62c5 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Fri, 29 Aug 2008 09:27:28 +0800 Subject: i965: mask control for BREAK/CONT/DO/WHILE. partial fix fox #16882 --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 6b97f8b170..27abdd658b 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -617,7 +617,7 @@ struct brw_instruction *brw_BREAK(struct brw_compile *p) brw_set_src1(insn, brw_imm_d(0x0)); insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.execution_size = BRW_EXECUTE_8; - insn->header.mask_control = BRW_MASK_DISABLE; + /* insn->header.mask_control = BRW_MASK_DISABLE; */ insn->bits3.if_else.pad0 = 0; return insn; } @@ -631,7 +631,7 @@ struct brw_instruction *brw_CONT(struct brw_compile *p) brw_set_src1(insn, brw_imm_d(0x0)); insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.execution_size = BRW_EXECUTE_8; - insn->header.mask_control = BRW_MASK_DISABLE; + /* insn->header.mask_control = BRW_MASK_DISABLE; */ insn->bits3.if_else.pad0 = 0; return insn; } @@ -655,7 +655,7 @@ struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size) insn->header.execution_size = execute_size; insn->header.predicate_control = BRW_PREDICATE_NONE; /* insn->header.mask_control = BRW_MASK_ENABLE; */ - insn->header.mask_control = BRW_MASK_DISABLE; + /* insn->header.mask_control = BRW_MASK_DISABLE; */ return insn; } @@ -694,7 +694,7 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p, /* insn->header.mask_control = BRW_MASK_ENABLE; */ - insn->header.mask_control = BRW_MASK_DISABLE; + /* insn->header.mask_control = BRW_MASK_DISABLE; */ p->current->header.predicate_control = BRW_PREDICATE_NONE; return insn; } -- cgit v1.2.3 From 7a2ab6d05573508389b38f8f1fa261ba56062865 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Fri, 29 Aug 2008 09:49:16 +0800 Subject: i965: force thread switch after IF/ELSE/ENDIF. partial fix for #16882. A thread switch is implicitly invoked after the issuance of an IF/ELSE/ENDIF instruction if necessary. Unfortunately it seems sometimes a forced thread switch is needed. --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 27abdd658b..0bfbec9d14 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -513,6 +513,8 @@ struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size) insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.predicate_control = BRW_PREDICATE_NORMAL; insn->header.mask_control = BRW_MASK_ENABLE; + if (!p->single_program_flow) + insn->header.thread_control = BRW_THREAD_SWITCH; p->current->header.predicate_control = BRW_PREDICATE_NONE; @@ -538,6 +540,8 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p, insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.execution_size = if_insn->header.execution_size; insn->header.mask_control = BRW_MASK_ENABLE; + if (!p->single_program_flow) + insn->header.thread_control = BRW_THREAD_SWITCH; /* Patch the if instruction to point at this instruction. */ @@ -579,6 +583,7 @@ void brw_ENDIF(struct brw_compile *p, insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.execution_size = patch_insn->header.execution_size; insn->header.mask_control = BRW_MASK_ENABLE; + insn->header.thread_control = BRW_THREAD_SWITCH; assert(patch_insn->bits3.if_else.jump_count == 0); -- cgit v1.2.3 From f56b569e9af356c11869ee49a4669bb01b75397e Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 13 Aug 2008 11:46:25 -0400 Subject: DRI2: Drop sarea, implement swap buffers in the X server. --- include/GL/internal/dri_interface.h | 83 ++++++--- include/GL/internal/dri_sarea.h | 134 -------------- src/glx/x11/dri2.c | 113 ++++++++---- src/glx/x11/dri2.h | 23 ++- src/glx/x11/dri2_glx.c | 128 +++++++------- src/glx/x11/dri_glx.c | 6 + src/glx/x11/glxclient.h | 5 +- src/glx/x11/glxcmds.c | 3 +- src/mesa/drivers/dri/Makefile | 2 - src/mesa/drivers/dri/common/dri_util.c | 254 ++++----------------------- src/mesa/drivers/dri/common/dri_util.h | 25 +-- src/mesa/drivers/dri/i965/brw_vtbl.c | 18 +- src/mesa/drivers/dri/intel/intel_buffers.c | 3 + src/mesa/drivers/dri/intel/intel_context.c | 160 +++++++++++++++-- src/mesa/drivers/dri/intel/intel_context.h | 1 + src/mesa/drivers/dri/intel/intel_regions.c | 7 +- src/mesa/drivers/dri/intel/intel_regions.h | 2 +- src/mesa/drivers/dri/intel/intel_screen.c | 116 +----------- src/mesa/drivers/dri/intel/intel_tex_image.c | 2 +- 19 files changed, 446 insertions(+), 639 deletions(-) delete mode 100644 include/GL/internal/dri_sarea.h (limited to 'src/mesa/drivers/dri') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index e7780d2e26..e4cc16b866 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -75,6 +75,10 @@ typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension; typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension; typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension; typedef struct __DRIswrastExtensionRec __DRIswrastExtension; +typedef struct __DRIbufferRec __DRIbuffer; +typedef struct __DRIdri2ExtensionRec __DRIdri2Extension; +typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension; + /*@}*/ @@ -343,29 +347,6 @@ struct __DRIdamageExtensionRec { void *loaderPrivate); }; -/** - * DRI2 Loader extension. This extension describes the basic - * functionality the loader needs to provide for the DRI driver. - */ -#define __DRI_LOADER "DRI_Loader" -#define __DRI_LOADER_VERSION 1 -struct __DRIloaderExtensionRec { - __DRIextension base; - - /** - * Ping the windowing system to get it to reemit info for the - * specified drawable in the DRI2 event buffer. - * - * \param draw the drawable for which to request info - * \param tail the new event buffer tail pointer - */ - void (*reemitDrawableInfo)(__DRIdrawable *draw, unsigned int *tail, - void *loaderPrivate); - - void (*postDamage)(__DRIdrawable *draw, struct drm_clip_rect *rects, - int num_rects, void *loaderPrivate); -}; - #define __DRI_SWRAST_IMAGE_OP_DRAW 1 #define __DRI_SWRAST_IMAGE_OP_CLEAR 2 #define __DRI_SWRAST_IMAGE_OP_SWAP 3 @@ -633,4 +614,60 @@ struct __DRIswrastExtensionRec { void *loaderPrivate); }; +/** + * DRI2 Loader extension. + */ +#define __DRI_BUFFER_FRONT_LEFT 0 +#define __DRI_BUFFER_BACK_LEFT 1 +#define __DRI_BUFFER_FRONT_RIGHT 2 +#define __DRI_BUFFER_BACK_RIGHT 3 +#define __DRI_BUFFER_DEPTH 4 +#define __DRI_BUFFER_STENCIL 5 +#define __DRI_BUFFER_ACCUM 6 + +struct __DRIbufferRec { + unsigned int attachment; + unsigned int name; + unsigned int pitch; + unsigned int cpp; + unsigned int flags; +}; + +#define __DRI_DRI2_LOADER "DRI_DRI2Loader" +#define __DRI_DRI2_LOADER_VERSION 1 +struct __DRIdri2LoaderExtensionRec { + __DRIextension base; + + __DRIbuffer *(*getBuffers)(__DRIdrawable *driDrawable, + int *width, int *height, + unsigned int *attachments, int count, + int *out_count, void *loaderPrivate); +}; + +/** + * This extension provides alternative screen, drawable and context + * constructors for DRI2. + */ +#define __DRI_DRI2 "DRI_DRI2" +#define __DRI_DRI2_VERSION 1 + +struct __DRIdri2ExtensionRec { + __DRIextension base; + + __DRIscreen *(*createNewScreen)(int screen, int fd, + const __DRIextension **extensions, + const __DRIconfig ***driver_configs, + void *loaderPrivate); + + __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, + const __DRIconfig *config, + void *loaderPrivate); + + __DRIcontext *(*createNewContext)(__DRIscreen *screen, + const __DRIconfig *config, + __DRIcontext *shared, + void *loaderPrivate); + +}; + #endif diff --git a/include/GL/internal/dri_sarea.h b/include/GL/internal/dri_sarea.h deleted file mode 100644 index 849161fbc1..0000000000 --- a/include/GL/internal/dri_sarea.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright 2007 Red Hat, Inc - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef DRI_SAREA_H -#define DRI_SAREA_H - -#include - -/* The DRI2 SAREA holds a list of self-describing blocks. Each block - * is 8 byte aligned and has a common 32-bit header word. The upper - * 16 bits describe the type of the block and the lower 16 bits the - * size. DRI2 only defines a couple of blocks and allows drivers to - * define driver specific blocks using type codes from 0x8000 and up. - * The type code 0x0000 defines the end of the sarea. */ - -#define DRI2_SAREA_BLOCK_HEADER(type, size) (((type) << 16) | (size)) -#define DRI2_SAREA_BLOCK_TYPE(b) ((b) >> 16) -#define DRI2_SAREA_BLOCK_SIZE(b) ((b) & 0xffff) -#define DRI2_SAREA_BLOCK_NEXT(p) \ - ((void *) ((unsigned char *) (p) + \ - DRI2_SAREA_BLOCK_SIZE(*(unsigned int *) p))) - -#define DRI2_SAREA_BLOCK_END 0x0000 -#define DRI2_SAREA_BLOCK_LOCK 0x0001 -#define DRI2_SAREA_BLOCK_EVENT_BUFFER 0x0002 - -/* Chipset specific blocks start at 0x8000, 0xffff is reserved. */ - -typedef struct __DRILock __DRILock; -typedef struct __DRIEventBuffer __DRIEventBuffer; -typedef struct __DRIDrawableBuffer __DRIDrawableBuffer; -typedef struct __DRIDrawableConfigEvent __DRIDrawableConfigEvent; -typedef struct __DRIBufferAttachEvent __DRIBufferAttachEvent; - -struct __DRILock { - unsigned int block_header; - drm_hw_lock_t lock; - - /* We use this with DRM_CAS to allocate lock IDs for the real lock.*/ - unsigned int next_id; -}; - -struct __DRIEventBuffer { - unsigned int block_header; - unsigned int head; /* last valid event */ - unsigned int prealloc; /* event currently being written */ - unsigned int size; /* size of data */ - unsigned char data[0]; -}; - -enum { - /* the four standard color buffers */ - DRI_DRAWABLE_BUFFER_FRONT_LEFT = 0, - DRI_DRAWABLE_BUFFER_BACK_LEFT = 1, - DRI_DRAWABLE_BUFFER_FRONT_RIGHT = 2, - DRI_DRAWABLE_BUFFER_BACK_RIGHT = 3, - /* optional aux buffer */ - DRI_DRAWABLE_BUFFER_AUX0 = 4, - DRI_DRAWABLE_BUFFER_AUX1 = 5, - DRI_DRAWABLE_BUFFER_AUX2 = 6, - DRI_DRAWABLE_BUFFER_AUX3 = 7, - DRI_DRAWABLE_BUFFER_DEPTH = 8, - DRI_DRAWABLE_BUFFER_STENCIL = 9, - DRI_DRAWABLE_BUFFER_ACCUM = 10, - /* generic renderbuffers */ - DRI_DRAWABLE_BUFFER_COLOR0 = 11, - DRI_DRAWABLE_BUFFER_COLOR1 = 12, - DRI_DRAWABLE_BUFFER_COLOR2 = 13, - DRI_DRAWABLE_BUFFER_COLOR3 = 14, - DRI_DRAWABLE_BUFFER_COLOR4 = 15, - DRI_DRAWABLE_BUFFER_COLOR5 = 16, - DRI_DRAWABLE_BUFFER_COLOR6 = 17, - DRI_DRAWABLE_BUFFER_COLOR7 = 18, - DRI_DRAWABLE_BUFFER_COUNT = 19 -}; - -struct __DRIDrawableBuffer { - unsigned int attachment; - unsigned int handle; - unsigned int pitch; - unsigned short cpp; - - /* Upper 8 bits are driver specific, lower 8 bits generic. The - * bits can inidicate buffer properties such as tiled, swizzled etc. */ - unsigned short flags; -}; - -#define DRI2_EVENT_HEADER(type, size) (((type) << 16) | (size)) -#define DRI2_EVENT_TYPE(b) ((b) >> 16) -#define DRI2_EVENT_SIZE(b) ((b) & 0xffff) - -#define DRI2_EVENT_PAD 0x0000 -#define DRI2_EVENT_DRAWABLE_CONFIG 0x0001 -#define DRI2_EVENT_BUFFER_ATTACH 0x0002 - -struct __DRIDrawableConfigEvent { - unsigned int event_header; - unsigned int drawable; - short x; - short y; - unsigned int width; - unsigned int height; - unsigned int num_rects; - struct drm_clip_rect rects[0]; -}; - -struct __DRIBufferAttachEvent { - unsigned int event_header; - unsigned int drawable; - __DRIDrawableBuffer buffer; -}; - -#endif /* DRI_SAREA_H */ diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c index e7044ab424..dc60af90c1 100644 --- a/src/glx/x11/dri2.c +++ b/src/glx/x11/dri2.c @@ -122,7 +122,11 @@ Bool DRI2Connect(Display *dpy, int screen, return False; } - *sareaHandle = rep.sareaHandle; + if (rep.driverNameLength == 0 && rep.busIdLength == 0) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } *driverName = Xmalloc(rep.driverNameLength + 1); if (*driverName == NULL) { @@ -150,7 +154,7 @@ Bool DRI2Connect(Display *dpy, int screen, UnlockDisplay(dpy); SyncHandle(); - return rep.sareaHandle != 0; + return True; } Bool DRI2AuthConnection(Display *dpy, int screen, drm_magic_t magic) @@ -179,74 +183,119 @@ Bool DRI2AuthConnection(Display *dpy, int screen, drm_magic_t magic) return rep.authenticated; } -Bool DRI2CreateDrawable(Display *dpy, XID drawable, - unsigned int *handle, unsigned int *head) +void DRI2CreateDrawable(Display *dpy, XID drawable) { XExtDisplayInfo *info = DRI2FindDisplay(dpy); - xDRI2CreateDrawableReply rep; xDRI2CreateDrawableReq *req; - XextCheckExtension (dpy, info, dri2ExtensionName, False); + XextSimpleCheckExtension (dpy, info, dri2ExtensionName); LockDisplay(dpy); GetReq(DRI2CreateDrawable, req); req->reqType = info->codes->major_opcode; req->dri2ReqType = X_DRI2CreateDrawable; req->drawable = drawable; + UnlockDisplay(dpy); + SyncHandle(); +} + +DRI2Buffer *DRI2GetBuffers(Display *dpy, XID drawable, + int *width, int *height, + unsigned int *attachments, int count, + int *outCount) +{ + XExtDisplayInfo *info = DRI2FindDisplay(dpy); + xDRI2GetBuffersReply rep; + xDRI2GetBuffersReq *req; + DRI2Buffer *buffers; + xDRI2Buffer repBuffer; + CARD32 *p; + int i; + + XextCheckExtension (dpy, info, dri2ExtensionName, False); + + LockDisplay(dpy); + GetReqExtra(DRI2GetBuffers, count * 4, req); + req->reqType = info->codes->major_opcode; + req->dri2ReqType = X_DRI2GetBuffers; + req->drawable = drawable; + req->count = count; + p = (CARD32 *) &req[1]; + for (i = 0; i < count; i++) + p[i] = attachments[i]; + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); - return False; + return NULL; + } + + *width = rep.width; + *height = rep.height; + *outCount = rep.count; + + buffers = Xmalloc(count * sizeof buffers[0]); + if (buffers == NULL) { + _XEatData(dpy, rep.count * sizeof repBuffer); + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + + for (i = 0; i < rep.count; i++) { + _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer); + buffers[i].attachment = repBuffer.attachment; + buffers[i].name = repBuffer.name; + buffers[i].pitch = repBuffer.pitch; + buffers[i].cpp = repBuffer.cpp; + buffers[i].flags = repBuffer.flags; } + UnlockDisplay(dpy); SyncHandle(); - *handle = rep.handle; - *head = rep.head; - - return True; + return buffers; } -void DRI2DestroyDrawable(Display *dpy, XID drawable) +void DRI2SwapBuffers(Display *dpy, XID drawable, + int x, int y, int width, int height) { XExtDisplayInfo *info = DRI2FindDisplay(dpy); - xDRI2DestroyDrawableReq *req; + xDRI2SwapBuffersReq *req; + xDRI2SwapBuffersReply rep; XextSimpleCheckExtension (dpy, info, dri2ExtensionName); - XSync(dpy, GL_FALSE); - LockDisplay(dpy); - GetReq(DRI2DestroyDrawable, req); + GetReq(DRI2SwapBuffers, req); req->reqType = info->codes->major_opcode; - req->dri2ReqType = X_DRI2DestroyDrawable; + req->dri2ReqType = X_DRI2SwapBuffers; req->drawable = drawable; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + + _XReply(dpy, (xReply *)&rep, 0, xFalse); + UnlockDisplay(dpy); SyncHandle(); } -Bool DRI2ReemitDrawableInfo(Display *dpy, XID drawable, unsigned int *head) +void DRI2DestroyDrawable(Display *dpy, XID drawable) { XExtDisplayInfo *info = DRI2FindDisplay(dpy); - xDRI2ReemitDrawableInfoReply rep; - xDRI2ReemitDrawableInfoReq *req; + xDRI2DestroyDrawableReq *req; - XextCheckExtension (dpy, info, dri2ExtensionName, False); + XextSimpleCheckExtension (dpy, info, dri2ExtensionName); + + XSync(dpy, GL_FALSE); LockDisplay(dpy); - GetReq(DRI2ReemitDrawableInfo, req); + GetReq(DRI2DestroyDrawable, req); req->reqType = info->codes->major_opcode; - req->dri2ReqType = X_DRI2ReemitDrawableInfo; + req->dri2ReqType = X_DRI2DestroyDrawable; req->drawable = drawable; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } UnlockDisplay(dpy); SyncHandle(); - - *head = rep.head; - - return True; } diff --git a/src/glx/x11/dri2.h b/src/glx/x11/dri2.h index 1dfd0448b2..e57c4ce644 100644 --- a/src/glx/x11/dri2.h +++ b/src/glx/x11/dri2.h @@ -33,6 +33,14 @@ #ifndef _DRI2_H_ #define _DRI2_H_ +typedef struct { + unsigned int attachment; + unsigned int name; + unsigned int pitch; + unsigned int cpp; + unsigned int flags; +} DRI2Buffer; + extern Bool DRI2QueryExtension(Display *display, int *eventBase, int *errorBase); extern Bool @@ -42,12 +50,17 @@ DRI2Connect(Display *display, int screen, char **driverName, char **busId, unsigned int *sareaHandle); extern Bool DRI2AuthConnection(Display *display, int screen, drm_magic_t magic); -extern Bool -DRI2CreateDrawable(Display *display, XID drawable, - unsigned int *handle, unsigned int *head); +extern void +DRI2CreateDrawable(Display *display, XID drawable); extern void DRI2DestroyDrawable(Display *display, XID handle); -extern Bool -DRI2ReemitDrawableInfo(Display *dpy, XID handle, unsigned int *head); +extern DRI2Buffer * +DRI2GetBuffers(Display *dpy, XID drawable, + int *width, int *height, + unsigned int *attachments, int count, + int *outCount); +extern void +DRI2SwapBuffers(Display *dpy, XID drawable, + int x, int y, int width, int height); #endif diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c index 0be65bce62..c56adfa558 100644 --- a/src/glx/x11/dri2_glx.c +++ b/src/glx/x11/dri2_glx.c @@ -49,6 +49,7 @@ typedef struct __GLXDRIdisplayPrivateRec __GLXDRIdisplayPrivate; typedef struct __GLXDRIcontextPrivateRec __GLXDRIcontextPrivate; +typedef struct __GLXDRIdrawablePrivateRec __GLXDRIdrawablePrivate; struct __GLXDRIdisplayPrivateRec { __GLXDRIdisplay base; @@ -67,6 +68,13 @@ struct __GLXDRIcontextPrivateRec { __GLXscreenConfigs *psc; }; +struct __GLXDRIdrawablePrivateRec { + __GLXDRIdrawable base; + __DRIbuffer buffers[5]; + int bufferCount; + int width, height; +}; + static void dri2DestroyContext(__GLXDRIcontext *context, __GLXscreenConfigs *psc, Display *dpy) { @@ -104,7 +112,6 @@ static __GLXDRIcontext *dri2CreateContext(__GLXscreenConfigs *psc, { __GLXDRIcontextPrivate *pcp, *pcp_shared; __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode; - const __DRIcoreExtension *core = psc->core; __DRIcontext *shared = NULL; if (shareList) { @@ -118,8 +125,8 @@ static __GLXDRIcontext *dri2CreateContext(__GLXscreenConfigs *psc, pcp->psc = psc; pcp->driContext = - (*core->createNewContext)(psc->__driScreen, - config->driConfig, shared, pcp); + (*psc->dri2->createNewContext)(psc->__driScreen, + config->driConfig, shared, pcp); gc->__driContext = pcp->driContext; if (pcp->driContext == NULL) { @@ -148,45 +155,40 @@ static __GLXDRIdrawable *dri2CreateDrawable(__GLXscreenConfigs *psc, GLXDrawable drawable, const __GLcontextModes *modes) { - __GLXDRIdrawable *pdraw; + __GLXDRIdrawablePrivate *pdraw; __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) modes; - unsigned int handle, head; - const __DRIcoreExtension *core = psc->core; pdraw = Xmalloc(sizeof(*pdraw)); if (!pdraw) return NULL; - pdraw->destroyDrawable = dri2DestroyDrawable; - pdraw->xDrawable = xDrawable; - pdraw->drawable = drawable; - pdraw->psc = psc; - - fprintf(stderr, "calling DRI2CreateDrawable, XID 0x%lx, GLX ID 0x%lx\n", - xDrawable, drawable); - - if (!DRI2CreateDrawable(psc->dpy, xDrawable, &handle, &head)) { - Xfree(pdraw); - return NULL; - } + pdraw->base.destroyDrawable = dri2DestroyDrawable; + pdraw->base.xDrawable = xDrawable; + pdraw->base.drawable = drawable; + pdraw->base.psc = psc; - fprintf(stderr, "success, head 0x%x, handle 0x%x\n", head, handle); + DRI2CreateDrawable(psc->dpy, xDrawable); /* Create a new drawable */ - pdraw->driDrawable = - (*core->createNewDrawable)(psc->__driScreen, - config->driConfig, - handle, - head, - pdraw); - - if (!pdraw->driDrawable) { + pdraw->base.driDrawable = + (*psc->dri2->createNewDrawable)(psc->__driScreen, + config->driConfig, pdraw); + + if (!pdraw->base.driDrawable) { DRI2DestroyDrawable(psc->dpy, drawable); Xfree(pdraw); return NULL; } - return pdraw; + return &pdraw->base; +} + +static void dri2SwapBuffers(__GLXDRIdrawable *pdraw) +{ + __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw; + + DRI2SwapBuffers(pdraw->psc->dpy, pdraw->drawable, + 0, 0, priv->width, priv->height); } static void dri2DestroyScreen(__GLXscreenConfigs *psc) @@ -197,46 +199,39 @@ static void dri2DestroyScreen(__GLXscreenConfigs *psc) psc->__driScreen = NULL; } - -static void dri2ReemitDrawableInfo(__DRIdrawable *draw, unsigned int *tail, - void *loaderPrivate) +static __DRIbuffer * +dri2GetBuffers(__DRIdrawable *driDrawable, + int *width, int *height, + unsigned int *attachments, int count, + int *out_count, void *loaderPrivate) { - __GLXDRIdrawable *pdraw = loaderPrivate; - - DRI2ReemitDrawableInfo(pdraw->psc->dpy, pdraw->drawable, tail); -} - -static void dri2PostDamage(__DRIdrawable *draw, - struct drm_clip_rect *rects, - int numRects, void *loaderPrivate) -{ - XRectangle *xrects; - XserverRegion region; - __GLXDRIdrawable *glxDraw = loaderPrivate; - __GLXscreenConfigs *psc = glxDraw->psc; - Display *dpy = psc->dpy; + __GLXDRIdrawablePrivate *pdraw = loaderPrivate; + DRI2Buffer *buffers; int i; - xrects = malloc(sizeof(XRectangle) * numRects); - if (xrects == NULL) - return; - - for (i = 0; i < numRects; i++) { - xrects[i].x = rects[i].x1; - xrects[i].y = rects[i].y1; - xrects[i].width = rects[i].x2 - rects[i].x1; - xrects[i].height = rects[i].y2 - rects[i].y1; + buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable, + width, height, attachments, count, out_count); + pdraw->width = *width; + pdraw->height = *height; + + /* This assumes the DRI2 buffer attachment tokens matches the + * __DRIbuffer tokens. */ + for (i = 0; i < *out_count; i++) { + pdraw->buffers[i].attachment = buffers[i].attachment; + pdraw->buffers[i].name = buffers[i].name; + pdraw->buffers[i].pitch = buffers[i].pitch; + pdraw->buffers[i].cpp = buffers[i].cpp; + pdraw->buffers[i].flags = buffers[i].flags; } - region = XFixesCreateRegion(dpy, xrects, numRects); - free(xrects); - XDamageAdd(dpy, glxDraw->xDrawable, region); - XFixesDestroyRegion(dpy, region); + + Xfree(buffers); + + return pdraw->buffers; } -static const __DRIloaderExtension dri2LoaderExtension = { - { __DRI_LOADER, __DRI_LOADER_VERSION }, - dri2ReemitDrawableInfo, - dri2PostDamage +static const __DRIdri2LoaderExtension dri2LoaderExtension = { + { __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION }, + dri2GetBuffers, }; static const __DRIextension *loader_extensions[] = { @@ -279,10 +274,12 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen, for (i = 0; extensions[i]; i++) { if (strcmp(extensions[i]->name, __DRI_CORE) == 0) psc->core = (__DRIcoreExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_DRI2) == 0) + psc->dri2 = (__DRIdri2Extension *) extensions[i]; } - if (psc->core == NULL) { - ErrorMessageF("core dri extension not found\n"); + if (psc->core == NULL || psc->dri2 == NULL) { + ErrorMessageF("core dri or dri2 extension not found\n"); goto handle_error; } @@ -301,7 +298,7 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen, } psc->__driScreen = - psc->core->createNewScreen(screen, psc->fd, sareaHandle, + psc->dri2->createNewScreen(screen, psc->fd, loader_extensions, &driver_configs, psc); if (psc->__driScreen == NULL) { ErrorMessageF("failed to create dri screen\n"); @@ -316,6 +313,7 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen, psp->destroyScreen = dri2DestroyScreen; psp->createContext = dri2CreateContext; psp->createDrawable = dri2CreateDrawable; + psp->swapBuffers = dri2SwapBuffers; Xfree(driverName); Xfree(busID); diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 08c83a2310..39bf6c430b 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -570,6 +570,11 @@ static __GLXDRIdrawable *driCreateDrawable(__GLXscreenConfigs *psc, return pdraw; } +static void driSwapBuffers(__GLXDRIdrawable *pdraw) +{ + (*pdraw->psc->core->swapBuffers)(pdraw->driDrawable); +} + static void driDestroyScreen(__GLXscreenConfigs *psc) { /* Free the direct rendering per screen data */ @@ -641,6 +646,7 @@ static __GLXDRIscreen *driCreateScreen(__GLXscreenConfigs *psc, int screen, psp->destroyScreen = driDestroyScreen; psp->createContext = driCreateContext; psp->createDrawable = driCreateDrawable; + psp->swapBuffers = driSwapBuffers; return psp; } diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index e2b4218200..412511247e 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -123,6 +123,8 @@ struct __GLXDRIscreenRec { XID drawable, GLXDrawable glxDrawable, const __GLcontextModes *modes); + + void (*swapBuffers)(__GLXDRIdrawable *pdraw); }; struct __GLXDRIcontextRec { @@ -141,8 +143,8 @@ struct __GLXDRIdrawableRec { XID xDrawable; XID drawable; __GLXscreenConfigs *psc; - __DRIdrawable *driDrawable; GLenum textureTarget; + __DRIdrawable *driDrawable; }; /* @@ -469,6 +471,7 @@ struct __GLXscreenConfigsRec { const __DRIcoreExtension *core; const __DRIlegacyExtension *legacy; const __DRIswrastExtension *swrast; + const __DRIdri2Extension *dri2; __glxHashTable *drawHash; Display *dpy; int scr, fd; diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 0f0cb6233a..9197130dca 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -855,7 +855,8 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable) __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL); if (pdraw != NULL) { - (*pdraw->psc->core->swapBuffers)(pdraw->driDrawable); + glFlush(); + (*pdraw->psc->driScreen->swapBuffers)(pdraw); return; } #endif diff --git a/src/mesa/drivers/dri/Makefile b/src/mesa/drivers/dri/Makefile index 3b3fcf11df..eef68825bc 100644 --- a/src/mesa/drivers/dri/Makefile +++ b/src/mesa/drivers/dri/Makefile @@ -40,8 +40,6 @@ install: dri.pc $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal $(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_interface.h \ $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal - $(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_sarea.h \ - $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig $(INSTALL) -m 0644 dri.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 93b9f458e4..ce540624a5 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -152,7 +152,6 @@ static int driUnbindContext(__DRIcontext *pcp) return GL_TRUE; } - /** * This function takes both a read buffer and a draw buffer. This is needed * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent @@ -186,10 +185,7 @@ static int driBindContext(__DRIcontext *pcp, ** initialize the drawable information if has not been done before. */ - if (psp->dri2.enabled) { - __driParseEvents(pcp, pdp); - __driParseEvents(pcp, prp); - } else { + if (!psp->dri2.enabled) { if (!pdp->pStamp || *pdp->pStamp != pdp->lastStamp) { DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); __driUtilUpdateDrawableInfo(pdp); @@ -279,139 +275,6 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); } - -int -__driParseEvents(__DRIcontextPrivate *pcp, __DRIdrawablePrivate *pdp) -{ - __DRIscreenPrivate *psp = pdp->driScreenPriv; - __DRIDrawableConfigEvent *dc, *last_dc; - __DRIBufferAttachEvent *ba, *last_ba; - unsigned int tail, mask, *p, end, total, size, changed; - unsigned char *data; - size_t rect_size; - - /* Check for wraparound. */ - if (pcp && psp->dri2.buffer->prealloc - pdp->dri2.tail > psp->dri2.buffer->size) { - /* If prealloc overlaps into what we just parsed, the - * server overwrote it and we have to reset our tail - * pointer. */ - DRM_UNLOCK(psp->fd, psp->lock, pcp->hHWContext); - (*psp->dri2.loader->reemitDrawableInfo)(pdp, &pdp->dri2.tail, - pdp->loaderPrivate); - DRM_LIGHT_LOCK(psp->fd, psp->lock, pcp->hHWContext); - } - - total = psp->dri2.buffer->head - pdp->dri2.tail; - mask = psp->dri2.buffer->size - 1; - end = psp->dri2.buffer->head; - data = psp->dri2.buffer->data; - - changed = 0; - last_dc = NULL; - last_ba = NULL; - - for (tail = pdp->dri2.tail; tail != end; tail += size) { - p = (unsigned int *) (data + (tail & mask)); - size = DRI2_EVENT_SIZE(*p); - if (size > total || (tail & mask) + size > psp->dri2.buffer->size) { - /* illegal data, bail out. */ - fprintf(stderr, "illegal event size\n"); - break; - } - - switch (DRI2_EVENT_TYPE(*p)) { - case DRI2_EVENT_DRAWABLE_CONFIG: - dc = (__DRIDrawableConfigEvent *) p; - if (dc->drawable == pdp->dri2.drawable_id) - last_dc = dc; - break; - - case DRI2_EVENT_BUFFER_ATTACH: - ba = (__DRIBufferAttachEvent *) p; - if (ba->drawable == pdp->dri2.drawable_id && - ba->buffer.attachment == DRI_DRAWABLE_BUFFER_FRONT_LEFT) - last_ba = ba; - break; - } - } - - if (last_dc) { - if (pdp->w != last_dc->width || pdp->h != last_dc->height) - changed = 1; - - pdp->x = last_dc->x; - pdp->y = last_dc->y; - pdp->w = last_dc->width; - pdp->h = last_dc->height; - - pdp->backX = 0; - pdp->backY = 0; - pdp->numBackClipRects = 1; - pdp->pBackClipRects[0].x1 = 0; - pdp->pBackClipRects[0].y1 = 0; - pdp->pBackClipRects[0].x2 = pdp->w; - pdp->pBackClipRects[0].y2 = pdp->h; - - pdp->numClipRects = last_dc->num_rects; - _mesa_free(pdp->pClipRects); - rect_size = last_dc->num_rects * sizeof last_dc->rects[0]; - pdp->pClipRects = _mesa_malloc(rect_size); - memcpy(pdp->pClipRects, last_dc->rects, rect_size); - } - - /* We only care about the most recent drawable config. */ - if (last_dc && changed) - (*psp->DriverAPI.HandleDrawableConfig)(pdp, pcp, last_dc); - - /* Front buffer attachments are special, they typically mean that - * we're rendering to a redirected window (or a child window of a - * redirected window) and that it got resized. Resizing the root - * window on randr events is a special case of this. Other causes - * may be a window transitioning between redirected and - * non-redirected, or a window getting reparented between parents - * with different window pixmaps (eg two redirected windows). - * These events are special in that the X server allocates the - * buffer and that the buffer may be shared by other child - * windows. When our window share the window pixmap with its - * parent, drawable config events doesn't affect the front buffer. - * We only care about the last such event in the buffer; in fact, - * older events will refer to invalid buffer objects.*/ - if (last_ba) - (*psp->DriverAPI.HandleBufferAttach)(pdp, pcp, last_ba); - - /* If there was a drawable config event in the buffer and it - * changed the size of the window, all buffer auxillary buffer - * attachments prior to that are invalid (as opposed to the front - * buffer case discussed above). In that case we can start - * looking for buffer attachment after the last drawable config - * event. If there is no drawable config event in this batch of - * events, we have to assume that the last batch might have had - * one and process all buffer attach events.*/ - if (last_dc && changed) - tail = (unsigned char *) last_dc - data; - else - tail = pdp->dri2.tail; - - for ( ; tail != end; tail += size) { - ba = (__DRIBufferAttachEvent *) (data + (tail & mask)); - size = DRI2_EVENT_SIZE(ba->event_header); - - if (DRI2_EVENT_TYPE(ba->event_header) != DRI2_EVENT_BUFFER_ATTACH) - continue; - if (ba->drawable != pdp->dri2.drawable_id) - continue; - if (last_ba == ba) - continue; - - (*psp->DriverAPI.HandleBufferAttach)(pdp, pcp, ba); - changed = 1; - } - - pdp->dri2.tail = tail; - - return changed || last_ba; -} - /*@}*/ /*****************************************************************/ @@ -425,12 +288,7 @@ static void driReportDamage(__DRIdrawable *pdp, __DRIscreen *psp = pdp->driScreenPriv; /* Check that we actually have the new damage report method */ - if (psp->dri2.enabled) { - (*psp->dri2.loader->postDamage)(pdp, - pClipRects, - numClipRects, - pdp->loaderPrivate); - } else if (psp->damage) { + if (psp->damage) { /* Report the damage. Currently, all our drivers draw * directly to the front buffer, so we report the damage there * rather than to the backing storein (if any). @@ -460,9 +318,6 @@ static void driSwapBuffers(__DRIdrawable *dPriv) if (!dPriv->numClipRects) return; - if (psp->dri2.enabled) - __driParseEvents(NULL, dPriv); - psp->DriverAPI.SwapBuffers(dPriv); driReportDamage(dPriv, dPriv->pClipRects, dPriv->numClipRects); @@ -602,17 +457,17 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, static __DRIdrawable * -dri2CreateNewDrawable(__DRIscreen *screen, const __DRIconfig *config, - unsigned int drawable_id, unsigned int head, void *data) +dri2CreateNewDrawable(__DRIscreen *screen, + const __DRIconfig *config, + void *loaderPrivate) { __DRIdrawable *pdraw; - pdraw = driCreateNewDrawable(screen, config, 0, 0, NULL, data); + pdraw = driCreateNewDrawable(screen, config, 0, 0, NULL, loaderPrivate); if (!pdraw) return NULL; - pdraw->dri2.drawable_id = drawable_id; - pdraw->dri2.tail = head; + pdraw->pClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); pdraw->pBackClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); return pdraw; @@ -723,18 +578,7 @@ static __DRIcontext * dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config, __DRIcontext *shared, void *data) { - drm_context_t hwContext; - DRM_CAS_RESULT(ret); - - /* DRI2 doesn't use kernel with context IDs, we just need an ID that's - * different from the kernel context ID to make drmLock() happy. */ - - do { - hwContext = screen->dri2.lock->next_id; - DRM_CAS(&screen->dri2.lock->next_id, hwContext, hwContext + 1, ret); - } while (ret); - - return driCreateNewContext(screen, config, 0, shared, hwContext, data); + return driCreateNewContext(screen, config, 0, shared, 0, data); } @@ -770,12 +614,7 @@ static void driDestroyScreen(__DRIscreen *psp) if (psp->DriverAPI.DestroyScreen) (*psp->DriverAPI.DestroyScreen)(psp); - if (psp->dri2.enabled) { -#ifdef TTM_API - drmBOUnmap(psp->fd, &psp->dri2.sareaBO); - drmBOUnreference(psp->fd, &psp->dri2.sareaBO); -#endif - } else { + if (!psp->dri2.enabled) { (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); (void)drmCloseOnce(psp->fd); @@ -798,8 +637,8 @@ setupLoaderExtensions(__DRIscreen *psp, psp->damage = (__DRIdamageExtension *) extensions[i]; if (strcmp(extensions[i]->name, __DRI_SYSTEM_TIME) == 0) psp->systemTime = (__DRIsystemTimeExtension *) extensions[i]; - if (strcmp(extensions[i]->name, __DRI_LOADER) == 0) - psp->dri2.loader = (__DRIloaderExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0) + psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i]; } } @@ -895,19 +734,16 @@ driCreateNewScreen(int scrn, return psp; } - /** * DRI2 */ static __DRIscreen * -dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle, +dri2CreateNewScreen(int scrn, int fd, const __DRIextension **extensions, const __DRIconfig ***driver_configs, void *data) { -#ifdef TTM_API static const __DRIextension *emptyExtensionList[] = { NULL }; __DRIscreen *psp; - unsigned int *p; drmVersionPtr version; if (driDriverAPI.InitScreen2 == NULL) @@ -932,39 +768,9 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle, psp->myNum = scrn; psp->dri2.enabled = GL_TRUE; - if (drmBOReference(psp->fd, sarea_handle, &psp->dri2.sareaBO)) { - fprintf(stderr, "Failed to reference DRI2 sarea BO\n"); - _mesa_free(psp); - return NULL; - } - - if (drmBOMap(psp->fd, &psp->dri2.sareaBO, - DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0, &psp->dri2.sarea)) { - drmBOUnreference(psp->fd, &psp->dri2.sareaBO); - _mesa_free(psp); - return NULL; - } - - p = psp->dri2.sarea; - while (DRI2_SAREA_BLOCK_TYPE(*p)) { - switch (DRI2_SAREA_BLOCK_TYPE(*p)) { - case DRI2_SAREA_BLOCK_LOCK: - psp->dri2.lock = (__DRILock *) p; - break; - case DRI2_SAREA_BLOCK_EVENT_BUFFER: - psp->dri2.buffer = (__DRIEventBuffer *) p; - break; - } - p = DRI2_SAREA_BLOCK_NEXT(p); - } - - psp->lock = (drmLock *) &psp->dri2.lock->lock; - psp->DriverAPI = driDriverAPI; *driver_configs = driDriverAPI.InitScreen2(psp); if (*driver_configs == NULL) { - drmBOUnmap(psp->fd, &psp->dri2.sareaBO); - drmBOUnreference(psp->fd, &psp->dri2.sareaBO); _mesa_free(psp); return NULL; } @@ -972,9 +778,6 @@ dri2CreateNewScreen(int scrn, int fd, unsigned int sarea_handle, psp->DriverAPI = driDriverAPI; return psp; -#else - return NULL; -#endif } static const __DRIextension **driGetExtensions(__DRIscreen *psp) @@ -982,36 +785,45 @@ static const __DRIextension **driGetExtensions(__DRIscreen *psp) return psp->extensions; } -/** Legacy DRI interface */ -const __DRIlegacyExtension driLegacyExtension = { - { __DRI_LEGACY, __DRI_LEGACY_VERSION }, - driCreateNewScreen, - driCreateNewDrawable, - driCreateNewContext -}; - -/** DRI2 interface */ +/** Core interface */ const __DRIcoreExtension driCoreExtension = { { __DRI_CORE, __DRI_CORE_VERSION }, - dri2CreateNewScreen, + NULL, driDestroyScreen, driGetExtensions, driGetConfigAttrib, driIndexConfigAttrib, - dri2CreateNewDrawable, + NULL, driDestroyDrawable, driSwapBuffers, - dri2CreateNewContext, + NULL, driCopyContext, driDestroyContext, driBindContext, driUnbindContext }; +/** Legacy DRI interface */ +const __DRIlegacyExtension driLegacyExtension = { + { __DRI_LEGACY, __DRI_LEGACY_VERSION }, + driCreateNewScreen, + driCreateNewDrawable, + driCreateNewContext, +}; + +/** Legacy DRI interface */ +const __DRIdri2Extension driDRI2Extension = { + { __DRI_DRI2, __DRI_DRI2_VERSION }, + dri2CreateNewScreen, + dri2CreateNewDrawable, + dri2CreateNewContext, +}; + /* This is the table of extensions that the loader will dlsym() for. */ PUBLIC const __DRIextension *__driDriverExtensions[] = { &driCoreExtension.base, &driLegacyExtension.base, + &driDRI2Extension.base, NULL }; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index f126d08406..65931d3feb 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -204,16 +204,8 @@ struct __DriverAPIRec { - /* DRI2 Entry points */ + /* DRI2 Entry point */ const __DRIconfig **(*InitScreen2) (__DRIscreen * priv); - void (*HandleDrawableConfig)(__DRIdrawable *dPriv, - __DRIcontext *pcp, - __DRIDrawableConfigEvent *event); - - void (*HandleBufferAttach)(__DRIdrawable *dPriv, - __DRIcontext *pcp, - __DRIBufferAttachEvent *ba); - }; extern const struct __DriverAPIRec driDriverAPI; @@ -369,10 +361,6 @@ struct __DRIdrawableRec { * GLX_MESA_swap_control. */ unsigned int swap_interval; - struct { - unsigned int tail; - unsigned int drawable_id; - } dri2; }; /** @@ -524,13 +512,7 @@ struct __DRIscreenRec { /* Flag to indicate that this is a DRI2 screen. Many of the above * fields will not be valid or initializaed in that case. */ int enabled; -#ifdef TTM_API - drmBO sareaBO; -#endif - void *sarea; - __DRIEventBuffer *buffer; - __DRILock *lock; - __DRIloaderExtension *loader; + __DRIdri2LoaderExtension *loader; } dri2; /* The lock actually in use, old sarea or DRI2 */ @@ -544,9 +526,6 @@ __driUtilMessage(const char *f, ...); extern void __driUtilUpdateDrawableInfo(__DRIdrawable *pdp); -extern int -__driParseEvents(__DRIcontext *psp, __DRIdrawable *pdp); - extern float driCalculateSwapUsage( __DRIdrawable *dPriv, int64_t last_swap_ust, int64_t current_ust ); diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 31e96a250a..ece01a8c9a 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -75,15 +75,27 @@ static void brw_set_draw_region( struct intel_context *intel, GLuint num_regions) { struct brw_context *brw = brw_context(&intel->ctx); + struct intel_region *old_depth_region, *old_draw_regions[MAX_DRAW_BUFFERS]; int i; + if (brw->state.depth_region != depth_region) brw->state.dirty.brw |= BRW_NEW_DEPTH_BUFFER; - for (i = 0; i < brw->state.nr_draw_regions; i++) - intel_region_release(&brw->state.draw_regions[i]); - intel_region_release(&brw->state.depth_region); + + for (i = 0; i < brw->state.nr_draw_regions; i++) { + old_draw_regions[i] = brw->state.draw_regions[i]; + brw->state.draw_regions[i] = NULL; + } + old_depth_region = brw->state.depth_region; + brw->state.depth_region = NULL; + for (i = 0; i < num_regions; i++) intel_region_reference(&brw->state.draw_regions[i], draw_regions[i]); intel_region_reference(&brw->state.depth_region, depth_region); + + for (i = 0; i < brw->state.nr_draw_regions; i++) + intel_region_release(&old_draw_regions[i]); + intel_region_release(&old_depth_region); + brw->state.nr_draw_regions = num_regions; } diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 77352e6a53..3fe67462d5 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -618,6 +618,9 @@ intel_wait_flips(struct intel_context *intel) BUFFER_FRONT_LEFT ? BUFFER_FRONT_LEFT : BUFFER_BACK_LEFT); + if (intel->intelScreen->driScrnPriv->dri2.enabled) + return; + if (intel_fb->Base.Name == 0 && intel_rb && intel_rb->pf_pending == intel_fb->pf_seq) { GLint pf_planes = intel_fb->pf_planes; diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 50c1964d87..f0ee96f18d 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -195,6 +195,142 @@ intelGetString(GLcontext * ctx, GLenum name) } } +void +intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) +{ + struct intel_framebuffer *intel_fb = drawable->driverPrivate; + struct intel_renderbuffer *rb; + struct intel_region *region, *depth_region; + struct intel_context *intel = context->driverPrivate; + __DRIbuffer *buffers; + __DRIscreen *screen; + int i, count; + unsigned int attachments[10]; + uint32_t name; + const char *region_name; + + if (INTEL_DEBUG & DEBUG_DRI) + fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable); + + screen = intel->intelScreen->driScrnPriv; + + i = 0; + if (intel_fb->color_rb[0]) + attachments[i++] = __DRI_BUFFER_FRONT_LEFT; + if (intel_fb->color_rb[1]) + attachments[i++] = __DRI_BUFFER_BACK_LEFT; + if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH)) + attachments[i++] = __DRI_BUFFER_DEPTH; + if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL)) + attachments[i++] = __DRI_BUFFER_STENCIL; + + buffers = (*screen->dri2.loader->getBuffers)(drawable, + &drawable->w, + &drawable->h, + attachments, i, + &count, + drawable->loaderPrivate); + + drawable->x = 0; + drawable->y = 0; + drawable->backX = 0; + drawable->backY = 0; + drawable->numClipRects = 1; + drawable->pClipRects[0].x1 = 0; + drawable->pClipRects[0].y1 = 0; + drawable->pClipRects[0].x2 = drawable->w; + drawable->pClipRects[0].y2 = drawable->h; + drawable->numBackClipRects = 1; + drawable->pBackClipRects[0].x1 = 0; + drawable->pBackClipRects[0].y1 = 0; + drawable->pBackClipRects[0].x2 = drawable->w; + drawable->pBackClipRects[0].y2 = drawable->h; + + depth_region = NULL; + for (i = 0; i < count; i++) { + switch (buffers[i].attachment) { + case __DRI_BUFFER_FRONT_LEFT: + rb = intel_fb->color_rb[0]; + region_name = "dri2 front buffer"; + break; + + case __DRI_BUFFER_BACK_LEFT: + rb = intel_fb->color_rb[1]; + region_name = "dri2 back buffer"; + break; + + case __DRI_BUFFER_DEPTH: + rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH); + region_name = "dri2 depth buffer"; + break; + + case __DRI_BUFFER_STENCIL: + rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL); + region_name = "dri2 stencil buffer"; + break; + + case __DRI_BUFFER_ACCUM: + default: + fprintf(stderr, + "unhandled buffer attach event, attacment type %d\n", + buffers[i].attachment); + return; + } + + if (rb->region) { + intel_bo_flink(rb->region->buffer, &name); + if (name == buffers[i].name) + continue; + } + + if (INTEL_DEBUG & DEBUG_DRI) + fprintf(stderr, + "attaching buffer %d, at %d, cpp %d, pitch %d\n", + buffers[i].name, buffers[i].attachment, + buffers[i].cpp, buffers[i].pitch); + + if (buffers[i].attachment == __DRI_BUFFER_STENCIL && depth_region) { + if (INTEL_DEBUG & DEBUG_DRI) + fprintf(stderr, "(reusing depth buffer as stencil)\n"); + region = depth_region; + } + else + region = intel_region_alloc_for_handle(intel, buffers[i].cpp, + buffers[i].pitch / buffers[i].cpp, + drawable->h, + buffers[i].name, + region_name); + + if (buffers[i].attachment == __DRI_BUFFER_DEPTH) + depth_region = region; + + intel_renderbuffer_set_region(rb, region); + intel_region_release(®ion); + } + + driUpdateFramebufferSize(&intel->ctx, drawable); +} + +static void +intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +{ + struct intel_context *intel = intel_context(ctx); + __DRIcontext *driContext = intel->driContext; + + if (!driContext->driScreenPriv->dri2.enabled) + return; + + intel_update_renderbuffers(driContext, driContext->driDrawablePriv); + if (driContext->driDrawablePriv != driContext->driReadablePriv) + intel_update_renderbuffers(driContext, driContext->driReadablePriv); + + ctx->Driver.Viewport = NULL; + intel->driDrawable = driContext->driDrawablePriv; + intelWindowMoved(intel); + intel_draw_buffer(ctx, intel->ctx.DrawBuffer); + ctx->Driver.Viewport = intel_viewport; +} + /** * Extension strings exported by the intel driver. * @@ -541,6 +677,7 @@ intelInitDriverFunctions(struct dd_function_table *functions) functions->Finish = intelFinish; functions->GetString = intelGetString; functions->UpdateState = intelInvalidateState; + functions->Viewport = intel_viewport; functions->CopyColorTable = _swrast_CopyColorTable; functions->CopyColorSubTable = _swrast_CopyColorSubTable; @@ -582,6 +719,7 @@ intelInitContext(struct intel_context *intel, intel->intelScreen = intelScreen; intel->driScreen = sPriv; intel->sarea = saPriv; + intel->driContext = driContextPriv; /* Dri stuff */ intel->hHWContext = driContextPriv->hHWContext; @@ -784,6 +922,9 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, (struct intel_framebuffer *) driDrawPriv->driverPrivate; GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate; + intel_update_renderbuffers(driContextPriv, driDrawPriv); + if (driDrawPriv != driReadPriv) + intel_update_renderbuffers(driContextPriv, driReadPriv); /* XXX FBO temporary fix-ups! */ /* if the renderbuffers don't have regions, init them from the context */ @@ -989,18 +1130,12 @@ void LOCK_HARDWARE( struct intel_context *intel ) intel_fb->vbl_waited = vbl.reply.sequence; } - DRM_CAS(intel->driHwLock, intel->hHWContext, - (DRM_LOCK_HELD|intel->hHWContext), __ret); + if (!sPriv->dri2.enabled) { + DRM_CAS(intel->driHwLock, intel->hHWContext, + (DRM_LOCK_HELD|intel->hHWContext), __ret); - if (sPriv->dri2.enabled) { if (__ret) - drmGetLock(intel->driFd, intel->hHWContext, 0); - if (__driParseEvents(dPriv->driContextPriv, dPriv)) { - intelWindowMoved(intel); - intel_draw_buffer(&intel->ctx, intel->ctx.DrawBuffer); - } - } else if (__ret) { - intelContendedLock( intel, 0 ); + intelContendedLock( intel, 0 ); } @@ -1013,10 +1148,13 @@ void LOCK_HARDWARE( struct intel_context *intel ) */ void UNLOCK_HARDWARE( struct intel_context *intel ) { + __DRIscreen *sPriv = intel->driScreen; + intel->vtbl.note_unlock( intel ); intel->locked = 0; - DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext); + if (!sPriv->dri2.enabled) + DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext); _glthread_UNLOCK_MUTEX(lockMutex); diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index f9a373cf74..7381eec191 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -257,6 +257,7 @@ struct intel_context drmLock *driHwLock; int driFd; + __DRIcontextPrivate *driContext; __DRIdrawablePrivate *driDrawable; __DRIdrawablePrivate *driReadDrawable; __DRIscreenPrivate *driScreen; diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index ddfdce3835..c86c1034a9 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -145,12 +145,12 @@ intel_region_alloc(struct intel_context *intel, struct intel_region * intel_region_alloc_for_handle(struct intel_context *intel, GLuint cpp, GLuint pitch, GLuint height, - GLuint handle) + GLuint handle, const char *name) { struct intel_region *region; dri_bo *buffer; - buffer = intel_bo_gem_create_from_name(intel->bufmgr, "dri2 region", handle); + buffer = intel_bo_gem_create_from_name(intel->bufmgr, name, handle); region = intel_region_alloc_internal(intel, cpp, pitch, height, buffer); if (region == NULL) @@ -164,6 +164,9 @@ intel_region_alloc_for_handle(struct intel_context *intel, void intel_region_reference(struct intel_region **dst, struct intel_region *src) { + if (src) + DBG("%s %d\n", __FUNCTION__, src->refcount); + assert(*dst == NULL); if (src) { src->refcount++; diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index e5f19fbb45..1285f250a7 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -76,7 +76,7 @@ struct intel_region *intel_region_alloc(struct intel_context *intel, struct intel_region * intel_region_alloc_for_handle(struct intel_context *intel, GLuint cpp, GLuint pitch, GLuint height, - unsigned int handle); + unsigned int handle, const char *name); void intel_region_reference(struct intel_region **dst, struct intel_region *src); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 9ed89906d5..c193830f05 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -211,102 +211,6 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelPrintSAREA(sarea); } - -/** - * DRI2 entrypoint - */ -static void -intelHandleDrawableConfig(__DRIdrawablePrivate *dPriv, - __DRIcontextPrivate *pcp, - __DRIDrawableConfigEvent *event) -{ - struct intel_framebuffer *intel_fb = dPriv->driverPrivate; - struct intel_region *region = NULL; - struct intel_renderbuffer *rb, *depth_rb, *stencil_rb; - struct intel_context *intel = pcp->driverPrivate; - int cpp, pitch; - - cpp = intel->ctx.Visual.rgbBits / 8; - pitch = ((cpp * dPriv->w + 63) & ~63) / cpp; - - rb = intel_fb->color_rb[1]; - if (rb) { - region = intel_region_alloc(intel, cpp, pitch, dPriv->h); - intel_renderbuffer_set_region(rb, region); - } - - rb = intel_fb->color_rb[2]; - if (rb) { - region = intel_region_alloc(intel, cpp, pitch, dPriv->h); - intel_renderbuffer_set_region(rb, region); - } - - depth_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH); - stencil_rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL); - if (depth_rb || stencil_rb) - region = intel_region_alloc(intel, cpp, pitch, dPriv->h); - if (depth_rb) - intel_renderbuffer_set_region(depth_rb, region); - if (stencil_rb) - intel_renderbuffer_set_region(stencil_rb, region); - - /* FIXME: Tell the X server about the regions we just allocated and - * attached. */ -} - -/** - * DRI2 entrypoint - */ -static void -intelHandleBufferAttach(__DRIdrawablePrivate *dPriv, - __DRIcontextPrivate *pcp, - __DRIBufferAttachEvent *ba) -{ - struct intel_framebuffer *intel_fb = dPriv->driverPrivate; - struct intel_renderbuffer *rb; - struct intel_region *region; - struct intel_context *intel = pcp->driverPrivate; - - switch (ba->buffer.attachment) { - case DRI_DRAWABLE_BUFFER_FRONT_LEFT: - rb = intel_fb->color_rb[0]; - break; - - case DRI_DRAWABLE_BUFFER_BACK_LEFT: - rb = intel_fb->color_rb[0]; - break; - - case DRI_DRAWABLE_BUFFER_DEPTH: - rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH); - break; - - case DRI_DRAWABLE_BUFFER_STENCIL: - rb = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL); - break; - - case DRI_DRAWABLE_BUFFER_ACCUM: - default: - fprintf(stderr, "unhandled buffer attach event, attacment type %d\n", - ba->buffer.attachment); - return; - } - -#if 0 - /* FIXME: Add this so we can filter out when the X server sends us - * attachment events for the buffers we just allocated. Need to - * get the BO handle for a render buffer. */ - if (intel_renderbuffer_get_region_handle(rb) == ba->buffer.handle) - return; -#endif - - region = intel_region_alloc_for_handle(intel, ba->buffer.cpp, - ba->buffer.pitch / ba->buffer.cpp, - dPriv->h, - ba->buffer.handle); - - intel_renderbuffer_set_region(rb, region); -} - static const __DRItexOffsetExtension intelTexOffsetExtension = { { __DRI_TEX_OFFSET }, intelSetTexOffset, @@ -750,26 +654,12 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) intelScreen->drmMinor = psp->drm_version.minor; - /* Determine chipset ID? */ + /* Determine chipset ID */ if (!intel_get_param(psp, I915_PARAM_CHIPSET_ID, &intelScreen->deviceID)) return GL_FALSE; - /* Determine if IRQs are active? */ - if (!intel_get_param(psp, I915_PARAM_IRQ_ACTIVE, - &intelScreen->irq_active)) - return GL_FALSE; - - /* Determine if batchbuffers are allowed */ - if (!intel_get_param(psp, I915_PARAM_ALLOW_BATCHBUFFER, - &intelScreen->allow_batchbuffer)) - return GL_FALSE; - - if (!intelScreen->allow_batchbuffer) { - fprintf(stderr, "batch buffer not allowed\n"); - return GL_FALSE; - } - + intelScreen->irq_active = 1; psp->extensions = intelScreenExtensions; return driConcatConfigs(intelFillInModes(psp, 16, 16, 0, 1), @@ -792,6 +682,4 @@ const struct __DriverAPIRec driDriverAPI = { .CopySubBuffer = intelCopySubBuffer, .InitScreen2 = intelInitScreen2, - .HandleDrawableConfig = intelHandleDrawableConfig, - .HandleBufferAttach = intelHandleBufferAttach, }; diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index c11687a2cf..187fcc7dcb 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -731,7 +731,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) if (!intelObj) return; - __driParseEvents(pDRICtx, dPriv); + intel_update_renderbuffers(pDRICtx, dPriv); rb = intel_fb->color_rb[0]; type = GL_BGRA; -- cgit v1.2.3 From 55270310c5040a0821fef3cfb3b620dc6c0320a9 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 1 Sep 2008 11:43:29 +0200 Subject: Fix build by removing #include of removed dri_sarea.h. Thanks to JohnFlux on IRC for pointing out the problem. --- src/mesa/drivers/dri/common/dri_util.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 65931d3feb..6104ac29f7 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -56,7 +56,6 @@ #include "glheader.h" #include "GL/internal/glcore.h" #include "GL/internal/dri_interface.h" -#include "GL/internal/dri_sarea.h" #define GLX_BAD_CONTEXT 5 -- cgit v1.2.3 From 3bb2a24921af0ec419afc928ee5b279982aa01ea Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Wed, 3 Sep 2008 14:47:36 +0800 Subject: intel: Fix a crash if dri2 is disabled. --- src/mesa/drivers/dri/intel/intel_context.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index f0ee96f18d..2975e4c0f0 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -921,14 +921,14 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, struct intel_framebuffer *intel_fb = (struct intel_framebuffer *) driDrawPriv->driverPrivate; GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate; - - intel_update_renderbuffers(driContextPriv, driDrawPriv); - if (driDrawPriv != driReadPriv) - intel_update_renderbuffers(driContextPriv, driReadPriv); - - /* XXX FBO temporary fix-ups! */ - /* if the renderbuffers don't have regions, init them from the context */ - if (!driContextPriv->driScreenPriv->dri2.enabled) { + + if (driContextPriv->driScreenPriv->dri2.enabled) { + intel_update_renderbuffers(driContextPriv, driDrawPriv); + if (driDrawPriv != driReadPriv) + intel_update_renderbuffers(driContextPriv, driReadPriv); + } else { + /* XXX FBO temporary fix-ups! */ + /* if the renderbuffers don't have regions, init them from the context */ struct intel_renderbuffer *irbDepth = intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH); struct intel_renderbuffer *irbStencil -- cgit v1.2.3 From e32721c46a713f55a8fd70e61f9cb066eeb69211 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 3 Sep 2008 12:36:43 +0100 Subject: intel: Fix refcounting on depth buffer initialization in DRI2. (Reverts a change to work around the problem on 965). --- src/mesa/drivers/dri/i965/brw_vtbl.c | 18 +++--------------- src/mesa/drivers/dri/intel/intel_context.c | 2 +- 2 files changed, 4 insertions(+), 16 deletions(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index ece01a8c9a..31e96a250a 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -75,27 +75,15 @@ static void brw_set_draw_region( struct intel_context *intel, GLuint num_regions) { struct brw_context *brw = brw_context(&intel->ctx); - struct intel_region *old_depth_region, *old_draw_regions[MAX_DRAW_BUFFERS]; int i; - if (brw->state.depth_region != depth_region) brw->state.dirty.brw |= BRW_NEW_DEPTH_BUFFER; - - for (i = 0; i < brw->state.nr_draw_regions; i++) { - old_draw_regions[i] = brw->state.draw_regions[i]; - brw->state.draw_regions[i] = NULL; - } - old_depth_region = brw->state.depth_region; - brw->state.depth_region = NULL; - + for (i = 0; i < brw->state.nr_draw_regions; i++) + intel_region_release(&brw->state.draw_regions[i]); + intel_region_release(&brw->state.depth_region); for (i = 0; i < num_regions; i++) intel_region_reference(&brw->state.draw_regions[i], draw_regions[i]); intel_region_reference(&brw->state.depth_region, depth_region); - - for (i = 0; i < brw->state.nr_draw_regions; i++) - intel_region_release(&old_draw_regions[i]); - intel_region_release(&old_depth_region); - brw->state.nr_draw_regions = num_regions; } diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 2975e4c0f0..c2ad5a0423 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -292,7 +292,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) if (buffers[i].attachment == __DRI_BUFFER_STENCIL && depth_region) { if (INTEL_DEBUG & DEBUG_DRI) fprintf(stderr, "(reusing depth buffer as stencil)\n"); - region = depth_region; + intel_region_reference(®ion, depth_region); } else region = intel_region_alloc_for_handle(intel, buffers[i].cpp, -- cgit v1.2.3 From a04aeea5c016530d7371e032438a0a8fa2c0d7f6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 3 Sep 2008 16:13:18 +0100 Subject: intel: Fix prototype warning. --- src/mesa/drivers/dri/intel/intel_context.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 7381eec191..04a20278d1 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -493,6 +493,8 @@ extern int intel_translate_stencil_op(GLenum op); extern int intel_translate_blend_factor(GLenum factor); extern int intel_translate_logic_op(GLenum opcode); +void intel_update_renderbuffers(__DRIcontext *context, + __DRIdrawable *drawable); /*====================================================================== * Inline conversion functions. -- cgit v1.2.3 From 0adfd1021035e90995a25ec5f20b736e55075d92 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Thu, 4 Sep 2008 11:35:15 +0800 Subject: intel: Fix depth_stencil texture. --- src/mesa/drivers/dri/i915/i915_texstate.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 2 +- src/mesa/drivers/dri/intel/intel_tex_format.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 69c1e0755e..1b1122cd8a 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -78,7 +78,7 @@ translate_texture_format(GLuint mesa_format, GLenum DepthMode) return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); case MESA_FORMAT_RGBA_DXT5: return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_Z24: return (MAPSURF_32BIT | MT_32BIT_xI824); default: fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__, mesa_format); diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index af1401b34b..493d2b182c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -138,7 +138,7 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum depth_mode ) case MESA_FORMAT_SRGB_DXT1: return BRW_SURFACEFORMAT_BC1_UNORM_SRGB; - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_Z24: return BRW_SURFACEFORMAT_I24X8_UNORM; default: diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index 349a29bd71..8ae80e1601 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -138,7 +138,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - return &_mesa_texformat_z24_s8; + return &_mesa_texformat_s8_z24; #ifndef I915 case GL_SRGB_EXT: -- cgit v1.2.3 From 06537296f18750a9442e3007fe7d8b2b966dd2cc Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 5 Sep 2008 13:48:51 +1000 Subject: intel: only enable occlusion query if the drm has defines. This interface has to be re-written to not be dumb and to work for multiple apps. --- src/mesa/drivers/dri/intel/intel_context.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index c2ad5a0423..18e73484ae 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -409,10 +409,12 @@ static const struct dri_extension brw_extensions[] = { { NULL, NULL } }; +#ifdef I915_MMIO_READ static const struct dri_extension arb_oc_extensions[] = { {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, {NULL, NULL} }; +#endif static const struct dri_extension ttm_extensions[] = { {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions}, @@ -437,10 +439,12 @@ void intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging) if (intel == NULL || intel->ttm) driInitExtensions(ctx, ttm_extensions, GL_FALSE); +#ifdef I915_MMIO_READ if (intel == NULL || (IS_965(intel->intelScreen->deviceID) && intel->intelScreen->drmMinor >= 8)) driInitExtensions(ctx, arb_oc_extensions, GL_FALSE); +#endif if (intel == NULL || IS_965(intel->intelScreen->deviceID)) driInitExtensions(ctx, brw_extensions, GL_FALSE); @@ -538,6 +542,7 @@ intelFinish(GLcontext * ctx) } } +#ifdef I915_MMIO_READ static void intelBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q) { @@ -568,6 +573,7 @@ intelEndQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q) q->Ready = GL_TRUE; intel->stats_wm--; } +#endif /** Driver-specific fence emit implementation for the fake memory manager. */ static unsigned int @@ -684,8 +690,10 @@ intelInitDriverFunctions(struct dd_function_table *functions) functions->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; functions->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; +#ifdef I915_MMIO_READ functions->BeginQuery = intelBeginQuery; functions->EndQuery = intelEndQuery; +#endif intelInitTextureFuncs(functions); intelInitStateFuncs(functions); -- cgit v1.2.3 From 7e0bbdcf033981282978554c2e68ce48b55aa291 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Sep 2008 22:16:31 +0100 Subject: intel: Move the bufmgr back to the screen. Mesa requires that we be able to share objects between contexts, which means that the objects need to be created by the same bufmgr, and the bufmgr internally requires pthread protection for thread safety. Rely on the bufmgr having appropriate locking. --- src/mesa/drivers/dri/intel/intel_batchbuffer.c | 4 +- src/mesa/drivers/dri/intel/intel_context.c | 115 +++---------------------- src/mesa/drivers/dri/intel/intel_ioctl.c | 21 +++-- src/mesa/drivers/dri/intel/intel_ioctl.h | 4 +- src/mesa/drivers/dri/intel/intel_screen.c | 98 +++++++++++++++++++++ src/mesa/drivers/dri/intel/intel_screen.h | 4 + 6 files changed, 132 insertions(+), 114 deletions(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 5afaad070c..550f467f83 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -265,9 +265,9 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, fprintf(stderr, "waiting for idle\n"); LOCK_HARDWARE(intel); - irq = intelEmitIrqLocked(intel); + irq = intelEmitIrqLocked(intel->intelScreen); UNLOCK_HARDWARE(intel); - intelWaitIrq(intel, irq); + intelWaitIrq(intel->intelScreen, irq); } /* Reset the buffer: diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 18e73484ae..15ab9cbf35 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -575,105 +575,6 @@ intelEndQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q) } #endif -/** Driver-specific fence emit implementation for the fake memory manager. */ -static unsigned int -intel_fence_emit(void *private) -{ - struct intel_context *intel = (struct intel_context *)private; - unsigned int fence; - - /* XXX: Need to emit a flush, if we haven't already (at least with the - * current batchbuffer implementation, we have). - */ - - fence = intelEmitIrqLocked(intel); - - return fence; -} - -/** Driver-specific fence wait implementation for the fake memory manager. */ -static int -intel_fence_wait(void *private, unsigned int cookie) -{ - struct intel_context *intel = (struct intel_context *)private; - - intelWaitIrq(intel, cookie); - - return 0; -} - -static GLboolean -intel_init_bufmgr(struct intel_context *intel) -{ - intelScreenPrivate *intelScreen = intel->intelScreen; - GLboolean gem_disable = getenv("INTEL_NO_GEM") != NULL; - int gem_kernel = 0; - GLboolean gem_supported; - struct drm_i915_getparam gp; - - gp.param = I915_PARAM_HAS_GEM; - gp.value = &gem_kernel; - - (void) drmCommandWriteRead(intel->driFd, DRM_I915_GETPARAM, &gp, sizeof(gp)); - - /* If we've got a new enough DDX that's initializing GEM and giving us - * object handles for the shared buffers, use that. - */ - intel->ttm = GL_FALSE; - if (intel->intelScreen->driScrnPriv->dri2.enabled) - gem_supported = GL_TRUE; - else if (intel->intelScreen->driScrnPriv->ddx_version.minor >= 9 && - gem_kernel && - intel->intelScreen->front.bo_handle != -1) - gem_supported = GL_TRUE; - else - gem_supported = GL_FALSE; - - if (!gem_disable && gem_supported) { - int bo_reuse_mode; - intel->bufmgr = intel_bufmgr_gem_init(intel->driFd, - BATCH_SZ); - if (intel->bufmgr != NULL) - intel->ttm = GL_TRUE; - - bo_reuse_mode = driQueryOptioni(&intel->optionCache, "bo_reuse"); - switch (bo_reuse_mode) { - case DRI_CONF_BO_REUSE_DISABLED: - break; - case DRI_CONF_BO_REUSE_ALL: - intel_bufmgr_gem_enable_reuse(intel->bufmgr); - break; - } - } - /* Otherwise, use the classic buffer manager. */ - if (intel->bufmgr == NULL) { - if (gem_disable) { - fprintf(stderr, "GEM disabled. Using classic.\n"); - } else { - fprintf(stderr, "Failed to initialize GEM. " - "Falling back to classic.\n"); - } - - if (intelScreen->tex.size == 0) { - fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n", - __func__, __LINE__); - return GL_FALSE; - } - - intel->bufmgr = intel_bufmgr_fake_init(intelScreen->tex.offset, - intelScreen->tex.map, - intelScreen->tex.size, - intel_fence_emit, - intel_fence_wait, - intel); - } - - /* XXX bufmgr should be per-screen, not per-context */ - intelScreen->ttm = intel->ttm; - - return GL_TRUE; -} - void intelInitDriverFunctions(struct dd_function_table *functions) { @@ -745,8 +646,20 @@ intelInitContext(struct intel_context *intel, else intel->maxBatchSize = BATCH_SZ; - if (!intel_init_bufmgr(intel)) - return GL_FALSE; + intel->bufmgr = intelScreen->bufmgr; + intel->ttm = intelScreen->ttm; + if (intel->ttm) { + int bo_reuse_mode; + + bo_reuse_mode = driQueryOptioni(&intel->optionCache, "bo_reuse"); + switch (bo_reuse_mode) { + case DRI_CONF_BO_REUSE_DISABLED: + break; + case DRI_CONF_BO_REUSE_ALL: + intel_bufmgr_gem_enable_reuse(intel->bufmgr); + break; + } + } ctx->Const.MaxTextureMaxAnisotropy = 2.0; diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.c b/src/mesa/drivers/dri/intel/intel_ioctl.c index 58c81766cd..ac9e9337d6 100644 --- a/src/mesa/drivers/dri/intel/intel_ioctl.c +++ b/src/mesa/drivers/dri/intel/intel_ioctl.c @@ -50,22 +50,23 @@ #define FILE_DEBUG_FLAG DEBUG_IOCTL int -intelEmitIrqLocked(struct intel_context *intel) +intelEmitIrqLocked(intelScreenPrivate *intelScreen) { + __DRIscreenPrivate *spriv = intelScreen->driScrnPriv; struct drm_i915_irq_emit ie; int ret, seq = 1; - if (intel->no_hw) + if (intelScreen->no_hw) return 1; /* - assert(((*(int *)intel->driHwLock) & ~DRM_LOCK_CONT) == - (DRM_LOCK_HELD|intel->hHWContext)); + assert(((*(int *)intelScreen->driHwLock) & ~DRM_LOCK_CONT) == + (DRM_LOCK_HELD|intelScreen->hHWContext)); */ ie.irq_seq = &seq; - ret = drmCommandWriteRead(intel->driFd, DRM_I915_IRQ_EMIT, &ie, sizeof(ie)); + ret = drmCommandWriteRead(spriv->fd, DRM_I915_IRQ_EMIT, &ie, sizeof(ie)); if (ret) { fprintf(stderr, "%s: drm_i915_irq_emit: %d\n", __FUNCTION__, ret); exit(1); @@ -77,13 +78,15 @@ intelEmitIrqLocked(struct intel_context *intel) } void -intelWaitIrq(struct intel_context *intel, int seq) +intelWaitIrq(intelScreenPrivate *intelScreen, int seq) { + __DRIscreenPrivate *spriv = intelScreen->driScrnPriv; struct drm_i915_irq_wait iw; int ret, lastdispatch; - volatile struct drm_i915_sarea *sarea = intel->sarea; + volatile struct drm_i915_sarea *sarea = (struct drm_i915_sarea *) + (((GLubyte *) spriv->pSAREA) + intelScreen->sarea_priv_offset); - if (intel->no_hw) + if (intelScreen->no_hw) return; DBG("%s %d\n", __FUNCTION__, seq); @@ -92,7 +95,7 @@ intelWaitIrq(struct intel_context *intel, int seq) do { lastdispatch = sarea->last_dispatch; - ret = drmCommandWrite(intel->driFd, DRM_I915_IRQ_WAIT, &iw, sizeof(iw)); + ret = drmCommandWrite(spriv->fd, DRM_I915_IRQ_WAIT, &iw, sizeof(iw)); } while (ret == -EAGAIN || ret == -EINTR || (ret == -EBUSY && lastdispatch != sarea->last_dispatch) || diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.h b/src/mesa/drivers/dri/intel/intel_ioctl.h index 526e38358c..2ea40001db 100644 --- a/src/mesa/drivers/dri/intel/intel_ioctl.h +++ b/src/mesa/drivers/dri/intel/intel_ioctl.h @@ -30,8 +30,8 @@ #include "intel_context.h" -void intelWaitIrq( struct intel_context *intel, int seq ); -int intelEmitIrqLocked( struct intel_context *intel ); +void intelWaitIrq(intelScreenPrivate *intelScreen, int seq); +int intelEmitIrqLocked(intelScreenPrivate *intelScreen); int intel_batch_ioctl(struct intel_context *intel, GLuint start_offset, diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index c193830f05..5cfb893305 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -552,6 +552,96 @@ intelFillInModes(__DRIscreenPrivate *psp, } +/** Driver-specific fence emit implementation for the fake memory manager. */ +static unsigned int +intel_fence_emit(void *private) +{ + intelScreenPrivate *intelScreen = (intelScreenPrivate *)private; + unsigned int fence; + + /* XXX: Need to emit a flush, if we haven't already (at least with the + * current batchbuffer implementation, we have). + */ + + fence = intelEmitIrqLocked(intelScreen); + + return fence; +} + +/** Driver-specific fence wait implementation for the fake memory manager. */ +static int +intel_fence_wait(void *private, unsigned int cookie) +{ + intelScreenPrivate *intelScreen = (intelScreenPrivate *)private; + + intelWaitIrq(intelScreen, cookie); + + return 0; +} + +static GLboolean +intel_init_bufmgr(intelScreenPrivate *intelScreen) +{ + GLboolean gem_disable = getenv("INTEL_NO_GEM") != NULL; + int gem_kernel = 0; + GLboolean gem_supported; + struct drm_i915_getparam gp; + __DRIscreenPrivate *spriv = intelScreen->driScrnPriv; + + intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL; + + gp.param = I915_PARAM_HAS_GEM; + gp.value = &gem_kernel; + + (void) drmCommandWriteRead(spriv->fd, DRM_I915_GETPARAM, &gp, sizeof(gp)); + + /* If we've got a new enough DDX that's initializing GEM and giving us + * object handles for the shared buffers, use that. + */ + intelScreen->ttm = GL_FALSE; + if (intelScreen->driScrnPriv->dri2.enabled) + gem_supported = GL_TRUE; + else if (intelScreen->driScrnPriv->ddx_version.minor >= 9 && + gem_kernel && + intelScreen->front.bo_handle != -1) + gem_supported = GL_TRUE; + else + gem_supported = GL_FALSE; + + if (!gem_disable && gem_supported) { + intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ); + if (intelScreen->bufmgr != NULL) + intelScreen->ttm = GL_TRUE; + } + /* Otherwise, use the classic buffer manager. */ + if (intelScreen->bufmgr == NULL) { + if (gem_disable) { + fprintf(stderr, "GEM disabled. Using classic.\n"); + } else { + fprintf(stderr, "Failed to initialize GEM. " + "Falling back to classic.\n"); + } + + if (intelScreen->tex.size == 0) { + fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n", + __func__, __LINE__); + return GL_FALSE; + } + + intelScreen->bufmgr = intel_bufmgr_fake_init(intelScreen->tex.offset, + intelScreen->tex.map, + intelScreen->tex.size, + intel_fence_emit, + intel_fence_wait, + intelScreen); + } + + /* XXX bufmgr should be per-screen, not per-context */ + intelScreen->ttm = intelScreen->ttm; + + return GL_TRUE; +} + /** * This is the driver specific part of the createNewScreen entry point. * Called when using legacy DRI. @@ -562,6 +652,7 @@ intelFillInModes(__DRIscreenPrivate *psp, */ static const __DRIconfig **intelInitScreen(__DRIscreenPrivate *psp) { + intelScreenPrivate *intelScreen; #ifdef I915 static const __DRIversion ddx_expected = { 1, 5, 0 }; #else @@ -595,6 +686,10 @@ static const __DRIconfig **intelInitScreen(__DRIscreenPrivate *psp) psp->extensions = intelScreenExtensions; + intelScreen = psp->private; + if (!intel_init_bufmgr(intelScreen)) + return GL_FALSE; + return (const __DRIconfig **) intelFillInModes(psp, dri_priv->cpp * 8, (dri_priv->cpp == 2) ? 16 : 24, @@ -659,6 +754,9 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) &intelScreen->deviceID)) return GL_FALSE; + if (!intel_init_bufmgr(intelScreen)) + return GL_FALSE; + intelScreen->irq_active = 1; psp->extensions = intelScreenExtensions; diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h index 9a73b13951..299da87210 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.h +++ b/src/mesa/drivers/dri/intel/intel_screen.h @@ -30,6 +30,7 @@ #include #include "dri_util.h" +#include "dri_bufmgr.h" #include "i915_drm.h" #include "xmlconfig.h" @@ -74,7 +75,10 @@ typedef struct int irq_active; int allow_batchbuffer; + GLboolean no_hw; + int ttm; + dri_bufmgr *bufmgr; /** * Configuration cache with default values for all contexts -- cgit v1.2.3 From 3628185f566e178a12b493fb89abf52b4b281f99 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 6 Sep 2008 03:09:43 +0100 Subject: intel: track bufmgr move to libdrm_intel and bufmgr_fake irq emit/wait change. --- src/mesa/drivers/dri/i915/Makefile | 2 + src/mesa/drivers/dri/i915/i830_texstate.c | 1 - src/mesa/drivers/dri/i915/i915_texstate.c | 1 - src/mesa/drivers/dri/i965/Makefile | 2 + src/mesa/drivers/dri/i965/brw_cc.c | 12 ++--- src/mesa/drivers/dri/i965/brw_clip_state.c | 12 ++--- src/mesa/drivers/dri/i965/brw_draw.h | 1 - src/mesa/drivers/dri/i965/brw_gs_state.c | 10 ++-- src/mesa/drivers/dri/i965/brw_sf_state.c | 20 ++++---- src/mesa/drivers/dri/i965/brw_state_upload.c | 1 - src/mesa/drivers/dri/i965/brw_vs_state.c | 10 ++-- src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 12 ++--- src/mesa/drivers/dri/i965/brw_wm_state.c | 31 ++++++------ src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 34 ++++++------- src/mesa/drivers/dri/intel/intel_batchbuffer.c | 12 ++--- src/mesa/drivers/dri/intel/intel_batchbuffer.h | 2 +- src/mesa/drivers/dri/intel/intel_blit.h | 1 - src/mesa/drivers/dri/intel/intel_buffer_objects.c | 1 - src/mesa/drivers/dri/intel/intel_context.c | 6 +-- src/mesa/drivers/dri/intel/intel_context.h | 1 - src/mesa/drivers/dri/intel/intel_ioctl.c | 60 ----------------------- src/mesa/drivers/dri/intel/intel_ioctl.h | 3 -- src/mesa/drivers/dri/intel/intel_regions.c | 1 - src/mesa/drivers/dri/intel/intel_regions.h | 4 +- src/mesa/drivers/dri/intel/intel_screen.c | 47 ++++-------------- src/mesa/drivers/dri/intel/intel_screen.h | 5 +- 26 files changed, 96 insertions(+), 196 deletions(-) (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index fd77980ebf..8f09c9f71e 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -64,6 +64,8 @@ DRIVER_DEFINES = -I../intel -I../intel/server -DI915 \ $(shell pkg-config libdrm --atleast-version=2.3.1 \ && echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP") +DRI_LIB_DEPS += -ldrm_intel + include ../Makefile.template intel_decode.o: ../intel/intel_decode.c diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 4e9b022eae..314bbe32b6 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -28,7 +28,6 @@ #include "mtypes.h" #include "enums.h" #include "texformat.h" -#include "dri_bufmgr.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 1b1122cd8a..48137f025f 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -28,7 +28,6 @@ #include "mtypes.h" #include "enums.h" #include "texformat.h" -#include "dri_bufmgr.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 8fa205e79f..e72790c687 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -91,6 +91,8 @@ ASM_SOURCES = DRIVER_DEFINES = -I../intel -I../intel/server +DRI_LIB_DEPS += -ldrm_intel + include ../Makefile.template symlinks: diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index d662cf7521..0458bf5983 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -255,12 +255,12 @@ cc_unit_create_from_key(struct brw_context *brw, struct brw_cc_unit_key *key) NULL, NULL); /* Emit CC viewport relocation */ - intel_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, - 0, - 0, - offsetof(struct brw_cc_unit_state, cc4), - brw->cc.vp_bo); + dri_bo_emit_reloc(bo, + I915_GEM_DOMAIN_INSTRUCTION, + 0, + 0, + offsetof(struct brw_cc_unit_state, cc4), + brw->cc.vp_bo); return bo; } diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c index ae904c6253..51045f9188 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_state.c +++ b/src/mesa/drivers/dri/i965/brw_clip_state.c @@ -119,12 +119,12 @@ clip_unit_create_from_key(struct brw_context *brw, /* Emit clip program relocation */ assert(brw->clip.prog_bo); - intel_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, - 0, - clip.thread0.grf_reg_count << 1, - offsetof(struct brw_clip_unit_state, thread0), - brw->clip.prog_bo); + dri_bo_emit_reloc(bo, + I915_GEM_DOMAIN_INSTRUCTION, + 0, + clip.thread0.grf_reg_count << 1, + offsetof(struct brw_clip_unit_state, thread0), + brw->clip.prog_bo); return bo; } diff --git a/src/mesa/drivers/dri/i965/brw_draw.h b/src/mesa/drivers/dri/i965/brw_draw.h index 2a3e0c1c5b..e0bba589d5 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.h +++ b/src/mesa/drivers/dri/i965/brw_draw.h @@ -31,7 +31,6 @@ #include "mtypes.h" /* for GLcontext... */ #include "vbo/vbo.h" -#include "dri_bufmgr.h" struct brw_context; diff --git a/src/mesa/drivers/dri/i965/brw_gs_state.c b/src/mesa/drivers/dri/i965/brw_gs_state.c index ff2e3ab059..633e17cc9d 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_state.c +++ b/src/mesa/drivers/dri/i965/brw_gs_state.c @@ -106,11 +106,11 @@ gs_unit_create_from_key(struct brw_context *brw, struct brw_gs_unit_key *key) if (key->prog_active) { /* Emit GS program relocation */ - intel_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - gs.thread0.grf_reg_count << 1, - offsetof(struct brw_gs_unit_state, thread0), - brw->gs.prog_bo); + dri_bo_emit_reloc(bo, + I915_GEM_DOMAIN_INSTRUCTION, 0, + gs.thread0.grf_reg_count << 1, + offsetof(struct brw_gs_unit_state, thread0), + brw->gs.prog_bo); } return bo; diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index 2478872b82..07d0b4c798 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -251,18 +251,18 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key, NULL, NULL); /* Emit SF program relocation */ - intel_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - sf.thread0.grf_reg_count << 1, - offsetof(struct brw_sf_unit_state, thread0), - brw->sf.prog_bo); + dri_bo_emit_reloc(bo, + I915_GEM_DOMAIN_INSTRUCTION, 0, + sf.thread0.grf_reg_count << 1, + offsetof(struct brw_sf_unit_state, thread0), + brw->sf.prog_bo); /* Emit SF viewport relocation */ - intel_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - sf.sf5.front_winding | (sf.sf5.viewport_transform << 1), - offsetof(struct brw_sf_unit_state, sf5), - brw->sf.vp_bo); + dri_bo_emit_reloc(bo, + I915_GEM_DOMAIN_INSTRUCTION, 0, + sf.sf5.front_winding | (sf.sf5.viewport_transform << 1), + offsetof(struct brw_sf_unit_state, sf5), + brw->sf.vp_bo); return bo; } diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index d1d319d92e..7d4fd467b1 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -33,7 +33,6 @@ #include "brw_context.h" #include "brw_state.h" -#include "dri_bufmgr.h" #include "intel_batchbuffer.h" /* This is used to initialize brw->state.atoms[]. We could use this diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c index 909b942610..24bf5567bd 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_state.c @@ -115,11 +115,11 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key) NULL, NULL); /* Emit VS program relocation */ - intel_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - vs.thread0.grf_reg_count << 1, - offsetof(struct brw_vs_unit_state, thread0), - brw->vs.prog_bo); + dri_bo_emit_reloc(bo, + I915_GEM_DOMAIN_INSTRUCTION, 0, + vs.thread0.grf_reg_count << 1, + offsetof(struct brw_vs_unit_state, thread0), + brw->vs.prog_bo); return bo; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index 08d01823de..e47dbe8b10 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -303,12 +303,12 @@ static void upload_wm_samplers( struct brw_context *brw ) if (!brw->attribs.Texture->Unit[i]._ReallyEnabled) continue; - intel_bo_emit_reloc(brw->wm.sampler_bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - 0, - i * sizeof(struct brw_sampler_state) + - offsetof(struct brw_sampler_state, ss2), - brw->wm.sdc_bo[i]); + dri_bo_emit_reloc(brw->wm.sampler_bo, + I915_GEM_DOMAIN_INSTRUCTION, 0, + 0, + i * sizeof(struct brw_sampler_state) + + offsetof(struct brw_sampler_state, ss2), + brw->wm.sdc_bo[i]); } } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index f97d0dc285..61fe97a463 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -34,7 +34,6 @@ #include "brw_context.h" #include "brw_state.h" #include "brw_defines.h" -#include "dri_bufmgr.h" #include "brw_wm.h" /*********************************************************************** @@ -199,28 +198,28 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key, NULL, NULL); /* Emit WM program relocation */ - intel_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - wm.thread0.grf_reg_count << 1, - offsetof(struct brw_wm_unit_state, thread0), - brw->wm.prog_bo); + dri_bo_emit_reloc(bo, + I915_GEM_DOMAIN_INSTRUCTION, 0, + wm.thread0.grf_reg_count << 1, + offsetof(struct brw_wm_unit_state, thread0), + brw->wm.prog_bo); /* Emit scratch space relocation */ if (key->total_scratch != 0) { - intel_bo_emit_reloc(bo, - 0, 0, - wm.thread2.per_thread_scratch_space, - offsetof(struct brw_wm_unit_state, thread2), - brw->wm.scratch_buffer); + dri_bo_emit_reloc(bo, + 0, 0, + wm.thread2.per_thread_scratch_space, + offsetof(struct brw_wm_unit_state, thread2), + brw->wm.scratch_buffer); } /* Emit sampler state relocation */ if (key->sampler_count != 0) { - intel_bo_emit_reloc(bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - wm.wm4.stats_enable | (wm.wm4.sampler_count << 2), - offsetof(struct brw_wm_unit_state, wm4), - brw->wm.sampler_bo); + dri_bo_emit_reloc(bo, + I915_GEM_DOMAIN_INSTRUCTION, 0, + wm.wm4.stats_enable | (wm.wm4.sampler_count << 2), + offsetof(struct brw_wm_unit_state, wm4), + brw->wm.sampler_bo); } return bo; diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 493d2b182c..8fcd50924f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -234,11 +234,11 @@ brw_create_texture_surface( struct brw_context *brw, if (key->bo) { /* Emit relocation to surface contents */ - intel_bo_emit_reloc(bo, - I915_GEM_DOMAIN_SAMPLER, 0, - 0, - offsetof(struct brw_surface_state, ss1), - key->bo); + dri_bo_emit_reloc(bo, + I915_GEM_DOMAIN_SAMPLER, 0, + 0, + offsetof(struct brw_surface_state, ss1), + key->bo); } return bo; } @@ -374,13 +374,13 @@ brw_update_region_surface(struct brw_context *brw, struct intel_region *region, * them both. We might be able to figure out from other state * a more restrictive relocation to emit. */ - intel_bo_emit_reloc(brw->wm.surf_bo[unit], - I915_GEM_DOMAIN_RENDER | - I915_GEM_DOMAIN_SAMPLER, - I915_GEM_DOMAIN_RENDER, - 0, - offsetof(struct brw_surface_state, ss1), - region_bo); + dri_bo_emit_reloc(brw->wm.surf_bo[unit], + I915_GEM_DOMAIN_RENDER | + I915_GEM_DOMAIN_SAMPLER, + I915_GEM_DOMAIN_RENDER, + 0, + offsetof(struct brw_surface_state, ss1), + region_bo); } } } @@ -420,11 +420,11 @@ brw_wm_get_binding_table(struct brw_context *brw) /* Emit binding table relocations to surface state */ for (i = 0; i < BRW_WM_MAX_SURF; i++) { if (brw->wm.surf_bo[i] != NULL) { - intel_bo_emit_reloc(bind_bo, - I915_GEM_DOMAIN_INSTRUCTION, 0, - 0, - i * sizeof(GLuint), - brw->wm.surf_bo[i]); + dri_bo_emit_reloc(bind_bo, + I915_GEM_DOMAIN_INSTRUCTION, 0, + 0, + i * sizeof(GLuint), + brw->wm.surf_bo[i]); } } diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 550f467f83..9671232343 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -261,13 +261,9 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, UNLOCK_HARDWARE(intel); if (INTEL_DEBUG & DEBUG_SYNC) { - int irq; - fprintf(stderr, "waiting for idle\n"); - LOCK_HARDWARE(intel); - irq = intelEmitIrqLocked(intel->intelScreen); - UNLOCK_HARDWARE(intel); - intelWaitIrq(intel->intelScreen, irq); + dri_bo_map(batch->buf, GL_TRUE); + dri_bo_unmap(batch->buf); } /* Reset the buffer: @@ -289,8 +285,8 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, if (batch->ptr - batch->map > batch->buf->size) _mesa_printf ("bad relocation ptr %p map %p offset %d size %d\n", batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size); - ret = intel_bo_emit_reloc(batch->buf, read_domains, write_domain, - delta, batch->ptr - batch->map, buffer); + ret = dri_bo_emit_reloc(batch->buf, read_domains, write_domain, + delta, batch->ptr - batch->map, buffer); /* * Using the old buffer offset, write in what the right data would be, in case diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index 52d6ecc223..7ede1b8903 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h @@ -3,7 +3,7 @@ #include "mtypes.h" -#include "dri_bufmgr.h" +#include "intel_bufmgr.h" #include "intel_reg.h" struct intel_context; diff --git a/src/mesa/drivers/dri/intel/intel_blit.h b/src/mesa/drivers/dri/intel/intel_blit.h index 0881cc4fdc..60e30f21e8 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.h +++ b/src/mesa/drivers/dri/intel/intel_blit.h @@ -30,7 +30,6 @@ #include "intel_context.h" #include "intel_ioctl.h" -#include "dri_bufmgr.h" extern void intelCopyBuffer(const __DRIdrawablePrivate * dpriv, const drm_clip_rect_t * rect); diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 1923a21516..88484a07af 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -34,7 +34,6 @@ #include "intel_buffer_objects.h" #include "intel_batchbuffer.h" #include "intel_regions.h" -#include "dri_bufmgr.h" static GLboolean intel_bufferobj_unmap(GLcontext * ctx, GLenum target, diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 15ab9cbf35..591b521664 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -278,7 +278,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) } if (rb->region) { - intel_bo_flink(rb->region->buffer, &name); + dri_bo_flink(rb->region->buffer, &name); if (name == buffers[i].name) continue; } @@ -614,8 +614,6 @@ intelInitContext(struct intel_context *intel, GLcontext *shareCtx = (GLcontext *) sharedContextPrivate; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private; - volatile struct drm_i915_sarea *saPriv = (struct drm_i915_sarea *) - (((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset); int fthrottle_mode; if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx, @@ -627,7 +625,7 @@ intelInitContext(struct intel_context *intel, driContextPriv->driverPrivate = intel; intel->intelScreen = intelScreen; intel->driScreen = sPriv; - intel->sarea = saPriv; + intel->sarea = intelScreen->sarea; intel->driContext = driContextPriv; /* Dri stuff */ diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 04a20278d1..8bd75753ea 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -34,7 +34,6 @@ #include "drm.h" #include "mm.h" #include "texmem.h" -#include "dri_bufmgr.h" #include "intel_bufmgr.h" #include "intel_screen.h" diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.c b/src/mesa/drivers/dri/intel/intel_ioctl.c index ac9e9337d6..c58a803505 100644 --- a/src/mesa/drivers/dri/intel/intel_ioctl.c +++ b/src/mesa/drivers/dri/intel/intel_ioctl.c @@ -49,66 +49,6 @@ #define FILE_DEBUG_FLAG DEBUG_IOCTL -int -intelEmitIrqLocked(intelScreenPrivate *intelScreen) -{ - __DRIscreenPrivate *spriv = intelScreen->driScrnPriv; - struct drm_i915_irq_emit ie; - int ret, seq = 1; - - if (intelScreen->no_hw) - return 1; - - /* - assert(((*(int *)intelScreen->driHwLock) & ~DRM_LOCK_CONT) == - (DRM_LOCK_HELD|intelScreen->hHWContext)); - */ - - ie.irq_seq = &seq; - - ret = drmCommandWriteRead(spriv->fd, DRM_I915_IRQ_EMIT, &ie, sizeof(ie)); - if (ret) { - fprintf(stderr, "%s: drm_i915_irq_emit: %d\n", __FUNCTION__, ret); - exit(1); - } - - DBG("%s --> %d\n", __FUNCTION__, seq); - - return seq; -} - -void -intelWaitIrq(intelScreenPrivate *intelScreen, int seq) -{ - __DRIscreenPrivate *spriv = intelScreen->driScrnPriv; - struct drm_i915_irq_wait iw; - int ret, lastdispatch; - volatile struct drm_i915_sarea *sarea = (struct drm_i915_sarea *) - (((GLubyte *) spriv->pSAREA) + intelScreen->sarea_priv_offset); - - if (intelScreen->no_hw) - return; - - DBG("%s %d\n", __FUNCTION__, seq); - - iw.irq_seq = seq; - - do { - lastdispatch = sarea->last_dispatch; - ret = drmCommandWrite(spriv->fd, DRM_I915_IRQ_WAIT, &iw, sizeof(iw)); - } while (ret == -EAGAIN || - ret == -EINTR || - (ret == -EBUSY && lastdispatch != sarea->last_dispatch) || - (ret == 0 && seq > sarea->last_dispatch) || - (ret == 0 && sarea->last_dispatch - seq >= (1 << 24))); - - if (ret) { - fprintf(stderr, "%s: drm_i915_irq_wait: %d\n", __FUNCTION__, ret); - exit(1); - } -} - - int intel_batch_ioctl(struct intel_context *intel, GLuint start_offset, diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.h b/src/mesa/drivers/dri/intel/intel_ioctl.h index 2ea40001db..6736856dbd 100644 --- a/src/mesa/drivers/dri/intel/intel_ioctl.h +++ b/src/mesa/drivers/dri/intel/intel_ioctl.h @@ -30,9 +30,6 @@ #include "intel_context.h" -void intelWaitIrq(intelScreenPrivate *intelScreen, int seq); -int intelEmitIrqLocked(intelScreenPrivate *intelScreen); - int intel_batch_ioctl(struct intel_context *intel, GLuint start_offset, GLuint used, diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index c86c1034a9..1cfc8ddd64 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -46,7 +46,6 @@ #include "intel_regions.h" #include "intel_blit.h" #include "intel_buffer_objects.h" -#include "dri_bufmgr.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_chipset.h" diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index 1285f250a7..a561de485e 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -34,8 +34,10 @@ * the basic structure for rectangular collections of pixels stored in a dri_bo. */ +#include + #include "mtypes.h" -#include "dri_bufmgr.h" +#include "intel_bufmgr.h" struct intel_context; struct intel_buffer_object; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 5cfb893305..2355eafeca 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -274,9 +274,9 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) intelScreen->driScrnPriv = sPriv; sPriv->private = (void *) intelScreen; - intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset; sarea = (struct drm_i915_sarea *) - (((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset); + (((GLubyte *) sPriv->pSAREA) + gDRIPriv->sarea_priv_offset); + intelScreen->sarea = sarea; intelScreen->deviceID = gDRIPriv->deviceID; @@ -289,8 +289,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) return GL_FALSE; } - intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset; - if (0) intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv); @@ -551,34 +549,6 @@ intelFillInModes(__DRIscreenPrivate *psp, return configs; } - -/** Driver-specific fence emit implementation for the fake memory manager. */ -static unsigned int -intel_fence_emit(void *private) -{ - intelScreenPrivate *intelScreen = (intelScreenPrivate *)private; - unsigned int fence; - - /* XXX: Need to emit a flush, if we haven't already (at least with the - * current batchbuffer implementation, we have). - */ - - fence = intelEmitIrqLocked(intelScreen); - - return fence; -} - -/** Driver-specific fence wait implementation for the fake memory manager. */ -static int -intel_fence_wait(void *private, unsigned int cookie) -{ - intelScreenPrivate *intelScreen = (intelScreenPrivate *)private; - - intelWaitIrq(intelScreen, cookie); - - return 0; -} - static GLboolean intel_init_bufmgr(intelScreenPrivate *intelScreen) { @@ -628,12 +598,13 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen) return GL_FALSE; } - intelScreen->bufmgr = intel_bufmgr_fake_init(intelScreen->tex.offset, - intelScreen->tex.map, - intelScreen->tex.size, - intel_fence_emit, - intel_fence_wait, - intelScreen); + intelScreen->bufmgr = + intel_bufmgr_fake_init(spriv->fd, + intelScreen->tex.offset, + intelScreen->tex.map, + intelScreen->tex.size, + (unsigned int * volatile) + &intelScreen->sarea->last_dispatch); } /* XXX bufmgr should be per-screen, not per-context */ diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h index 299da87210..daf2ab4c58 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.h +++ b/src/mesa/drivers/dri/intel/intel_screen.h @@ -30,7 +30,7 @@ #include #include "dri_util.h" -#include "dri_bufmgr.h" +#include "intel_bufmgr.h" #include "i915_drm.h" #include "xmlconfig.h" @@ -68,7 +68,8 @@ typedef struct int logTextureGranularity; __DRIscreenPrivate *driScrnPriv; - unsigned int sarea_priv_offset; + + volatile struct drm_i915_sarea *sarea; int drmMinor; -- cgit v1.2.3 From 35fd72756a05463568d94862f4fcd234903e1204 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 8 Sep 2008 08:52:48 -0700 Subject: intel: track move of bo_exec from drivers to bufmgr. --- src/mesa/drivers/dri/i915/Makefile | 1 - src/mesa/drivers/dri/i915/i830_metaops.c | 1 - src/mesa/drivers/dri/i915/i830_tex.c | 2 - src/mesa/drivers/dri/i915/i830_texblend.c | 1 - src/mesa/drivers/dri/i915/i915_metaops.c | 1 - src/mesa/drivers/dri/i915/i915_tex.c | 2 - src/mesa/drivers/dri/i915/intel_ioctl.c | 1 - src/mesa/drivers/dri/i915/intel_pixel_read.c | 1 - src/mesa/drivers/dri/i965/Makefile | 1 - src/mesa/drivers/dri/i965/brw_draw.c | 1 - src/mesa/drivers/dri/i965/brw_draw_upload.c | 1 - src/mesa/drivers/dri/i965/brw_tex.c | 1 - src/mesa/drivers/dri/i965/intel_ioctl.c | 1 - src/mesa/drivers/dri/intel/intel_batchbuffer.c | 29 ++---- src/mesa/drivers/dri/intel/intel_batchbuffer.h | 3 +- src/mesa/drivers/dri/intel/intel_blit.c | 2 +- src/mesa/drivers/dri/intel/intel_blit.h | 1 - src/mesa/drivers/dri/intel/intel_context.c | 1 - src/mesa/drivers/dri/intel/intel_ioctl.c | 128 ------------------------ src/mesa/drivers/dri/intel/intel_ioctl.h | 43 -------- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 1 - src/mesa/drivers/dri/intel/intel_pixel_copy.c | 1 - src/mesa/drivers/dri/intel/intel_pixel_draw.c | 1 - src/mesa/drivers/dri/intel/intel_screen.c | 1 - src/mesa/drivers/dri/intel/intel_span.c | 1 - src/mesa/drivers/dri/intel/intel_tex_image.c | 1 - 26 files changed, 10 insertions(+), 218 deletions(-) delete mode 120000 src/mesa/drivers/dri/i915/intel_ioctl.c delete mode 120000 src/mesa/drivers/dri/i965/intel_ioctl.c delete mode 100644 src/mesa/drivers/dri/intel/intel_ioctl.c delete mode 100644 src/mesa/drivers/dri/intel/intel_ioctl.h (limited to 'src/mesa/drivers/dri') diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index 8f09c9f71e..5858e0ee9f 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -46,7 +46,6 @@ DRIVER_SOURCES = \ i915_vtbl.c \ intel_context.c \ intel_decode.c \ - intel_ioctl.c \ intel_screen.c \ intel_span.c \ intel_state.c \ diff --git a/src/mesa/drivers/dri/i915/i830_metaops.c b/src/mesa/drivers/dri/i915/i830_metaops.c index 13e4ab3aac..acfb3af910 100644 --- a/src/mesa/drivers/dri/i915/i830_metaops.c +++ b/src/mesa/drivers/dri/i915/i830_metaops.c @@ -33,7 +33,6 @@ #include "intel_screen.h" #include "intel_batchbuffer.h" -#include "intel_ioctl.h" #include "intel_regions.h" #include "i830_context.h" diff --git a/src/mesa/drivers/dri/i915/i830_tex.c b/src/mesa/drivers/dri/i915/i830_tex.c index 79b0fcf596..c0126ba19a 100644 --- a/src/mesa/drivers/dri/i915/i830_tex.c +++ b/src/mesa/drivers/dri/i915/i830_tex.c @@ -38,8 +38,6 @@ #include "mm.h" -#include "intel_ioctl.h" - #include "i830_context.h" #include "i830_reg.h" diff --git a/src/mesa/drivers/dri/i915/i830_texblend.c b/src/mesa/drivers/dri/i915/i830_texblend.c index 58f220eb7c..dca72adeca 100644 --- a/src/mesa/drivers/dri/i915/i830_texblend.c +++ b/src/mesa/drivers/dri/i915/i830_texblend.c @@ -36,7 +36,6 @@ #include "mm.h" #include "intel_screen.h" -#include "intel_ioctl.h" #include "intel_tex.h" #include "i830_context.h" diff --git a/src/mesa/drivers/dri/i915/i915_metaops.c b/src/mesa/drivers/dri/i915/i915_metaops.c index 73aa63451e..bfe97f13e5 100644 --- a/src/mesa/drivers/dri/i915/i915_metaops.c +++ b/src/mesa/drivers/dri/i915/i915_metaops.c @@ -33,7 +33,6 @@ #include "intel_screen.h" #include "intel_batchbuffer.h" -#include "intel_ioctl.h" #include "intel_regions.h" #include "i915_context.h" diff --git a/src/mesa/drivers/dri/i915/i915_tex.c b/src/mesa/drivers/dri/i915/i915_tex.c index 386617a1ff..cb55bf6125 100644 --- a/src/mesa/drivers/dri/i915/i915_tex.c +++ b/src/mesa/drivers/dri/i915/i915_tex.c @@ -38,8 +38,6 @@ #include "mm.h" -#include "intel_ioctl.h" - #include "i915_context.h" #include "i915_reg.h" diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.c b/src/mesa/drivers/dri/i915/intel_ioctl.c deleted file mode 120000 index effd0f378d..0000000000 --- a/src/mesa/drivers/dri/i915/intel_ioctl.c +++ /dev/null @@ -1 +0,0 @@ -../intel/intel_ioctl.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/i915/intel_pixel_read.c b/src/mesa/drivers/dri/i915/intel_pixel_read.c index d009590a4b..120c887abd 100644 --- a/src/mesa/drivers/dri/i915/intel_pixel_read.c +++ b/src/mesa/drivers/dri/i915/intel_pixel_read.c @@ -35,7 +35,6 @@ #include "intel_screen.h" #include "intel_context.h" -#include "intel_ioctl.h" #include "intel_batchbuffer.h" #include "intel_blit.h" #include "intel_buffers.h" diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index e72790c687..c2d555cd0c 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -13,7 +13,6 @@ DRIVER_SOURCES = \ intel_decode.c \ intel_depthstencil.c \ intel_fbo.c \ - intel_ioctl.c \ intel_mipmap_tree.c \ intel_regions.c \ intel_screen.c \ diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index d43b52c2c7..95d798238d 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -39,7 +39,6 @@ #include "brw_state.h" #include "brw_fallback.h" -#include "intel_ioctl.h" #include "intel_batchbuffer.h" #include "intel_buffer_objects.h" diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 0122d18f82..465239f195 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -39,7 +39,6 @@ #include "brw_state.h" #include "brw_fallback.h" -#include "intel_ioctl.h" #include "intel_batchbuffer.h" #include "intel_buffer_objects.h" #include "intel_tex.h" diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c index 258c6260fb..ab6393420a 100644 --- a/src/mesa/drivers/dri/i965/brw_tex.c +++ b/src/mesa/drivers/dri/i965/brw_tex.c @@ -42,7 +42,6 @@ #include "texmem.h" #include "intel_context.h" -#include "intel_ioctl.h" #include "intel_regions.h" #include "intel_tex.h" #include "brw_context.h" diff --git a/src/mesa/drivers/dri/i965/intel_ioctl.c b/src/mesa/drivers/dri/i965/intel_ioctl.c deleted file mode 120000 index effd0f378d..0000000000 --- a/src/mesa/drivers/dri/i965/intel_ioctl.c +++ /dev/null @@ -1 +0,0 @@ -../intel/intel_ioctl.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 9671232343..7dbc646370 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -25,8 +25,8 @@ * **************************************************************************/ +#include "intel_context.h" #include "intel_batchbuffer.h" -#include "intel_ioctl.h" #include "intel_decode.h" #include "intel_reg.h" #include "intel_bufmgr.h" @@ -148,28 +148,15 @@ do_flush_locked(struct intel_batchbuffer *batch, */ if (!(intel->numClipRects == 0 && - batch->cliprect_mode == LOOP_CLIPRECTS)) { - if (intel->ttm == GL_TRUE) { - struct drm_i915_gem_execbuffer *execbuf; - - execbuf = dri_process_relocs(batch->buf); - ret = intel_exec_ioctl(batch->intel, - used, - batch->cliprect_mode != LOOP_CLIPRECTS, - allow_unlock, - execbuf); - } else { - dri_process_relocs(batch->buf); - ret = intel_batch_ioctl(batch->intel, - batch->buf->offset, - used, - batch->cliprect_mode != LOOP_CLIPRECTS, - allow_unlock); - } + batch->cliprect_mode == LOOP_CLIPRECTS) || intel->no_hw) { + dri_bo_exec(batch->buf, used, + intel->pClipRects, + batch->cliprect_mode != LOOP_CLIPRECTS ? + 0 : intel->numClipRects, + (((GLuint) intel->drawX) & 0xffff) | + (((GLuint) intel->drawY) << 16)); } - dri_post_submit(batch->buf); - if (intel->numClipRects == 0 && batch->cliprect_mode == LOOP_CLIPRECTS) { if (allow_unlock) { diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index 7ede1b8903..cf7d4a0633 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h @@ -3,11 +3,10 @@ #include "mtypes.h" +#include "intel_context.h" #include "intel_bufmgr.h" #include "intel_reg.h" -struct intel_context; - #define BATCH_SZ 16384 #define BATCH_RESERVED 16 diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 7129a4ba91..653f485dd0 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -33,13 +33,13 @@ #include "context.h" #include "enums.h" -#include "intel_batchbuffer.h" #include "intel_blit.h" #include "intel_buffers.h" #include "intel_context.h" #include "intel_fbo.h" #include "intel_reg.h" #include "intel_regions.h" +#include "intel_batchbuffer.h" #define FILE_DEBUG_FLAG DEBUG_BLIT diff --git a/src/mesa/drivers/dri/intel/intel_blit.h b/src/mesa/drivers/dri/intel/intel_blit.h index 60e30f21e8..52065b13ed 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.h +++ b/src/mesa/drivers/dri/intel/intel_blit.h @@ -29,7 +29,6 @@ #define INTEL_BLIT_H #include "intel_context.h" -#include "intel_ioctl.h" extern void intelCopyBuffer(const __DRIdrawablePrivate * dpriv, const drm_clip_rect_t * rect); diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 591b521664..4d1a742698 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -51,7 +51,6 @@ #include "intel_chipset.h" #include "intel_buffers.h" #include "intel_tex.h" -#include "intel_ioctl.h" #include "intel_batchbuffer.h" #include "intel_blit.h" #include "intel_pixel.h" diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.c b/src/mesa/drivers/dri/intel/intel_ioctl.c deleted file mode 100644 index c58a803505..0000000000 --- a/src/mesa/drivers/dri/intel/intel_ioctl.c +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include -#include -#include -#include -#include -#include - -#include "mtypes.h" -#include "context.h" -#include "swrast/swrast.h" - -#include "intel_context.h" -#include "intel_ioctl.h" -#include "intel_batchbuffer.h" -#include "intel_blit.h" -#include "intel_regions.h" -#include "drm.h" -#include "i915_drm.h" - -#include "intel_bufmgr.h" - -#define FILE_DEBUG_FLAG DEBUG_IOCTL - -int -intel_batch_ioctl(struct intel_context *intel, - GLuint start_offset, - GLuint used, - GLboolean ignore_cliprects, GLboolean allow_unlock) -{ - struct drm_i915_batchbuffer batch; - - if (intel->no_hw) - return 0; - - assert(intel->locked); - assert(used); - - DBG("%s used %d offset %x..%x ignore_cliprects %d\n", - __FUNCTION__, - used, start_offset, start_offset + used, ignore_cliprects); - - /* Throw away non-effective packets. Won't work once we have - * hardware contexts which would preserve statechanges beyond a - * single buffer. - */ - batch.start = start_offset; - batch.used = used; - batch.cliprects = intel->pClipRects; - batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects; - batch.DR1 = 0; - batch.DR4 = ((((GLuint) intel->drawX) & 0xffff) | - (((GLuint) intel->drawY) << 16)); - - DBG("%s: 0x%x..0x%x DR4: %x cliprects: %d\n", - __FUNCTION__, - batch.start, - batch.start + batch.used * 4, batch.DR4, batch.num_cliprects); - - if (drmCommandWrite(intel->driFd, DRM_I915_BATCHBUFFER, &batch, - sizeof(batch))) { - fprintf(stderr, "DRM_I915_BATCHBUFFER: %d\n", -errno); - return -errno; - } - - return 0; -} - -int -intel_exec_ioctl(struct intel_context *intel, - GLuint used, - GLboolean ignore_cliprects, GLboolean allow_unlock, - struct drm_i915_gem_execbuffer *execbuf) -{ - int ret; - - assert(intel->locked); - assert(used); - - if (intel->no_hw) - return 0; - - execbuf->batch_start_offset = 0; - execbuf->batch_len = used; - execbuf->cliprects_ptr = (uintptr_t)intel->pClipRects; - execbuf->num_cliprects = ignore_cliprects ? 0 : intel->numClipRects; - execbuf->DR1 = 0; - execbuf->DR4 = ((((GLuint) intel->drawX) & 0xffff) | - (((GLuint) intel->drawY) << 16)); - - do { - ret = ioctl(intel->driFd, DRM_IOCTL_I915_GEM_EXECBUFFER, execbuf); - } while (ret == -EAGAIN); - - if (ret != 0) { - fprintf(stderr, "DRM_I915_GEM_EXECBUFFER: %d\n", -errno); - return -errno; - } - - return 0; -} diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.h b/src/mesa/drivers/dri/intel/intel_ioctl.h deleted file mode 100644 index 6736856dbd..0000000000 --- a/src/mesa/drivers/dri/intel/intel_ioctl.h +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef INTEL_IOCTL_H -#define INTEL_IOCTL_H - -#include "intel_context.h" - -int intel_batch_ioctl(struct intel_context *intel, - GLuint start_offset, - GLuint used, - GLboolean ignore_cliprects, - GLboolean allow_unlock); -int intel_exec_ioctl(struct intel_context *intel, - GLuint used, - GLboolean ignore_cliprects, GLboolean allow_unlock, - struct drm_i915_gem_execbuffer *execbuf); - -#endif diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 7e0d20e681..daa6d4be17 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -36,7 +36,6 @@ #include "intel_screen.h" #include "intel_context.h" -#include "intel_ioctl.h" #include "intel_batchbuffer.h" #include "intel_blit.h" #include "intel_regions.h" diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index 3093ccf7c6..1c72d6179d 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -35,7 +35,6 @@ #include "intel_screen.h" #include "intel_context.h" -#include "intel_ioctl.h" #include "intel_batchbuffer.h" #include "intel_buffers.h" #include "intel_blit.h" diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index 5675084da5..47460da9aa 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -35,7 +35,6 @@ #include "intel_screen.h" #include "intel_context.h" -#include "intel_ioctl.h" #include "intel_batchbuffer.h" #include "intel_blit.h" #include "intel_buffers.h" diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 2355eafeca..1de1ac49ea 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -41,7 +41,6 @@ #include "intel_buffers.h" #include "intel_tex.h" #include "intel_span.h" -#include "intel_ioctl.h" #include "intel_fbo.h" #include "intel_chipset.h" diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index edede3a74b..0ea8576a02 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -34,7 +34,6 @@ #include "intel_screen.h" #include "intel_span.h" #include "intel_regions.h" -#include "intel_ioctl.h" #include "intel_tex.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 187fcc7dcb..d1f540b0f1 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -21,7 +21,6 @@ #include "intel_buffer_objects.h" #include "intel_batchbuffer.h" #include "intel_tex.h" -#include "intel_ioctl.h" #include "intel_blit.h" #include "intel_fbo.h" -- cgit v1.2.3