summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/dri
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/dri')
-rw-r--r--src/gallium/state_trackers/dri/dri_context.c14
-rw-r--r--src/gallium/state_trackers/dri/dri_context.h22
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c56
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.h18
-rw-r--r--src/gallium/state_trackers/dri/dri_extensions.c17
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c21
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.h4
7 files changed, 85 insertions, 67 deletions
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index 8819936fca..f2e5f3fb23 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -44,9 +44,9 @@
GLboolean
dri_create_context(const __GLcontextModes * visual,
- __DRIcontextPrivate * cPriv, void *sharedContextPrivate)
+ __DRIcontext * cPriv, void *sharedContextPrivate)
{
- __DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
+ __DRIscreen *sPriv = cPriv->driScreenPriv;
struct dri_screen *screen = dri_screen(sPriv);
struct dri_context *ctx = NULL;
struct st_context *st_share = NULL;
@@ -97,7 +97,7 @@ dri_create_context(const __GLcontextModes * visual,
}
void
-dri_destroy_context(__DRIcontextPrivate * cPriv)
+dri_destroy_context(__DRIcontext * cPriv)
{
struct dri_context *ctx = dri_context(cPriv);
@@ -116,7 +116,7 @@ dri_destroy_context(__DRIcontextPrivate * cPriv)
}
GLboolean
-dri_unbind_context(__DRIcontextPrivate * cPriv)
+dri_unbind_context(__DRIcontext * cPriv)
{
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);
@@ -133,9 +133,9 @@ dri_unbind_context(__DRIcontextPrivate * cPriv)
}
GLboolean
-dri_make_current(__DRIcontextPrivate * cPriv,
- __DRIdrawablePrivate * driDrawPriv,
- __DRIdrawablePrivate * driReadPriv)
+dri_make_current(__DRIcontext * cPriv,
+ __DRIdrawable * driDrawPriv,
+ __DRIdrawable * driReadPriv)
{
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);
diff --git a/src/gallium/state_trackers/dri/dri_context.h b/src/gallium/state_trackers/dri/dri_context.h
index 4650178734..13f497462f 100644
--- a/src/gallium/state_trackers/dri/dri_context.h
+++ b/src/gallium/state_trackers/dri/dri_context.h
@@ -44,10 +44,10 @@ struct dri_drawable;
struct dri_context
{
/* dri */
- __DRIscreenPrivate *sPriv;
- __DRIcontextPrivate *cPriv;
- __DRIdrawablePrivate *dPriv;
- __DRIdrawablePrivate *rPriv;
+ __DRIscreen *sPriv;
+ __DRIcontext *cPriv;
+ __DRIdrawable *dPriv;
+ __DRIdrawable *rPriv;
driOptionCache optionCache;
@@ -67,7 +67,7 @@ struct dri_context
};
static INLINE struct dri_context *
-dri_context(__DRIcontextPrivate * driContextPriv)
+dri_context(__DRIcontext * driContextPriv)
{
return (struct dri_context *)driContextPriv->driverPrivate;
}
@@ -99,18 +99,18 @@ dri_unlock(struct dri_context *ctx)
*/
extern struct dri1_api_lock_funcs dri1_lf;
-void dri_destroy_context(__DRIcontextPrivate * driContextPriv);
+void dri_destroy_context(__DRIcontext * driContextPriv);
-boolean dri_unbind_context(__DRIcontextPrivate * driContextPriv);
+boolean dri_unbind_context(__DRIcontext * driContextPriv);
boolean
-dri_make_current(__DRIcontextPrivate * driContextPriv,
- __DRIdrawablePrivate * driDrawPriv,
- __DRIdrawablePrivate * driReadPriv);
+dri_make_current(__DRIcontext * driContextPriv,
+ __DRIdrawable * driDrawPriv,
+ __DRIdrawable * driReadPriv);
boolean
dri_create_context(const __GLcontextModes * visual,
- __DRIcontextPrivate * driContextPriv,
+ __DRIcontext * driContextPriv,
void *sharedContextPrivate);
/***********************************************************************
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index c67cc8dacb..1058dd38c2 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -44,8 +44,10 @@
#include "state_tracker/st_context.h"
#include "state_tracker/st_cb_fbo.h"
+#include "util/u_format.h"
#include "util/u_memory.h"
-
+#include "util/u_rect.h"
+
static struct pipe_surface *
dri_surface_from_handle(struct drm_api *api,
struct pipe_screen *screen,
@@ -61,11 +63,10 @@ dri_surface_from_handle(struct drm_api *api,
templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
templat.target = PIPE_TEXTURE_2D;
templat.last_level = 0;
- templat.depth[0] = 1;
+ templat.depth0 = 1;
templat.format = format;
- templat.width[0] = width;
- templat.height[0] = height;
- pf_get_block(templat.format, &templat.block);
+ templat.width0 = width;
+ templat.height0 = height;
texture = api->texture_from_shared_handle(api, screen, &templat,
"dri2 buffer", pitch, handle);
@@ -117,7 +118,7 @@ dri2_check_if_pixmap(__DRIbuffer *buffers, int count)
* This will be called a drawable is known to have been resized.
*/
void
-dri_get_buffers(__DRIdrawablePrivate * dPriv)
+dri_get_buffers(__DRIdrawable * dPriv)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
@@ -298,8 +299,8 @@ dri_flush_frontbuffer(struct pipe_screen *screen,
* This is called when we need to set up GL rendering to a new X window.
*/
boolean
-dri_create_buffer(__DRIscreenPrivate * sPriv,
- __DRIdrawablePrivate * dPriv,
+dri_create_buffer(__DRIscreen * sPriv,
+ __DRIdrawable * dPriv,
const __GLcontextModes * visual, boolean isPixmap)
{
struct dri_screen *screen = sPriv->private;
@@ -415,7 +416,7 @@ dri_swap_fences_push_back(struct dri_drawable *draw,
}
void
-dri_destroy_buffer(__DRIdrawablePrivate * dPriv)
+dri_destroy_buffer(__DRIdrawable * dPriv)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_fence_handle *fence;
@@ -433,8 +434,8 @@ dri_destroy_buffer(__DRIdrawablePrivate * dPriv)
static void
dri1_update_drawables_locked(struct dri_context *ctx,
- __DRIdrawablePrivate * driDrawPriv,
- __DRIdrawablePrivate * driReadPriv)
+ __DRIdrawable * driDrawPriv,
+ __DRIdrawable * driReadPriv)
{
if (ctx->stLostLock) {
ctx->stLostLock = FALSE;
@@ -457,8 +458,8 @@ dri1_update_drawables_locked(struct dri_context *ctx,
static void
dri1_propagate_drawable_change(struct dri_context *ctx)
{
- __DRIdrawablePrivate *dPriv = ctx->dPriv;
- __DRIdrawablePrivate *rPriv = ctx->rPriv;
+ __DRIdrawable *dPriv = ctx->dPriv;
+ __DRIdrawable *rPriv = ctx->rPriv;
boolean flushed = FALSE;
if (dPriv && ctx->d_stamp != dPriv->lastStamp) {
@@ -531,7 +532,7 @@ static void
dri1_swap_copy(struct dri_context *ctx,
struct pipe_surface *dst,
struct pipe_surface *src,
- __DRIdrawablePrivate * dPriv, const struct drm_clip_rect *bbox)
+ __DRIdrawable * dPriv, const struct drm_clip_rect *bbox)
{
struct pipe_context *pipe = ctx->pipe;
struct drm_clip_rect clip;
@@ -541,19 +542,28 @@ dri1_swap_copy(struct dri_context *ctx,
cur = dPriv->pClipRects;
for (i = 0; i < dPriv->numClipRects; ++i) {
- if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox))
- pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
- src,
- (int)clip.x1 - dPriv->x,
- (int)clip.y1 - dPriv->y,
- clip.x2 - clip.x1, clip.y2 - clip.y1);
+ if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox)) {
+ if (pipe->surface_copy) {
+ pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
+ src,
+ (int)clip.x1 - dPriv->x,
+ (int)clip.y1 - dPriv->y,
+ clip.x2 - clip.x1, clip.y2 - clip.y1);
+ } else {
+ util_surface_copy(pipe, FALSE, dst, clip.x1, clip.y1,
+ src,
+ (int)clip.x1 - dPriv->x,
+ (int)clip.y1 - dPriv->y,
+ clip.x2 - clip.x1, clip.y2 - clip.y1);
+ }
+ }
}
}
static void
dri1_copy_to_front(struct dri_context *ctx,
struct pipe_surface *surf,
- __DRIdrawablePrivate * dPriv,
+ __DRIdrawable * dPriv,
const struct drm_clip_rect *sub_box,
struct pipe_fence_handle **fence)
{
@@ -626,7 +636,7 @@ dri1_flush_frontbuffer(struct pipe_screen *screen,
}
void
-dri_swap_buffers(__DRIdrawablePrivate * dPriv)
+dri_swap_buffers(__DRIdrawable * dPriv)
{
struct dri_context *ctx;
struct pipe_surface *back_surf;
@@ -658,7 +668,7 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv)
}
void
-dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
+dri_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h)
{
struct pipe_screen *screen = dri_screen(dPriv->driScreenPriv)->pipe_screen;
struct drm_clip_rect sub_bbox;
diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h
index b910930db4..80bb5d7f61 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/dri_drawable.h
@@ -41,8 +41,8 @@ struct dri_context;
struct dri_drawable
{
/* dri */
- __DRIdrawablePrivate *dPriv;
- __DRIscreenPrivate *sPriv;
+ __DRIdrawable *dPriv;
+ __DRIscreen *sPriv;
unsigned attachments[8];
unsigned num_attachments;
@@ -67,7 +67,7 @@ struct dri_drawable
};
static INLINE struct dri_drawable *
-dri_drawable(__DRIdrawablePrivate * driDrawPriv)
+dri_drawable(__DRIdrawable * driDrawPriv)
{
return (struct dri_drawable *)driDrawPriv->driverPrivate;
}
@@ -76,22 +76,22 @@ dri_drawable(__DRIdrawablePrivate * driDrawPriv)
* dri_drawable.c
*/
boolean
-dri_create_buffer(__DRIscreenPrivate * sPriv,
- __DRIdrawablePrivate * dPriv,
+dri_create_buffer(__DRIscreen * sPriv,
+ __DRIdrawable * dPriv,
const __GLcontextModes * visual, boolean isPixmap);
void
dri_flush_frontbuffer(struct pipe_screen *screen,
struct pipe_surface *surf, void *context_private);
-void dri_swap_buffers(__DRIdrawablePrivate * dPriv);
+void dri_swap_buffers(__DRIdrawable * dPriv);
void
-dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h);
+dri_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h);
-void dri_get_buffers(__DRIdrawablePrivate * dPriv);
+void dri_get_buffers(__DRIdrawable * dPriv);
-void dri_destroy_buffer(__DRIdrawablePrivate * dPriv);
+void dri_destroy_buffer(__DRIdrawable * dPriv);
void dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
GLint glx_texture_format, __DRIdrawable *dPriv);
diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c
index f39a305531..8b014a2a8b 100644
--- a/src/gallium/state_trackers/dri/dri_extensions.c
+++ b/src/gallium/state_trackers/dri/dri_extensions.c
@@ -37,6 +37,7 @@
#define need_GL_ARB_multisample
#define need_GL_ARB_occlusion_query
#define need_GL_ARB_point_parameters
+#define need_GL_ARB_provoking_vertex
#define need_GL_ARB_shader_objects
#define need_GL_ARB_texture_compression
#define need_GL_ARB_vertex_array_object
@@ -52,23 +53,27 @@
#define need_GL_EXT_fog_coord
#define need_GL_EXT_framebuffer_object
#define need_GL_EXT_multi_draw_arrays
+#define need_GL_EXT_provoking_vertex
#define need_GL_EXT_secondary_color
+#define need_GL_EXT_stencil_two_side
#define need_GL_APPLE_vertex_array_object
#define need_GL_NV_vertex_program
#define need_GL_VERSION_2_0
#define need_GL_VERSION_2_1
-#include "extension_helper.h"
+#include "main/remap_helper.h"
+#include "utils.h"
/**
* Extension strings exported by the driver.
*/
-const struct dri_extension card_extensions[] = {
+static const struct dri_extension card_extensions[] = {
{"GL_ARB_fragment_shader", NULL},
{"GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions},
{"GL_ARB_multisample", GL_ARB_multisample_functions},
{"GL_ARB_multitexture", NULL},
{"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
{"GL_ARB_pixel_buffer_object", NULL},
+ {"GL_ARB_provoking_vertex", GL_ARB_provoking_vertex_functions},
{"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
{"GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
{"GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
@@ -80,6 +85,7 @@ const struct dri_extension card_extensions[] = {
{"GL_ARB_texture_env_combine", NULL},
{"GL_ARB_texture_env_dot3", NULL},
{"GL_ARB_texture_mirrored_repeat", NULL},
+ {"GL_ARB_texture_non_power_of_two", NULL},
{"GL_ARB_texture_rectangle", NULL},
{"GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions},
{"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
@@ -97,7 +103,9 @@ const struct dri_extension card_extensions[] = {
{"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
{"GL_EXT_packed_depth_stencil", NULL},
{"GL_EXT_pixel_buffer_object", NULL},
+ {"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions},
{"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
+ {"GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions},
{"GL_EXT_stencil_wrap", NULL},
{"GL_EXT_texture_edge_clamp", NULL},
{"GL_EXT_texture_env_combine", NULL},
@@ -123,10 +131,7 @@ dri_init_extensions(struct dri_context *ctx)
* capabilities of the pipe_screen. This is actually something
* that can/should be done inside st_create_context().
*/
- if (ctx)
- driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE);
- else
- driInitExtensions(NULL, card_extensions, GL_FALSE);
+ driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE);
}
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 884b6d5011..bb12baf281 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -202,7 +202,7 @@ dri_fill_in_modes(struct dri_screen *screen,
* Get information about previous buffer swaps.
*/
static int
-dri_get_swap_info(__DRIdrawablePrivate * dPriv, __DRIswapInfo * sInfo)
+dri_get_swap_info(__DRIdrawable * dPriv, __DRIswapInfo * sInfo)
{
if (dPriv == NULL || dPriv->driverPrivate == NULL || sInfo == NULL)
return -1;
@@ -220,14 +220,12 @@ dri_copy_version(struct dri1_api_version *dst,
}
static const __DRIconfig **
-dri_init_screen(__DRIscreenPrivate * sPriv)
+dri_init_screen(__DRIscreen * sPriv)
{
struct dri_screen *screen;
const __DRIconfig **configs;
struct dri1_create_screen_arg arg;
- dri_init_extensions(NULL);
-
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
return NULL;
@@ -287,14 +285,11 @@ dri_init_screen(__DRIscreenPrivate * sPriv)
* Returns the __GLcontextModes supported by this driver.
*/
static const __DRIconfig **
-dri_init_screen2(__DRIscreenPrivate * sPriv)
+dri_init_screen2(__DRIscreen * sPriv)
{
struct dri_screen *screen;
struct drm_create_screen_arg arg;
- /* Set up dispatch table to cope with all known extensions */
- dri_init_extensions(NULL);
-
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
goto fail;
@@ -324,7 +319,7 @@ dri_init_screen2(__DRIscreenPrivate * sPriv)
}
static void
-dri_destroy_screen(__DRIscreenPrivate * sPriv)
+dri_destroy_screen(__DRIscreen * sPriv)
{
struct dri_screen *screen = dri_screen(sPriv);
@@ -351,4 +346,12 @@ PUBLIC const struct __DriverAPIRec driDriverAPI = {
.InitScreen2 = dri_init_screen2,
};
+/* This is the table of extensions that the loader will dlsym() for. */
+PUBLIC const __DRIextension *__driDriverExtensions[] = {
+ &driCoreExtension.base,
+ &driLegacyExtension.base,
+ &driDRI2Extension.base,
+ NULL
+};
+
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h
index f6c56d0f0c..03387a0e81 100644
--- a/src/gallium/state_trackers/dri/dri_screen.h
+++ b/src/gallium/state_trackers/dri/dri_screen.h
@@ -42,7 +42,7 @@
struct dri_screen
{
/* dri */
- __DRIscreenPrivate *sPriv;
+ __DRIscreen *sPriv;
/**
* Configuration cache with default values for all contexts
@@ -63,7 +63,7 @@ struct dri_screen
/** cast wrapper */
static INLINE struct dri_screen *
-dri_screen(__DRIscreenPrivate * sPriv)
+dri_screen(__DRIscreen * sPriv)
{
return (struct dri_screen *)sPriv->private;
}