Merge remote-tracking branch 'origin/master' into pipe-video
Conflicts: configure.ac src/gallium/drivers/r600/r600_state_inlines.h src/gallium/tests/trivial/Makefile src/gallium/winsys/g3dvl/dri/XF86dri.c src/gallium/winsys/g3dvl/dri/driclient.c src/gallium/winsys/g3dvl/dri/driclient.h src/gallium/winsys/g3dvl/dri/xf86dri.h src/gallium/winsys/g3dvl/dri/xf86dristr.h src/gallium/winsys/r600/drm/r600_bo.c
This commit is contained in:
@@ -22,6 +22,7 @@ SConscript('mesa/SConscript')
|
||||
SConscript('mapi/vgapi/SConscript')
|
||||
|
||||
if env['platform'] != 'embedded':
|
||||
SConscript('glx/SConscript')
|
||||
SConscript('egl/main/SConscript')
|
||||
SConscript('glu/sgi/SConscript')
|
||||
SConscript('glut/glx/SConscript')
|
||||
|
||||
@@ -4,12 +4,14 @@ TOP = ../../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
EGL_DRIVER = egl_dri2
|
||||
EGL_SOURCES = egl_dri2.c platform_drm.c common.c
|
||||
EGL_SOURCES = egl_dri2.c common.c
|
||||
|
||||
EGL_INCLUDES = \
|
||||
-I$(TOP)/include \
|
||||
-I$(TOP)/src/egl/main \
|
||||
-I$(TOP)/src/mapi \
|
||||
-I$(TOP)/src/gbm/main \
|
||||
-I$(TOP)/src/gbm/backends/dri \
|
||||
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" \
|
||||
$(LIBUDEV_CFLAGS) \
|
||||
$(LIBDRM_CFLAGS)
|
||||
@@ -29,6 +31,11 @@ EGL_INCLUDES += -DHAVE_X11_PLATFORM $(XCB_DRI2_CFLAGS)
|
||||
EGL_LIBS += $(XCB_DRI2_LIBS)
|
||||
endif
|
||||
|
||||
ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
|
||||
EGL_SOURCES += platform_drm.c
|
||||
EGL_INCLUDES += -DHAVE_DRM_PLATFORM
|
||||
endif
|
||||
|
||||
ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
|
||||
EGL_SOURCES += platform_wayland.c
|
||||
EGL_INCLUDES += -DHAVE_WAYLAND_PLATFORM $(WAYLAND_CFLAGS) \
|
||||
|
||||
+119
-49
@@ -97,6 +97,18 @@ EGLint dri2_to_egl_attribute_map[] = {
|
||||
0, /* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */
|
||||
};
|
||||
|
||||
static EGLBoolean
|
||||
dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
|
||||
{
|
||||
if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0)
|
||||
return EGL_FALSE;
|
||||
|
||||
if (!_eglMatchConfig(conf, criteria))
|
||||
return EGL_FALSE;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
struct dri2_egl_config *
|
||||
dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
|
||||
int depth, EGLint surface_type, const EGLint *attr_list)
|
||||
@@ -190,7 +202,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
|
||||
base.ConfigID = EGL_DONT_CARE;
|
||||
base.SurfaceType = EGL_DONT_CARE;
|
||||
num_configs = _eglFilterArray(disp->Configs, (void **) &matching_config, 1,
|
||||
(_EGLArrayForEach) _eglMatchConfig, &base);
|
||||
(_EGLArrayForEach) dri2_match_config, &base);
|
||||
|
||||
if (num_configs == 1) {
|
||||
conf = (struct dri2_egl_config *) matching_config;
|
||||
@@ -232,7 +244,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
|
||||
return conf;
|
||||
}
|
||||
|
||||
static __DRIimage *
|
||||
__DRIimage *
|
||||
dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data)
|
||||
{
|
||||
_EGLDisplay *disp = data;
|
||||
@@ -322,8 +334,8 @@ dri2_bind_extensions(struct dri2_egl_display *dri2_dpy,
|
||||
return ret;
|
||||
}
|
||||
|
||||
EGLBoolean
|
||||
dri2_load_driver(_EGLDisplay *disp)
|
||||
static const __DRIextension **
|
||||
dri2_open_driver(_EGLDisplay *disp)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = disp->DriverData;
|
||||
const __DRIextension **extensions;
|
||||
@@ -362,9 +374,9 @@ dri2_load_driver(_EGLDisplay *disp)
|
||||
|
||||
if (dri2_dpy->driver == NULL) {
|
||||
_eglLog(_EGL_WARNING,
|
||||
"DRI2: failed to open any driver (search paths %s)",
|
||||
search_paths);
|
||||
return EGL_FALSE;
|
||||
"DRI2: failed to open %s (search paths %s)",
|
||||
dri2_dpy->driver_name, search_paths);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_eglLog(_EGL_DEBUG, "DRI2: dlopen(%s)", path);
|
||||
@@ -373,59 +385,59 @@ dri2_load_driver(_EGLDisplay *disp)
|
||||
_eglLog(_EGL_WARNING,
|
||||
"DRI2: driver exports no extensions (%s)", dlerror());
|
||||
dlclose(dri2_dpy->driver);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (strcmp(dri2_dpy->driver_name, "swrast") == 0) {
|
||||
if (!dri2_bind_extensions(dri2_dpy, swrast_driver_extensions, extensions)) {
|
||||
dlclose(dri2_dpy->driver);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
} else {
|
||||
if (!dri2_bind_extensions(dri2_dpy, dri2_driver_extensions, extensions)) {
|
||||
dlclose(dri2_dpy->driver);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
return extensions;
|
||||
}
|
||||
|
||||
EGLBoolean
|
||||
dri2_load_driver(_EGLDisplay *disp)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = disp->DriverData;
|
||||
const __DRIextension **extensions;
|
||||
|
||||
extensions = dri2_open_driver(disp);
|
||||
if (!extensions)
|
||||
return EGL_FALSE;
|
||||
|
||||
if (!dri2_bind_extensions(dri2_dpy, dri2_driver_extensions, extensions)) {
|
||||
dlclose(dri2_dpy->driver);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean
|
||||
dri2_create_screen(_EGLDisplay *disp)
|
||||
dri2_load_driver_swrast(_EGLDisplay *disp)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = disp->DriverData;
|
||||
const __DRIextension **extensions;
|
||||
struct dri2_egl_display *dri2_dpy;
|
||||
unsigned int api_mask;
|
||||
|
||||
dri2_dpy = disp->DriverData;
|
||||
|
||||
if (dri2_dpy->dri2) {
|
||||
dri2_dpy->dri_screen =
|
||||
dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd, dri2_dpy->extensions,
|
||||
&dri2_dpy->driver_configs, disp);
|
||||
} else {
|
||||
assert(dri2_dpy->swrast);
|
||||
dri2_dpy->dri_screen =
|
||||
dri2_dpy->swrast->createNewScreen(0, dri2_dpy->extensions,
|
||||
&dri2_dpy->driver_configs, disp);
|
||||
dri2_dpy->driver_name = "swrast";
|
||||
extensions = dri2_open_driver(disp);
|
||||
if (!extensions) {
|
||||
/* try again with swrastg */
|
||||
dri2_dpy->driver_name = "swrastg";
|
||||
extensions = dri2_open_driver(disp);
|
||||
}
|
||||
|
||||
if (dri2_dpy->dri_screen == NULL) {
|
||||
_eglLog(_EGL_WARNING, "DRI2: failed to create dri screen");
|
||||
if (!extensions)
|
||||
return EGL_FALSE;
|
||||
|
||||
if (!dri2_bind_extensions(dri2_dpy, swrast_driver_extensions, extensions)) {
|
||||
dlclose(dri2_dpy->driver);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen);
|
||||
|
||||
if (dri2_dpy->dri2) {
|
||||
if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions))
|
||||
goto cleanup_dri_screen;
|
||||
} else {
|
||||
assert(dri2_dpy->swrast);
|
||||
if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions, extensions))
|
||||
goto cleanup_dri_screen;
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
dri2_setup_screen(_EGLDisplay *disp)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
unsigned int api_mask;
|
||||
|
||||
if (dri2_dpy->dri2) {
|
||||
if (dri2_dpy->dri2->base.version >= 2)
|
||||
@@ -468,6 +480,46 @@ dri2_create_screen(_EGLDisplay *disp)
|
||||
disp->Extensions.KHR_image_base = EGL_TRUE;
|
||||
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
EGLBoolean
|
||||
dri2_create_screen(_EGLDisplay *disp)
|
||||
{
|
||||
const __DRIextension **extensions;
|
||||
struct dri2_egl_display *dri2_dpy;
|
||||
|
||||
dri2_dpy = disp->DriverData;
|
||||
|
||||
if (dri2_dpy->dri2) {
|
||||
dri2_dpy->dri_screen =
|
||||
dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd, dri2_dpy->extensions,
|
||||
&dri2_dpy->driver_configs, disp);
|
||||
} else {
|
||||
assert(dri2_dpy->swrast);
|
||||
dri2_dpy->dri_screen =
|
||||
dri2_dpy->swrast->createNewScreen(0, dri2_dpy->extensions,
|
||||
&dri2_dpy->driver_configs, disp);
|
||||
}
|
||||
|
||||
if (dri2_dpy->dri_screen == NULL) {
|
||||
_eglLog(_EGL_WARNING, "DRI2: failed to create dri screen");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
dri2_dpy->own_dri_screen = 1;
|
||||
|
||||
extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen);
|
||||
|
||||
if (dri2_dpy->dri2) {
|
||||
if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions))
|
||||
goto cleanup_dri_screen;
|
||||
} else {
|
||||
assert(dri2_dpy->swrast);
|
||||
if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions, extensions))
|
||||
goto cleanup_dri_screen;
|
||||
}
|
||||
|
||||
dri2_setup_screen(disp);
|
||||
|
||||
return EGL_TRUE;
|
||||
|
||||
@@ -496,10 +548,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBUDEV
|
||||
#ifdef HAVE_DRM_PLATFORM
|
||||
case _EGL_PLATFORM_DRM:
|
||||
if (disp->Options.TestOnly)
|
||||
return EGL_TRUE;
|
||||
return dri2_initialize_drm(drv, disp);
|
||||
#endif
|
||||
#ifdef HAVE_WAYLAND_PLATFORM
|
||||
case _EGL_PLATFORM_WAYLAND:
|
||||
if (disp->Options.TestOnly)
|
||||
@@ -524,14 +578,30 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
_eglReleaseDisplayResources(drv, disp);
|
||||
_eglCleanupDisplay(disp);
|
||||
|
||||
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
|
||||
if (dri2_dpy->own_dri_screen)
|
||||
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
|
||||
if (dri2_dpy->fd)
|
||||
close(dri2_dpy->fd);
|
||||
dlclose(dri2_dpy->driver);
|
||||
if (dri2_dpy->driver)
|
||||
dlclose(dri2_dpy->driver);
|
||||
|
||||
if (disp->PlatformDisplay == NULL) {
|
||||
switch (disp->Platform) {
|
||||
#ifdef HAVE_X11_PLATFORM
|
||||
if (disp->PlatformDisplay == NULL)
|
||||
xcb_disconnect(dri2_dpy->conn);
|
||||
case _EGL_PLATFORM_X11:
|
||||
xcb_disconnect(dri2_dpy->conn);
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_WAYLAND_PLATFORM
|
||||
case _EGL_PLATFORM_WAYLAND:
|
||||
wl_display_destroy(dri2_dpy->wl_dpy);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(dri2_dpy);
|
||||
disp->DriverData = NULL;
|
||||
|
||||
|
||||
@@ -44,6 +44,10 @@
|
||||
#include <GL/gl.h>
|
||||
#include <GL/internal/dri_interface.h>
|
||||
|
||||
#ifdef HAVE_DRM_PLATFORM
|
||||
#include <gbm_driint.h>
|
||||
#endif
|
||||
|
||||
#include "eglconfig.h"
|
||||
#include "eglcontext.h"
|
||||
#include "egldisplay.h"
|
||||
@@ -69,6 +73,7 @@ struct dri2_egl_display
|
||||
int dri2_major;
|
||||
int dri2_minor;
|
||||
__DRIscreen *dri_screen;
|
||||
int own_dri_screen;
|
||||
const __DRIconfig **driver_configs;
|
||||
void *driver;
|
||||
__DRIcoreExtension *core;
|
||||
@@ -79,12 +84,16 @@ struct dri2_egl_display
|
||||
__DRIimageExtension *image;
|
||||
int fd;
|
||||
|
||||
#ifdef HAVE_DRM_PLATFORM
|
||||
struct gbm_dri_device *gbm_dri;
|
||||
#endif
|
||||
|
||||
char *device_name;
|
||||
char *driver_name;
|
||||
|
||||
__DRIdri2LoaderExtension dri2_loader_extension;
|
||||
__DRIswrastLoaderExtension swrast_loader_extension;
|
||||
const __DRIextension *extensions[3];
|
||||
const __DRIextension *extensions[4];
|
||||
|
||||
#ifdef HAVE_X11_PLATFORM
|
||||
xcb_connection_t *conn;
|
||||
@@ -110,6 +119,7 @@ struct dri2_egl_context
|
||||
enum wayland_buffer_type {
|
||||
WL_BUFFER_FRONT,
|
||||
WL_BUFFER_BACK,
|
||||
WL_BUFFER_THIRD,
|
||||
WL_BUFFER_COUNT
|
||||
};
|
||||
|
||||
@@ -145,9 +155,11 @@ struct dri2_egl_surface
|
||||
struct wl_egl_window *wl_win;
|
||||
struct wl_egl_pixmap *wl_pix;
|
||||
struct wl_buffer *wl_drm_buffer[WL_BUFFER_COUNT];
|
||||
int wl_buffer_lock[WL_BUFFER_COUNT];
|
||||
int dx;
|
||||
int dy;
|
||||
__DRIbuffer *dri_buffers[__DRI_BUFFER_COUNT];
|
||||
__DRIbuffer *third_buffer;
|
||||
__DRIbuffer *pending_buffer;
|
||||
EGLBoolean block_swap_buffers;
|
||||
#endif
|
||||
@@ -182,9 +194,19 @@ extern const __DRIuseInvalidateExtension use_invalidate;
|
||||
EGLBoolean
|
||||
dri2_load_driver(_EGLDisplay *disp);
|
||||
|
||||
/* Helper for platforms not using dri2_create_screen */
|
||||
void
|
||||
dri2_setup_screen(_EGLDisplay *disp);
|
||||
|
||||
EGLBoolean
|
||||
dri2_load_driver_swrast(_EGLDisplay *disp);
|
||||
|
||||
EGLBoolean
|
||||
dri2_create_screen(_EGLDisplay *disp);
|
||||
|
||||
__DRIimage *
|
||||
dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data);
|
||||
|
||||
struct dri2_egl_config *
|
||||
dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
|
||||
int depth, EGLint surface_type, const EGLint *attr_list);
|
||||
|
||||
@@ -33,6 +33,50 @@
|
||||
|
||||
#include "egl_dri2.h"
|
||||
|
||||
static _EGLImage *
|
||||
dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
|
||||
EGLClientBuffer buffer, const EGLint *attr_list)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct gbm_dri_bo *dri_bo = gbm_dri_bo((struct gbm_bo *) buffer);
|
||||
struct dri2_egl_image *dri2_img;
|
||||
|
||||
dri2_img = malloc(sizeof *dri2_img);
|
||||
if (!dri2_img) {
|
||||
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr_pixmap");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!_eglInitImage(&dri2_img->base, disp)) {
|
||||
free(dri2_img);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dri2_img->dri_image = dri2_dpy->image->dupImage(dri_bo->image, dri2_img);
|
||||
if (dri2_img->dri_image == NULL) {
|
||||
free(dri2_img);
|
||||
_eglError(EGL_BAD_ALLOC, "dri2_create_image_khr_pixmap");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &dri2_img->base;
|
||||
}
|
||||
|
||||
static _EGLImage *
|
||||
dri2_drm_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
_EGLContext *ctx, EGLenum target,
|
||||
EGLClientBuffer buffer, const EGLint *attr_list)
|
||||
{
|
||||
(void) drv;
|
||||
|
||||
switch (target) {
|
||||
case EGL_NATIVE_PIXMAP_KHR:
|
||||
return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list);
|
||||
default:
|
||||
return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id)
|
||||
{
|
||||
@@ -45,57 +89,58 @@ EGLBoolean
|
||||
dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy;
|
||||
struct gbm_device *gbm;
|
||||
int i;
|
||||
|
||||
dri2_dpy = malloc(sizeof *dri2_dpy);
|
||||
if (!dri2_dpy)
|
||||
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
|
||||
|
||||
|
||||
memset(dri2_dpy, 0, sizeof *dri2_dpy);
|
||||
|
||||
disp->DriverData = (void *) dri2_dpy;
|
||||
dri2_dpy->fd = (int) (intptr_t) disp->PlatformDisplay;
|
||||
|
||||
dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
|
||||
if (dri2_dpy->driver_name == NULL)
|
||||
return _eglError(EGL_BAD_ALLOC, "DRI2: failed to get driver name");
|
||||
|
||||
dri2_dpy->device_name = dri2_get_device_name_for_fd(dri2_dpy->fd);
|
||||
if (dri2_dpy->device_name == NULL) {
|
||||
_eglError(EGL_BAD_ALLOC, "DRI2: failed to get device name");
|
||||
goto cleanup_driver_name;
|
||||
gbm = (struct gbm_device *) disp->PlatformDisplay;
|
||||
if (strcmp(gbm_device_get_backend_name(gbm), "drm") != 0) {
|
||||
free(dri2_dpy);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (!dri2_load_driver(disp))
|
||||
goto cleanup_device_name;
|
||||
dri2_dpy->gbm_dri = gbm_dri_device(gbm);
|
||||
if (dri2_dpy->gbm_dri->base.type != GBM_DRM_DRIVER_TYPE_DRI) {
|
||||
free(dri2_dpy);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
dri2_dpy->extensions[0] = &image_lookup_extension.base;
|
||||
dri2_dpy->extensions[1] = &use_invalidate.base;
|
||||
dri2_dpy->extensions[2] = NULL;
|
||||
dri2_dpy->fd = gbm_device_get_fd(gbm);
|
||||
dri2_dpy->device_name = dri2_get_device_name_for_fd(dri2_dpy->fd);
|
||||
dri2_dpy->driver_name = dri2_dpy->gbm_dri->base.driver_name;
|
||||
|
||||
if (!dri2_create_screen(disp))
|
||||
goto cleanup_driver;
|
||||
dri2_dpy->dri_screen = dri2_dpy->gbm_dri->screen;
|
||||
dri2_dpy->core = dri2_dpy->gbm_dri->core;
|
||||
dri2_dpy->dri2 = dri2_dpy->gbm_dri->dri2;
|
||||
dri2_dpy->image = dri2_dpy->gbm_dri->image;
|
||||
dri2_dpy->driver_configs = dri2_dpy->gbm_dri->driver_configs;
|
||||
|
||||
dri2_dpy->gbm_dri->lookup_image = dri2_lookup_egl_image;
|
||||
dri2_dpy->gbm_dri->lookup_user_data = disp;
|
||||
|
||||
dri2_setup_screen(disp);
|
||||
|
||||
for (i = 0; dri2_dpy->driver_configs[i]; i++)
|
||||
dri2_add_config(disp, dri2_dpy->driver_configs[i], i + 1, 0, 0, NULL);
|
||||
dri2_add_config(disp, dri2_dpy->driver_configs[i],
|
||||
i + 1, 0, 0, NULL);
|
||||
|
||||
drv->API.CreateImageKHR = dri2_drm_create_image_khr;
|
||||
|
||||
#ifdef HAVE_WAYLAND_PLATFORM
|
||||
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
|
||||
#endif
|
||||
dri2_dpy->authenticate = dri2_drm_authenticate;
|
||||
|
||||
|
||||
/* we're supporting EGL 1.4 */
|
||||
disp->VersionMajor = 1;
|
||||
disp->VersionMinor = 4;
|
||||
|
||||
return EGL_TRUE;
|
||||
|
||||
cleanup_driver:
|
||||
dlclose(dri2_dpy->driver);
|
||||
cleanup_device_name:
|
||||
free(dri2_dpy->device_name);
|
||||
cleanup_driver_name:
|
||||
free(dri2_dpy->driver_name);
|
||||
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,29 @@ force_roundtrip(struct wl_display *display)
|
||||
wl_display_iterate(display, WL_DISPLAY_READABLE);
|
||||
}
|
||||
|
||||
static void
|
||||
wl_buffer_release(void *data, struct wl_buffer *buffer)
|
||||
{
|
||||
struct dri2_egl_surface *dri2_surf = data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < WL_BUFFER_COUNT; ++i)
|
||||
if (dri2_surf->wl_drm_buffer[i] == buffer)
|
||||
break;
|
||||
|
||||
assert(i <= WL_BUFFER_COUNT);
|
||||
|
||||
/* not found? */
|
||||
if (i == WL_BUFFER_COUNT)
|
||||
return;
|
||||
|
||||
dri2_surf->wl_buffer_lock[i] = 0;
|
||||
|
||||
}
|
||||
|
||||
static struct wl_buffer_listener wl_buffer_listener = {
|
||||
wl_buffer_release
|
||||
};
|
||||
|
||||
/**
|
||||
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
|
||||
@@ -85,13 +108,16 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
||||
if (!_eglInitSurface(&dri2_surf->base, disp, type, conf, attrib_list))
|
||||
goto cleanup_surf;
|
||||
|
||||
for (i = 0; i < WL_BUFFER_COUNT; ++i)
|
||||
for (i = 0; i < WL_BUFFER_COUNT; ++i) {
|
||||
dri2_surf->wl_drm_buffer[i] = NULL;
|
||||
dri2_surf->wl_buffer_lock[i] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < __DRI_BUFFER_COUNT; ++i)
|
||||
dri2_surf->dri_buffers[i] = NULL;
|
||||
|
||||
dri2_surf->pending_buffer = NULL;
|
||||
dri2_surf->third_buffer = NULL;
|
||||
dri2_surf->block_swap_buffers = EGL_FALSE;
|
||||
|
||||
switch (type) {
|
||||
@@ -187,6 +213,11 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
|
||||
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
|
||||
dri2_surf->dri_buffers[i]);
|
||||
|
||||
if (dri2_surf->third_buffer) {
|
||||
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
|
||||
dri2_surf->third_buffer);
|
||||
}
|
||||
|
||||
free(surf);
|
||||
|
||||
return EGL_TRUE;
|
||||
@@ -215,10 +246,14 @@ wayland_create_buffer(struct dri2_egl_surface *dri2_surf,
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy =
|
||||
dri2_egl_display(dri2_surf->base.Resource.Display);
|
||||
struct wl_buffer *buf;
|
||||
|
||||
return wl_drm_create_buffer(dri2_dpy->wl_drm, buffer->name,
|
||||
dri2_surf->base.Width, dri2_surf->base.Height,
|
||||
buffer->pitch, visual);
|
||||
buf = wl_drm_create_buffer(dri2_dpy->wl_drm, buffer->name,
|
||||
dri2_surf->base.Width, dri2_surf->base.Height,
|
||||
buffer->pitch, visual);
|
||||
wl_buffer_add_listener(buf, &wl_buffer_listener, dri2_surf);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -232,6 +267,8 @@ dri2_process_back_buffer(struct dri2_egl_surface *dri2_surf, unsigned format)
|
||||
switch (dri2_surf->type) {
|
||||
case DRI2_WINDOW_SURFACE:
|
||||
/* allocate a front buffer for our double-buffered window*/
|
||||
if (dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT] != NULL)
|
||||
break;
|
||||
dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT] =
|
||||
dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen,
|
||||
__DRI_BUFFER_FRONT_LEFT, format,
|
||||
@@ -289,6 +326,12 @@ dri2_release_buffers(struct dri2_egl_surface *dri2_surf)
|
||||
dri2_egl_display(dri2_surf->base.Resource.Display);
|
||||
int i;
|
||||
|
||||
if (dri2_surf->third_buffer) {
|
||||
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
|
||||
dri2_surf->third_buffer);
|
||||
dri2_surf->third_buffer = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < __DRI_BUFFER_COUNT; ++i) {
|
||||
if (dri2_surf->dri_buffers[i]) {
|
||||
switch (i) {
|
||||
@@ -309,6 +352,76 @@ dri2_release_buffers(struct dri2_egl_surface *dri2_surf)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
pointer_swap(const void **p1, const void **p2)
|
||||
{
|
||||
const void *tmp = *p1;
|
||||
*p1 = *p2;
|
||||
*p2 = tmp;
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_third_buffer(struct dri2_egl_surface *dri2_surf)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy =
|
||||
dri2_egl_display(dri2_surf->base.Resource.Display);
|
||||
|
||||
if (dri2_surf->third_buffer == NULL)
|
||||
return;
|
||||
|
||||
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
|
||||
dri2_surf->third_buffer);
|
||||
dri2_surf->third_buffer = NULL;
|
||||
|
||||
if (dri2_surf->wl_drm_buffer[WL_BUFFER_THIRD])
|
||||
wl_buffer_destroy(dri2_surf->wl_drm_buffer[WL_BUFFER_THIRD]);
|
||||
dri2_surf->wl_drm_buffer[WL_BUFFER_THIRD] = NULL;
|
||||
dri2_surf->wl_buffer_lock[WL_BUFFER_THIRD] = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
swap_wl_buffers(struct dri2_egl_surface *dri2_surf,
|
||||
enum wayland_buffer_type a, enum wayland_buffer_type b)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
tmp = dri2_surf->wl_buffer_lock[a];
|
||||
dri2_surf->wl_buffer_lock[a] = dri2_surf->wl_buffer_lock[b];
|
||||
dri2_surf->wl_buffer_lock[b] = tmp;
|
||||
|
||||
pointer_swap((const void **) &dri2_surf->wl_drm_buffer[a],
|
||||
(const void **) &dri2_surf->wl_drm_buffer[b]);
|
||||
}
|
||||
|
||||
static void
|
||||
swap_back_and_third(struct dri2_egl_surface *dri2_surf)
|
||||
{
|
||||
if (dri2_surf->wl_buffer_lock[WL_BUFFER_THIRD])
|
||||
destroy_third_buffer(dri2_surf);
|
||||
|
||||
pointer_swap((const void **) &dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT],
|
||||
(const void **) &dri2_surf->third_buffer);
|
||||
|
||||
swap_wl_buffers(dri2_surf, WL_BUFFER_BACK, WL_BUFFER_THIRD);
|
||||
}
|
||||
|
||||
static void
|
||||
dri2_prior_buffer_creation(struct dri2_egl_surface *dri2_surf,
|
||||
unsigned int type)
|
||||
{
|
||||
switch (type) {
|
||||
case __DRI_BUFFER_BACK_LEFT:
|
||||
if (dri2_surf->wl_buffer_lock[WL_BUFFER_BACK])
|
||||
swap_back_and_third(dri2_surf);
|
||||
else if (dri2_surf->third_buffer)
|
||||
destroy_third_buffer(dri2_surf);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static __DRIbuffer *
|
||||
dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
|
||||
int *width, int *height,
|
||||
@@ -335,6 +448,7 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
|
||||
if (dri2_surf->wl_drm_buffer[i])
|
||||
wl_buffer_destroy(dri2_surf->wl_drm_buffer[i]);
|
||||
dri2_surf->wl_drm_buffer[i] = NULL;
|
||||
dri2_surf->wl_buffer_lock[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,6 +457,8 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
|
||||
assert(attachments[i] < __DRI_BUFFER_COUNT);
|
||||
assert(dri2_surf->buffer_count < 5);
|
||||
|
||||
dri2_prior_buffer_creation(dri2_surf, attachments[i]);
|
||||
|
||||
if (dri2_surf->dri_buffers[attachments[i]] == NULL) {
|
||||
|
||||
dri2_surf->dri_buffers[attachments[i]] =
|
||||
@@ -443,14 +559,6 @@ wayland_frame_callback(struct wl_surface *surface, void *data, uint32_t time)
|
||||
dri2_surf->block_swap_buffers = EGL_FALSE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
pointer_swap(const void **p1, const void **p2)
|
||||
{
|
||||
const void *tmp = *p1;
|
||||
*p1 = *p2;
|
||||
*p2 = tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called via eglSwapBuffers(), drv->API.SwapBuffers().
|
||||
*/
|
||||
@@ -466,8 +574,8 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
|
||||
|
||||
dri2_surf->block_swap_buffers = EGL_TRUE;
|
||||
wl_display_frame_callback(dri2_dpy->wl_dpy,
|
||||
dri2_surf->wl_win->surface,
|
||||
wayland_frame_callback, dri2_surf);
|
||||
dri2_surf->wl_win->surface,
|
||||
wayland_frame_callback, dri2_surf);
|
||||
|
||||
if (dri2_surf->type == DRI2_WINDOW_SURFACE) {
|
||||
pointer_swap(
|
||||
@@ -479,8 +587,7 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
|
||||
dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]->attachment =
|
||||
__DRI_BUFFER_BACK_LEFT;
|
||||
|
||||
pointer_swap((const void **) &dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT],
|
||||
(const void **) &dri2_surf->wl_drm_buffer[WL_BUFFER_BACK]);
|
||||
swap_wl_buffers(dri2_surf, WL_BUFFER_FRONT, WL_BUFFER_BACK);
|
||||
|
||||
if (!dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT])
|
||||
dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT] =
|
||||
@@ -493,6 +600,7 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
|
||||
wl_surface_attach(dri2_surf->wl_win->surface,
|
||||
dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT],
|
||||
dri2_surf->dx, dri2_surf->dy);
|
||||
dri2_surf->wl_buffer_lock[WL_BUFFER_FRONT] = 1;
|
||||
|
||||
dri2_surf->wl_win->attached_width = dri2_surf->base.Width;
|
||||
dri2_surf->wl_win->attached_height = dri2_surf->base.Height;
|
||||
@@ -676,7 +784,13 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
memset(dri2_dpy, 0, sizeof *dri2_dpy);
|
||||
|
||||
disp->DriverData = (void *) dri2_dpy;
|
||||
dri2_dpy->wl_dpy = disp->PlatformDisplay;
|
||||
if (disp->PlatformDisplay == NULL) {
|
||||
dri2_dpy->wl_dpy = wl_display_connect(NULL);
|
||||
if (dri2_dpy->wl_dpy == NULL)
|
||||
goto cleanup_dpy;
|
||||
} else {
|
||||
dri2_dpy->wl_dpy = disp->PlatformDisplay;
|
||||
}
|
||||
|
||||
id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_drm", 1);
|
||||
if (id == 0)
|
||||
@@ -714,7 +828,8 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
|
||||
dri2_dpy->extensions[0] = &dri2_dpy->dri2_loader_extension.base;
|
||||
dri2_dpy->extensions[1] = &image_lookup_extension.base;
|
||||
dri2_dpy->extensions[2] = NULL;
|
||||
dri2_dpy->extensions[2] = &use_invalidate.base;
|
||||
dri2_dpy->extensions[3] = NULL;
|
||||
|
||||
if (!dri2_create_screen(disp))
|
||||
goto cleanup_driver;
|
||||
|
||||
@@ -479,10 +479,19 @@ dri2_connect(struct dri2_egl_display *dri2_dpy)
|
||||
xcb_generic_error_t *error;
|
||||
xcb_screen_iterator_t s;
|
||||
char *driver_name, *device_name;
|
||||
const xcb_query_extension_reply_t *extension;
|
||||
|
||||
xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_xfixes_id);
|
||||
xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_dri2_id);
|
||||
|
||||
extension = xcb_get_extension_data(dri2_dpy->conn, &xcb_xfixes_id);
|
||||
if (!(extension && extension->present))
|
||||
return EGL_FALSE;
|
||||
|
||||
extension = xcb_get_extension_data(dri2_dpy->conn, &xcb_dri2_id);
|
||||
if (!(extension && extension->present))
|
||||
return EGL_FALSE;
|
||||
|
||||
xfixes_query_cookie = xcb_xfixes_query_version(dri2_dpy->conn,
|
||||
XCB_XFIXES_MAJOR_VERSION,
|
||||
XCB_XFIXES_MINOR_VERSION);
|
||||
@@ -906,9 +915,7 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
goto cleanup_dpy;
|
||||
}
|
||||
|
||||
dri2_dpy->driver_name = dri2_strndup("swrast", strlen("swrast"));
|
||||
|
||||
if (!dri2_load_driver(disp))
|
||||
if (!dri2_load_driver_swrast(disp))
|
||||
goto cleanup_conn;
|
||||
|
||||
dri2_dpy->swrast_loader_extension.base.name = __DRI_SWRAST_LOADER;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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
|
||||
@@ -10,19 +12,19 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -61,9 +61,13 @@ LOCAL_LIBS += $(TOP)/src/egl/drivers/dri2/libegl_dri2.a
|
||||
ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
|
||||
EGL_LIB_DEPS += $(XCB_DRI2_LIBS)
|
||||
endif
|
||||
ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
|
||||
EGL_LIB_DEPS += -lgbm
|
||||
endif
|
||||
EGL_LIB_DEPS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB) $(WAYLAND_LIBS)
|
||||
endif
|
||||
|
||||
|
||||
ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
|
||||
LOCAL_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
|
||||
endif
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Public EGL API entrypoints
|
||||
*
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLAPI_INCLUDED
|
||||
#define EGLAPI_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLARRAY_INCLUDED
|
||||
#define EGLARRAY_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,32 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLCOMPILER_INCLUDED
|
||||
#define EGLCOMPILER_INCLUDED
|
||||
|
||||
|
||||
+91
-24
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* EGL Configuration (pixel format) functions.
|
||||
*/
|
||||
@@ -305,6 +335,7 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
mask = 0;
|
||||
break;
|
||||
}
|
||||
if (val & ~mask)
|
||||
@@ -456,8 +487,6 @@ _eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
|
||||
return EGL_FALSE;
|
||||
|
||||
switch (attr) {
|
||||
case EGL_MATCH_NATIVE_PIXMAP:
|
||||
return EGL_FALSE;
|
||||
case EGL_Y_INVERTED_NOK:
|
||||
return conf->Display->Extensions.NOK_texture_from_pixmap;
|
||||
default:
|
||||
@@ -634,7 +663,7 @@ void _eglSwapConfigs(const _EGLConfig **conf1, const _EGLConfig **conf2)
|
||||
* qsort() in that the compare function accepts an additional
|
||||
* argument.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
_eglSortConfigs(const _EGLConfig **configs, EGLint count,
|
||||
EGLint (*compare)(const _EGLConfig *, const _EGLConfig *,
|
||||
void *),
|
||||
@@ -672,34 +701,27 @@ _eglSortConfigs(const _EGLConfig **configs, EGLint count,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
_eglFallbackCompare(const _EGLConfig *conf1, const _EGLConfig *conf2,
|
||||
void *priv_data)
|
||||
{
|
||||
const _EGLConfig *criteria = (const _EGLConfig *) priv_data;
|
||||
return _eglCompareConfigs(conf1, conf2, criteria, EGL_TRUE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Typical fallback routine for eglChooseConfig
|
||||
* A helper function for implementing eglChooseConfig. See _eglFilterArray and
|
||||
* _eglSortConfigs for the meanings of match and compare.
|
||||
*/
|
||||
EGLBoolean
|
||||
_eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list,
|
||||
EGLConfig *configs, EGLint config_size, EGLint *num_configs)
|
||||
_eglFilterConfigArray(_EGLArray *array, EGLConfig *configs,
|
||||
EGLint config_size, EGLint *num_configs,
|
||||
EGLBoolean (*match)(const _EGLConfig *, void *),
|
||||
EGLint (*compare)(const _EGLConfig *, const _EGLConfig *,
|
||||
void *),
|
||||
void *priv_data)
|
||||
{
|
||||
_EGLConfig **configList, criteria;
|
||||
_EGLConfig **configList;
|
||||
EGLint i, count;
|
||||
|
||||
if (!num_configs)
|
||||
return _eglError(EGL_BAD_PARAMETER, "eglChooseConfigs");
|
||||
|
||||
if (!_eglParseConfigAttribList(&criteria, disp, attrib_list))
|
||||
return _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
|
||||
|
||||
/* get the number of matched configs */
|
||||
count = _eglFilterArray(disp->Configs, NULL, 0,
|
||||
(_EGLArrayForEach) _eglMatchConfig, (void *) &criteria);
|
||||
count = _eglFilterArray(array, NULL, 0,
|
||||
(_EGLArrayForEach) match, priv_data);
|
||||
if (!count) {
|
||||
*num_configs = count;
|
||||
return EGL_TRUE;
|
||||
@@ -710,13 +732,13 @@ _eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list,
|
||||
return _eglError(EGL_BAD_ALLOC, "eglChooseConfig(out of memory)");
|
||||
|
||||
/* get the matched configs */
|
||||
_eglFilterArray(disp->Configs, (void **) configList, count,
|
||||
(_EGLArrayForEach) _eglMatchConfig, (void *) &criteria);
|
||||
_eglFilterArray(array, (void **) configList, count,
|
||||
(_EGLArrayForEach) match, priv_data);
|
||||
|
||||
/* perform sorting of configs */
|
||||
if (configs && count) {
|
||||
_eglSortConfigs((const _EGLConfig **) configList, count,
|
||||
_eglFallbackCompare, (void *) &criteria);
|
||||
compare, priv_data);
|
||||
count = MIN2(count, config_size);
|
||||
for (i = 0; i < count; i++)
|
||||
configs[i] = _eglGetConfigHandle(configList[i]);
|
||||
@@ -730,6 +752,41 @@ _eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list,
|
||||
}
|
||||
|
||||
|
||||
static EGLBoolean
|
||||
_eglFallbackMatch(const _EGLConfig *conf, void *priv_data)
|
||||
{
|
||||
return _eglMatchConfig(conf, (const _EGLConfig *) priv_data);
|
||||
}
|
||||
|
||||
|
||||
static EGLint
|
||||
_eglFallbackCompare(const _EGLConfig *conf1, const _EGLConfig *conf2,
|
||||
void *priv_data)
|
||||
{
|
||||
return _eglCompareConfigs(conf1, conf2,
|
||||
(const _EGLConfig *) priv_data, EGL_TRUE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Typical fallback routine for eglChooseConfig
|
||||
*/
|
||||
EGLBoolean
|
||||
_eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list,
|
||||
EGLConfig *configs, EGLint config_size, EGLint *num_configs)
|
||||
{
|
||||
_EGLConfig criteria;
|
||||
|
||||
if (!_eglParseConfigAttribList(&criteria, disp, attrib_list))
|
||||
return _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
|
||||
|
||||
return _eglFilterConfigArray(disp->Configs,
|
||||
configs, config_size, num_configs,
|
||||
_eglFallbackMatch, _eglFallbackCompare,
|
||||
(void *) &criteria);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fallback for eglGetConfigAttrib.
|
||||
*/
|
||||
@@ -739,6 +796,16 @@ _eglGetConfigAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
|
||||
{
|
||||
if (!_eglIsConfigAttribValid(conf, attribute))
|
||||
return _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib");
|
||||
|
||||
/* nonqueryable attributes */
|
||||
switch (attribute) {
|
||||
case EGL_MATCH_NATIVE_PIXMAP:
|
||||
return _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!value)
|
||||
return _eglError(EGL_BAD_PARAMETER, "eglGetConfigAttrib");
|
||||
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLCONFIG_INCLUDED
|
||||
#define EGLCONFIG_INCLUDED
|
||||
|
||||
@@ -172,11 +202,13 @@ _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
|
||||
const _EGLConfig *criteria, EGLBoolean compare_id);
|
||||
|
||||
|
||||
PUBLIC void
|
||||
_eglSortConfigs(const _EGLConfig **configs, EGLint count,
|
||||
EGLint (*compare)(const _EGLConfig *, const _EGLConfig *,
|
||||
void *),
|
||||
void *priv_data);
|
||||
PUBLIC EGLBoolean
|
||||
_eglFilterConfigArray(_EGLArray *array, EGLConfig *configs,
|
||||
EGLint config_size, EGLint *num_configs,
|
||||
EGLBoolean (*match)(const _EGLConfig *, void *),
|
||||
EGLint (*compare)(const _EGLConfig *, const _EGLConfig *,
|
||||
void *),
|
||||
void *filter_data);
|
||||
|
||||
|
||||
extern EGLBoolean
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLCONTEXT_INCLUDED
|
||||
#define EGLCONTEXT_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "egllog.h"
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLCURRENT_INCLUDED
|
||||
#define EGLCURRENT_INCLUDED
|
||||
|
||||
|
||||
+12
-13
@@ -1,8 +1,8 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
*
|
||||
* Copyright 2008 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
|
||||
@@ -10,23 +10,22 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal EGL defines
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Functions related to EGLDisplay.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLDISPLAY_INCLUDED
|
||||
#define EGLDISPLAY_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Functions for choosing and opening/loading device drivers.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLDRIVER_INCLUDED
|
||||
#define EGLDRIVER_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 <string.h>
|
||||
#include "egltypedefs.h"
|
||||
#include "egldriver.h"
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "eglglobals.h"
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLGLOBALS_INCLUDED
|
||||
#define EGLGLOBALS_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,32 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -1,3 +1,32 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLIMAGE_INCLUDED
|
||||
#define EGLIMAGE_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Logging facility for debug/info messages.
|
||||
* _EGL_FATAL messages are printed to stderr
|
||||
|
||||
@@ -1,3 +1,32 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLLOG_INCLUDED
|
||||
#define EGLLOG_INCLUDED
|
||||
|
||||
|
||||
+14
-12
@@ -1,8 +1,10 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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
|
||||
@@ -10,19 +12,19 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
|
||||
+14
-12
@@ -1,8 +1,10 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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
|
||||
@@ -10,19 +12,19 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLMODE_INCLUDED
|
||||
#define EGLMODE_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Chia-I Wu <olvaffe@gmail.com>
|
||||
* 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLMUTEX_INCLUDED
|
||||
#define EGLMUTEX_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Ideas for screen management extension to EGL.
|
||||
*
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLSCREEN_INCLUDED
|
||||
#define EGLSCREEN_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* String utils.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010-2011 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLSTRING_INCLUDED
|
||||
#define EGLSTRING_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Surface-related functions.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLSURFACE_INCLUDED
|
||||
#define EGLSURFACE_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 <string.h>
|
||||
|
||||
#include "eglsync.h"
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLSYNC_INCLUDED
|
||||
#define EGLSYNC_INCLUDED
|
||||
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
|
||||
* Copyright 2010 LunarG, 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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 EGLTYPEDEFS_INCLUDED
|
||||
#define EGLTYPEDEFS_INCLUDED
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ depend:
|
||||
clean:
|
||||
rm -rf libwayland-drm.a $(wayland_drm_OBJECTS) \
|
||||
$(GEN_SOURCES) $(GEN_HEADERS)
|
||||
rm -f depend depend.bak
|
||||
|
||||
install:
|
||||
@echo -n ""
|
||||
|
||||
@@ -88,17 +88,17 @@ drm_create_buffer(struct wl_client *client, struct wl_drm *drm,
|
||||
{
|
||||
struct wl_drm_buffer *buffer;
|
||||
|
||||
buffer = malloc(sizeof *buffer);
|
||||
buffer = calloc(1, sizeof *buffer);
|
||||
if (buffer == NULL) {
|
||||
wl_client_post_no_memory(client);
|
||||
return;
|
||||
}
|
||||
|
||||
buffer->drm = drm;
|
||||
buffer->buffer.compositor = NULL;
|
||||
buffer->buffer.width = width;
|
||||
buffer->buffer.height = height;
|
||||
buffer->buffer.visual = visual;
|
||||
buffer->buffer.client = client;
|
||||
|
||||
if (!visual || visual->object.interface != &wl_visual_interface) {
|
||||
wl_client_post_error(client, &drm->object,
|
||||
|
||||
+40
-40
@@ -53,7 +53,7 @@ if env['drm']:
|
||||
# Needed by some state trackers
|
||||
SConscript('winsys/sw/null/SConscript')
|
||||
|
||||
if env['platform'] != 'embedded':
|
||||
if not env['embedded']:
|
||||
SConscript('state_trackers/vega/SConscript')
|
||||
SConscript('state_trackers/egl/SConscript')
|
||||
|
||||
@@ -66,8 +66,8 @@ if env['platform'] != 'embedded':
|
||||
if env['dri'] and env['xorg']:
|
||||
SConscript('state_trackers/xorg/SConscript')
|
||||
|
||||
if env['platform'] == 'windows':
|
||||
SConscript('state_trackers/wgl/SConscript')
|
||||
if env['platform'] == 'windows':
|
||||
SConscript('state_trackers/wgl/SConscript')
|
||||
|
||||
#
|
||||
# Winsys
|
||||
@@ -83,55 +83,55 @@ SConscript([
|
||||
'targets/graw-null/SConscript',
|
||||
])
|
||||
|
||||
if env['platform'] != 'embedded':
|
||||
if not env['embedded']:
|
||||
SConscript([
|
||||
'targets/egl-static/SConscript'
|
||||
])
|
||||
|
||||
if env['x11']:
|
||||
SConscript([
|
||||
'targets/graw-xlib/SConscript',
|
||||
'targets/libgl-xlib/SConscript',
|
||||
])
|
||||
|
||||
if env['platform'] == 'windows':
|
||||
SConscript([
|
||||
'targets/graw-gdi/SConscript',
|
||||
'targets/libgl-gdi/SConscript',
|
||||
])
|
||||
|
||||
if env['dri']:
|
||||
SConscript([
|
||||
'targets/SConscript.dri',
|
||||
'targets/dri-swrast/SConscript',
|
||||
'targets/dri-vmwgfx/SConscript',
|
||||
#'targets/dri-nouveau/SConscript',
|
||||
])
|
||||
if env['drm_intel']:
|
||||
if env['x11']:
|
||||
SConscript([
|
||||
'targets/dri-i915/SConscript',
|
||||
'targets/dri-i965/SConscript',
|
||||
])
|
||||
if env['drm_radeon']:
|
||||
SConscript([
|
||||
'targets/dri-r300/SConscript',
|
||||
'targets/dri-r600/SConscript',
|
||||
'targets/graw-xlib/SConscript',
|
||||
'targets/libgl-xlib/SConscript',
|
||||
])
|
||||
|
||||
if env['xorg'] and env['drm']:
|
||||
SConscript([
|
||||
#'targets/xorg-i915/SConscript',
|
||||
#'targets/xorg-i965/SConscript',
|
||||
#'targets/xorg-nouveau/SConscript',
|
||||
#'targets/xorg-radeon/SConscript',
|
||||
'targets/xorg-vmwgfx/SConscript',
|
||||
])
|
||||
if env['platform'] == 'windows':
|
||||
SConscript([
|
||||
'targets/graw-gdi/SConscript',
|
||||
'targets/libgl-gdi/SConscript',
|
||||
])
|
||||
|
||||
if env['dri']:
|
||||
SConscript([
|
||||
'targets/SConscript.dri',
|
||||
'targets/dri-swrast/SConscript',
|
||||
'targets/dri-vmwgfx/SConscript',
|
||||
#'targets/dri-nouveau/SConscript',
|
||||
])
|
||||
if env['drm_intel']:
|
||||
SConscript([
|
||||
'targets/dri-i915/SConscript',
|
||||
'targets/dri-i965/SConscript',
|
||||
])
|
||||
if env['drm_radeon']:
|
||||
SConscript([
|
||||
'targets/dri-r300/SConscript',
|
||||
'targets/dri-r600/SConscript',
|
||||
])
|
||||
|
||||
if env['xorg'] and env['drm']:
|
||||
SConscript([
|
||||
#'targets/xorg-i915/SConscript',
|
||||
#'targets/xorg-i965/SConscript',
|
||||
#'targets/xorg-nouveau/SConscript',
|
||||
#'targets/xorg-radeon/SConscript',
|
||||
'targets/xorg-vmwgfx/SConscript',
|
||||
])
|
||||
|
||||
|
||||
#
|
||||
# Unit tests & tools
|
||||
#
|
||||
|
||||
if env['platform'] != 'embedded':
|
||||
if not env['embedded']:
|
||||
SConscript('tests/unit/SConscript')
|
||||
SConscript('tests/graw/SConscript')
|
||||
|
||||
@@ -1163,6 +1163,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
|
||||
struct lp_build_loop_state lp_loop;
|
||||
const int max_vertices = 4;
|
||||
LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS];
|
||||
LLVMValueRef fetch_max;
|
||||
void *code;
|
||||
struct lp_build_sampler_soa *sampler = 0;
|
||||
LLVMValueRef ret, ret_ptr;
|
||||
@@ -1234,6 +1235,10 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
|
||||
draw_llvm_variant_key_samplers(&variant->key),
|
||||
context_ptr);
|
||||
|
||||
fetch_max = LLVMBuildSub(builder, count,
|
||||
lp_build_const_int32(gallivm, 1),
|
||||
"fetch_max");
|
||||
|
||||
#if DEBUG_STORE
|
||||
lp_build_printf(builder, "start = %d, end = %d, step = %d\n",
|
||||
start, end, step);
|
||||
@@ -1257,6 +1262,12 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
|
||||
builder,
|
||||
lp_loop.counter,
|
||||
lp_build_const_int32(gallivm, i), "");
|
||||
|
||||
/* make sure we're not out of bounds which can happen
|
||||
* if fetch_count % 4 != 0, because on the last iteration
|
||||
* a few of the 4 vertex fetches will be out of bounds */
|
||||
true_index = lp_build_min(&bld, true_index, fetch_max);
|
||||
|
||||
for (j = 0; j < draw->pt.nr_vertex_elements; ++j) {
|
||||
struct pipe_vertex_element *velem = &draw->pt.vertex_element[j];
|
||||
LLVMValueRef vb_index = lp_build_const_int32(gallivm, velem->vertex_buffer_index);
|
||||
|
||||
@@ -784,6 +784,14 @@ aaline_destroy(struct draw_stage *stage)
|
||||
|
||||
draw_free_temp_verts( stage );
|
||||
|
||||
/* restore the old entry points */
|
||||
pipe->create_fs_state = aaline->driver_create_fs_state;
|
||||
pipe->bind_fs_state = aaline->driver_bind_fs_state;
|
||||
pipe->delete_fs_state = aaline->driver_delete_fs_state;
|
||||
|
||||
pipe->bind_fragment_sampler_states = aaline->driver_bind_sampler_states;
|
||||
pipe->set_fragment_sampler_views = aaline->driver_set_sampler_views;
|
||||
|
||||
FREE( stage );
|
||||
}
|
||||
|
||||
|
||||
@@ -768,7 +768,16 @@ aapoint_reset_stipple_counter(struct draw_stage *stage)
|
||||
static void
|
||||
aapoint_destroy(struct draw_stage *stage)
|
||||
{
|
||||
struct aapoint_stage* aapoint = aapoint_stage(stage);
|
||||
struct pipe_context *pipe = stage->draw->pipe;
|
||||
|
||||
draw_free_temp_verts( stage );
|
||||
|
||||
/* restore the old entry points */
|
||||
pipe->create_fs_state = aapoint->driver_create_fs_state;
|
||||
pipe->bind_fs_state = aapoint->driver_bind_fs_state;
|
||||
pipe->delete_fs_state = aapoint->driver_delete_fs_state;
|
||||
|
||||
FREE( stage );
|
||||
}
|
||||
|
||||
|
||||
@@ -207,7 +207,11 @@ lp_disassemble(const void* func)
|
||||
}
|
||||
|
||||
raw_debug_ostream Out;
|
||||
#if HAVE_LLVM >= 0x0300
|
||||
TargetMachine *TM = T->createTargetMachine(Triple, sys::getHostCPUName(), "");
|
||||
#else
|
||||
TargetMachine *TM = T->createTargetMachine(Triple, "");
|
||||
#endif
|
||||
|
||||
#if HAVE_LLVM >= 0x0300
|
||||
unsigned int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
|
||||
@@ -287,7 +291,11 @@ lp_disassemble(const void* func)
|
||||
|
||||
pc += Size;
|
||||
|
||||
#if HAVE_LLVM >= 0x0300
|
||||
const MCInstrDesc &TID = TII->get(Inst.getOpcode());
|
||||
#else
|
||||
const TargetInstrDesc &TID = TII->get(Inst.getOpcode());
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Keep track of forward jumps to a nearby address.
|
||||
|
||||
@@ -83,8 +83,12 @@ lp_set_target_options(void)
|
||||
* to only assume a 4 bytes alignment for backwards compatibility.
|
||||
*/
|
||||
#if defined(PIPE_ARCH_X86)
|
||||
#if HAVE_LLVM >= 0x0300
|
||||
llvm::StackAlignmentOverride = 4;
|
||||
#else
|
||||
llvm::StackAlignment = 4;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG) || defined(PROFILE)
|
||||
llvm::NoFramePointerElim = true;
|
||||
|
||||
@@ -167,8 +167,8 @@ def trifan(intype, outtype):
|
||||
|
||||
def polygon(intype, outtype):
|
||||
preamble(intype, outtype, prim='polygon')
|
||||
print ' for (j = i = 0; j < nr; j+=6, i++) { '
|
||||
do_tri( intype, outtype, 'out+j', '0', 'i+1', 'i+2' );
|
||||
print ' for (j = i = 0; j < nr; j+=2, i++) { '
|
||||
line( intype, outtype, 'out+j', 'i', '(i+1)%(nr/2)' )
|
||||
print ' }'
|
||||
postamble()
|
||||
|
||||
|
||||
@@ -71,6 +71,11 @@ static void generate_linear_uint( unsigned nr,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given a primitive type and number of vertices, return the number of vertices
|
||||
* needed to draw the primitive with fill mode = PIPE_POLYGON_MODE_LINE using
|
||||
* separate lines (PIPE_PRIM_LINES).
|
||||
*/
|
||||
static unsigned nr_lines( unsigned prim,
|
||||
unsigned nr )
|
||||
{
|
||||
@@ -86,7 +91,7 @@ static unsigned nr_lines( unsigned prim,
|
||||
case PIPE_PRIM_QUAD_STRIP:
|
||||
return (nr - 2) / 2 * 8;
|
||||
case PIPE_PRIM_POLYGON:
|
||||
return (nr - 2) * 6;
|
||||
return 2 * nr; /* a line (two verts) for each polygon edge */
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "pipe/p_compiler.h"
|
||||
|
||||
|
||||
#if defined(PIPE_OS_EMBEDDED)
|
||||
#if defined(PIPE_SUBSYSTEM_EMBEDDED)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -58,8 +58,6 @@ extern "C" {
|
||||
# define os_break() __debugbreak()
|
||||
#elif defined(PIPE_OS_UNIX)
|
||||
# define os_break() kill(getpid(), SIGTRAP)
|
||||
#elif defined(PIPE_OS_EMBEDDED)
|
||||
void os_break(void);
|
||||
#else
|
||||
# define os_break() abort()
|
||||
#endif
|
||||
@@ -70,8 +68,6 @@ void os_break(void);
|
||||
*/
|
||||
#if defined(DEBUG) || defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
|
||||
# define os_abort() os_break()
|
||||
#elif defined(PIPE_OS_EMBEDDED)
|
||||
void os_abort(void);
|
||||
#else
|
||||
# define os_abort() abort()
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "util/u_debug.h" /* for assert */
|
||||
|
||||
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED) || defined(PIPE_OS_CYGWIN)
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
|
||||
|
||||
#include <pthread.h> /* POSIX threads headers */
|
||||
#include <stdio.h> /* for perror() */
|
||||
@@ -314,7 +314,7 @@ typedef int64_t pipe_condvar;
|
||||
* pipe_barrier
|
||||
*/
|
||||
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
|
||||
|
||||
typedef pthread_barrier_t pipe_barrier;
|
||||
|
||||
@@ -442,7 +442,7 @@ pipe_semaphore_wait(pipe_semaphore *sema)
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED) || defined(PIPE_OS_CYGWIN)
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
|
||||
pthread_key_t key;
|
||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||
DWORD key;
|
||||
@@ -457,7 +457,7 @@ typedef struct {
|
||||
static INLINE void
|
||||
pipe_tsd_init(pipe_tsd *tsd)
|
||||
{
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED) || defined(PIPE_OS_CYGWIN)
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
|
||||
if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
|
||||
perror("pthread_key_create(): failed to allocate key for thread specific data");
|
||||
exit(-1);
|
||||
@@ -474,7 +474,7 @@ pipe_tsd_get(pipe_tsd *tsd)
|
||||
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
|
||||
pipe_tsd_init(tsd);
|
||||
}
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED) || defined(PIPE_OS_CYGWIN)
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
|
||||
return pthread_getspecific(tsd->key);
|
||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||
assert(0);
|
||||
@@ -491,7 +491,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
|
||||
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
|
||||
pipe_tsd_init(tsd);
|
||||
}
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED) || defined(PIPE_OS_CYGWIN)
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
|
||||
if (pthread_setspecific(tsd->key, value) != 0) {
|
||||
perror("pthread_set_specific() failed");
|
||||
exit(-1);
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
|
||||
#include "pipe/p_config.h"
|
||||
|
||||
#if !defined(PIPE_OS_EMBEDDED)
|
||||
|
||||
#if defined(PIPE_OS_UNIX)
|
||||
# include <sys/time.h> /* timeval */
|
||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
|
||||
@@ -123,6 +121,3 @@ os_time_sleep(int64_t usecs)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* !PIPE_OS_EMBEDDED */
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
#include "galahad/glhd_public.h"
|
||||
#endif
|
||||
|
||||
#ifdef GALLIUM_NOOP
|
||||
#include "noop/noop_public.h"
|
||||
#endif
|
||||
|
||||
static INLINE struct pipe_screen *
|
||||
debug_screen_wrap(struct pipe_screen *screen)
|
||||
{
|
||||
@@ -38,6 +42,10 @@ debug_screen_wrap(struct pipe_screen *screen)
|
||||
screen = galahad_screen_create(screen);
|
||||
#endif
|
||||
|
||||
#if defined(GALLIUM_NOOP)
|
||||
screen = noop_screen_create(screen);
|
||||
#endif
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
|
||||
#ifndef INLINE_DEBUG_HELPER_H
|
||||
#define INLINE_DEBUG_HELPER_H
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
|
||||
/* Helper function to wrap a screen with
|
||||
* one or more debug driver: rbug, trace.
|
||||
*/
|
||||
|
||||
#ifdef GALLIUM_TRACE
|
||||
#include "trace/tr_public.h"
|
||||
#endif
|
||||
|
||||
#ifdef GALLIUM_RBUG
|
||||
#include "rbug/rbug_public.h"
|
||||
#endif
|
||||
|
||||
#ifdef GALLIUM_GALAHAD
|
||||
#include "galahad/glhd_public.h"
|
||||
#endif
|
||||
|
||||
#ifdef GALLIUM_NOOP
|
||||
#include "noop/noop_public.h"
|
||||
#endif
|
||||
|
||||
static INLINE struct pipe_screen *
|
||||
debug_screen_wrap(struct pipe_screen *screen)
|
||||
{
|
||||
#if defined(GALLIUM_RBUG)
|
||||
screen = rbug_screen_create(screen);
|
||||
#endif
|
||||
|
||||
#if defined(GALLIUM_TRACE)
|
||||
screen = trace_screen_create(screen);
|
||||
#endif
|
||||
|
||||
#if defined(GALLIUM_GALAHAD)
|
||||
screen = galahad_screen_create(screen);
|
||||
#endif
|
||||
|
||||
#if defined(GALLIUM_NOOP)
|
||||
screen = noop_screen_create(screen);
|
||||
#endif
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
void _debug_vprintf(const char *format, va_list ap)
|
||||
{
|
||||
#if defined(PIPE_OS_WINDOWS) || defined(PIPE_OS_EMBEDDED)
|
||||
#if defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_EMBEDDED)
|
||||
/* We buffer until we find a newline. */
|
||||
static char buf[4096] = {'\0'};
|
||||
size_t len = strlen(buf);
|
||||
|
||||
@@ -72,6 +72,22 @@ struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
|
||||
return upload;
|
||||
}
|
||||
|
||||
void u_upload_unmap( struct u_upload_mgr *upload )
|
||||
{
|
||||
if (upload->transfer) {
|
||||
struct pipe_box *box = &upload->transfer->box;
|
||||
if (upload->offset > box->x) {
|
||||
|
||||
pipe_buffer_flush_mapped_range(upload->pipe, upload->transfer,
|
||||
box->x, upload->offset - box->x);
|
||||
}
|
||||
pipe_transfer_unmap(upload->pipe, upload->transfer);
|
||||
pipe_transfer_destroy(upload->pipe, upload->transfer);
|
||||
upload->transfer = NULL;
|
||||
upload->map = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release old buffer.
|
||||
*
|
||||
* This must usually be called prior to firing the command stream
|
||||
@@ -84,15 +100,7 @@ struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
|
||||
void u_upload_flush( struct u_upload_mgr *upload )
|
||||
{
|
||||
/* Unmap and unreference the upload buffer. */
|
||||
if (upload->transfer) {
|
||||
if (upload->offset) {
|
||||
pipe_buffer_flush_mapped_range(upload->pipe, upload->transfer,
|
||||
0, upload->offset);
|
||||
}
|
||||
pipe_transfer_unmap(upload->pipe, upload->transfer);
|
||||
pipe_transfer_destroy(upload->pipe, upload->transfer);
|
||||
upload->transfer = NULL;
|
||||
}
|
||||
u_upload_unmap(upload);
|
||||
pipe_resource_reference( &upload->buffer, NULL );
|
||||
upload->size = 0;
|
||||
}
|
||||
@@ -172,6 +180,15 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
|
||||
|
||||
offset = MAX2(upload->offset, alloc_offset);
|
||||
|
||||
if (!upload->map) {
|
||||
upload->map = pipe_buffer_map_range(upload->pipe, upload->buffer,
|
||||
offset, upload->size - offset,
|
||||
PIPE_TRANSFER_WRITE |
|
||||
PIPE_TRANSFER_FLUSH_EXPLICIT |
|
||||
PIPE_TRANSFER_UNSYNCHRONIZED,
|
||||
&upload->transfer);
|
||||
}
|
||||
|
||||
assert(offset < upload->buffer->width0);
|
||||
assert(offset + size <= upload->buffer->width0);
|
||||
assert(size);
|
||||
@@ -223,10 +240,11 @@ enum pipe_error u_upload_buffer( struct u_upload_mgr *upload,
|
||||
struct pipe_transfer *transfer = NULL;
|
||||
const char *map = NULL;
|
||||
|
||||
map = (const char *)pipe_buffer_map(upload->pipe,
|
||||
inbuf,
|
||||
PIPE_TRANSFER_READ,
|
||||
&transfer);
|
||||
map = (const char *)pipe_buffer_map_range(upload->pipe,
|
||||
inbuf,
|
||||
offset, size,
|
||||
PIPE_TRANSFER_READ,
|
||||
&transfer);
|
||||
|
||||
if (map == NULL) {
|
||||
ret = PIPE_ERROR_OUT_OF_MEMORY;
|
||||
@@ -239,7 +257,7 @@ enum pipe_error u_upload_buffer( struct u_upload_mgr *upload,
|
||||
ret = u_upload_data( upload,
|
||||
min_out_offset,
|
||||
size,
|
||||
map + offset,
|
||||
map,
|
||||
out_offset,
|
||||
outbuf, flushed );
|
||||
|
||||
|
||||
@@ -56,15 +56,27 @@ struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
|
||||
*/
|
||||
void u_upload_destroy( struct u_upload_mgr *upload );
|
||||
|
||||
/* Unmap and release old buffer.
|
||||
/* Unmap and release old upload buffer.
|
||||
*
|
||||
* This is like u_upload_unmap() except the upload buffer is released for
|
||||
* recycling. This should be called on real hardware flushes on systems
|
||||
* that don't support the PIPE_TRANSFER_UNSYNCHRONIZED flag, as otherwise
|
||||
* the next u_upload_buffer will cause a sync on the buffer.
|
||||
*/
|
||||
|
||||
void u_upload_flush( struct u_upload_mgr *upload );
|
||||
|
||||
/**
|
||||
* Unmap upload buffer
|
||||
*
|
||||
* \param upload Upload manager
|
||||
*
|
||||
* This must usually be called prior to firing the command stream
|
||||
* which references the upload buffer, as many memory managers either
|
||||
* don't like firing a mapped buffer or cause subsequent maps of a
|
||||
* fired buffer to wait. For now, it's easiest just to grab a new
|
||||
* buffer.
|
||||
* fired buffer to wait.
|
||||
*/
|
||||
void u_upload_flush( struct u_upload_mgr *upload );
|
||||
void u_upload_unmap( struct u_upload_mgr *upload );
|
||||
|
||||
/**
|
||||
* Sub-allocate new memory from the upload buffer.
|
||||
|
||||
@@ -152,9 +152,9 @@ void u_vbuf_mgr_destroy(struct u_vbuf_mgr *mgrb)
|
||||
}
|
||||
|
||||
|
||||
static void u_vbuf_translate_begin(struct u_vbuf_mgr_priv *mgr,
|
||||
int min_index, int max_index,
|
||||
boolean *upload_flushed)
|
||||
static enum u_vbuf_return_flags
|
||||
u_vbuf_translate_begin(struct u_vbuf_mgr_priv *mgr,
|
||||
int min_index, int max_index)
|
||||
{
|
||||
struct translate_key key;
|
||||
struct translate_element *te;
|
||||
@@ -166,6 +166,7 @@ static void u_vbuf_translate_begin(struct u_vbuf_mgr_priv *mgr,
|
||||
struct pipe_resource *out_buffer = NULL;
|
||||
unsigned i, num_verts, out_offset;
|
||||
struct pipe_vertex_element new_velems[PIPE_MAX_ATTRIBS];
|
||||
boolean upload_flushed = FALSE;
|
||||
|
||||
memset(&key, 0, sizeof(key));
|
||||
memset(tr_elem_index, 0xff, sizeof(tr_elem_index));
|
||||
@@ -248,7 +249,7 @@ static void u_vbuf_translate_begin(struct u_vbuf_mgr_priv *mgr,
|
||||
u_upload_alloc(mgr->b.uploader,
|
||||
key.output_stride * min_index,
|
||||
key.output_stride * num_verts,
|
||||
&out_offset, &out_buffer, upload_flushed,
|
||||
&out_offset, &out_buffer, &upload_flushed,
|
||||
(void**)&out_map);
|
||||
|
||||
out_offset -= key.output_stride * min_index;
|
||||
@@ -308,6 +309,8 @@ static void u_vbuf_translate_begin(struct u_vbuf_mgr_priv *mgr,
|
||||
}
|
||||
|
||||
pipe_resource_reference(&out_buffer, NULL);
|
||||
|
||||
return upload_flushed ? U_VBUF_UPLOAD_FLUSHED : 0;
|
||||
}
|
||||
|
||||
static void u_vbuf_translate_end(struct u_vbuf_mgr_priv *mgr)
|
||||
@@ -510,14 +513,15 @@ void u_vbuf_mgr_set_vertex_buffers(struct u_vbuf_mgr *mgrb,
|
||||
mgr->b.nr_real_vertex_buffers = count;
|
||||
}
|
||||
|
||||
static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
|
||||
int min_index, int max_index,
|
||||
unsigned instance_count,
|
||||
boolean *upload_flushed)
|
||||
static enum u_vbuf_return_flags
|
||||
u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
|
||||
int min_index, int max_index,
|
||||
unsigned instance_count)
|
||||
{
|
||||
unsigned i, nr = mgr->ve->count;
|
||||
unsigned count = max_index + 1 - min_index;
|
||||
boolean uploaded[PIPE_MAX_ATTRIBS] = {0};
|
||||
enum u_vbuf_return_flags retval = 0;
|
||||
|
||||
for (i = 0; i < nr; i++) {
|
||||
unsigned index = mgr->ve->ve[i].vertex_buffer_index;
|
||||
@@ -537,6 +541,11 @@ static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
|
||||
} else if (vb->stride) {
|
||||
first = vb->stride * min_index;
|
||||
size = vb->stride * count;
|
||||
|
||||
/* Unusual case when stride is smaller than the format size.
|
||||
* XXX This won't work with interleaved arrays. */
|
||||
if (mgr->ve->native_format_size[i] > vb->stride)
|
||||
size += mgr->ve->native_format_size[i] - vb->stride;
|
||||
} else {
|
||||
first = 0;
|
||||
size = mgr->ve->native_format_size[i];
|
||||
@@ -551,11 +560,14 @@ static void u_vbuf_upload_buffers(struct u_vbuf_mgr_priv *mgr,
|
||||
vb->buffer_offset -= first;
|
||||
|
||||
uploaded[index] = TRUE;
|
||||
*upload_flushed = *upload_flushed || flushed;
|
||||
if (flushed)
|
||||
retval |= U_VBUF_UPLOAD_FLUSHED;
|
||||
} else {
|
||||
assert(mgr->b.real_vertex_buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void u_vbuf_mgr_compute_max_index(struct u_vbuf_mgr_priv *mgr)
|
||||
@@ -597,14 +609,13 @@ static void u_vbuf_mgr_compute_max_index(struct u_vbuf_mgr_priv *mgr)
|
||||
}
|
||||
}
|
||||
|
||||
void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
|
||||
const struct pipe_draw_info *info,
|
||||
boolean *buffers_updated,
|
||||
boolean *uploader_flushed)
|
||||
enum u_vbuf_return_flags
|
||||
u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
|
||||
const struct pipe_draw_info *info)
|
||||
{
|
||||
struct u_vbuf_mgr_priv *mgr = (struct u_vbuf_mgr_priv*)mgrb;
|
||||
boolean bufs_updated = FALSE, upload_flushed = FALSE;
|
||||
int min_index, max_index;
|
||||
enum u_vbuf_return_flags retval = 0;
|
||||
|
||||
u_vbuf_mgr_compute_max_index(mgr);
|
||||
|
||||
@@ -617,27 +628,20 @@ void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
|
||||
|
||||
/* Translate vertices with non-native layouts or formats. */
|
||||
if (mgr->incompatible_vb_layout || mgr->ve->incompatible_layout) {
|
||||
u_vbuf_translate_begin(mgr, min_index, max_index, &upload_flushed);
|
||||
retval |= u_vbuf_translate_begin(mgr, min_index, max_index);
|
||||
|
||||
if (mgr->fallback_ve) {
|
||||
bufs_updated = TRUE;
|
||||
retval |= U_VBUF_BUFFERS_UPDATED;
|
||||
}
|
||||
}
|
||||
|
||||
/* Upload user buffers. */
|
||||
if (mgr->any_user_vbs) {
|
||||
u_vbuf_upload_buffers(mgr, min_index, max_index, info->instance_count,
|
||||
&upload_flushed);
|
||||
bufs_updated = TRUE;
|
||||
}
|
||||
|
||||
/* Set the return values. */
|
||||
if (buffers_updated) {
|
||||
*buffers_updated = bufs_updated;
|
||||
}
|
||||
if (uploader_flushed) {
|
||||
*uploader_flushed = upload_flushed;
|
||||
retval |= u_vbuf_upload_buffers(mgr, min_index, max_index,
|
||||
info->instance_count);
|
||||
retval |= U_VBUF_BUFFERS_UPDATED;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
void u_vbuf_mgr_draw_end(struct u_vbuf_mgr *mgrb)
|
||||
|
||||
@@ -78,6 +78,11 @@ enum u_fetch_alignment {
|
||||
U_VERTEX_FETCH_DWORD_ALIGNED
|
||||
};
|
||||
|
||||
enum u_vbuf_return_flags {
|
||||
U_VBUF_BUFFERS_UPDATED = 1,
|
||||
U_VBUF_UPLOAD_FLUSHED = 2
|
||||
};
|
||||
|
||||
|
||||
struct u_vbuf_mgr *
|
||||
u_vbuf_mgr_create(struct pipe_context *pipe,
|
||||
@@ -105,10 +110,9 @@ void u_vbuf_mgr_set_vertex_buffers(struct u_vbuf_mgr *mgr,
|
||||
unsigned count,
|
||||
const struct pipe_vertex_buffer *bufs);
|
||||
|
||||
void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgr,
|
||||
const struct pipe_draw_info *info,
|
||||
boolean *buffers_updated,
|
||||
boolean *uploader_flushed);
|
||||
enum u_vbuf_return_flags
|
||||
u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgr,
|
||||
const struct pipe_draw_info *info);
|
||||
|
||||
void u_vbuf_mgr_draw_end(struct u_vbuf_mgr *mgr);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ C_SOURCES = \
|
||||
i915_screen.c \
|
||||
i915_prim_emit.c \
|
||||
i915_prim_vbuf.c \
|
||||
i915_query.c \
|
||||
i915_resource.c \
|
||||
i915_resource_texture.c \
|
||||
i915_resource_buffer.c \
|
||||
|
||||
@@ -16,6 +16,7 @@ i915 = env.ConvenienceLibrary(
|
||||
'i915_fpc_translate.c',
|
||||
'i915_prim_emit.c',
|
||||
'i915_prim_vbuf.c',
|
||||
'i915_query.c',
|
||||
'i915_screen.c',
|
||||
'i915_state.c',
|
||||
'i915_state_derived.c',
|
||||
|
||||
@@ -26,5 +26,20 @@ Random list of problems with i915g:
|
||||
- src/xvmc/i915_structs.h in xf86-video-intel has a few more bits of various
|
||||
commands defined. Scavenge them and see what's useful.
|
||||
|
||||
- Do smarter remapping. Right now we send everything onto tex coords 0-7.
|
||||
We could also use diffuse/specular and pack two sets of 2D coords in a single
|
||||
4D. Is it a big problem though? We're more limited by the # of texture
|
||||
indirections and the # of instructions.
|
||||
|
||||
- Leverage draw to enable more caps:
|
||||
* PIPE_CAP_TGSI_INSTANCEID
|
||||
* PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS
|
||||
|
||||
- Finish front/back face. We need to add face support to lp_build_system_values_array and use it in draw_llvm.c.
|
||||
|
||||
- Replace constants and immediates which are 0,1,-1 or a combination of those with a swizzle.
|
||||
|
||||
- i915_delete_fs_state doesn't call draw_delete_fragment_shader. Why?
|
||||
|
||||
Other bugs can be found here:
|
||||
https://bugs.freedesktop.org/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=Drivers/Gallium/i915g
|
||||
|
||||
@@ -66,7 +66,7 @@ i915_clear_emit(struct pipe_context *pipe, unsigned buffers, const float *rgba,
|
||||
else
|
||||
clear_color = (u_color.ui & 0xffff) | (u_color.ui << 16);
|
||||
|
||||
util_pack_color(rgba, PIPE_FORMAT_B8G8R8A8_UNORM, &u_color);
|
||||
util_pack_color(rgba, cbuf->format, &u_color);
|
||||
clear_color8888 = u_color.ui;
|
||||
} else
|
||||
clear_color = clear_color8888 = 0;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "i915_state.h"
|
||||
#include "i915_screen.h"
|
||||
#include "i915_surface.h"
|
||||
#include "i915_query.h"
|
||||
#include "i915_batch.h"
|
||||
#include "i915_resource.h"
|
||||
|
||||
@@ -53,13 +54,11 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
|
||||
struct i915_context *i915 = i915_context(pipe);
|
||||
struct draw_context *draw = i915->draw;
|
||||
void *mapped_indices = NULL;
|
||||
unsigned cbuf_dirty;
|
||||
|
||||
|
||||
/*
|
||||
* Ack vs contants here, helps ipers a lot.
|
||||
*/
|
||||
cbuf_dirty = i915->dirty & I915_NEW_VS_CONSTANTS;
|
||||
i915->dirty &= ~I915_NEW_VS_CONSTANTS;
|
||||
|
||||
if (i915->dirty)
|
||||
@@ -72,15 +71,13 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
|
||||
mapped_indices = i915_buffer(i915->index_buffer.buffer)->data;
|
||||
draw_set_mapped_index_buffer(draw, mapped_indices);
|
||||
|
||||
if (cbuf_dirty) {
|
||||
if (i915->constants[PIPE_SHADER_VERTEX])
|
||||
draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
|
||||
i915_buffer(i915->constants[PIPE_SHADER_VERTEX])->data,
|
||||
(i915->current.num_user_constants[PIPE_SHADER_VERTEX] *
|
||||
4 * sizeof(float)));
|
||||
else
|
||||
draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0, NULL, 0);
|
||||
}
|
||||
if (i915->constants[PIPE_SHADER_VERTEX])
|
||||
draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
|
||||
i915_buffer(i915->constants[PIPE_SHADER_VERTEX])->data,
|
||||
(i915->current.num_user_constants[PIPE_SHADER_VERTEX] *
|
||||
4 * sizeof(float)));
|
||||
else
|
||||
draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0, NULL, 0);
|
||||
|
||||
/*
|
||||
* Do the drawing
|
||||
@@ -106,7 +103,7 @@ static void i915_destroy(struct pipe_context *pipe)
|
||||
|
||||
if (i915->blitter)
|
||||
util_blitter_destroy(i915->blitter);
|
||||
|
||||
|
||||
if(i915->batch)
|
||||
i915->iws->batchbuffer_destroy(i915->batch);
|
||||
|
||||
@@ -150,6 +147,8 @@ i915_create_context(struct pipe_screen *screen, void *priv)
|
||||
/* init this before draw */
|
||||
util_slab_create(&i915->transfer_pool, sizeof(struct pipe_transfer),
|
||||
16, UTIL_SLAB_SINGLETHREADED);
|
||||
util_slab_create(&i915->texture_transfer_pool, sizeof(struct i915_transfer),
|
||||
16, UTIL_SLAB_SINGLETHREADED);
|
||||
|
||||
/* Batch stream debugging is a bit hacked up at the moment:
|
||||
*/
|
||||
@@ -170,9 +169,11 @@ i915_create_context(struct pipe_screen *screen, void *priv)
|
||||
i915_init_state_functions(i915);
|
||||
i915_init_flush_functions(i915);
|
||||
i915_init_resource_functions(i915);
|
||||
i915_init_query_functions(i915);
|
||||
|
||||
draw_install_aaline_stage(i915->draw, &i915->base);
|
||||
draw_install_aapoint_stage(i915->draw, &i915->base);
|
||||
draw_enable_point_sprites(i915->draw, TRUE);
|
||||
|
||||
/* augmented draw pipeline clobbers state functions */
|
||||
i915_init_fixup_state_functions(i915);
|
||||
|
||||
@@ -102,6 +102,8 @@ struct i915_fragment_shader
|
||||
|
||||
struct tgsi_shader_info info;
|
||||
|
||||
struct draw_fragment_shader *draw_data;
|
||||
|
||||
uint *program;
|
||||
uint program_len;
|
||||
|
||||
@@ -260,6 +262,7 @@ struct i915_context {
|
||||
int num_validation_buffers;
|
||||
|
||||
struct util_slab_mempool transfer_pool;
|
||||
struct util_slab_mempool texture_transfer_pool;
|
||||
|
||||
/** blitter/hw-clear */
|
||||
struct blitter_context* blitter;
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
|
||||
#define I915_PROGRAM_SIZE 192
|
||||
|
||||
/* Use those indices for pos/face routing, must be >= I915_TEX_UNITS */
|
||||
#define I915_SEMANTIC_POS 10
|
||||
#define I915_SEMANTIC_FACE 11
|
||||
|
||||
|
||||
/**
|
||||
@@ -67,13 +70,13 @@ struct i915_fp_compile {
|
||||
uint temp_flag; /**< Tracks temporary regs which are in use */
|
||||
uint utemp_flag; /**< Tracks TYPE_U temporary regs which are in use */
|
||||
|
||||
uint register_phases[16];
|
||||
uint nr_tex_indirect;
|
||||
uint nr_tex_insn;
|
||||
uint nr_alu_insn;
|
||||
uint nr_decl_insn;
|
||||
|
||||
boolean error; /**< Set if i915_program_error() is called */
|
||||
uint wpos_tex;
|
||||
uint NumNativeInstructions;
|
||||
uint NumNativeAluInstructions;
|
||||
uint NumNativeTexInstructions;
|
||||
|
||||
@@ -67,7 +67,7 @@ i915_get_temp(struct i915_fp_compile *p)
|
||||
{
|
||||
int bit = ffs(~p->temp_flag);
|
||||
if (!bit) {
|
||||
i915_program_error(p, "i915_get_temp: out of temporaries\n");
|
||||
i915_program_error(p, "i915_get_temp: out of temporaries");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ i915_get_utemp(struct i915_fp_compile * p)
|
||||
{
|
||||
int bit = ffs(~p->utemp_flag);
|
||||
if (!bit) {
|
||||
i915_program_error(p, "i915_get_utemp: out of temporaries\n");
|
||||
i915_program_error(p, "i915_get_utemp: out of temporaries");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -128,9 +128,13 @@ i915_emit_decl(struct i915_fp_compile *p,
|
||||
else
|
||||
return reg;
|
||||
|
||||
*(p->decl++) = (D0_DCL | D0_DEST(reg) | d0_flags);
|
||||
*(p->decl++) = D1_MBZ;
|
||||
*(p->decl++) = D2_MBZ;
|
||||
if (p->decl< p->declarations + I915_PROGRAM_SIZE) {
|
||||
*(p->decl++) = (D0_DCL | D0_DEST(reg) | d0_flags);
|
||||
*(p->decl++) = D1_MBZ;
|
||||
*(p->decl++) = D2_MBZ;
|
||||
}
|
||||
else
|
||||
i915_program_error(p, "Out of declarations");
|
||||
|
||||
p->nr_decl_insn++;
|
||||
return reg;
|
||||
@@ -187,9 +191,16 @@ i915_emit_arith(struct i915_fp_compile * p,
|
||||
p->utemp_flag = old_utemp_flag; /* restore */
|
||||
}
|
||||
|
||||
*(p->csr++) = (op | A0_DEST(dest) | mask | saturate | A0_SRC0(src0));
|
||||
*(p->csr++) = (A1_SRC0(src0) | A1_SRC1(src1));
|
||||
*(p->csr++) = (A2_SRC1(src1) | A2_SRC2(src2));
|
||||
if (p->csr< p->program + I915_PROGRAM_SIZE) {
|
||||
*(p->csr++) = (op | A0_DEST(dest) | mask | saturate | A0_SRC0(src0));
|
||||
*(p->csr++) = (A1_SRC0(src0) | A1_SRC1(src1));
|
||||
*(p->csr++) = (A2_SRC1(src1) | A2_SRC2(src2));
|
||||
}
|
||||
else
|
||||
i915_program_error(p, "Out of instructions");
|
||||
|
||||
if (GET_UREG_TYPE(dest) == REG_TYPE_R)
|
||||
p->register_phases[GET_UREG_NR(dest)] = p->nr_tex_indirect;
|
||||
|
||||
p->nr_alu_insn++;
|
||||
return dest;
|
||||
@@ -245,17 +256,31 @@ uint i915_emit_texld( struct i915_fp_compile *p,
|
||||
assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST);
|
||||
assert(dest == UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)));
|
||||
|
||||
/* is the sampler coord a texcoord input reg? */
|
||||
if (GET_UREG_TYPE(coord) != REG_TYPE_T) {
|
||||
p->nr_tex_indirect++;
|
||||
/* Output register being oC or oD defines a phase boundary */
|
||||
if (GET_UREG_TYPE(dest) == REG_TYPE_OC ||
|
||||
GET_UREG_TYPE(dest) == REG_TYPE_OD)
|
||||
p->nr_tex_indirect++;
|
||||
|
||||
/* Reading from an r# register whose contents depend on output of the
|
||||
* current phase defines a phase boundary.
|
||||
*/
|
||||
if (GET_UREG_TYPE(coord) == REG_TYPE_R &&
|
||||
p->register_phases[GET_UREG_NR(coord)] == p->nr_tex_indirect)
|
||||
p->nr_tex_indirect++;
|
||||
|
||||
if (p->csr< p->program + I915_PROGRAM_SIZE) {
|
||||
*(p->csr++) = (opcode |
|
||||
T0_DEST( dest ) |
|
||||
T0_SAMPLER( sampler ));
|
||||
|
||||
*(p->csr++) = T1_ADDRESS_REG( coord );
|
||||
*(p->csr++) = T2_MBZ;
|
||||
}
|
||||
else
|
||||
i915_program_error(p, "Out of instructions");
|
||||
|
||||
*(p->csr++) = (opcode |
|
||||
T0_DEST( dest ) |
|
||||
T0_SAMPLER( sampler ));
|
||||
|
||||
*(p->csr++) = T1_ADDRESS_REG( coord );
|
||||
*(p->csr++) = T2_MBZ;
|
||||
if (GET_UREG_TYPE(dest) == REG_TYPE_R)
|
||||
p->register_phases[GET_UREG_NR(dest)] = p->nr_tex_indirect;
|
||||
|
||||
p->nr_tex_insn++;
|
||||
}
|
||||
@@ -293,7 +318,7 @@ i915_emit_const1f(struct i915_fp_compile * p, float c0)
|
||||
}
|
||||
}
|
||||
|
||||
i915_program_error(p, "i915_emit_const1f: out of constants\n");
|
||||
i915_program_error(p, "i915_emit_const1f: out of constants");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -313,6 +338,8 @@ i915_emit_const2f(struct i915_fp_compile * p, float c0, float c1)
|
||||
if (c1 == 1.0)
|
||||
return swizzle(i915_emit_const1f(p, c0), X, ONE, Z, W);
|
||||
|
||||
// XXX emit swizzle here for 0, 1, -1 and any combination thereof
|
||||
// we can use swizzle + neg for that
|
||||
for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
|
||||
if (ifs->constant_flags[reg] == 0xf ||
|
||||
ifs->constant_flags[reg] == I915_CONSTFLAG_USER)
|
||||
@@ -329,12 +356,10 @@ i915_emit_const2f(struct i915_fp_compile * p, float c0, float c1)
|
||||
}
|
||||
}
|
||||
|
||||
i915_program_error(p, "i915_emit_const2f: out of constants\n");
|
||||
i915_program_error(p, "i915_emit_const2f: out of constants");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint
|
||||
i915_emit_const4f(struct i915_fp_compile * p,
|
||||
float c0, float c1, float c2, float c3)
|
||||
@@ -342,6 +367,9 @@ i915_emit_const4f(struct i915_fp_compile * p,
|
||||
struct i915_fragment_shader *ifs = p->shader;
|
||||
unsigned reg;
|
||||
|
||||
// XXX emit swizzle here for 0, 1, -1 and any combination thereof
|
||||
// we can use swizzle + neg for that
|
||||
printf("const %f %f %f %f\n",c0,c1,c2,c3);
|
||||
for (reg = 0; reg < I915_MAX_CONSTANT; reg++) {
|
||||
if (ifs->constant_flags[reg] == 0xf &&
|
||||
ifs->constants[reg][0] == c0 &&
|
||||
@@ -363,7 +391,7 @@ i915_emit_const4f(struct i915_fp_compile * p,
|
||||
}
|
||||
}
|
||||
|
||||
i915_program_error(p, "i915_emit_const4f: out of constants\n");
|
||||
i915_program_error(p, "i915_emit_const4f: out of constants");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
|
||||
#include "draw/draw_vertex.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Simple pass-through fragment shader to use when we don't have
|
||||
@@ -72,19 +75,33 @@ static unsigned passthrough[] =
|
||||
|
||||
|
||||
/* 1, -1/3!, 1/5!, -1/7! */
|
||||
static const float sin_constants[4] = { 1.0,
|
||||
static const float scs_sin_constants[4] = { 1.0,
|
||||
-1.0f / (3 * 2 * 1),
|
||||
1.0f / (5 * 4 * 3 * 2 * 1),
|
||||
-1.0f / (7 * 6 * 5 * 4 * 3 * 2 * 1)
|
||||
};
|
||||
|
||||
/* 1, -1/2!, 1/4!, -1/6! */
|
||||
static const float cos_constants[4] = { 1.0,
|
||||
static const float scs_cos_constants[4] = { 1.0,
|
||||
-1.0f / (2 * 1),
|
||||
1.0f / (4 * 3 * 2 * 1),
|
||||
-1.0f / (6 * 5 * 4 * 3 * 2 * 1)
|
||||
};
|
||||
|
||||
/* 2*pi, -(2*pi)^3/3!, (2*pi)^5/5!, -(2*pi)^7/7! */
|
||||
static const float sin_constants[4] = { 2.0 * M_PI,
|
||||
-8.0f * M_PI * M_PI * M_PI / (3 * 2 * 1),
|
||||
32.0f * M_PI * M_PI * M_PI * M_PI * M_PI / (5 * 4 * 3 * 2 * 1),
|
||||
-128.0f * M_PI * M_PI * M_PI * M_PI * M_PI * M_PI * M_PI / (7 * 6 * 5 * 4 * 3 * 2 * 1)
|
||||
};
|
||||
|
||||
/* 1, -(2*pi)^2/2!, (2*pi)^4/4!, -(2*pi)^6/6! */
|
||||
static const float cos_constants[4] = { 1.0,
|
||||
-4.0f * M_PI * M_PI / (2 * 1),
|
||||
16.0f * M_PI * M_PI * M_PI * M_PI / (4 * 3 * 2 * 1),
|
||||
-64.0f * M_PI * M_PI * M_PI * M_PI * M_PI * M_PI / (6 * 5 * 4 * 3 * 2 * 1)
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -185,12 +202,12 @@ src_vector(struct i915_fp_compile *p,
|
||||
|
||||
switch (sem_name) {
|
||||
case TGSI_SEMANTIC_POSITION:
|
||||
debug_printf("SKIP SEM POS\n");
|
||||
/*
|
||||
assert(p->wpos_tex != -1);
|
||||
src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL);
|
||||
*/
|
||||
break;
|
||||
{
|
||||
/* for fragcoord */
|
||||
int real_tex_unit = get_mapping(fs, I915_SEMANTIC_POS);
|
||||
src = i915_emit_decl(p, REG_TYPE_T, T_TEX0 + real_tex_unit, D0_CHANNEL_ALL);
|
||||
break;
|
||||
}
|
||||
case TGSI_SEMANTIC_COLOR:
|
||||
if (sem_ind == 0) {
|
||||
src = i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL);
|
||||
@@ -212,6 +229,13 @@ src_vector(struct i915_fp_compile *p,
|
||||
src = i915_emit_decl(p, REG_TYPE_T, T_TEX0 + real_tex_unit, D0_CHANNEL_ALL);
|
||||
break;
|
||||
}
|
||||
case TGSI_SEMANTIC_FACE:
|
||||
{
|
||||
/* for back/front faces */
|
||||
int real_tex_unit = get_mapping(fs, I915_SEMANTIC_FACE);
|
||||
src = i915_emit_decl(p, REG_TYPE_T, T_TEX0 + real_tex_unit, D0_CHANNEL_X);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
i915_program_error(p, "Bad source->Index");
|
||||
return 0;
|
||||
@@ -237,7 +261,6 @@ src_vector(struct i915_fp_compile *p,
|
||||
source->Register.SwizzleZ,
|
||||
source->Register.SwizzleW);
|
||||
|
||||
|
||||
/* There's both negate-all-components and per-component negation.
|
||||
* Try to handle both here.
|
||||
*/
|
||||
@@ -252,6 +275,9 @@ src_vector(struct i915_fp_compile *p,
|
||||
/* XXX enable these assertions, or fix things */
|
||||
assert(!source->Register.Absolute);
|
||||
#endif
|
||||
if (source->Register.Absolute)
|
||||
debug_printf("Unhandled absolute value\n");
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
@@ -419,11 +445,6 @@ emit_simple_arith_swap2(struct i915_fp_compile *p,
|
||||
emit_simple_arith(p, &inst2, opcode, numArgs, fs);
|
||||
}
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Translate TGSI instruction to i915 instruction.
|
||||
*
|
||||
@@ -477,13 +498,6 @@ i915_translate_instruction(struct i915_fp_compile *p,
|
||||
|
||||
i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);
|
||||
|
||||
/* By choosing different taylor constants, could get rid of this mul:
|
||||
*/
|
||||
i915_emit_arith(p,
|
||||
A0_MUL,
|
||||
tmp, A0_DEST_CHANNEL_X, 0,
|
||||
tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0);
|
||||
|
||||
/*
|
||||
* t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
|
||||
* t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, 1
|
||||
@@ -516,6 +530,18 @@ i915_translate_instruction(struct i915_fp_compile *p,
|
||||
i915_emit_const4fv(p, cos_constants), 0);
|
||||
break;
|
||||
|
||||
case TGSI_OPCODE_DDX:
|
||||
case TGSI_OPCODE_DDY:
|
||||
/* XXX We just output 0 here */
|
||||
debug_printf("Punting DDX/DDX\n");
|
||||
src0 = get_result_vector(p, &inst->Dst[0]);
|
||||
i915_emit_arith(p,
|
||||
A0_MOV,
|
||||
get_result_vector(p, &inst->Dst[0]),
|
||||
get_result_flags(inst), 0,
|
||||
swizzle(src0, ZERO, ZERO, ZERO, ZERO), 0, 0);
|
||||
break;
|
||||
|
||||
case TGSI_OPCODE_DP2:
|
||||
src0 = src_vector(p, &inst->Src[0], fs);
|
||||
src1 = src_vector(p, &inst->Src[1], fs);
|
||||
@@ -754,9 +780,9 @@ i915_translate_instruction(struct i915_fp_compile *p,
|
||||
* t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
|
||||
* t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x
|
||||
* t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x
|
||||
* scs.x = DP4 t1, sin_constants
|
||||
* scs.x = DP4 t1, scs_sin_constants
|
||||
* t1 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1
|
||||
* scs.y = DP4 t1, cos_constants
|
||||
* scs.y = DP4 t1, scs_cos_constants
|
||||
*/
|
||||
i915_emit_arith(p,
|
||||
A0_MUL,
|
||||
@@ -791,7 +817,7 @@ i915_translate_instruction(struct i915_fp_compile *p,
|
||||
get_result_vector(p, &inst->Dst[0]),
|
||||
A0_DEST_CHANNEL_Y, 0,
|
||||
swizzle(tmp1, W, Z, Y, X),
|
||||
i915_emit_const4fv(p, sin_constants), 0);
|
||||
i915_emit_const4fv(p, scs_sin_constants), 0);
|
||||
}
|
||||
|
||||
if (writemask & TGSI_WRITEMASK_X) {
|
||||
@@ -806,7 +832,7 @@ i915_translate_instruction(struct i915_fp_compile *p,
|
||||
get_result_vector(p, &inst->Dst[0]),
|
||||
A0_DEST_CHANNEL_X, 0,
|
||||
swizzle(tmp, ONE, Z, Y, X),
|
||||
i915_emit_const4fv(p, cos_constants), 0);
|
||||
i915_emit_const4fv(p, scs_cos_constants), 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -853,13 +879,6 @@ i915_translate_instruction(struct i915_fp_compile *p,
|
||||
|
||||
i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);
|
||||
|
||||
/* By choosing different taylor constants, could get rid of this mul:
|
||||
*/
|
||||
i915_emit_arith(p,
|
||||
A0_MUL,
|
||||
tmp, A0_DEST_CHANNEL_X, 0,
|
||||
tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0);
|
||||
|
||||
/*
|
||||
* t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
|
||||
* t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x
|
||||
@@ -907,7 +926,7 @@ i915_translate_instruction(struct i915_fp_compile *p,
|
||||
break;
|
||||
|
||||
case TGSI_OPCODE_SNE:
|
||||
/* if we're neither < nor > then we're != */
|
||||
/* if we're < or > then we're != */
|
||||
src0 = src_vector(p, &inst->Src[0], fs);
|
||||
src1 = src_vector(p, &inst->Src[1], fs);
|
||||
tmp = i915_get_utemp(p);
|
||||
@@ -1070,9 +1089,11 @@ i915_translate_instructions(struct i915_fp_compile *p,
|
||||
for (i = parse.FullToken.FullDeclaration.Range.First;
|
||||
i <= parse.FullToken.FullDeclaration.Range.Last;
|
||||
i++) {
|
||||
assert(i < I915_MAX_TEMPORARY);
|
||||
/* XXX just use shader->info->file_mask[TGSI_FILE_TEMPORARY] */
|
||||
p->temp_flag |= (1 << i); /* mark temp as used */
|
||||
if (i >= I915_MAX_TEMPORARY)
|
||||
debug_printf("Too many temps (%d)\n",i);
|
||||
else
|
||||
/* XXX just use shader->info->file_mask[TGSI_FILE_TEMPORARY] */
|
||||
p->temp_flag |= (1 << i); /* mark temp as used */
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1144,6 +1165,8 @@ i915_init_compile(struct i915_context *i915,
|
||||
ifs->num_constants = 0;
|
||||
memset(ifs->constant_flags, 0, sizeof(ifs->constant_flags));
|
||||
|
||||
memset(&p->register_phases, 0, sizeof(p->register_phases));
|
||||
|
||||
for (i = 0; i < I915_TEX_UNITS; i++)
|
||||
ifs->generic_mapping[i] = -1;
|
||||
|
||||
@@ -1161,8 +1184,6 @@ i915_init_compile(struct i915_context *i915,
|
||||
p->temp_flag = ~0x0 << I915_MAX_TEMPORARY;
|
||||
p->utemp_flag = ~0x7;
|
||||
|
||||
p->wpos_tex = -1;
|
||||
|
||||
/* initialize the first program word */
|
||||
*(p->decl++) = _3DSTATE_PIXEL_SHADER_PROGRAM;
|
||||
|
||||
@@ -1181,7 +1202,7 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
|
||||
unsigned long decl_size = (unsigned long) (p->decl - p->declarations);
|
||||
|
||||
if (p->nr_tex_indirect > I915_MAX_TEX_INDIRECT)
|
||||
i915_program_error(p, "Exceeded max nr indirect texture lookups");
|
||||
debug_printf("Exceeded max nr indirect texture lookups\n");
|
||||
|
||||
if (p->nr_tex_insn > I915_MAX_TEX_INSN)
|
||||
i915_program_error(p, "Exceeded max TEX instructions");
|
||||
@@ -1234,40 +1255,6 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find an unused texture coordinate slot to use for fragment WPOS.
|
||||
* Update p->fp->wpos_tex with the result (-1 if no used texcoord slot is found).
|
||||
*/
|
||||
static void
|
||||
i915_find_wpos_space(struct i915_fp_compile *p)
|
||||
{
|
||||
#if 0
|
||||
const uint inputs
|
||||
= p->shader->inputs_read | (1 << TGSI_ATTRIB_POS); /*XXX hack*/
|
||||
uint i;
|
||||
|
||||
p->wpos_tex = -1;
|
||||
|
||||
if (inputs & (1 << TGSI_ATTRIB_POS)) {
|
||||
for (i = 0; i < I915_TEX_UNITS; i++) {
|
||||
if ((inputs & (1 << (TGSI_ATTRIB_TEX0 + i))) == 0) {
|
||||
p->wpos_tex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
i915_program_error(p, "No free texcoord for wpos value");
|
||||
}
|
||||
#else
|
||||
if (p->shader->info.input_semantic_name[0] == TGSI_SEMANTIC_POSITION) {
|
||||
/* frag shader using the fragment position input */
|
||||
#if 0
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1314,7 +1301,6 @@ i915_translate_fragment_program( struct i915_context *i915,
|
||||
}
|
||||
|
||||
p = i915_init_compile(i915, fs);
|
||||
i915_find_wpos_space(p);
|
||||
|
||||
i915_translate_instructions(p, tokens, fs);
|
||||
i915_fixup_depth_write(p);
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2011 The Chromium OS authors.
|
||||
* 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 GOOGLE 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* Fake occlusion queries which return 0, it's better than crashing */
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#include "i915_context.h"
|
||||
#include "i915_query.h"
|
||||
|
||||
struct i915_query
|
||||
{
|
||||
unsigned query;
|
||||
};
|
||||
|
||||
static struct pipe_query *i915_create_query(struct pipe_context *ctx,
|
||||
unsigned query_type)
|
||||
{
|
||||
struct i915_query *query = CALLOC_STRUCT( i915_query );
|
||||
|
||||
return (struct pipe_query *)query;
|
||||
}
|
||||
|
||||
static void i915_destroy_query(struct pipe_context *ctx,
|
||||
struct pipe_query *query)
|
||||
{
|
||||
FREE(query);
|
||||
}
|
||||
|
||||
static void i915_begin_query(struct pipe_context *ctx,
|
||||
struct pipe_query *query)
|
||||
{
|
||||
}
|
||||
|
||||
static void i915_end_query(struct pipe_context *ctx, struct pipe_query *query)
|
||||
{
|
||||
}
|
||||
|
||||
static boolean i915_get_query_result(struct pipe_context *ctx,
|
||||
struct pipe_query *query,
|
||||
boolean wait,
|
||||
void *vresult)
|
||||
{
|
||||
uint64_t *result = (uint64_t*)vresult;
|
||||
|
||||
/* 2* viewport Max */
|
||||
*result = 512*1024*1024;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
i915_init_query_functions(struct i915_context *i915)
|
||||
{
|
||||
i915->base.create_query = i915_create_query;
|
||||
i915->base.destroy_query = i915_destroy_query;
|
||||
i915->base.begin_query = i915_begin_query;
|
||||
i915->base.end_query = i915_end_query;
|
||||
i915->base.get_query_result = i915_get_query_result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2011 The Chromium OS authors.
|
||||
* 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 GOOGLE 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 I915_QUERY_H
|
||||
#define I915_QUERY_H
|
||||
|
||||
struct i915_context;
|
||||
struct pipe_context;
|
||||
|
||||
void i915_init_query_functions( struct i915_context *i915 );
|
||||
|
||||
#endif /* I915_QUERY_H */
|
||||
@@ -170,6 +170,13 @@
|
||||
#define COLOR_BUF_RGB555 (1<<8)
|
||||
#define COLOR_BUF_RGB565 (2<<8)
|
||||
#define COLOR_BUF_ARGB8888 (3<<8)
|
||||
#define COLOR_BUF_YCRCB_SWAP (4<<8)
|
||||
#define COLOR_BUF_YCRCB_NORMAL (5<<8)
|
||||
#define COLOR_BUF_YCRCB_SWAPUV (6<<8)
|
||||
#define COLOR_BUF_YCRCB_SWAPUVY (7<<8)
|
||||
#define COLOR_BUF_ARGB4444 (8<<8)
|
||||
#define COLOR_BUF_ARGB1555 (9<<8)
|
||||
#define COLOR_BUF_ARGB2101010 (10<<8)
|
||||
#define DEPTH_FRMT_16_FIXED 0
|
||||
#define DEPTH_FRMT_16_FLOAT (1<<2)
|
||||
#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2)
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
static struct pipe_resource *
|
||||
i915_resource_create(struct pipe_screen *screen,
|
||||
const struct pipe_resource *template)
|
||||
const struct pipe_resource *template)
|
||||
{
|
||||
if (template->target == PIPE_BUFFER)
|
||||
return i915_buffer_create(screen, template);
|
||||
else
|
||||
return i915_texture_create(screen, template);
|
||||
return i915_texture_create(screen, template, FALSE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,15 @@ struct i915_buffer {
|
||||
boolean free_on_destroy;
|
||||
};
|
||||
|
||||
|
||||
/* Texture transfer. */
|
||||
struct i915_transfer {
|
||||
/* Base class. */
|
||||
struct pipe_transfer b;
|
||||
struct pipe_resource *staging_texture;
|
||||
};
|
||||
|
||||
|
||||
#define I915_MAX_TEXTURE_2D_LEVELS 12 /* max 2048x2048 */
|
||||
#define I915_MAX_TEXTURE_3D_LEVELS 9 /* max 256x256x256 */
|
||||
|
||||
@@ -101,7 +110,8 @@ static INLINE struct i915_buffer *i915_buffer(struct pipe_resource *resource)
|
||||
|
||||
struct pipe_resource *
|
||||
i915_texture_create(struct pipe_screen *screen,
|
||||
const struct pipe_resource *template);
|
||||
const struct pipe_resource *template,
|
||||
boolean force_untiled);
|
||||
|
||||
struct pipe_resource *
|
||||
i915_texture_from_handle(struct pipe_screen * screen,
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_rect.h"
|
||||
|
||||
#include "i915_context.h"
|
||||
#include "i915_resource.h"
|
||||
@@ -710,7 +711,7 @@ i915_texture_destroy(struct pipe_screen *screen,
|
||||
FREE(tex);
|
||||
}
|
||||
|
||||
static struct pipe_transfer *
|
||||
static struct pipe_transfer *
|
||||
i915_texture_get_transfer(struct pipe_context *pipe,
|
||||
struct pipe_resource *resource,
|
||||
unsigned level,
|
||||
@@ -719,19 +720,45 @@ i915_texture_get_transfer(struct pipe_context *pipe,
|
||||
{
|
||||
struct i915_context *i915 = i915_context(pipe);
|
||||
struct i915_texture *tex = i915_texture(resource);
|
||||
struct pipe_transfer *transfer = util_slab_alloc(&i915->transfer_pool);
|
||||
struct i915_transfer *transfer = util_slab_alloc(&i915->texture_transfer_pool);
|
||||
boolean use_staging_texture = FALSE;
|
||||
|
||||
if (transfer == NULL)
|
||||
return NULL;
|
||||
|
||||
transfer->resource = resource;
|
||||
transfer->level = level;
|
||||
transfer->usage = usage;
|
||||
transfer->box = *box;
|
||||
transfer->stride = tex->stride;
|
||||
/* FIXME: layer_stride */
|
||||
transfer->b.resource = resource;
|
||||
transfer->b.level = level;
|
||||
transfer->b.usage = usage;
|
||||
transfer->b.box = *box;
|
||||
transfer->b.stride = tex->stride;
|
||||
transfer->staging_texture = NULL;
|
||||
/* XXX: handle depth textures everyhwere*/
|
||||
transfer->b.layer_stride = 0;
|
||||
transfer->b.data = NULL;
|
||||
|
||||
return transfer;
|
||||
/* if we use staging transfers, only support textures we can render to,
|
||||
* because we need that for u_blitter */
|
||||
if (i915->blitter &&
|
||||
i915_is_format_supported(NULL, /* screen */
|
||||
transfer->b.resource->format,
|
||||
0, /* target */
|
||||
1, /* sample count */
|
||||
PIPE_BIND_RENDER_TARGET) &&
|
||||
(usage & PIPE_TRANSFER_WRITE) &&
|
||||
!(usage & (PIPE_TRANSFER_READ | PIPE_TRANSFER_DONTBLOCK | PIPE_TRANSFER_UNSYNCHRONIZED)))
|
||||
use_staging_texture = TRUE;
|
||||
|
||||
use_staging_texture = FALSE;
|
||||
|
||||
if (use_staging_texture) {
|
||||
/*
|
||||
* Allocate the untiled staging texture.
|
||||
* If the alloc fails, transfer->staging_texture is NULL and we fallback to a map()
|
||||
*/
|
||||
transfer->staging_texture = i915_texture_create(pipe->screen, resource, TRUE);
|
||||
}
|
||||
|
||||
return (struct pipe_transfer*)transfer;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -739,17 +766,33 @@ i915_transfer_destroy(struct pipe_context *pipe,
|
||||
struct pipe_transfer *transfer)
|
||||
{
|
||||
struct i915_context *i915 = i915_context(pipe);
|
||||
util_slab_free(&i915->transfer_pool, transfer);
|
||||
struct i915_transfer *itransfer = (struct i915_transfer*)transfer;
|
||||
|
||||
if ((itransfer->staging_texture) &&
|
||||
(transfer->usage & PIPE_TRANSFER_WRITE)) {
|
||||
struct pipe_box sbox;
|
||||
|
||||
u_box_origin_2d(itransfer->b.box.width, itransfer->b.box.height, &sbox);
|
||||
pipe->resource_copy_region(pipe, itransfer->b.resource, itransfer->b.level,
|
||||
itransfer->b.box.x, itransfer->b.box.y, itransfer->b.box.z,
|
||||
itransfer->staging_texture,
|
||||
0, &sbox);
|
||||
pipe->flush(pipe, NULL);
|
||||
pipe_resource_reference(&itransfer->staging_texture, NULL);
|
||||
}
|
||||
|
||||
util_slab_free(&i915->texture_transfer_pool, itransfer);
|
||||
}
|
||||
|
||||
static void *
|
||||
i915_texture_transfer_map(struct pipe_context *pipe,
|
||||
struct pipe_transfer *transfer)
|
||||
{
|
||||
struct pipe_resource *resource = transfer->resource;
|
||||
struct i915_texture *tex = i915_texture(resource);
|
||||
struct i915_transfer *itransfer = (struct i915_transfer*)transfer;
|
||||
struct pipe_resource *resource = itransfer->b.resource;
|
||||
struct i915_texture *tex = NULL;
|
||||
struct i915_winsys *iws = i915_screen(pipe->screen)->iws;
|
||||
struct pipe_box *box = &transfer->box;
|
||||
struct pipe_box *box = &itransfer->b.box;
|
||||
enum pipe_format format = resource->format;
|
||||
unsigned offset;
|
||||
char *map;
|
||||
@@ -757,18 +800,25 @@ i915_texture_transfer_map(struct pipe_context *pipe,
|
||||
if (resource->target != PIPE_TEXTURE_3D &&
|
||||
resource->target != PIPE_TEXTURE_CUBE)
|
||||
assert(box->z == 0);
|
||||
offset = i915_texture_offset(tex, transfer->level, box->z);
|
||||
|
||||
/* TODO this is a sledgehammer */
|
||||
pipe->flush(pipe, NULL);
|
||||
if (itransfer->staging_texture) {
|
||||
tex = i915_texture(itransfer->staging_texture);
|
||||
} else {
|
||||
/* TODO this is a sledgehammer */
|
||||
tex = i915_texture(resource);
|
||||
pipe->flush(pipe, NULL);
|
||||
}
|
||||
|
||||
offset = i915_texture_offset(tex, itransfer->b.level, box->z);
|
||||
|
||||
map = iws->buffer_map(iws, tex->buffer,
|
||||
(transfer->usage & PIPE_TRANSFER_WRITE) ? TRUE : FALSE);
|
||||
if (map == NULL)
|
||||
(itransfer->b.usage & PIPE_TRANSFER_WRITE) ? TRUE : FALSE);
|
||||
if (map == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return map + offset +
|
||||
box->y / util_format_get_blockheight(format) * transfer->stride +
|
||||
box->y / util_format_get_blockheight(format) * itransfer->b.stride +
|
||||
box->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
|
||||
}
|
||||
|
||||
@@ -776,14 +826,106 @@ static void
|
||||
i915_texture_transfer_unmap(struct pipe_context *pipe,
|
||||
struct pipe_transfer *transfer)
|
||||
{
|
||||
struct i915_texture *tex = i915_texture(transfer->resource);
|
||||
struct i915_transfer *itransfer = (struct i915_transfer*)transfer;
|
||||
struct i915_texture *tex = i915_texture(itransfer->b.resource);
|
||||
struct i915_winsys *iws = i915_screen(tex->b.b.screen)->iws;
|
||||
|
||||
if (itransfer->staging_texture)
|
||||
tex = i915_texture(itransfer->staging_texture);
|
||||
|
||||
iws->buffer_unmap(iws, tex->buffer);
|
||||
}
|
||||
|
||||
static void i915_transfer_inline_write( struct pipe_context *pipe,
|
||||
struct pipe_resource *resource,
|
||||
unsigned level,
|
||||
unsigned usage,
|
||||
const struct pipe_box *box,
|
||||
const void *data,
|
||||
unsigned stride,
|
||||
unsigned layer_stride)
|
||||
{
|
||||
struct pipe_transfer *transfer = NULL;
|
||||
struct i915_transfer *itransfer = NULL;
|
||||
const uint8_t *src_data = data;
|
||||
unsigned i;
|
||||
|
||||
transfer = pipe->get_transfer(pipe,
|
||||
resource,
|
||||
level,
|
||||
usage,
|
||||
box );
|
||||
if (transfer == NULL)
|
||||
goto out;
|
||||
|
||||
itransfer = (struct i915_transfer*)transfer;
|
||||
|
||||
if (itransfer->staging_texture) {
|
||||
struct i915_texture *tex = i915_texture(itransfer->staging_texture);
|
||||
enum pipe_format format = tex->b.b.format;
|
||||
struct i915_winsys *iws = i915_screen(tex->b.b.screen)->iws;
|
||||
size_t offset;
|
||||
size_t size;
|
||||
|
||||
offset = i915_texture_offset(tex, transfer->level, transfer->box.z);
|
||||
|
||||
for (i = 0; i < box->depth; i++) {
|
||||
if (!tex->b.b.last_level &&
|
||||
tex->b.b.width0 == transfer->box.width) {
|
||||
unsigned nby = util_format_get_nblocksy(format, transfer->box.y);
|
||||
assert(!offset);
|
||||
assert(!transfer->box.x);
|
||||
assert(tex->stride == transfer->stride);
|
||||
|
||||
offset += tex->stride * nby;
|
||||
size = util_format_get_2d_size(format, transfer->stride,
|
||||
transfer->box.height);
|
||||
iws->buffer_write(iws, tex->buffer, offset, size, transfer->data);
|
||||
|
||||
} else {
|
||||
unsigned nby = util_format_get_nblocksy(format, transfer->box.y);
|
||||
int i;
|
||||
offset += util_format_get_stride(format, transfer->box.x);
|
||||
size = transfer->stride;
|
||||
|
||||
for (i = 0; i < nby; i++) {
|
||||
iws->buffer_write(iws, tex->buffer, offset, size, transfer->data);
|
||||
offset += tex->stride;
|
||||
}
|
||||
}
|
||||
offset += layer_stride;
|
||||
}
|
||||
} else {
|
||||
uint8_t *map = pipe_transfer_map(pipe, &itransfer->b);
|
||||
if (map == NULL)
|
||||
goto nomap;
|
||||
|
||||
for (i = 0; i < box->depth; i++) {
|
||||
util_copy_rect(map,
|
||||
resource->format,
|
||||
itransfer->b.stride, /* bytes */
|
||||
0, 0,
|
||||
box->width,
|
||||
box->height,
|
||||
src_data,
|
||||
stride, /* bytes */
|
||||
0, 0);
|
||||
map += itransfer->b.layer_stride;
|
||||
src_data += layer_stride;
|
||||
}
|
||||
nomap:
|
||||
if (map)
|
||||
pipe_transfer_unmap(pipe, &itransfer->b);
|
||||
}
|
||||
|
||||
out:
|
||||
if (itransfer)
|
||||
pipe_transfer_destroy(pipe, &itransfer->b);
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct u_resource_vtbl i915_texture_vtbl =
|
||||
struct u_resource_vtbl i915_texture_vtbl =
|
||||
{
|
||||
i915_texture_get_handle, /* get_handle */
|
||||
i915_texture_destroy, /* resource_destroy */
|
||||
@@ -792,7 +934,7 @@ struct u_resource_vtbl i915_texture_vtbl =
|
||||
i915_texture_transfer_map, /* transfer_map */
|
||||
u_default_transfer_flush_region, /* transfer_flush_region */
|
||||
i915_texture_transfer_unmap, /* transfer_unmap */
|
||||
u_default_transfer_inline_write /* transfer_inline_write */
|
||||
i915_transfer_inline_write /* transfer_inline_write */
|
||||
};
|
||||
|
||||
|
||||
@@ -800,7 +942,8 @@ struct u_resource_vtbl i915_texture_vtbl =
|
||||
|
||||
struct pipe_resource *
|
||||
i915_texture_create(struct pipe_screen *screen,
|
||||
const struct pipe_resource *template)
|
||||
const struct pipe_resource *template,
|
||||
boolean force_untiled)
|
||||
{
|
||||
struct i915_screen *is = i915_screen(screen);
|
||||
struct i915_winsys *iws = is->iws;
|
||||
@@ -815,7 +958,10 @@ i915_texture_create(struct pipe_screen *screen,
|
||||
pipe_reference_init(&tex->b.b.reference, 1);
|
||||
tex->b.b.screen = screen;
|
||||
|
||||
tex->tiling = i915_texture_tiling(is, tex);
|
||||
if (force_untiled)
|
||||
tex->tiling = I915_TILE_NONE;
|
||||
else
|
||||
tex->tiling = i915_texture_tiling(is, tex);
|
||||
|
||||
if (is->is_i945) {
|
||||
if (!i945_texture_layout(tex))
|
||||
@@ -836,7 +982,7 @@ i915_texture_create(struct pipe_screen *screen,
|
||||
buf_usage = I915_NEW_TEXTURE;
|
||||
|
||||
tex->buffer = iws->buffer_create_tiled(iws, &tex->stride, tex->total_nblocksy,
|
||||
&tex->tiling, buf_usage);
|
||||
&tex->tiling, buf_usage);
|
||||
if (!tex->buffer)
|
||||
goto fail;
|
||||
|
||||
|
||||
@@ -109,17 +109,17 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
|
||||
case PIPE_CAP_ANISOTROPIC_FILTER:
|
||||
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
|
||||
case PIPE_CAP_NPOT_TEXTURES:
|
||||
case PIPE_CAP_POINT_SPRITE:
|
||||
case PIPE_CAP_PRIMITIVE_RESTART: /* draw module */
|
||||
case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
|
||||
case PIPE_CAP_TEXTURE_SHADOW_MAP:
|
||||
case PIPE_CAP_TWO_SIDED_STENCIL:
|
||||
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
|
||||
return 1;
|
||||
|
||||
/* Features that should be supported (boolean caps). */
|
||||
/* XXX: Just test the code */
|
||||
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
|
||||
/* XXX: No code but hw supports it */
|
||||
case PIPE_CAP_POINT_SPRITE:
|
||||
/* Also lie about these when asked to (needed for GLSL / GL 2.0) */
|
||||
return is->debug.lie ? 1 : 0;
|
||||
|
||||
@@ -129,7 +129,6 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
|
||||
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
case PIPE_CAP_TGSI_INSTANCEID:
|
||||
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
|
||||
case PIPE_CAP_SHADER_STENCIL_EXPORT:
|
||||
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
|
||||
case PIPE_CAP_TEXTURE_SWIZZLE:
|
||||
@@ -254,7 +253,7 @@ i915_get_paramf(struct pipe_screen *screen, enum pipe_cap cap)
|
||||
}
|
||||
}
|
||||
|
||||
static boolean
|
||||
boolean
|
||||
i915_is_format_supported(struct pipe_screen *screen,
|
||||
enum pipe_format format,
|
||||
enum pipe_texture_target target,
|
||||
@@ -264,7 +263,10 @@ i915_is_format_supported(struct pipe_screen *screen,
|
||||
static const enum pipe_format tex_supported[] = {
|
||||
PIPE_FORMAT_B8G8R8A8_UNORM,
|
||||
PIPE_FORMAT_B8G8R8X8_UNORM,
|
||||
PIPE_FORMAT_R8G8B8A8_UNORM,
|
||||
PIPE_FORMAT_R8G8B8X8_UNORM,
|
||||
PIPE_FORMAT_B5G6R5_UNORM,
|
||||
PIPE_FORMAT_B10G10R10A2_UNORM,
|
||||
PIPE_FORMAT_L8_UNORM,
|
||||
PIPE_FORMAT_A8_UNORM,
|
||||
PIPE_FORMAT_I8_UNORM,
|
||||
@@ -283,7 +285,12 @@ i915_is_format_supported(struct pipe_screen *screen,
|
||||
};
|
||||
static const enum pipe_format render_supported[] = {
|
||||
PIPE_FORMAT_B8G8R8A8_UNORM,
|
||||
PIPE_FORMAT_R8G8B8A8_UNORM,
|
||||
PIPE_FORMAT_B5G6R5_UNORM,
|
||||
PIPE_FORMAT_B10G10R10A2_UNORM,
|
||||
PIPE_FORMAT_L8_UNORM,
|
||||
PIPE_FORMAT_A8_UNORM,
|
||||
PIPE_FORMAT_I8_UNORM,
|
||||
PIPE_FORMAT_NONE /* list terminator */
|
||||
};
|
||||
static const enum pipe_format depth_supported[] = {
|
||||
|
||||
@@ -65,5 +65,11 @@ i915_screen(struct pipe_screen *pscreen)
|
||||
return (struct i915_screen *) pscreen;
|
||||
}
|
||||
|
||||
boolean
|
||||
i915_is_format_supported(struct pipe_screen *screen,
|
||||
enum pipe_format format,
|
||||
enum pipe_texture_target target,
|
||||
unsigned sample_count,
|
||||
unsigned tex_usage);
|
||||
|
||||
#endif /* I915_SCREEN_H */
|
||||
|
||||
@@ -146,6 +146,7 @@ i915_create_blend_state(struct pipe_context *pipe,
|
||||
if (blend->dither)
|
||||
cso_data->LIS5 |= S5_COLOR_DITHER_ENABLE;
|
||||
|
||||
/* XXX here take the target fixup into account */
|
||||
if ((blend->rt[0].colormask & PIPE_MASK_R) == 0)
|
||||
cso_data->LIS5 |= S5_WRITEDISABLE_RED;
|
||||
|
||||
@@ -246,7 +247,7 @@ i915_create_sampler_state(struct pipe_context *pipe,
|
||||
if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE)
|
||||
{
|
||||
cso->state[0] |= (SS2_SHADOW_ENABLE |
|
||||
i915_translate_compare_func(sampler->compare_func));
|
||||
i915_translate_shadow_compare_func(sampler->compare_func));
|
||||
|
||||
minFilt = FILTER_4X4_FLAT;
|
||||
magFilt = FILTER_4X4_FLAT;
|
||||
@@ -466,6 +467,7 @@ i915_create_fs_state(struct pipe_context *pipe,
|
||||
if (!ifs)
|
||||
return NULL;
|
||||
|
||||
ifs->draw_data = draw_create_fragment_shader(i915->draw, templ);
|
||||
ifs->state.tokens = tgsi_dup_tokens(templ->tokens);
|
||||
|
||||
tgsi_scan_shader(templ->tokens, &ifs->info);
|
||||
@@ -495,6 +497,8 @@ i915_bind_fs_state(struct pipe_context *pipe, void *shader)
|
||||
|
||||
i915->fs = (struct i915_fragment_shader*) shader;
|
||||
|
||||
draw_bind_fragment_shader(i915->draw, (i915->fs ? i915->fs->draw_data : NULL));
|
||||
|
||||
i915->dirty |= I915_NEW_FS;
|
||||
}
|
||||
|
||||
@@ -503,12 +507,14 @@ void i915_delete_fs_state(struct pipe_context *pipe, void *shader)
|
||||
{
|
||||
struct i915_fragment_shader *ifs = (struct i915_fragment_shader *) shader;
|
||||
|
||||
if (ifs->program)
|
||||
if (ifs->program) {
|
||||
FREE(ifs->program);
|
||||
ifs->program = NULL;
|
||||
FREE((struct tgsi_token *)ifs->state.tokens);
|
||||
ifs->state.tokens = NULL;
|
||||
}
|
||||
ifs->program_len = 0;
|
||||
|
||||
FREE((struct tgsi_token *)ifs->state.tokens);
|
||||
|
||||
FREE(ifs);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,9 +33,10 @@
|
||||
#include "i915_context.h"
|
||||
#include "i915_state.h"
|
||||
#include "i915_debug.h"
|
||||
#include "i915_fpc.h"
|
||||
#include "i915_reg.h"
|
||||
|
||||
static uint find_mapping(struct i915_fragment_shader* fs, int unit)
|
||||
static uint find_mapping(const struct i915_fragment_shader* fs, int unit)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < I915_TEX_UNITS ; i++)
|
||||
@@ -58,12 +59,12 @@ static void calculate_vertex_layout(struct i915_context *i915)
|
||||
const struct i915_fragment_shader *fs = i915->fs;
|
||||
const enum interp_mode colorInterp = i915->rasterizer->color_interp;
|
||||
struct vertex_info vinfo;
|
||||
boolean texCoords[I915_TEX_UNITS], colors[2], fog, needW;
|
||||
boolean texCoords[I915_TEX_UNITS], colors[2], fog, needW, face;
|
||||
uint i;
|
||||
int src;
|
||||
|
||||
memset(texCoords, 0, sizeof(texCoords));
|
||||
colors[0] = colors[1] = fog = needW = FALSE;
|
||||
colors[0] = colors[1] = fog = needW = face = FALSE;
|
||||
memset(&vinfo, 0, sizeof(vinfo));
|
||||
|
||||
/* Determine which fragment program inputs are needed. Setup HW vertex
|
||||
@@ -72,6 +73,10 @@ static void calculate_vertex_layout(struct i915_context *i915)
|
||||
for (i = 0; i < fs->info.num_inputs; i++) {
|
||||
switch (fs->info.input_semantic_name[i]) {
|
||||
case TGSI_SEMANTIC_POSITION:
|
||||
{
|
||||
uint unit = I915_SEMANTIC_POS;
|
||||
texCoords[find_mapping(fs, unit)] = TRUE;
|
||||
}
|
||||
break;
|
||||
case TGSI_SEMANTIC_COLOR:
|
||||
assert(fs->info.input_semantic_index[i] < 2);
|
||||
@@ -80,7 +85,6 @@ static void calculate_vertex_layout(struct i915_context *i915)
|
||||
case TGSI_SEMANTIC_GENERIC:
|
||||
{
|
||||
/* texcoords/varyings/other generic */
|
||||
/* XXX handle back/front face and point size */
|
||||
uint unit = fs->info.input_semantic_index[i];
|
||||
|
||||
texCoords[find_mapping(fs, unit)] = TRUE;
|
||||
@@ -90,7 +94,11 @@ static void calculate_vertex_layout(struct i915_context *i915)
|
||||
case TGSI_SEMANTIC_FOG:
|
||||
fog = TRUE;
|
||||
break;
|
||||
case TGSI_SEMANTIC_FACE:
|
||||
face = TRUE;
|
||||
break;
|
||||
default:
|
||||
debug_printf("Unknown input type %d\n", fs->info.input_semantic_name[i]);
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
@@ -147,6 +155,20 @@ static void calculate_vertex_layout(struct i915_context *i915)
|
||||
vinfo.hwfmt[1] |= hwtc << (i * 4);
|
||||
}
|
||||
|
||||
/* front/back face */
|
||||
if (face) {
|
||||
uint slot = find_mapping(fs, I915_SEMANTIC_FACE);
|
||||
debug_printf("Front/back face is broken\n");
|
||||
/* XXX Because of limitations in the draw module, currently src will be 0
|
||||
* for SEMANTIC_FACE, so this aliases to POS. We need to fix in the draw
|
||||
* module by adding an extra shader output.
|
||||
*/
|
||||
src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_FACE, 0);
|
||||
draw_emit_vertex_attr(&vinfo, EMIT_1F, INTERP_CONSTANT, src);
|
||||
vinfo.hwfmt[1] &= ~(TEXCOORDFMT_NOT_PRESENT << (slot * 4));
|
||||
vinfo.hwfmt[1] |= TEXCOORDFMT_1D << (slot * 4);
|
||||
}
|
||||
|
||||
draw_compute_vertex_size(&vinfo);
|
||||
|
||||
if (memcmp(&i915->current.vertex_info, &vinfo, sizeof(vinfo))) {
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_format.h"
|
||||
|
||||
#include "util/u_format.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
@@ -128,7 +130,7 @@ validate_immediate(struct i915_context *i915, unsigned *batch_space)
|
||||
static void
|
||||
emit_immediate(struct i915_context *i915)
|
||||
{
|
||||
/* remove unwatned bits and S7 */
|
||||
/* remove unwanted bits and S7 */
|
||||
unsigned dirty = (1 << I915_IMMEDIATE_S0 | 1 << I915_IMMEDIATE_S1 |
|
||||
1 << I915_IMMEDIATE_S2 | 1 << I915_IMMEDIATE_S3 |
|
||||
1 << I915_IMMEDIATE_S3 | 1 << I915_IMMEDIATE_S4 |
|
||||
@@ -341,6 +343,59 @@ emit_constants(struct i915_context *i915)
|
||||
}
|
||||
}
|
||||
|
||||
static const struct
|
||||
{
|
||||
enum pipe_format format;
|
||||
uint hw_shift_R;
|
||||
uint hw_shift_G;
|
||||
uint hw_shift_B;
|
||||
uint hw_shift_A;
|
||||
} fixup_formats[] = {
|
||||
{ PIPE_FORMAT_R8G8B8A8_UNORM, 20, 24, 28, 16 /* BGRA */},
|
||||
{ PIPE_FORMAT_L8_UNORM, 28, 28, 28, 16 /* RRRA */},
|
||||
{ PIPE_FORMAT_I8_UNORM, 28, 28, 28, 16 /* RRRA */},
|
||||
{ PIPE_FORMAT_A8_UNORM, 16, 16, 16, 16 /* AAAA */},
|
||||
{ PIPE_FORMAT_NONE, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static boolean need_fixup(struct pipe_surface* p)
|
||||
{
|
||||
enum pipe_format f;
|
||||
|
||||
/* if we don't have a surface bound yet, we don't need to fixup the shader */
|
||||
if (!p)
|
||||
return FALSE;
|
||||
|
||||
f = p->format;
|
||||
for(int i=0; fixup_formats[i].format != PIPE_FORMAT_NONE; i++)
|
||||
if (fixup_formats[i].format == f)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static uint fixup_swizzle(enum pipe_format f, uint v)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; fixup_formats[i].format != PIPE_FORMAT_NONE; i++)
|
||||
if (fixup_formats[i].format == f)
|
||||
break;
|
||||
|
||||
if (fixup_formats[i].format == PIPE_FORMAT_NONE)
|
||||
return v;
|
||||
|
||||
uint rgba = v & 0xFFFF0000;
|
||||
|
||||
v &= 0xFFFF;
|
||||
v |= ((rgba >> fixup_formats[i].hw_shift_R) & 0xF) << 28;
|
||||
v |= ((rgba >> fixup_formats[i].hw_shift_G) & 0xF) << 24;
|
||||
v |= ((rgba >> fixup_formats[i].hw_shift_B) & 0xF) << 20;
|
||||
v |= ((rgba >> fixup_formats[i].hw_shift_A) & 0xF) << 16;
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
static void
|
||||
validate_program(struct i915_context *i915, unsigned *batch_space)
|
||||
{
|
||||
@@ -350,12 +405,39 @@ validate_program(struct i915_context *i915, unsigned *batch_space)
|
||||
static void
|
||||
emit_program(struct i915_context *i915)
|
||||
{
|
||||
uint i;
|
||||
/* we should always have, at least, a pass-through program */
|
||||
assert(i915->fs->program_len > 0);
|
||||
for (i = 0; i < i915->fs->program_len; i++) {
|
||||
OUT_BATCH(i915->fs->program[i]);
|
||||
struct pipe_surface *cbuf_surface = i915->framebuffer.cbufs[0];
|
||||
boolean need_format_fixup = need_fixup(cbuf_surface);
|
||||
int i;
|
||||
int fixup_offset = -1;
|
||||
|
||||
/* we should always have, at least, a pass-through program */
|
||||
assert(i915->fs->program_len > 0);
|
||||
|
||||
if (need_format_fixup) {
|
||||
/* Find where we emit the output color */
|
||||
for (i = i915->fs->program_len - 3; i>0; i-=3) {
|
||||
uint instr = i915->fs->program[i];
|
||||
if ((instr & (REG_NR_MASK << A0_DEST_TYPE_SHIFT)) ==
|
||||
(REG_TYPE_OC << A0_DEST_TYPE_SHIFT) ) {
|
||||
/* Found it! */
|
||||
fixup_offset = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fixup_offset == -1) {
|
||||
need_format_fixup = FALSE;
|
||||
debug_printf("couldn't find fixup offset\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* emit the program to the hw */
|
||||
for (i = 0; i < i915->fs->program_len; i++) {
|
||||
if (need_format_fixup && (i == fixup_offset) ) {
|
||||
uint v = fixup_swizzle(cbuf_surface->format, i915->fs->program[i]);
|
||||
OUT_BATCH(v);
|
||||
} else
|
||||
OUT_BATCH(i915->fs->program[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -59,6 +59,31 @@ i915_translate_compare_func(unsigned func)
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE unsigned
|
||||
i915_translate_shadow_compare_func(unsigned func)
|
||||
{
|
||||
switch (func) {
|
||||
case PIPE_FUNC_NEVER:
|
||||
return COMPAREFUNC_ALWAYS;
|
||||
case PIPE_FUNC_LESS:
|
||||
return COMPAREFUNC_LEQUAL;
|
||||
case PIPE_FUNC_LEQUAL:
|
||||
return COMPAREFUNC_LESS;
|
||||
case PIPE_FUNC_GREATER:
|
||||
return COMPAREFUNC_GEQUAL;
|
||||
case PIPE_FUNC_GEQUAL:
|
||||
return COMPAREFUNC_GREATER;
|
||||
case PIPE_FUNC_NOTEQUAL:
|
||||
return COMPAREFUNC_EQUAL;
|
||||
case PIPE_FUNC_EQUAL:
|
||||
return COMPAREFUNC_NOTEQUAL;
|
||||
case PIPE_FUNC_ALWAYS:
|
||||
return COMPAREFUNC_NEVER;
|
||||
default:
|
||||
return COMPAREFUNC_NEVER;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE unsigned
|
||||
i915_translate_stencil_op(unsigned op)
|
||||
{
|
||||
|
||||
@@ -62,6 +62,7 @@ static void update_map(struct i915_context *i915,
|
||||
uint unit,
|
||||
const struct i915_texture *tex,
|
||||
const struct i915_sampler_state *sampler,
|
||||
const struct pipe_sampler_view* view,
|
||||
uint state[2]);
|
||||
|
||||
|
||||
@@ -161,9 +162,10 @@ static void update_samplers(struct i915_context *i915)
|
||||
i915->current.sampler[unit]); /* the result */
|
||||
update_map(i915,
|
||||
unit,
|
||||
texture, /* texture */
|
||||
i915->sampler[unit], /* sampler state */
|
||||
i915->current.texbuffer[unit]); /* the result */
|
||||
texture, /* texture */
|
||||
i915->sampler[unit], /* sampler state */
|
||||
i915->fragment_sampler_views[unit], /* sampler view */
|
||||
i915->current.texbuffer[unit]); /* the result */
|
||||
|
||||
i915->current.sampler_enable_nr++;
|
||||
i915->current.sampler_enable_flags |= (1 << unit);
|
||||
@@ -180,13 +182,21 @@ struct i915_tracked_state i915_hw_samplers = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Sampler views
|
||||
*/
|
||||
|
||||
static uint translate_texture_format(enum pipe_format pipeFormat)
|
||||
static uint translate_texture_format(enum pipe_format pipeFormat,
|
||||
const struct pipe_sampler_view* view)
|
||||
{
|
||||
if ( (view->swizzle_r != PIPE_SWIZZLE_RED ||
|
||||
view->swizzle_g != PIPE_SWIZZLE_GREEN ||
|
||||
view->swizzle_b != PIPE_SWIZZLE_BLUE ||
|
||||
view->swizzle_a != PIPE_SWIZZLE_ALPHA ) &&
|
||||
pipeFormat != PIPE_FORMAT_Z24_UNORM_S8_USCALED &&
|
||||
pipeFormat != PIPE_FORMAT_Z24X8_UNORM )
|
||||
debug_printf("i915: unsupported texture swizzle for format %d\n", pipeFormat);
|
||||
|
||||
switch (pipeFormat) {
|
||||
case PIPE_FORMAT_L8_UNORM:
|
||||
return MAPSURF_8BIT | MT_8BIT_L8;
|
||||
@@ -202,16 +212,16 @@ static uint translate_texture_format(enum pipe_format pipeFormat)
|
||||
return MAPSURF_16BIT | MT_16BIT_ARGB1555;
|
||||
case PIPE_FORMAT_B4G4R4A4_UNORM:
|
||||
return MAPSURF_16BIT | MT_16BIT_ARGB4444;
|
||||
case PIPE_FORMAT_B10G10R10A2_UNORM:
|
||||
return MAPSURF_32BIT | MT_32BIT_ARGB2101010;
|
||||
case PIPE_FORMAT_B8G8R8A8_UNORM:
|
||||
return MAPSURF_32BIT | MT_32BIT_ARGB8888;
|
||||
case PIPE_FORMAT_B8G8R8X8_UNORM:
|
||||
return MAPSURF_32BIT | MT_32BIT_XRGB8888;
|
||||
case PIPE_FORMAT_R8G8B8A8_UNORM:
|
||||
return MAPSURF_32BIT | MT_32BIT_ABGR8888;
|
||||
#if 0
|
||||
case PIPE_FORMAT_R8G8B8X8_UNORM:
|
||||
return MAPSURF_32BIT | MT_32BIT_XBGR8888;
|
||||
#endif
|
||||
case PIPE_FORMAT_YUYV:
|
||||
return (MAPSURF_422 | MT_422_YCRCB_NORMAL);
|
||||
case PIPE_FORMAT_UYVY:
|
||||
@@ -232,7 +242,25 @@ static uint translate_texture_format(enum pipe_format pipeFormat)
|
||||
return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
|
||||
case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
|
||||
case PIPE_FORMAT_Z24X8_UNORM:
|
||||
return (MAPSURF_32BIT | MT_32BIT_xI824);
|
||||
{
|
||||
if ( view->swizzle_r == PIPE_SWIZZLE_RED &&
|
||||
view->swizzle_g == PIPE_SWIZZLE_RED &&
|
||||
view->swizzle_b == PIPE_SWIZZLE_RED &&
|
||||
view->swizzle_a == PIPE_SWIZZLE_ONE)
|
||||
return (MAPSURF_32BIT | MT_32BIT_xA824);
|
||||
if ( view->swizzle_r == PIPE_SWIZZLE_RED &&
|
||||
view->swizzle_g == PIPE_SWIZZLE_RED &&
|
||||
view->swizzle_b == PIPE_SWIZZLE_RED &&
|
||||
view->swizzle_a == PIPE_SWIZZLE_RED)
|
||||
return (MAPSURF_32BIT | MT_32BIT_xI824);
|
||||
if ( view->swizzle_r == PIPE_SWIZZLE_ZERO &&
|
||||
view->swizzle_g == PIPE_SWIZZLE_ZERO &&
|
||||
view->swizzle_b == PIPE_SWIZZLE_ZERO &&
|
||||
view->swizzle_a == PIPE_SWIZZLE_RED)
|
||||
return (MAPSURF_32BIT | MT_32BIT_xL824);
|
||||
debug_printf("i915: unsupported depth swizzle\n");
|
||||
return (MAPSURF_32BIT | MT_32BIT_xL824);
|
||||
}
|
||||
default:
|
||||
debug_printf("i915: translate_texture_format() bad image format %x\n",
|
||||
pipeFormat);
|
||||
@@ -262,6 +290,7 @@ static void update_map(struct i915_context *i915,
|
||||
uint unit,
|
||||
const struct i915_texture *tex,
|
||||
const struct i915_sampler_state *sampler,
|
||||
const struct pipe_sampler_view* view,
|
||||
uint state[2])
|
||||
{
|
||||
const struct pipe_resource *pt = &tex->b.b;
|
||||
@@ -275,7 +304,7 @@ static void update_map(struct i915_context *i915,
|
||||
assert(height);
|
||||
assert(depth);
|
||||
|
||||
format = translate_texture_format(pt->format);
|
||||
format = translate_texture_format(pt->format, view);
|
||||
pitch = tex->stride;
|
||||
|
||||
assert(format);
|
||||
@@ -318,8 +347,9 @@ static void update_maps(struct i915_context *i915)
|
||||
|
||||
update_map(i915,
|
||||
unit,
|
||||
texture, /* texture */
|
||||
i915->sampler[unit], /* sampler state */
|
||||
texture, /* texture */
|
||||
i915->sampler[unit], /* sampler state */
|
||||
i915->fragment_sampler_views[unit], /* sampler view */
|
||||
i915->current.texbuffer[unit]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,18 @@ static unsigned translate_format(enum pipe_format format)
|
||||
return COLOR_BUF_ARGB8888;
|
||||
case PIPE_FORMAT_B5G6R5_UNORM:
|
||||
return COLOR_BUF_RGB565;
|
||||
case PIPE_FORMAT_B5G5R5A1_UNORM:
|
||||
return COLOR_BUF_ARGB1555;
|
||||
case PIPE_FORMAT_R8G8B8A8_UNORM:
|
||||
return COLOR_BUF_ARGB8888;
|
||||
case PIPE_FORMAT_B4G4R4A4_UNORM:
|
||||
return COLOR_BUF_ARGB4444;
|
||||
case PIPE_FORMAT_B10G10R10A2_UNORM:
|
||||
return COLOR_BUF_ARGB2101010;
|
||||
case PIPE_FORMAT_L8_UNORM:
|
||||
case PIPE_FORMAT_A8_UNORM:
|
||||
case PIPE_FORMAT_I8_UNORM:
|
||||
return COLOR_BUF_8BIT;
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
@@ -137,7 +149,8 @@ static void update_framebuffer(struct i915_context *i915)
|
||||
i915->static_dirty |= I915_DST_RECT;
|
||||
}
|
||||
|
||||
i915->hardware_dirty |= I915_HW_STATIC;
|
||||
/* we also send a new program to make sure the fixup for RGBA surfaces happens */
|
||||
i915->hardware_dirty |= I915_HW_STATIC | I915_HW_PROGRAM;
|
||||
|
||||
/* flush the cache in case we sample from the old renderbuffers */
|
||||
i915_set_flush_dirty(i915, I915_FLUSH_CACHE);
|
||||
|
||||
@@ -79,7 +79,7 @@ llvmpipe = env.ConvenienceLibrary(
|
||||
env.Alias('llvmpipe', llvmpipe)
|
||||
|
||||
|
||||
if env['platform'] != 'embedded':
|
||||
if not env['embedded']:
|
||||
env = env.Clone()
|
||||
|
||||
env.Prepend(LIBS = [llvmpipe] + gallium)
|
||||
|
||||
@@ -423,7 +423,7 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
|
||||
lp_jit_screen_init(screen);
|
||||
|
||||
screen->num_threads = util_cpu_caps.nr_cpus > 1 ? util_cpu_caps.nr_cpus : 0;
|
||||
#ifdef PIPE_OS_EMBEDDED
|
||||
#ifdef PIPE_SUBSYSTEM_EMBEDDED
|
||||
screen->num_threads = 0;
|
||||
#endif
|
||||
screen->num_threads = debug_get_num_option("LP_NUM_THREADS", screen->num_threads);
|
||||
|
||||
@@ -423,6 +423,70 @@ lp_tile_b8g8r8a8_unorm_unswizzle_4ub_sse2(const uint8_t * restrict src,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
lp_tile_b8g8r8x8_unorm_swizzle_4ub_sse2(uint8_t * restrict dst,
|
||||
const uint8_t * restrict src, unsigned src_stride,
|
||||
unsigned x0, unsigned y0)
|
||||
{
|
||||
__m128i *dst128 = (__m128i *) dst;
|
||||
unsigned x, y;
|
||||
|
||||
src += y0 * src_stride;
|
||||
src += x0 * sizeof(uint32_t);
|
||||
|
||||
for (y = 0; y < TILE_SIZE; y += 4) {
|
||||
const uint8_t *src_row = src;
|
||||
|
||||
for (x = 0; x < TILE_SIZE; x += 4) {
|
||||
swz4((const __m128i *) (src_row + 0 * src_stride),
|
||||
(const __m128i *) (src_row + 1 * src_stride),
|
||||
(const __m128i *) (src_row + 2 * src_stride),
|
||||
(const __m128i *) (src_row + 3 * src_stride),
|
||||
dst128 + 2, /* b */
|
||||
dst128 + 1, /* g */
|
||||
dst128 + 0, /* r */
|
||||
dst128 + 3); /* a */
|
||||
|
||||
dst128 += 4;
|
||||
src_row += sizeof(__m128i);
|
||||
}
|
||||
|
||||
src += 4 * src_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
lp_tile_b8g8r8x8_unorm_unswizzle_4ub_sse2(const uint8_t * restrict src,
|
||||
uint8_t * restrict dst, unsigned dst_stride,
|
||||
unsigned x0, unsigned y0)
|
||||
{
|
||||
unsigned int x, y;
|
||||
const __m128i *src128 = (const __m128i *) src;
|
||||
|
||||
dst += y0 * dst_stride;
|
||||
dst += x0 * sizeof(uint32_t);
|
||||
|
||||
for (y = 0; y < TILE_SIZE; y += 4) {
|
||||
const uint8_t *dst_row = dst;
|
||||
|
||||
for (x = 0; x < TILE_SIZE; x += 4) {
|
||||
unswz4( &src128[2], /* b */
|
||||
&src128[1], /* g */
|
||||
&src128[0], /* r */
|
||||
&src128[3], /* a */
|
||||
(__m128i *) (dst_row + 0 * dst_stride),
|
||||
(__m128i *) (dst_row + 1 * dst_stride),
|
||||
(__m128i *) (dst_row + 2 * dst_stride),
|
||||
(__m128i *) (dst_row + 3 * dst_stride));
|
||||
|
||||
src128 += 4;
|
||||
dst_row += sizeof(__m128i);;
|
||||
}
|
||||
|
||||
dst += 4 * dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* PIPE_ARCH_SSE */
|
||||
'''
|
||||
|
||||
@@ -446,7 +510,7 @@ def generate_swizzle(formats, dst_channel, dst_native_type, dst_suffix):
|
||||
if is_format_supported(format):
|
||||
print ' case %s:' % format.name
|
||||
func_name = 'lp_tile_%s_swizzle_%s' % (format.short_name(), dst_suffix)
|
||||
if format.name == 'PIPE_FORMAT_B8G8R8A8_UNORM':
|
||||
if format.name == 'PIPE_FORMAT_B8G8R8A8_UNORM' or format.name == 'PIPE_FORMAT_B8G8R8X8_UNORM':
|
||||
print '#ifdef PIPE_ARCH_SSE'
|
||||
print ' func = util_cpu_caps.has_sse2 ? %s_sse2 : %s;' % (func_name, func_name)
|
||||
print '#else'
|
||||
@@ -484,7 +548,7 @@ def generate_unswizzle(formats, src_channel, src_native_type, src_suffix):
|
||||
if is_format_supported(format):
|
||||
print ' case %s:' % format.name
|
||||
func_name = 'lp_tile_%s_unswizzle_%s' % (format.short_name(), src_suffix)
|
||||
if format.name == 'PIPE_FORMAT_B8G8R8A8_UNORM':
|
||||
if format.name == 'PIPE_FORMAT_B8G8R8A8_UNORM' or format.name == 'PIPE_FORMAT_B8G8R8X8_UNORM':
|
||||
print '#ifdef PIPE_ARCH_SSE'
|
||||
print ' func = util_cpu_caps.has_sse2 ? %s_sse2 : %s;' % (func_name, func_name)
|
||||
print '#else'
|
||||
|
||||
@@ -81,20 +81,6 @@ nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment,
|
||||
return bo;
|
||||
}
|
||||
|
||||
struct nouveau_bo *
|
||||
nouveau_screen_bo_user(struct pipe_screen *pscreen, void *ptr, unsigned bytes)
|
||||
{
|
||||
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
|
||||
struct nouveau_bo *bo = NULL;
|
||||
int ret;
|
||||
|
||||
ret = nouveau_bo_user(dev, ptr, bytes, &bo);
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
return bo;
|
||||
}
|
||||
|
||||
void *
|
||||
nouveau_screen_bo_map(struct pipe_screen *pscreen,
|
||||
struct nouveau_bo *bo,
|
||||
|
||||
@@ -47,8 +47,6 @@ nouveau_screen(struct pipe_screen *pscreen)
|
||||
struct nouveau_bo *
|
||||
nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment,
|
||||
unsigned usage, unsigned bind, unsigned size);
|
||||
struct nouveau_bo *
|
||||
nouveau_screen_bo_user(struct pipe_screen *pscreen, void *ptr, unsigned bytes);
|
||||
void *
|
||||
nouveau_screen_bo_map(struct pipe_screen *pscreen,
|
||||
struct nouveau_bo *pb,
|
||||
|
||||
@@ -168,6 +168,7 @@ nv50_bufctx_add_resident(struct nv50_context *nv50, int ctx,
|
||||
|
||||
if (!resource->bo)
|
||||
return;
|
||||
nv50->residents_size += sizeof(struct resident);
|
||||
|
||||
/* We don't need to reference the resource here, it will be referenced
|
||||
* in the context/state, and bufctx will be reset when state changes.
|
||||
@@ -189,6 +190,7 @@ nv50_bufctx_del_resident(struct nv50_context *nv50, int ctx,
|
||||
top = util_dynarray_pop_ptr(&nv50->residents[ctx], struct resident);
|
||||
if (rsd != top)
|
||||
*rsd = *top;
|
||||
nv50->residents_size -= sizeof(struct resident);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -201,11 +203,15 @@ nv50_bufctx_emit_relocs(struct nv50_context *nv50)
|
||||
struct util_dynarray *array;
|
||||
unsigned ctx, i, n;
|
||||
|
||||
n = nv50->residents_size / sizeof(struct resident);
|
||||
n += NV50_SCREEN_RESIDENT_BO_COUNT;
|
||||
|
||||
MARK_RING(nv50->screen->base.channel, n, n);
|
||||
|
||||
for (ctx = 0; ctx < NV50_BUFCTX_COUNT; ++ctx) {
|
||||
array = &nv50->residents[ctx];
|
||||
|
||||
n = array->size / sizeof(struct resident);
|
||||
MARK_RING(nv50->screen->base.channel, n, n);
|
||||
for (i = 0; i < n; ++i) {
|
||||
rsd = util_dynarray_element(array, struct resident, i);
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ struct nv50_context {
|
||||
struct nv50_screen *screen;
|
||||
|
||||
struct util_dynarray residents[NV50_BUFCTX_COUNT];
|
||||
unsigned residents_size;
|
||||
|
||||
uint32_t dirty;
|
||||
|
||||
@@ -156,6 +157,7 @@ void nv50_bufctx_del_resident(struct nv50_context *, int ctx,
|
||||
static INLINE void
|
||||
nv50_bufctx_reset(struct nv50_context *nv50, int ctx)
|
||||
{
|
||||
nv50->residents_size -= nv50->residents[ctx].size;
|
||||
util_dynarray_resize(&nv50->residents[ctx], 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ struct nv50_context;
|
||||
#define NV50_SCRATCH_SIZE (2 << 20)
|
||||
#define NV50_SCRATCH_NR_BUFFERS 2
|
||||
|
||||
#define NV50_SCREEN_RESIDENT_BO_COUNT 5
|
||||
|
||||
struct nv50_screen {
|
||||
struct nouveau_screen base;
|
||||
struct nouveau_winsys *nvws;
|
||||
|
||||
@@ -215,10 +215,12 @@ void
|
||||
nv50_gmtyprog_validate(struct nv50_context *nv50)
|
||||
{
|
||||
struct nouveau_channel *chan = nv50->screen->base.channel;
|
||||
struct nv50_program *gp = nv50->vertprog;
|
||||
struct nv50_program *gp = nv50->gmtyprog;
|
||||
|
||||
if (!gp) /* GP_ENABLE is updated in linkage validation */
|
||||
return;
|
||||
if (!nv50_program_validate(nv50, gp))
|
||||
return;
|
||||
return;
|
||||
|
||||
BEGIN_RING(chan, RING_3D(GP_REG_ALLOC_TEMP), 1);
|
||||
OUT_RING (chan, gp->max_gpr);
|
||||
|
||||
@@ -404,9 +404,6 @@ nv50_draw_arrays(struct nv50_context *nv50,
|
||||
struct nouveau_channel *chan = nv50->screen->base.channel;
|
||||
unsigned prim;
|
||||
|
||||
chan->flush_notify = nv50_draw_vbo_flush_notify;
|
||||
chan->user_private = nv50;
|
||||
|
||||
prim = nv50_prim_gl(mode);
|
||||
|
||||
while (instance_count--) {
|
||||
@@ -420,8 +417,6 @@ nv50_draw_arrays(struct nv50_context *nv50,
|
||||
|
||||
prim |= NV50_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
|
||||
}
|
||||
|
||||
chan->flush_notify = nv50_default_flush_notify;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -523,9 +518,6 @@ nv50_draw_elements(struct nv50_context *nv50, boolean shorten,
|
||||
unsigned prim;
|
||||
const unsigned index_size = nv50->idxbuf.index_size;
|
||||
|
||||
chan->flush_notify = nv50_draw_vbo_flush_notify;
|
||||
chan->user_private = nv50;
|
||||
|
||||
prim = nv50_prim_gl(mode);
|
||||
|
||||
if (index_bias != nv50->state.index_bias) {
|
||||
@@ -631,8 +623,6 @@ nv50_draw_elements(struct nv50_context *nv50, boolean shorten,
|
||||
prim |= NV50_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
|
||||
}
|
||||
}
|
||||
|
||||
chan->flush_notify = nv50_default_flush_notify;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -659,8 +649,12 @@ nv50_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
|
||||
|
||||
nv50_state_validate(nv50);
|
||||
|
||||
chan->flush_notify = nv50_draw_vbo_flush_notify;
|
||||
chan->user_private = nv50;
|
||||
|
||||
if (nv50->vbo_fifo) {
|
||||
nv50_push_vbo(nv50, info);
|
||||
chan->flush_notify = nv50_default_flush_notify;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -712,6 +706,7 @@ nv50_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
|
||||
info->mode, info->start, info->count,
|
||||
info->instance_count, info->index_bias);
|
||||
}
|
||||
chan->flush_notify = nv50_default_flush_notify;
|
||||
|
||||
nv50_release_user_vbufs(nv50);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user