summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2009-01-08 15:47:23 -0800
committerCorbin Simpson <[email protected]>2009-02-01 23:30:20 -0800
commit3b37cb49b821dd0c59fd5361ada6c0df9ac07db8 (patch)
treea52b04a9df6da65a7dcaaa3333999f171d512594 /src
parent3e09a07a265d5ee75b110954d160a73d83793c40 (diff)
gallium-r300: Make it build.
Still todo: - Sort out winsys. - Less suckage.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r300/Makefile13
-rw-r--r--src/gallium/drivers/r300/r300_context.c20
-rw-r--r--src/gallium/drivers/r300/r300_context.h8
-rw-r--r--src/gallium/drivers/r300/r300_screen.c65
-rw-r--r--src/gallium/drivers/r300/r300_screen.h13
5 files changed, 98 insertions, 21 deletions
diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile
new file mode 100644
index 00000000000..b33e56f73d1
--- /dev/null
+++ b/src/gallium/drivers/r300/Makefile
@@ -0,0 +1,13 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = r300
+
+C_SOURCES = \
+ r300_context.c \
+ r300_screen.c \
+ r300_state.c
+
+include ../../Makefile.template
+
+symlinks:
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 4aef5030fcf..569fdd3f0f9 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -1,9 +1,9 @@
#include "r300_context.h"
-static void r300_destroy_context(struct pipe_context* pipe) {
- struct r300_context* context = r300_context(pipe);
+static void r300_destroy_context(struct pipe_context* context) {
+ struct r300_context* r300 = r300_context(context);
- draw_destroy(context->draw);
+ draw_destroy(r300->draw);
FREE(context);
}
@@ -12,16 +12,16 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
struct pipe_winsys* winsys,
struct amd_winsys* amd_winsys)
{
- struct r300_context* context = CALLOC_STRUCT(r300_context);
+ struct r300_context* r300 = CALLOC_STRUCT(r300_context);
- if (!context)
+ if (!r300)
return NULL;
- context->winsys = amd_winsys;
- context->context.winsys = winsys;
- context->context.screen = screen;
+ r300->winsys = amd_winsys;
+ r300->context.winsys = winsys;
+ r300->context.screen = screen;
- context->context.destroy = r300_destroy_context;
+ r300->context.destroy = r300_destroy_context;
- return &context->context;
+ return &r300->context;
} \ No newline at end of file
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index fd344361d91..7c2055e43e8 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -23,17 +23,19 @@
#ifndef R300_CONTEXT_H
#define R300_CONTEXT_H
+#include "pipe/p_context.h"
+
struct r300_context {
/* Parent class */
struct pipe_context context;
struct amd_winsys* winsys;
struct draw_context* draw;
-}
+};
/* Convenience cast wrapper. */
-static struct r300_context* r300_context(struct pipe_context* pipe) {
- return (struct r300_context*)pipe;
+static struct r300_context* r300_context(struct pipe_context* context) {
+ return (struct r300_context*)context;
}
#endif /* R300_CONTEXT_H */ \ No newline at end of file
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index a1f056b8107..9c89623df3c 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -1,6 +1,26 @@
-/* XXX put a copyright here */
+/*
+ * Copyright 2008 Corbin Simpson <[email protected]>
+ *
+ * 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
+ * on 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
+ * THE AUTHOR(S) AND/OR THEIR 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. */
-/* I know my style's weird, get used to it */
+#include "r300_screen.h"
static const char* r300_get_vendor(struct pipe_screen* pscreen) {
return "X.Org R300 Project";
@@ -12,6 +32,8 @@ static const char* r300_get_name(struct pipe_screen* pscreen) {
}
static int r300_get_param(struct pipe_screen* pscreen, int param) {
+ struct r300_screen* r300screen = r300_screen(pscreen);
+
switch (param) {
/* Cases marked "IN THEORY" are possible on the hardware,
* but haven't been implemented yet. */
@@ -43,9 +65,13 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) {
/* IN THEORY */
return 0;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- /* 12 == 2048x2048
- * R500 can do 4096x4096 */
- return 12;
+ /* 12 == 2048x2048 */
+ if (r300screen->is_r500) {
+ /* R500 can do 4096x4096 */
+ return 13;
+ } else {
+ return 12;
+ }
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
/* XXX educated guess */
return 8;
@@ -60,7 +86,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) {
}
}
-static float r300_get_paramf(struct pipe_screen* pscreen, float param) {
+static float r300_get_paramf(struct pipe_screen* pscreen, int param) {
switch (param) {
case PIPE_CAP_MAX_LINE_WIDTH:
case PIPE_CAP_MAX_LINE_WIDTH_AA:
@@ -81,12 +107,35 @@ static float r300_get_paramf(struct pipe_screen* pscreen, float param) {
}
static boolean r300_is_format_supported(struct pipe_screen* pscreen,
- enum pipe_format format, uint type)
+ enum pipe_format format,
+ enum pipe_texture_target target,
+ unsigned tex_usage,
+ unsigned geom_flags)
{
return FALSE;
}
-static r300_destroy_screen(struct pipe_screen* pscreen) {
+static void* r300_surface_map(struct pipe_screen* screen,
+ struct pipe_surface* surface,
+ unsigned flags)
+{
+ /* XXX is this all we need to do here? */
+ char* map = pipe_buffer_map(screen, surface->buffer, flags);
+
+ if (!map) {
+ return NULL;
+ }
+
+ return map + surface->offset;
+}
+
+static void r300_surface_unmap(struct pipe_screen* screen,
+ struct pipe_surface* surface)
+{
+ pipe_buffer_unmap(screen, surface->buffer);
+}
+
+static void r300_destroy_screen(struct pipe_screen* pscreen) {
FREE(pscreen);
}
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index aa12c29a99f..36fc5aa67dd 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -23,6 +23,11 @@
#ifndef R300_SCREEN_H
#define R300_SCREEN_H
+#include "pipe/p_screen.h"
+#include "util/u_memory.h"
+
+#include "r300_context.h"
+
struct r300_screen {
/* Parent class */
struct pipe_screen screen;
@@ -30,6 +35,14 @@ struct r300_screen {
boolean is_r400;
boolean is_r500;
int pci_id;
+};
+
+/* Convenience cast wrapper. */
+static struct r300_screen* r300_screen(struct pipe_screen* screen) {
+ return (struct r300_screen*)screen;
}
+/* Creates a new r300 screen. */
+struct pipe_screen* r300_create_screen(struct pipe_winsys* winsys, uint pci_id);
+
#endif /* R300_SCREEN_H */