SUBDIRS = shaders
-AM_CFLAGS = -Wall -I$(top_srcdir) -I$(top_srcdir)/va -I$(top_srcdir)/va/x11 @DRM_CFLAGS@
+AM_CFLAGS = -Wall -I$(top_srcdir) -I$(top_srcdir)/va -I$(top_srcdir)/va/x11 -DPTHREADS @DRM_CFLAGS@
i965_drv_video_la_LTLIBRARIES = i965_drv_video.la
i965_drv_video_ladir = @LIBVA_DRIVERS_PATH@
gen6_mfd.h \
i965_encoder.h \
gen6_vme.h \
- gen6_mfc.h
+ gen6_mfc.h \
+ intel_compiler.h \
+ i965_mutext.h
if (i965_render_init(ctx) == False)
return VA_STATUS_ERROR_UNKNOWN;
+ _i965InitMutex(&i965->render_mutex);
i965->batch = intel_batchbuffer_new(&i965->intel, I915_EXEC_RENDER);
return VA_STATUS_SUCCESS;
if (!obj_surface || !obj_surface->bo)
return VA_STATUS_SUCCESS;
+ _i965LockMutex(&i965->render_mutex);
+
dri_drawable = dri_get_drawable(ctx, (Drawable)draw);
assert(dri_drawable);
obj_surface->free_private_data(&obj_surface->private_data);
}
+ _i965UnlockMutex(&i965->render_mutex);
+
return VA_STATUS_SUCCESS;
}
if (i965->batch)
intel_batchbuffer_free(i965->batch);
+ _i965DestroyMutex(&i965->render_mutex);
+
if (i965_render_terminate(ctx) == False)
return VA_STATUS_ERROR_UNKNOWN;
#include <va/va.h>
#include <va/va_backend.h>
+#include "i965_mutext.h"
#include "object_heap.h"
-
#include "intel_driver.h"
#define I965_MAX_PROFILES 11
struct object_heap subpic_heap;
struct hw_codec_info *codec_info;
+ _I965Mutex render_mutex;
struct intel_batchbuffer *batch;
struct i965_render_state render_state;
void *pp_context;
--- /dev/null
+#ifndef _I965_MUTEX_H_
+#define _I965_MUTEX_H_
+
+#include "intel_compiler.h"
+
+#if defined PTHREADS
+#include <pthread.h>
+
+typedef pthread_mutex_t _I965Mutex;
+
+static INLINE void _i965InitMutex(_I965Mutex *m)
+{
+ pthread_mutex_init(m, NULL);
+}
+
+static INLINE void
+_i965DestroyMutex(_I965Mutex *m)
+{
+ pthread_mutex_destroy(m);
+}
+
+static INLINE void
+_i965LockMutex(_I965Mutex *m)
+{
+ pthread_mutex_lock(m);
+}
+
+static INLINE void
+_i965UnlockMutex(_I965Mutex *m)
+{
+ pthread_mutex_unlock(m);
+}
+
+#define _I965_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#define _I965_DECLARE_MUTEX(m) \
+ _I965Mutex m = _I965_MUTEX_INITIALIZER
+
+#else
+
+typedef int _I965Mutex;
+static INLINE void _i965InitMutex(_I965Mutex *m) { (void) m; }
+static INLINE void _i965DestroyMutex(_I965Mutex *m) { (void) m; }
+static INLINE void _i965LockMutex(_I965Mutex *m) { (void) m; }
+static INLINE void _i965UnlockMutex(_I965Mutex *m) { (void) m; }
+
+#define _I965_MUTEX_INITIALIZER 0
+#define _I965_DECLARE_MUTEX(m) \
+ _I965Mutex m = _I965_MUTEX_INITIALIZER
+
+#endif
+
+#endif /* _I965_MUTEX_H_ */
--- /dev/null
+#ifndef _INTEL_COMPILER_H_
+#define _INTEL_COMPILER_H_
+
+/**
+ * Function inlining
+ */
+#if defined(__GNUC__)
+# define INLINE __inline__
+#elif (__STDC_VERSION__ >= 199901L) /* C99 */
+# define INLINE inline
+#else
+# define INLINE
+#endif
+
+#endif /* _INTEL_COMPILER_H_ */
#include <va/va_backend.h>
-#if defined(__GNUC__)
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
+#include "intel_compiler.h"
#define BATCH_SIZE 0x80000
#define BATCH_RESERVED 0x10