Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mesa
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
virgl-es
mesa
Commits
adbdabb8
Commit
adbdabb8
authored
Jun 06, 2008
by
Jakob Bornecrantz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i915: Moved pipe_buffer and i915_winsys functions to a common folder
parent
18953a87
Changes
39
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
1340 additions
and
2618 deletions
+1340
-2618
configs/default
configs/default
+1
-0
src/gallium/Makefile
src/gallium/Makefile
+1
-1
src/gallium/winsys/common/Makefile
src/gallium/winsys/common/Makefile
+20
-0
src/gallium/winsys/common/Makefile.template
src/gallium/winsys/common/Makefile.template
+64
-0
src/gallium/winsys/common/intel_drm/Makefile
src/gallium/winsys/common/intel_drm/Makefile
+23
-0
src/gallium/winsys/common/intel_drm/glthread.h
src/gallium/winsys/common/intel_drm/glthread.h
+359
-0
src/gallium/winsys/common/intel_drm/intel_be_batchbuffer.c
src/gallium/winsys/common/intel_drm/intel_be_batchbuffer.c
+58
-91
src/gallium/winsys/common/intel_drm/intel_be_batchbuffer.h
src/gallium/winsys/common/intel_drm/intel_be_batchbuffer.h
+69
-0
src/gallium/winsys/common/intel_drm/intel_be_context.c
src/gallium/winsys/common/intel_drm/intel_be_context.c
+107
-0
src/gallium/winsys/common/intel_drm/intel_be_context.h
src/gallium/winsys/common/intel_drm/intel_be_context.h
+40
-0
src/gallium/winsys/common/intel_drm/intel_be_device.c
src/gallium/winsys/common/intel_drm/intel_be_device.c
+257
-0
src/gallium/winsys/common/intel_drm/intel_be_device.h
src/gallium/winsys/common/intel_drm/intel_be_device.h
+58
-0
src/gallium/winsys/common/intel_drm/ws_dri_bufmgr.c
src/gallium/winsys/common/intel_drm/ws_dri_bufmgr.c
+43
-47
src/gallium/winsys/common/intel_drm/ws_dri_bufmgr.h
src/gallium/winsys/common/intel_drm/ws_dri_bufmgr.h
+9
-9
src/gallium/winsys/common/intel_drm/ws_dri_bufpool.h
src/gallium/winsys/common/intel_drm/ws_dri_bufpool.h
+8
-8
src/gallium/winsys/common/intel_drm/ws_dri_drmpool.c
src/gallium/winsys/common/intel_drm/ws_dri_drmpool.c
+13
-13
src/gallium/winsys/common/intel_drm/ws_dri_fencemgr.c
src/gallium/winsys/common/intel_drm/ws_dri_fencemgr.c
+1
-1
src/gallium/winsys/common/intel_drm/ws_dri_fencemgr.h
src/gallium/winsys/common/intel_drm/ws_dri_fencemgr.h
+0
-0
src/gallium/winsys/common/intel_drm/ws_dri_mallocpool.c
src/gallium/winsys/common/intel_drm/ws_dri_mallocpool.c
+9
-10
src/gallium/winsys/common/intel_drm/ws_dri_slabpool.c
src/gallium/winsys/common/intel_drm/ws_dri_slabpool.c
+5
-5
src/gallium/winsys/dri/Makefile.template
src/gallium/winsys/dri/Makefile.template
+1
-0
src/gallium/winsys/dri/intel/Makefile
src/gallium/winsys/dri/intel/Makefile
+4
-13
src/gallium/winsys/dri/intel/intel_batchbuffer.h
src/gallium/winsys/dri/intel/intel_batchbuffer.h
+9
-122
src/gallium/winsys/dri/intel/intel_context.c
src/gallium/winsys/dri/intel/intel_context.c
+58
-13
src/gallium/winsys/dri/intel/intel_context.h
src/gallium/winsys/dri/intel/intel_context.h
+10
-7
src/gallium/winsys/dri/intel/intel_lock.c
src/gallium/winsys/dri/intel/intel_lock.c
+7
-7
src/gallium/winsys/dri/intel/intel_reg.h
src/gallium/winsys/dri/intel/intel_reg.h
+5
-5
src/gallium/winsys/dri/intel/intel_screen.c
src/gallium/winsys/dri/intel/intel_screen.c
+39
-67
src/gallium/winsys/dri/intel/intel_screen.h
src/gallium/winsys/dri/intel/intel_screen.h
+12
-13
src/gallium/winsys/dri/intel/intel_swapbuffers.c
src/gallium/winsys/dri/intel/intel_swapbuffers.c
+21
-12
src/gallium/winsys/dri/intel/intel_swapbuffers.h
src/gallium/winsys/dri/intel/intel_swapbuffers.h
+5
-5
src/gallium/winsys/dri/intel/intel_winsys_i915.c
src/gallium/winsys/dri/intel/intel_winsys_i915.c
+0
-156
src/gallium/winsys/dri/intel/intel_winsys_pipe.c
src/gallium/winsys/dri/intel/intel_winsys_pipe.c
+0
-318
src/gallium/winsys/dri/intel/intel_winsys_softpipe.c
src/gallium/winsys/dri/intel/intel_winsys_softpipe.c
+10
-10
src/gallium/winsys/dri/intel/intel_winsys_softpipe.h
src/gallium/winsys/dri/intel/intel_winsys_softpipe.h
+9
-43
src/gallium/winsys/dri/intel/server/i830_common.h
src/gallium/winsys/dri/intel/server/i830_common.h
+4
-4
src/gallium/winsys/dri/intel/server/i830_dri.h
src/gallium/winsys/dri/intel/server/i830_dri.h
+1
-1
src/gallium/winsys/dri/intel/server/intel.h
src/gallium/winsys/dri/intel/server/intel.h
+0
-331
src/gallium/winsys/dri/intel/server/intel_dri.c
src/gallium/winsys/dri/intel/server/intel_dri.c
+0
-1306
No files found.
configs/default
View file @
adbdabb8
...
...
@@ -71,6 +71,7 @@ PROGRAM_DIRS = demos redbook samples glsl xdemos
GALLIUM_AUXILIARY_DIRS = draw cso_cache pipebuffer tgsi sct translate rtasm util
GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
GALLIUM_DRIVER_DIRS = softpipe i915simple i965simple failover
GALLIUM_WINSYS_COMMON_DIRS = intel_drm
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVER_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
GALLIUM_WINSYS_DIRS = xlib egl_xlib
...
...
src/gallium/Makefile
View file @
adbdabb8
...
...
@@ -2,7 +2,7 @@ TOP = ../..
include
$(TOP)/configs/current
SUBDIRS
=
auxiliary drivers
SUBDIRS
=
auxiliary drivers
winsys/common
default
:
subdirs
...
...
src/gallium/winsys/common/Makefile
0 → 100644
View file @
adbdabb8
TOP
=
../../../..
include
$(TOP)/configs/current
SUBDIRS
=
$(GALLIUM_WINSYS_COMMON_DIRS)
default
:
subdirs
subdirs
:
@
for
dir
in
$(SUBDIRS)
;
do
\
if
[
-d
$$
dir
]
;
then
\
(
cd
$$
dir
&&
$(MAKE)
)
||
exit
1
;
\
fi
\
done
clean
:
rm
-f
`
find
.
-name
\*
.[oa]
`
src/gallium/winsys/common/Makefile.template
0 → 100644
View file @
adbdabb8
# -*-makefile-*-
# We still have a dependency on the "dri" buffer manager. Most likely
# the interface can be reused in non-dri environments, and also as a
# frontend to simpler memory managers.
#
COMMON_SOURCES
=
OBJECTS
=
$(C_SOURCES:.c=.o)
\
$(CPP_SOURCES:.cpp=.o)
\
$(ASM_SOURCES:.S=.o)
### Include directories
INCLUDES
=
\
-I
.
\
-I
$(TOP)
/src/gallium/include
\
-I
$(TOP)
/src/gallium/auxiliary
\
-I
$(TOP)
/src/gallium/drivers
\
-I
$(TOP)
/include
\
$(DRIVER_INCLUDES)
##### RULES #####
.c.o
:
$(CC)
-c
$(INCLUDES)
$(CFLAGS)
$(DRIVER_DEFINES)
$<
-o
$@
.cpp.o
:
$(CXX)
-c
$(INCLUDES)
$(CXXFLAGS)
$(DRIVER_DEFINES)
$<
-o
$@
.S.o
:
$(CC)
-c
$(INCLUDES)
$(CFLAGS)
$(DRIVER_DEFINES)
$<
-o
$@
##### TARGETS #####
default
:
depend symlinks $(LIBNAME)
$(LIBNAME)
:
$(OBJECTS) Makefile $(TOP)/src/gallium/winsys/common/Makefile.template
$(TOP)
/bin/mklib
-o
$@
-static
$(OBJECTS)
$(DRIVER_LIBS)
depend
:
$(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
rm
-f
depend
touch
depend
$(MKDEP)
$(MKDEP_OPTIONS)
$(DRIVER_DEFINES)
$(INCLUDES)
$(C_SOURCES)
$(CPP_SOURCES)
\
$(ASM_SOURCES)
2> /dev/null
# Emacs tags
tags
:
etags
`
find
.
-name
\*
.[ch]
`
`
find ../include
`
# Remove .o and backup files
clean
::
-
rm
-f
*
.o
*
/
*
.o
*
~
*
.so
*
~ server/
*
.o
$(SYMLINKS)
-
rm
-f
depend depend.bak
include
depend
src/gallium/winsys/common/intel_drm/Makefile
0 → 100644
View file @
adbdabb8
TOP
=
../../../../..
include
$(TOP)/configs/current
LIBNAME
=
inteldrm
C_SOURCES
=
\
intel_be_batchbuffer.c
\
intel_be_context.c
\
intel_be_device.c
\
ws_dri_bufmgr.c
\
ws_dri_drmpool.c
\
ws_dri_fencemgr.c
\
ws_dri_mallocpool.c
\
ws_dri_slabpool.c
include
../Makefile.template
DRIVER_DEFINES
=
$(
shell
pkg-config libdrm
--cflags
\
&&
pkg-config libdrm
--atleast-version
=
2.3.1
\
&&
echo
"-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP"
)
symlinks
:
src/gallium/winsys/common/intel_drm/glthread.h
0 → 100644
View file @
adbdabb8
/*
* Mesa 3-D graphics library
* Version: 6.5.2
*
* Copyright (C) 1999-2006 Brian Paul 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL 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.
*/
/*
* Thread support for gl dispatch.
*
* Initial version by John Stone (j.stone@acm.org) (johns@cs.umr.edu)
* and Christoph Poliwoda (poliwoda@volumegraphics.com)
* Revised by Keith Whitwell
* Adapted for new gl dispatcher by Brian Paul
*
*
*
* DOCUMENTATION
*
* This thread module exports the following types:
* _glthread_TSD Thread-specific data area
* _glthread_Thread Thread datatype
* _glthread_Mutex Mutual exclusion lock
*
* Macros:
* _glthread_DECLARE_STATIC_MUTEX(name) Declare a non-local mutex
* _glthread_INIT_MUTEX(name) Initialize a mutex
* _glthread_LOCK_MUTEX(name) Lock a mutex
* _glthread_UNLOCK_MUTEX(name) Unlock a mutex
*
* Functions:
* _glthread_GetID(v) Get integer thread ID
* _glthread_InitTSD() Initialize thread-specific data
* _glthread_GetTSD() Get thread-specific data
* _glthread_SetTSD() Set thread-specific data
*
*/
/*
* If this file is accidentally included by a non-threaded build,
* it should not cause the build to fail, or otherwise cause problems.
* In general, it should only be included when needed however.
*/
#ifndef GLTHREAD_H
#define GLTHREAD_H
#if defined(USE_MGL_NAMESPACE)
#define _glapi_Dispatch _mglapi_Dispatch
#endif
#if (defined(PTHREADS) || defined(SOLARIS_THREADS) ||\
defined(WIN32_THREADS) || defined(USE_XTHREADS) || defined(BEOS_THREADS)) \
&& !defined(THREADS)
# define THREADS
#endif
#ifdef VMS
#include <GL/vms_x_fix.h>
#endif
/*
* POSIX threads. This should be your choice in the Unix world
* whenever possible. When building with POSIX threads, be sure
* to enable any compiler flags which will cause the MT-safe
* libc (if one exists) to be used when linking, as well as any
* header macros for MT-safe errno, etc. For Solaris, this is the -mt
* compiler flag. On Solaris with gcc, use -D_REENTRANT to enable
* proper compiling for MT-safe libc etc.
*/
#if defined(PTHREADS)
#include <pthread.h>
/* POSIX threads headers */
typedef
struct
{
pthread_key_t
key
;
int
initMagic
;
}
_glthread_TSD
;
typedef
pthread_t
_glthread_Thread
;
typedef
pthread_mutex_t
_glthread_Mutex
;
#define _glthread_DECLARE_STATIC_MUTEX(name) \
static _glthread_Mutex name = PTHREAD_MUTEX_INITIALIZER
#define _glthread_INIT_MUTEX(name) \
pthread_mutex_init(&(name), NULL)
#define _glthread_DESTROY_MUTEX(name) \
pthread_mutex_destroy(&(name))
#define _glthread_LOCK_MUTEX(name) \
(void) pthread_mutex_lock(&(name))
#define _glthread_UNLOCK_MUTEX(name) \
(void) pthread_mutex_unlock(&(name))
typedef
pthread_cond_t
_glthread_Cond
;
#define _glthread_DECLARE_STATIC_COND(name) \
static _glthread_Cond name = PTHREAD_COND_INITIALIZER
#define _glthread_INIT_COND(cond) \
pthread_cond_init(&(cond), NULL)
#define _glthread_DESTROY_COND(name) \
pthread_cond_destroy(&(name))
#define _glthread_COND_WAIT(cond, mutex) \
pthread_cond_wait(&(cond), &(mutex))
#define _glthread_COND_SIGNAL(cond) \
pthread_cond_signal(&(cond))
#define _glthread_COND_BROADCAST(cond) \
pthread_cond_broadcast(&(cond))
#else
/* PTHREADS */
typedef
unsigned
int
_glthread_Cond
;
#define _glthread_DECLARE_STATIC_COND(name) \
// #warning Condition variables not implemented.
#define _glthread_INIT_COND(cond) \
abort();
#define _glthread_DESTROY_COND(name) \
abort();
#define _glthread_COND_WAIT(cond, mutex) \
abort();
#define _glthread_COND_SIGNAL(cond) \
abort();
#define _glthread_COND_BROADCAST(cond) \
abort();
#endif
/*
* Solaris threads. Use only up to Solaris 2.4.
* Solaris 2.5 and higher provide POSIX threads.
* Be sure to compile with -mt on the Solaris compilers, or
* use -D_REENTRANT if using gcc.
*/
#ifdef SOLARIS_THREADS
#include <thread.h>
typedef
struct
{
thread_key_t
key
;
mutex_t
keylock
;
int
initMagic
;
}
_glthread_TSD
;
typedef
thread_t
_glthread_Thread
;
typedef
mutex_t
_glthread_Mutex
;
/* XXX need to really implement mutex-related macros */
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
#define _glthread_INIT_MUTEX(name) (void) name
#define _glthread_DESTROY_MUTEX(name) (void) name
#define _glthread_LOCK_MUTEX(name) (void) name
#define _glthread_UNLOCK_MUTEX(name) (void) name
#endif
/* SOLARIS_THREADS */
/*
* Windows threads. Should work with Windows NT and 95.
* IMPORTANT: Link with multithreaded runtime library when THREADS are
* used!
*/
#ifdef WIN32_THREADS
#include <windows.h>
typedef
struct
{
DWORD
key
;
int
initMagic
;
}
_glthread_TSD
;
typedef
HANDLE
_glthread_Thread
;
typedef
CRITICAL_SECTION
_glthread_Mutex
;
#define _glthread_DECLARE_STATIC_MUTEX(name)
/*static*/
_glthread_Mutex name = {0,0,0,0,0,0}
#define _glthread_INIT_MUTEX(name) InitializeCriticalSection(&name)
#define _glthread_DESTROY_MUTEX(name) DeleteCriticalSection(&name)
#define _glthread_LOCK_MUTEX(name) EnterCriticalSection(&name)
#define _glthread_UNLOCK_MUTEX(name) LeaveCriticalSection(&name)
#endif
/* WIN32_THREADS */
/*
* XFree86 has its own thread wrapper, Xthreads.h
* We wrap it again for GL.
*/
#ifdef USE_XTHREADS
#include <X11/Xthreads.h>
typedef
struct
{
xthread_key_t
key
;
int
initMagic
;
}
_glthread_TSD
;
typedef
xthread_t
_glthread_Thread
;
typedef
xmutex_rec
_glthread_Mutex
;
#ifdef XMUTEX_INITIALIZER
#define _glthread_DECLARE_STATIC_MUTEX(name) \
static _glthread_Mutex name = XMUTEX_INITIALIZER
#else
#define _glthread_DECLARE_STATIC_MUTEX(name) \
static _glthread_Mutex name
#endif
#define _glthread_INIT_MUTEX(name) \
xmutex_init(&(name))
#define _glthread_DESTROY_MUTEX(name) \
xmutex_clear(&(name))
#define _glthread_LOCK_MUTEX(name) \
(void) xmutex_lock(&(name))
#define _glthread_UNLOCK_MUTEX(name) \
(void) xmutex_unlock(&(name))
#endif
/* USE_XTHREADS */
/*
* BeOS threads. R5.x required.
*/
#ifdef BEOS_THREADS
#include <kernel/OS.h>
#include <support/TLS.h>
typedef
struct
{
int32
key
;
int
initMagic
;
}
_glthread_TSD
;
typedef
thread_id
_glthread_Thread
;
/* Use Benaphore, aka speeder semaphore */
typedef
struct
{
int32
lock
;
sem_id
sem
;
}
benaphore
;
typedef
benaphore
_glthread_Mutex
;
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = { 0, 0 }
#define _glthread_INIT_MUTEX(name) name.sem = create_sem(0, #name"_benaphore"), name.lock = 0
#define _glthread_DESTROY_MUTEX(name) delete_sem(name.sem), name.lock = 0
#define _glthread_LOCK_MUTEX(name) if (name.sem == 0) _glthread_INIT_MUTEX(name); \
if (atomic_add(&(name.lock), 1) >= 1) acquire_sem(name.sem)
#define _glthread_UNLOCK_MUTEX(name) if (atomic_add(&(name.lock), -1) > 1) release_sem(name.sem)
#endif
/* BEOS_THREADS */
#ifndef THREADS
/*
* THREADS not defined
*/
typedef
GLuint
_glthread_TSD
;
typedef
GLuint
_glthread_Thread
;
typedef
GLuint
_glthread_Mutex
;
#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0
#define _glthread_INIT_MUTEX(name) (void) name
#define _glthread_DESTROY_MUTEX(name) (void) name
#define _glthread_LOCK_MUTEX(name) (void) name
#define _glthread_UNLOCK_MUTEX(name) (void) name
#endif
/* THREADS */
/*
* Platform independent thread specific data API.
*/
extern
unsigned
long
_glthread_GetID
(
void
);
extern
void
_glthread_InitTSD
(
_glthread_TSD
*
);
extern
void
*
_glthread_GetTSD
(
_glthread_TSD
*
);
extern
void
_glthread_SetTSD
(
_glthread_TSD
*
,
void
*
);
#if defined(GLX_USE_TLS)
extern
__thread
struct
_glapi_table
*
_glapi_tls_Dispatch
__attribute__
((
tls_model
(
"initial-exec"
)));
#define GET_DISPATCH() _glapi_tls_Dispatch
#elif !defined(GL_CALL)
# if defined(THREADS)
# define GET_DISPATCH() \
((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \
? _glapi_Dispatch : _glapi_get_dispatch())
# else
# define GET_DISPATCH() _glapi_Dispatch
# endif
/* defined(THREADS) */
#endif
/* ndef GL_CALL */
#endif
/* THREADS_H */
src/gallium/winsys/
dri/intel/intel
_batchbuffer.c
→
src/gallium/winsys/
common/intel_drm/intel_be
_batchbuffer.c
View file @
adbdabb8
/**************************************************************************
*
* Copyright 2006 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 "intel_batchbuffer.h"
#include "intel_context.h"
#include "intel_be_batchbuffer.h"
#include "intel_be_context.h"
#include "intel_be_device.h"
#include <errno.h>
#if 0
static void
intel_dump_batchbuffer(GLuint offset, GLuint * ptr, GLuint count)
{
int i;
fprintf(stderr, "\n\n\nSTART BATCH (%d dwords):\n", count / 4);
for (i = 0; i < count / 4; i += 4)
fprintf(stderr, "0x%x:\t0x%08x 0x%08x 0x%08x 0x%08x\n",
offset + i * 4, ptr[i], ptr[i + 1], ptr[i + 2], ptr[i + 3]);
fprintf(stderr, "END BATCH\n\n\n");
}
#endif
#include "xf86drm.h"
static
void
intel_realloc_relocs
(
struct
intel_batchbuffer
*
batch
,
int
num_relocs
)
static
void
intel_realloc_relocs
(
struct
intel_b
e_b
atchbuffer
*
batch
,
int
num_relocs
)
{
unsigned
long
size
=
num_relocs
*
I915_RELOC0_STRIDE
+
I915_RELOC_HEADER
;
size
*=
sizeof
(
uint32_t
);
batch
->
reloc
=
realloc
(
batch
->
reloc
,
size
);
batch
->
reloc_size
=
num_relocs
;
...
...
@@ -54,20 +18,20 @@ intel_realloc_relocs(struct intel_batchbuffer *batch, int num_relocs)
void
intel_b
atchbuffer_reset
(
struct
intel
_batchbuffer
*
batch
)
intel_b
e_batchbuffer_reset
(
struct
intel_be
_batchbuffer
*
batch
)
{
/*
* Get a new, free batchbuffer.
*/
drmBO
*
bo
;
struct
drm_bo_info_req
*
req
;
driBOUnrefUserList
(
batch
->
list
);
driBOResetList
(
batch
->
list
);
/* base.size is the size available to the i915simple driver */
batch
->
base
.
size
=
batch
->
intel
->
intelScreen
->
max_batch_size
-
BATCH_RESERVED
;
batch
->
base
.
actual_size
=
batch
->
intel
->
intelScreen
->
max_batch_size
;
batch
->
base
.
size
=
batch
->
device
->
max_batch_size
-
BATCH_RESERVED
;
batch
->
base
.
actual_size
=
batch
->
device
->
max_batch_size
;
driBOData
(
batch
->
buffer
,
batch
->
base
.
actual_size
,
NULL
,
NULL
,
0
);
/*
...
...
@@ -98,9 +62,9 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch)
*/
if
(
batch
->
reloc_size
>
INTEL_MAX_RELOCS
||
batch
->
reloc
==
NULL
)
batch
->
reloc
==
NULL
)
intel_realloc_relocs
(
batch
,
INTEL_DEFAULT_RELOCS
);
assert
(
batch
->
reloc
!=
NULL
);
batch
->
reloc
[
0
]
=
0
;
/* No relocs yet. */
batch
->
reloc
[
1
]
=
1
;
/* Reloc type 1 */
...
...
@@ -119,29 +83,30 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch)
/*======================================================================
* Public functions
*/
struct
intel_batchbuffer
*
intel_b
atchbuffer_alloc
(
struct
intel
_context
*
intel
)
struct
intel_b
e_b
atchbuffer
*
intel_b
e_batchbuffer_alloc
(
struct
intel_be
_context
*
intel
)
{
struct
intel_batchbuffer
*
batch
=
calloc
(
sizeof
(
*
batch
),
1
);
struct
intel_b
e_b
atchbuffer
*
batch
=
calloc
(
sizeof
(
*
batch
),
1
);
batch
->
intel
=
intel
;
batch
->
device
=
intel
->
device
;
driGenBuffers
(
intel
->
intelScreen
->
batchPool
,
"batchbuffer"
,
1
,
driGenBuffers
(
intel
->
device
->
batchPool
,
"batchbuffer"
,
1
,
&
batch
->
buffer
,
4096
,
DRM_BO_FLAG_MEM_TT
|
DRM_BO_FLAG_EXE
,
0
);
batch
->
last_fence
=
NULL
;
batch
->
list
=
driBOCreateList
(
20
);
batch
->
reloc
=
NULL
;
intel_batchbuffer_reset
(
batch
);
intel_b
e_b
atchbuffer_reset
(
batch
);
return
batch
;
}
void
intel_b
atchbuffer_free
(
struct
intel
_batchbuffer
*
batch
)
intel_b
e_batchbuffer_free
(
struct
intel_be
_batchbuffer
*
batch
)