Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5080 → Rev 5079

/contrib/sdk/sources/Mesa/src/gallium/dri.def
File deleted
/contrib/sdk/sources/Mesa/src/gallium/osmesa.def
File deleted
/contrib/sdk/sources/Mesa/src/gallium/Makefile
File deleted
/contrib/sdk/sources/Mesa/src/gallium/auxiliary/os/os_time.c
62,9 → 62,3
}
 
#endif
 
void
os_time_sleep(int64_t usecs)
{
 
}
/contrib/sdk/sources/Mesa/src/gallium/auxiliary/util/u_dl.c
30,17 → 30,27
#include "pipe/p_config.h"
#include "pipe/p_compiler.h"
 
#if defined(PIPE_OS_UNIX)
#include <dlfcn.h>
#endif
#if defined(PIPE_OS_WINDOWS)
#include <windows.h>
#endif
 
#include "u_dl.h"
#include "u_pointer.h"
 
void* load_library(const char *name);
void *get_proc_address(void *module, const char *proc_name);
 
struct util_dl_library *
util_dl_open(const char *filename)
{
return (struct util_dl_library *)load_library(filename);
#if defined(PIPE_OS_UNIX)
return (struct util_dl_library *)dlopen(filename, RTLD_LAZY | RTLD_GLOBAL);
#elif defined(PIPE_OS_WINDOWS)
return (struct util_dl_library *)LoadLibraryA(filename);
#else
return NULL;
#endif
}
 
 
48,7 → 58,13
util_dl_get_proc_address(struct util_dl_library *library,
const char *procname)
{
return (util_dl_proc)get_proc_address(library, procname);
#if defined(PIPE_OS_UNIX)
return (util_dl_proc) pointer_to_func(dlsym((void *)library, procname));
#elif defined(PIPE_OS_WINDOWS)
return (util_dl_proc)GetProcAddress((HMODULE)library, procname);
#else
return (util_dl_proc)NULL;
#endif
}
 
 
55,7 → 71,13
void
util_dl_close(struct util_dl_library *library)
{
#if defined(PIPE_OS_UNIX)
dlclose((void *)library);
#elif defined(PIPE_OS_WINDOWS)
FreeLibrary((HMODULE)library);
#else
(void)library;
#endif
}
 
 
62,5 → 84,11
const char *
util_dl_error(void)
{
#if defined(PIPE_OS_UNIX)
return dlerror();
#elif defined(PIPE_OS_WINDOWS)
return "unknown error";
#else
return "unknown error";
#endif
}
/contrib/sdk/sources/Mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
32,7 → 32,7
 
#include <fcntl.h>
#include <stdio.h>
//#include <libudev.h>
#include <libudev.h>
#include <xf86drm.h>
 
#ifdef HAVE_PIPE_LOADER_XCB
50,21 → 50,7
 
#define DRIVER_MAP_GALLIUM_ONLY
#include "pci_ids/pci_id_driver_map.h"
#include <kos32sys.h>
 
struct pci_device {
uint16_t domain;
uint8_t bus;
uint8_t dev;
uint8_t func;
uint16_t vendor_id;
uint16_t device_id;
uint16_t subvendor_id;
uint16_t subdevice_id;
uint32_t device_class;
uint8_t revision;
};
 
struct pipe_loader_drm_device {
struct pipe_loader_device base;
struct util_dl_library *lib;
76,23 → 62,41
static boolean
find_drm_pci_id(struct pipe_loader_drm_device *ddev)
{
struct pci_device device;
ioctl_t io;
struct udev *udev = NULL;
struct udev_device *parent, *device = NULL;
struct stat stat;
const char *pci_id;
 
io.handle = ddev->fd;
io.io_code = SRV_GET_PCI_INFO;
io.input = &device;
io.inp_size = sizeof(device);
io.output = NULL;
io.out_size = 0;
if (fstat(ddev->fd, &stat) < 0)
goto fail;
 
if (call_service(&io)!=0)
return FALSE;
udev = udev_new();
if (!udev)
goto fail;
 
ddev->base.u.pci.vendor_id = device.vendor_id;
ddev->base.u.pci.chip_id = device.device_id;
device = udev_device_new_from_devnum(udev, 'c', stat.st_rdev);
if (!device)
goto fail;
 
parent = udev_device_get_parent(device);
if (!parent)
goto fail;
 
pci_id = udev_device_get_property_value(parent, "PCI_ID");
if (!pci_id ||
sscanf(pci_id, "%x:%x", &ddev->base.u.pci.vendor_id,
&ddev->base.u.pci.chip_id) != 2)
goto fail;
 
return TRUE;
 
fail:
if (device)
udev_device_unref(device);
if (udev)
udev_unref(udev);
 
return FALSE;
}
 
static boolean
126,7 → 130,59
 
static struct pipe_loader_ops pipe_loader_drm_ops;
 
static void
pipe_loader_drm_x_auth(int fd)
{
#if HAVE_PIPE_LOADER_XCB
/* Try authenticate with the X server to give us access to devices that X
* is running on. */
xcb_connection_t *xcb_conn;
const xcb_setup_t *xcb_setup;
xcb_screen_iterator_t s;
xcb_dri2_connect_cookie_t connect_cookie;
xcb_dri2_connect_reply_t *connect;
drm_magic_t magic;
xcb_dri2_authenticate_cookie_t authenticate_cookie;
xcb_dri2_authenticate_reply_t *authenticate;
 
xcb_conn = xcb_connect(NULL, NULL);
 
if(!xcb_conn)
return;
 
xcb_setup = xcb_get_setup(xcb_conn);
 
if (!xcb_setup)
goto disconnect;
 
s = xcb_setup_roots_iterator(xcb_setup);
connect_cookie = xcb_dri2_connect_unchecked(xcb_conn, s.data->root,
XCB_DRI2_DRIVER_TYPE_DRI);
connect = xcb_dri2_connect_reply(xcb_conn, connect_cookie, NULL);
 
if (!connect || connect->driver_name_length
+ connect->device_name_length == 0) {
 
goto disconnect;
}
 
if (drmGetMagic(fd, &magic))
goto disconnect;
 
authenticate_cookie = xcb_dri2_authenticate_unchecked(xcb_conn,
s.data->root,
magic);
authenticate = xcb_dri2_authenticate_reply(xcb_conn,
authenticate_cookie,
NULL);
FREE(authenticate);
 
disconnect:
xcb_disconnect(xcb_conn);
 
#endif
}
 
boolean
pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd)
{
136,6 → 192,8
ddev->base.ops = &pipe_loader_drm_ops;
ddev->fd = fd;
 
pipe_loader_drm_x_auth(fd);
 
if (!find_drm_pci_id(ddev))
goto fail;
 
150,6 → 208,13
return FALSE;
}
 
static int
open_drm_minor(int minor)
{
char path[PATH_MAX];
snprintf(path, sizeof(path), DRM_DEV_NAME, DRM_DIR_NAME, minor);
return open(path, O_RDWR, 0);
}
 
int
pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
156,13 → 221,13
{
int i, j, fd;
 
for (i = 0, j = 0; i < 1; i++) {
fd = get_service("DISPLAY");
if (fd == 0)
for (i = 0, j = 0; i < DRM_MAX_MINOR; i++) {
fd = open_drm_minor(i);
if (fd < 0)
continue;
 
if (j >= ndev || !pipe_loader_drm_probe_fd(&devs[j], fd))
;
close(fd);
 
j++;
}
175,6 → 240,10
{
struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(*dev);
 
if (ddev->lib)
util_dl_close(ddev->lib);
 
close(ddev->fd);
FREE(ddev);
*dev = NULL;
}
/contrib/sdk/sources/Mesa/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
31,7 → 31,7
#include "util/u_dl.h"
#include "sw/null/null_sw_winsys.h"
#include "target-helpers/inline_sw_helper.h"
//#include "state_tracker/xlib_sw_winsys.h"
#include "state_tracker/xlib_sw_winsys.h"
 
struct pipe_loader_sw_device {
struct pipe_loader_device base;
/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/common/egl_g3d.c
100,8 → 100,52
const char *plat_name = NULL;
const struct native_platform *nplat = NULL;
 
switch (plat) {
case _EGL_PLATFORM_WINDOWS:
plat_name = "Windows";
#ifdef HAVE_GDI_BACKEND
nplat = native_get_gdi_platform(&egl_g3d_native_event_handler);
#endif
break;
case _EGL_PLATFORM_X11:
plat_name = "X11";
#ifdef HAVE_X11_BACKEND
nplat = native_get_x11_platform(&egl_g3d_native_event_handler);
#endif
break;
case _EGL_PLATFORM_WAYLAND:
plat_name = "wayland";
#ifdef HAVE_WAYLAND_BACKEND
nplat = native_get_wayland_platform(&egl_g3d_native_event_handler);
#endif
break;
case _EGL_PLATFORM_DRM:
plat_name = "DRM";
#ifdef HAVE_DRM_BACKEND
nplat = native_get_drm_platform(&egl_g3d_native_event_handler);
#endif
break;
case _EGL_PLATFORM_FBDEV:
plat_name = "FBDEV";
#ifdef HAVE_FBDEV_BACKEND
nplat = native_get_fbdev_platform(&egl_g3d_native_event_handler);
#endif
break;
case _EGL_PLATFORM_NULL:
plat_name = "NULL";
#ifdef HAVE_NULL_BACKEND
nplat = native_get_null_platform(&egl_g3d_native_event_handler);
#endif
break;
case _EGL_PLATFORM_ANDROID:
plat_name = "Android";
#ifdef HAVE_ANDROID_BACKEND
nplat = native_get_android_platform(&egl_g3d_native_event_handler);
#endif
break;
default:
break;
}
 
if (!nplat)
_eglLog(_EGL_WARNING, "unsupported platform %s", plat_name);
543,10 → 587,19
dpy->Extensions.MESA_drm_image = EGL_TRUE;
}
 
// if (dpy->Platform == _EGL_PLATFORM_WAYLAND && gdpy->native->buffer)
// dpy->Extensions.MESA_drm_image = EGL_TRUE;
if (dpy->Platform == _EGL_PLATFORM_WAYLAND && gdpy->native->buffer)
dpy->Extensions.MESA_drm_image = EGL_TRUE;
 
#ifdef EGL_ANDROID_image_native_buffer
if (dpy->Platform == _EGL_PLATFORM_ANDROID && gdpy->native->buffer)
dpy->Extensions.ANDROID_image_native_buffer = EGL_TRUE;
#endif
 
#ifdef EGL_WL_bind_wayland_display
if (gdpy->native->wayland_bufmgr)
dpy->Extensions.WL_bind_wayland_display = EGL_TRUE;
#endif
 
if (gdpy->native->get_param(gdpy->native, NATIVE_PARAM_PRESENT_REGION) &&
gdpy->native->get_param(gdpy->native, NATIVE_PARAM_PRESERVE_BUFFER)) {
#ifdef EGL_NOK_swap_region
/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/drm/native_drm.c
27,7 → 27,6
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <kos32sys.h>
 
#include "util/u_memory.h"
#include "egllog.h"
139,6 → 138,8
 
if (drmdpy->own_gbm) {
gbm_device_destroy(&drmdpy->gbmdrm->base.base);
if (drmdpy->fd >= 0)
close(drmdpy->fd);
}
 
FREE(drmdpy);
155,6 → 156,34
{
char *device_name = NULL;
#ifdef HAVE_LIBUDEV
struct udev *udev;
struct udev_device *device;
struct stat buf;
const char *tmp;
 
udev = udev_new();
if (fstat(fd, &buf) < 0) {
_eglLog(_EGL_WARNING, "failed to stat fd %d", fd);
goto outudev;
}
 
device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
if (device == NULL) {
_eglLog(_EGL_WARNING,
"could not create udev device for fd %d", fd);
goto outdevice;
}
 
tmp = udev_device_get_devnode(device);
if (!tmp)
goto outdevice;
device_name = strdup(tmp);
 
outdevice:
udev_device_unref(device);
outudev:
udev_unref(udev);
 
#endif
return device_name;
}
285,13 → 314,19
gbm = dpy;
 
if (gbm == NULL) {
fd = get_service("DISPLAY");
if (fd == NULL)
return NULL;
 
const char *device_name="/dev/dri/card0";
#ifdef O_CLOEXEC
fd = open(device_name, O_RDWR | O_CLOEXEC);
if (fd == -1 && errno == EINVAL)
#endif
{
fd = open(device_name, O_RDWR);
if (fd != -1)
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
}
/* FIXME: Use an internal constructor to create a gbm
* device with gallium backend directly, without setenv */
// setenv("GBM_BACKEND", "gbm_gallium_drm.so", 1);
setenv("GBM_BACKEND", "gbm_gallium_drm.so", 1);
gbm = gbm_gallium_drm_device(gbm_create_device(fd));
own_gbm = 1;
}
/contrib/sdk/sources/Mesa/src/gallium/state_trackers/egl/drm/modeset.c
61,7 → 61,6
static boolean
drm_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back)
{
#if 0
struct drm_surface *drmsurf = drm_surface(nsurf);
struct drm_display *drmdpy = drmsurf->drmdpy;
int num_framebuffers = (need_back) ? 2 : 1;
116,8 → 115,6
}
 
return TRUE;
#endif
return FALSE;
}
 
static boolean
124,6 → 121,11
drm_surface_flush_frontbuffer(struct native_surface *nsurf)
{
#ifdef DRM_MODE_FEATURE_DIRTYFB
struct drm_surface *drmsurf = drm_surface(nsurf);
struct drm_display *drmdpy = drmsurf->drmdpy;
 
if (drmsurf->front_fb.is_passive)
drmModeDirtyFB(drmdpy->fd, drmsurf->front_fb.buffer_id, NULL, 0);
#endif
 
return TRUE;
151,7 → 153,6
static boolean
drm_surface_swap_buffers(struct native_surface *nsurf)
{
#if 0
struct drm_surface *drmsurf = drm_surface(nsurf);
struct drm_crtc *drmcrtc = &drmsurf->current_crtc;
struct drm_display *drmdpy = drmsurf->drmdpy;
186,7 → 187,6
drmsurf->sequence_number++;
drmdpy->event_handler->invalid_surface(&drmdpy->base,
&drmsurf->base, drmsurf->sequence_number);
#endif
 
return TRUE;
}
229,7 → 229,6
static void
drm_surface_destroy(struct native_surface *nsurf)
{
#if 0
struct drm_surface *drmsurf = drm_surface(nsurf);
 
resource_surface_wait(drmsurf->rsurf);
246,7 → 245,6
 
resource_surface_destroy(drmsurf->rsurf);
FREE(drmsurf);
#endif
}
 
static struct drm_surface *
334,7 → 332,7
{
struct drm_display *drmdpy = drm_display(ndpy);
int idx;
#if 0
 
for (idx = 0; idx < drmdpy->resources->count_crtcs; idx++) {
boolean found_crtc = TRUE;
int i, j;
379,8 → 377,6
}
 
return drmdpy->resources->crtcs[idx];
#endif
return 0;
}
 
/**
396,7 → 392,7
struct drm_crtc *drmcrtc = &drmdpy->saved_crtcs[crtc_idx];
uint32_t crtc_id;
int err;
#if 0
 
if (drmcrtc->crtc) {
crtc_id = drmcrtc->crtc->crtc_id;
}
445,9 → 441,6
}
 
return TRUE;
#endif
return FALSE;
 
}
 
static boolean
456,7 → 449,6
const struct native_connector **nconns, int num_nconns,
const struct native_mode *nmode)
{
#if 0
struct drm_display *drmdpy = drm_display(ndpy);
struct drm_surface *drmsurf = drm_surface(nsurf);
const struct drm_mode *drmmode = drm_mode(nmode);
520,9 → 512,6
}
 
return TRUE;
#endif
return FALSE;
 
}
 
static const struct native_mode **
530,7 → 519,6
const struct native_connector *nconn,
int *num_modes)
{
#if 0
struct drm_display *drmdpy = drm_display(ndpy);
struct drm_connector *drmconn = drm_connector(nconn);
const struct native_mode **nmodes_return;
584,8 → 572,6
}
 
return nmodes_return;
#endif
return NULL;
}
 
static const struct native_connector **
592,7 → 578,6
drm_display_get_connectors(struct native_display *ndpy, int *num_connectors,
int *num_crtc)
{
#if 0
struct drm_display *drmdpy = drm_display(ndpy);
const struct native_connector **connectors;
int i;
625,8 → 610,6
*num_crtc = drmdpy->resources->count_crtcs;
 
return connectors;
#endif
return NULL;
}
 
static struct native_surface *
650,7 → 633,6
void
drm_display_fini_modeset(struct native_display *ndpy)
{
#if 0
struct drm_display *drmdpy = drm_display(ndpy);
int i;
 
691,13 → 673,11
}
 
drmdpy->base.modeset = NULL;
#endif
}
 
boolean
drm_display_init_modeset(struct native_display *ndpy)
{
#if 0
struct drm_display *drmdpy = drm_display(ndpy);
 
/* resources are fixed, unlike crtc, connector, or encoder */
722,6 → 702,6
}
 
drmdpy->base.modeset = &drm_display_modeset;
#endif
 
return TRUE;
}
/contrib/sdk/sources/Mesa/src/gallium/targets/egl-static/egl.c
309,170 → 309,3
 
return drv;
}
 
EGLBoolean
_eglError(EGLint errCode, const char *msg)
{
return EGL_FALSE;
}
 
void
_eglLog(EGLint level, const char *fmtStr, ...)
{
 
}
 
void
_eglDestroyArray(_EGLArray *array, void (*free_cb)(void *))
{
 
}
 
void
_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy, EGLint num_modes)
{
}
 
void
_eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display)
{
 
}
 
EGLScreenMESA
_eglLinkScreen(_EGLScreen *screen)
{
}
 
EGLBoolean
_eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
{
return EGL_FALSE;
}
 
void
_eglInitConfig(_EGLConfig *conf, _EGLDisplay *dpy, EGLint id)
{
}
void
_eglCleanupDisplay(_EGLDisplay *disp)
{
 
}
 
PUBLIC EGLConfig
_eglLinkConfig(_EGLConfig *conf)
{
 
}
 
EGLBoolean
_eglPutResource(_EGLResource *res)
{
return EGL_FALSE;
}
 
_EGLContext *
_eglGetCurrentContext(void)
{
return NULL;
}
 
EGLBoolean
_eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
_EGLConfig *conf, const EGLint *attrib_list)
{
return EGL_FALSE;
}
 
EGLBoolean
_eglBindContext(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read,
_EGLContext **old_ctx,
_EGLSurface **old_draw, _EGLSurface **old_read)
{
return EGL_FALSE;
}
 
PUBLIC _EGLContext *
_eglGetAPIContext(EGLenum api)
{
return NULL;
}
 
EGLBoolean
_eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf,
const EGLint *attrib_list)
{
return EGL_FALSE;
}
 
EGLint
_eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
const _EGLConfig *criteria, EGLBoolean compare_id)
{
return 0;
}
 
EGLBoolean
_eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria)
{
return EGL_FALSE;
}
 
EGLBoolean
_eglParseConfigAttribList(_EGLConfig *conf, _EGLDisplay *dpy,
const EGLint *attrib_list)
{
return EGL_FALSE;
}
 
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 *priv_data)
{
return EGL_FALSE;
}
 
EGLBoolean
_eglInitImage(_EGLImage *img, _EGLDisplay *dpy)
{
 
return EGL_TRUE;
}
 
EGLint
_eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
const EGLint *attrib_list)
{
return 0;
}
 
EGLBoolean
_eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type,
const EGLint *attrib_list)
{
 
return EGL_TRUE;
}
 
void
_eglGetResource(_EGLResource *res)
{
}
 
EGLBoolean
_eglCheckResource(void *res, int type, _EGLDisplay *dpy)
{
 
return EGL_TRUE;
}
 
void
_eglInitDriverFallbacks(_EGLDriver *drv)
{
}
 
/contrib/sdk/sources/Mesa/src/gallium/targets/gbm/gbm.c
34,9 → 34,13
static const char *
get_library_search_path(void)
{
const char *search_path;
const char *search_path = NULL;
 
search_path = "/kolibrios/drivers/gallium-pipe/";
/* don't allow setuid apps to use GBM_BACKENDS_PATH */
if (geteuid() == getuid())
search_path = getenv("GBM_BACKENDS_PATH");
if (search_path == NULL)
search_path = PIPE_SEARCH_DIR;
 
return search_path;
}
/contrib/sdk/sources/Mesa/src/gallium/include/state_tracker/xlib_sw_winsys.h
2,7 → 2,7
#define XLIB_SW_WINSYS_H
 
#include "state_tracker/sw_winsys.h"
//#include <X11/Xlib.h>
#include <X11/Xlib.h>
 
 
struct pipe_screen;
/contrib/sdk/sources/Mesa/src/gbm/main/backend.c
44,8 → 44,8
};
 
static const struct backend_desc backends[] = {
{ "gbm_dri.dll", &gbm_dri_backend },
{ "gbm_gallium_drm.dll", NULL },
{ "gbm_dri.so", &gbm_dri_backend }
// { "gbm_gallium_drm.so", NULL },
};
 
#if 0
/contrib/sdk/sources/Mesa/Makefile
29,7 → 29,7
 
EGL_DEFS = -DHAVE_DRM_PLATFORM -D__unix__ -DMESA_EGL_NO_X11_HEADERS -D_EGL_BUILT_IN_DRIVER_DRI2
 
SUBDIRS = src/glsl src/mapi src/gallium src/egl src/mesa
SUBDIRS = src/egl src/glsl src/mapi src/mesa
 
# targets