From: Jakob Bornecrantz Date: Sat, 29 May 2010 11:31:30 +0000 (+0200) Subject: i915g: Rename winsys c file X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e7f0f6bb72c63fd6e6ddcb7a815be68682f1764c;p=mesa.git i915g: Rename winsys c file --- diff --git a/src/gallium/winsys/i915/drm/Makefile b/src/gallium/winsys/i915/drm/Makefile index a67b9e8a528..1977de1fb09 100644 --- a/src/gallium/winsys/i915/drm/Makefile +++ b/src/gallium/winsys/i915/drm/Makefile @@ -7,7 +7,7 @@ C_SOURCES = \ i915_drm_batchbuffer.c \ i915_drm_buffer.c \ i915_drm_fence.c \ - i915_drm_api.c + i915_drm_winsys.c LIBRARY_INCLUDES = $(shell pkg-config libdrm --cflags-only-I) diff --git a/src/gallium/winsys/i915/drm/i915_drm_api.c b/src/gallium/winsys/i915/drm/i915_drm_api.c deleted file mode 100644 index 5a6b45e6c9f..00000000000 --- a/src/gallium/winsys/i915/drm/i915_drm_api.c +++ /dev/null @@ -1,93 +0,0 @@ -#include - -#include "state_tracker/drm_api.h" - -#include "i915_drm_winsys.h" -#include "util/u_memory.h" - -#include "i915/i915_context.h" -#include "i915/i915_screen.h" - -#include "trace/tr_drm.h" - -/* - * Helper functions - */ - - -static void -i915_drm_get_device_id(unsigned int *device_id) -{ - char path[512]; - FILE *file; - void *shutup_gcc; - - /* - * FIXME: Fix this up to use a drm ioctl or whatever. - */ - - snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device"); - file = fopen(path, "r"); - if (!file) { - return; - } - - shutup_gcc = fgets(path, sizeof(path), file); - (void) shutup_gcc; - sscanf(path, "%x", device_id); - fclose(file); -} - -static void -i915_drm_winsys_destroy(struct i915_winsys *iws) -{ - struct i915_drm_winsys *idws = i915_drm_winsys(iws); - - drm_intel_bufmgr_destroy(idws->pools.gem); - - FREE(idws); -} - -static struct pipe_screen * -i915_drm_create_screen(struct drm_api *api, int drmFD) -{ - struct i915_drm_winsys *idws; - unsigned int deviceID; - - idws = CALLOC_STRUCT(i915_drm_winsys); - if (!idws) - return NULL; - - i915_drm_get_device_id(&deviceID); - - i915_drm_winsys_init_batchbuffer_functions(idws); - i915_drm_winsys_init_buffer_functions(idws); - i915_drm_winsys_init_fence_functions(idws); - - idws->fd = drmFD; - idws->base.pci_id = deviceID; - idws->max_batch_size = 16 * 4096; - - idws->base.destroy = i915_drm_winsys_destroy; - - idws->pools.gem = drm_intel_bufmgr_gem_init(idws->fd, idws->max_batch_size); - drm_intel_bufmgr_gem_enable_reuse(idws->pools.gem); - - idws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE); - - return i915_screen_create(&idws->base); -} - -static struct drm_api i915_drm_api = -{ - .name = "i915", - .driver_name = "i915", - .create_screen = i915_drm_create_screen, - .destroy = NULL, -}; - -struct drm_api * -drm_api_create() -{ - return trace_drm_create(&i915_drm_api); -} diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.c b/src/gallium/winsys/i915/drm/i915_drm_winsys.c new file mode 100644 index 00000000000..5a6b45e6c9f --- /dev/null +++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.c @@ -0,0 +1,93 @@ +#include + +#include "state_tracker/drm_api.h" + +#include "i915_drm_winsys.h" +#include "util/u_memory.h" + +#include "i915/i915_context.h" +#include "i915/i915_screen.h" + +#include "trace/tr_drm.h" + +/* + * Helper functions + */ + + +static void +i915_drm_get_device_id(unsigned int *device_id) +{ + char path[512]; + FILE *file; + void *shutup_gcc; + + /* + * FIXME: Fix this up to use a drm ioctl or whatever. + */ + + snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device"); + file = fopen(path, "r"); + if (!file) { + return; + } + + shutup_gcc = fgets(path, sizeof(path), file); + (void) shutup_gcc; + sscanf(path, "%x", device_id); + fclose(file); +} + +static void +i915_drm_winsys_destroy(struct i915_winsys *iws) +{ + struct i915_drm_winsys *idws = i915_drm_winsys(iws); + + drm_intel_bufmgr_destroy(idws->pools.gem); + + FREE(idws); +} + +static struct pipe_screen * +i915_drm_create_screen(struct drm_api *api, int drmFD) +{ + struct i915_drm_winsys *idws; + unsigned int deviceID; + + idws = CALLOC_STRUCT(i915_drm_winsys); + if (!idws) + return NULL; + + i915_drm_get_device_id(&deviceID); + + i915_drm_winsys_init_batchbuffer_functions(idws); + i915_drm_winsys_init_buffer_functions(idws); + i915_drm_winsys_init_fence_functions(idws); + + idws->fd = drmFD; + idws->base.pci_id = deviceID; + idws->max_batch_size = 16 * 4096; + + idws->base.destroy = i915_drm_winsys_destroy; + + idws->pools.gem = drm_intel_bufmgr_gem_init(idws->fd, idws->max_batch_size); + drm_intel_bufmgr_gem_enable_reuse(idws->pools.gem); + + idws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE); + + return i915_screen_create(&idws->base); +} + +static struct drm_api i915_drm_api = +{ + .name = "i915", + .driver_name = "i915", + .create_screen = i915_drm_create_screen, + .destroy = NULL, +}; + +struct drm_api * +drm_api_create() +{ + return trace_drm_create(&i915_drm_api); +}