summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/state_trackers/dri/dri_context.c42
-rw-r--r--src/gallium/state_trackers/dri/dri_context.h23
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c227
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.h33
-rw-r--r--src/gallium/state_trackers/dri/dri_extensions.c7
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c164
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.h6
7 files changed, 221 insertions, 281 deletions
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index a45fb541fdd..7f386711268 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -42,12 +42,9 @@
#include "util/u_memory.h"
-
-
GLboolean
-dri_create_context(const __GLcontextModes *visual,
- __DRIcontextPrivate *cPriv,
- void *sharedContextPrivate)
+dri_create_context(const __GLcontextModes * visual,
+ __DRIcontextPrivate * cPriv, void *sharedContextPrivate)
{
__DRIscreenPrivate *sPriv = cPriv->driScreenPriv;
struct dri_screen *screen = dri_screen(sPriv);
@@ -55,7 +52,7 @@ dri_create_context(const __GLcontextModes *visual,
struct st_context *st_share = NULL;
if (sharedContextPrivate) {
- st_share = ((struct dri_context *) sharedContextPrivate)->st;
+ st_share = ((struct dri_context *)sharedContextPrivate)->st;
}
ctx = CALLOC_STRUCT(dri_context);
@@ -70,9 +67,7 @@ dri_create_context(const __GLcontextModes *visual,
ctx->r_stamp = -1;
driParseConfigFiles(&ctx->optionCache,
- &screen->optionCache,
- sPriv->myNum,
- "dri");
+ &screen->optionCache, sPriv->myNum, "dri");
ctx->pipe = drm_api_hooks.create_context(screen->pipe_screen);
@@ -90,7 +85,7 @@ dri_create_context(const __GLcontextModes *visual,
return GL_TRUE;
-fail:
+ fail:
if (ctx && ctx->st)
st_destroy_context(ctx->st);
@@ -101,9 +96,8 @@ fail:
return FALSE;
}
-
void
-dri_destroy_context(__DRIcontextPrivate *cPriv)
+dri_destroy_context(__DRIcontextPrivate * cPriv)
{
struct dri_context *ctx = dri_context(cPriv);
struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
@@ -125,9 +119,8 @@ dri_destroy_context(__DRIcontextPrivate *cPriv)
FREE(ctx);
}
-
GLboolean
-dri_unbind_context(__DRIcontextPrivate *cPriv)
+dri_unbind_context(__DRIcontextPrivate * cPriv)
{
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);
@@ -146,15 +139,16 @@ dri_unbind_context(__DRIcontextPrivate *cPriv)
}
GLboolean
-dri_make_current(__DRIcontextPrivate *cPriv,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
+dri_make_current(__DRIcontextPrivate * cPriv,
+ __DRIdrawablePrivate * driDrawPriv,
+ __DRIdrawablePrivate * driReadPriv)
{
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);
struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
struct dri_drawable *draw = dri_drawable(driDrawPriv);
struct dri_drawable *read = dri_drawable(driReadPriv);
+
GET_CURRENT_CONTEXT(oldGLCtx);
if (oldGLCtx && oldGLCtx->st != ctx->st)
@@ -191,35 +185,34 @@ dri_make_current(__DRIcontextPrivate *cPriv,
static void
st_dri_lock(struct pipe_context *pipe)
{
- dri_lock((struct dri_context *) pipe->priv);
+ dri_lock((struct dri_context *)pipe->priv);
}
static void
st_dri_unlock(struct pipe_context *pipe)
{
- dri_unlock((struct dri_context *) pipe->priv);
+ dri_unlock((struct dri_context *)pipe->priv);
}
static boolean
st_dri_is_locked(struct pipe_context *pipe)
{
- return ((struct dri_context *) pipe->priv)->isLocked;
+ return ((struct dri_context *)pipe->priv)->isLocked;
}
static boolean
st_dri_lost_lock(struct pipe_context *pipe)
{
- return ((struct dri_context *) pipe->priv)->wsLostLock;
+ return ((struct dri_context *)pipe->priv)->wsLostLock;
}
static void
st_dri_clear_lost_lock(struct pipe_context *pipe)
{
- ((struct dri_context *) pipe->priv)->wsLostLock = FALSE;
+ ((struct dri_context *)pipe->priv)->wsLostLock = FALSE;
}
-struct dri1_api_lock_funcs dri1_lf =
-{
+struct dri1_api_lock_funcs dri1_lf = {
.lock = st_dri_lock,
.unlock = st_dri_unlock,
.is_locked = st_dri_is_locked,
@@ -227,5 +220,4 @@ struct dri1_api_lock_funcs dri1_lf =
.clear_lost_lock = st_dri_clear_lost_lock
};
-
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_context.h b/src/gallium/state_trackers/dri/dri_context.h
index 82a5916827e..46501787340 100644
--- a/src/gallium/state_trackers/dri/dri_context.h
+++ b/src/gallium/state_trackers/dri/dri_context.h
@@ -36,7 +36,6 @@
#include "drm.h"
#include "dri_util.h"
-
struct pipe_context;
struct pipe_fence;
struct st_context;
@@ -68,9 +67,9 @@ struct dri_context
};
static INLINE struct dri_context *
-dri_context(__DRIcontextPrivate *driContextPriv)
+dri_context(__DRIcontextPrivate * driContextPriv)
{
- return (struct dri_context *) driContextPriv->driverPrivate;
+ return (struct dri_context *)driContextPriv->driverPrivate;
}
static INLINE void
@@ -100,28 +99,24 @@ dri_unlock(struct dri_context *ctx)
*/
extern struct dri1_api_lock_funcs dri1_lf;
-void
-dri_destroy_context(__DRIcontextPrivate * driContextPriv);
+void dri_destroy_context(__DRIcontextPrivate * driContextPriv);
-boolean
-dri_unbind_context(__DRIcontextPrivate * driContextPriv);
+boolean dri_unbind_context(__DRIcontextPrivate * driContextPriv);
boolean
dri_make_current(__DRIcontextPrivate * driContextPriv,
- __DRIdrawablePrivate * driDrawPriv,
- __DRIdrawablePrivate * driReadPriv);
+ __DRIdrawablePrivate * driDrawPriv,
+ __DRIdrawablePrivate * driReadPriv);
boolean
dri_create_context(const __GLcontextModes * visual,
- __DRIcontextPrivate * driContextPriv,
- void *sharedContextPrivate);
-
+ __DRIcontextPrivate * driContextPriv,
+ void *sharedContextPrivate);
/***********************************************************************
* dri_extensions.c
*/
-void
-dri_init_extensions(struct dri_context *ctx);
+void dri_init_extensions(struct dri_context *ctx);
#endif
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 287617e9a9b..abda4ff17ea 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -44,23 +44,19 @@
#include "util/u_memory.h"
-
static void
-dri_copy_to_front(__DRIdrawablePrivate *dPriv,
- struct pipe_surface *from,
- int x, int y, unsigned w, unsigned h)
+dri_copy_to_front(__DRIdrawablePrivate * dPriv,
+ struct pipe_surface *from,
+ int x, int y, unsigned w, unsigned h)
{
/* TODO send a message to the Xserver to copy to the real front buffer */
}
-
static struct pipe_surface *
dri_surface_from_handle(struct pipe_screen *screen,
- unsigned handle,
- enum pipe_format format,
- unsigned width,
- unsigned height,
- unsigned pitch)
+ unsigned handle,
+ enum pipe_format format,
+ unsigned width, unsigned height, unsigned pitch)
{
struct pipe_surface *surface = NULL;
struct pipe_texture *texture = NULL;
@@ -81,10 +77,7 @@ dri_surface_from_handle(struct pipe_screen *screen,
templat.height[0] = height;
pf_get_block(templat.format, &templat.block);
- texture = screen->texture_blanket(screen,
- &templat,
- &pitch,
- buf);
+ texture = screen->texture_blanket(screen, &templat, &pitch, buf);
/* we don't need the buffer from this point on */
pipe_buffer_reference(&buf, NULL);
@@ -93,20 +86,19 @@ dri_surface_from_handle(struct pipe_screen *screen,
return NULL;
surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_READ |
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_GPU_WRITE);
/* we don't need the texture from this point on */
pipe_texture_reference(&texture, NULL);
return surface;
}
-
/**
* This will be called a drawable is known to have been resized.
*/
void
-dri_get_buffers(__DRIdrawablePrivate *dPriv)
+dri_get_buffers(__DRIdrawablePrivate * dPriv)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_surface *surface = NULL;
@@ -117,13 +109,14 @@ dri_get_buffers(__DRIdrawablePrivate *dPriv)
boolean have_depth = FALSE;
int i, count;
- buffers = (*dri_screen->dri2.loader->getBuffers)(dri_drawable,
- &dri_drawable->w,
- &dri_drawable->h,
- drawable->attachments,
- drawable->num_attachments,
- &count,
- dri_drawable->loaderPrivate);
+ buffers = (*dri_screen->dri2.loader->getBuffers) (dri_drawable,
+ &dri_drawable->w,
+ &dri_drawable->h,
+ drawable->attachments,
+ drawable->
+ num_attachments, &count,
+ dri_drawable->
+ loaderPrivate);
if (buffers == NULL) {
return;
@@ -150,45 +143,44 @@ dri_get_buffers(__DRIdrawablePrivate *dPriv)
int index = 0;
switch (buffers[i].attachment) {
- case __DRI_BUFFER_FRONT_LEFT:
- index = ST_SURFACE_FRONT_LEFT;
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- break;
- case __DRI_BUFFER_FAKE_FRONT_LEFT:
- index = ST_SURFACE_FRONT_LEFT;
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- break;
- case __DRI_BUFFER_BACK_LEFT:
- index = ST_SURFACE_BACK_LEFT;
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- break;
- case __DRI_BUFFER_DEPTH:
- index = ST_SURFACE_DEPTH;
- format = PIPE_FORMAT_Z24S8_UNORM;
- break;
- case __DRI_BUFFER_STENCIL:
- index = ST_SURFACE_DEPTH;
- format = PIPE_FORMAT_Z24S8_UNORM;
- break;
- case __DRI_BUFFER_ACCUM:
- default:
- assert(0);
+ case __DRI_BUFFER_FRONT_LEFT:
+ index = ST_SURFACE_FRONT_LEFT;
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ break;
+ case __DRI_BUFFER_FAKE_FRONT_LEFT:
+ index = ST_SURFACE_FRONT_LEFT;
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ break;
+ case __DRI_BUFFER_BACK_LEFT:
+ index = ST_SURFACE_BACK_LEFT;
+ format = PIPE_FORMAT_A8R8G8B8_UNORM;
+ break;
+ case __DRI_BUFFER_DEPTH:
+ index = ST_SURFACE_DEPTH;
+ format = PIPE_FORMAT_Z24S8_UNORM;
+ break;
+ case __DRI_BUFFER_STENCIL:
+ index = ST_SURFACE_DEPTH;
+ format = PIPE_FORMAT_Z24S8_UNORM;
+ break;
+ case __DRI_BUFFER_ACCUM:
+ default:
+ assert(0);
}
assert(buffers[i].cpp == 4);
if (index == ST_SURFACE_DEPTH) {
- if (have_depth)
- continue;
- else
- have_depth = TRUE;
+ if (have_depth)
+ continue;
+ else
+ have_depth = TRUE;
}
surface = dri_surface_from_handle(screen,
- buffers[i].name,
- format,
- dri_drawable->w,
- dri_drawable->h,
- buffers[i].pitch);
+ buffers[i].name,
+ format,
+ dri_drawable->w,
+ dri_drawable->h, buffers[i].pitch);
st_set_framebuffer_surface(drawable->stfb, index, surface);
pipe_surface_reference(&surface, NULL);
@@ -197,25 +189,22 @@ dri_get_buffers(__DRIdrawablePrivate *dPriv)
st_resize_framebuffer(drawable->stfb, dri_drawable->w, dri_drawable->h);
}
-
void
dri_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf,
- void *context_private)
+ struct pipe_surface *surf, void *context_private)
{
struct dri_context *ctx = (struct dri_context *)context_private;
+
dri_copy_to_front(ctx->dPriv, surf, 0, 0, surf->width, surf->height);
}
-
/**
* This is called when we need to set up GL rendering to a new X window.
*/
boolean
-dri_create_buffer(__DRIscreenPrivate *sPriv,
- __DRIdrawablePrivate *dPriv,
- const __GLcontextModes *visual,
- boolean isPixmap)
+dri_create_buffer(__DRIscreenPrivate * sPriv,
+ __DRIdrawablePrivate * dPriv,
+ const __GLcontextModes * visual, boolean isPixmap)
{
enum pipe_format colorFormat, depthFormat, stencilFormat;
struct dri_screen *screen = sPriv->private;
@@ -224,7 +213,7 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
int i;
if (isPixmap)
- goto fail; /* not implemented */
+ goto fail; /* not implemented */
drawable = CALLOC_STRUCT(dri_drawable);
if (drawable == NULL)
@@ -241,39 +230,38 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
if (visual->depthBits) {
if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_RENDER_TARGET |
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
- depthFormat = PIPE_FORMAT_Z24S8_UNORM;
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
+ depthFormat = PIPE_FORMAT_Z24S8_UNORM;
else
- depthFormat = PIPE_FORMAT_S8Z24_UNORM;
+ depthFormat = PIPE_FORMAT_S8Z24_UNORM;
} else
depthFormat = PIPE_FORMAT_NONE;
if (visual->stencilBits) {
if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_RENDER_TARGET |
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
- stencilFormat = PIPE_FORMAT_Z24S8_UNORM;
+ PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
+ stencilFormat = PIPE_FORMAT_Z24S8_UNORM;
else
- stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
+ stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
} else
stencilFormat = PIPE_FORMAT_NONE;
drawable->stfb = st_create_framebuffer(visual,
- colorFormat,
- depthFormat,
- stencilFormat,
- dPriv->w,
- dPriv->h,
- (void*) drawable);
+ colorFormat,
+ depthFormat,
+ stencilFormat,
+ dPriv->w,
+ dPriv->h, (void *)drawable);
if (drawable->stfb == NULL)
goto fail;
drawable->sPriv = sPriv;
drawable->dPriv = dPriv;
- dPriv->driverPrivate = (void *) drawable;
+ dPriv->driverPrivate = (void *)drawable;
/* setup dri2 buffers information */
i = 0;
@@ -293,7 +281,7 @@ dri_create_buffer(__DRIscreenPrivate *sPriv,
drawable->desired_fences = 2;
return GL_TRUE;
-fail:
+ fail:
FREE(drawable);
return GL_FALSE;
}
@@ -324,13 +312,14 @@ dri_swap_fences_push_back(struct dri_drawable *draw,
if (draw->cur_fences < DRI_SWAP_FENCES_MAX) {
draw->cur_fences++;
- screen->fence_reference(screen, &draw->swap_fences[draw->head++], fence);
+ screen->fence_reference(screen, &draw->swap_fences[draw->head++],
+ fence);
draw->head &= DRI_SWAP_FENCES_MASK;
}
}
void
-dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
+dri_destroy_buffer(__DRIdrawablePrivate * dPriv)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_fence_handle *fence;
@@ -338,7 +327,7 @@ dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
st_unreference_framebuffer(drawable->stfb);
drawable->desired_fences = 0;
- while(drawable->cur_fences) {
+ while (drawable->cur_fences) {
fence = dri_swap_fences_pop_front(drawable);
screen->fence_reference(screen, &fence, NULL);
}
@@ -348,15 +337,16 @@ dri_destroy_buffer(__DRIdrawablePrivate *dPriv)
static void
dri1_update_drawables_locked(struct dri_context *ctx,
- __DRIdrawablePrivate *driDrawPriv,
- __DRIdrawablePrivate *driReadPriv)
+ __DRIdrawablePrivate * driDrawPriv,
+ __DRIdrawablePrivate * driReadPriv)
{
if (ctx->stLostLock) {
ctx->stLostLock = FALSE;
if (driDrawPriv == driReadPriv)
DRI_VALIDATE_DRAWABLE_INFO(ctx->sPriv, driDrawPriv);
else
- DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv, driReadPriv);
+ DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv,
+ driReadPriv);
}
}
@@ -387,7 +377,7 @@ dri1_propagate_drawable_change(struct dri_context *ctx)
if (rPriv && dPriv != rPriv && ctx->r_stamp != rPriv->lastStamp) {
if (!flushed)
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
ctx->r_stamp = rPriv->lastStamp;
st_resize_framebuffer(dri_drawable(rPriv)->stfb, rPriv->w, rPriv->h);
@@ -400,8 +390,7 @@ dri1_propagate_drawable_change(struct dri_context *ctx)
void
dri1_update_drawables(struct dri_context *ctx,
- struct dri_drawable *draw,
- struct dri_drawable *read)
+ struct dri_drawable *draw, struct dri_drawable *read)
{
dri_lock(ctx);
dri1_update_drawables_locked(ctx, draw->dPriv, read->dPriv);
@@ -420,20 +409,20 @@ dri1_intersect_src_bbox(struct drm_clip_rect *dst,
int xy1;
int xy2;
- xy1 = ((int) src->x1 > (int) bbox->x1 + dst_x) ? src->x1 :
- (int) bbox->x1 + dst_x;
- xy2 = ((int) src->x2 < (int) bbox->x2 + dst_x) ? src->x2 :
- (int) bbox->x2 + dst_x;
+ xy1 = ((int)src->x1 > (int)bbox->x1 + dst_x) ? src->x1 :
+ (int)bbox->x1 + dst_x;
+ xy2 = ((int)src->x2 < (int)bbox->x2 + dst_x) ? src->x2 :
+ (int)bbox->x2 + dst_x;
if (xy1 >= xy2 || xy1 < 0)
return FALSE;
dst->x1 = xy1;
dst->x2 = xy2;
- xy1 = ((int) src->y1 > (int) bbox->y1 + dst_x) ? src->y1 :
- (int) bbox->y1 + dst_x;
- xy2 = ((int) src->y2 < (int) bbox->y2 + dst_x) ? src->y2 :
- (int) bbox->y2 + dst_x;
+ xy1 = ((int)src->y1 > (int)bbox->y1 + dst_x) ? src->y1 :
+ (int)bbox->y1 + dst_x;
+ xy2 = ((int)src->y2 < (int)bbox->y2 + dst_x) ? src->y2 :
+ (int)bbox->y2 + dst_x;
if (xy1 >= xy2 || xy1 < 0)
return FALSE;
@@ -442,13 +431,11 @@ dri1_intersect_src_bbox(struct drm_clip_rect *dst,
return TRUE;
}
-
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)
+ __DRIdrawablePrivate * dPriv, const struct drm_clip_rect *bbox)
{
struct pipe_context *pipe = ctx->pipe;
struct drm_clip_rect clip;
@@ -457,21 +444,20 @@ dri1_swap_copy(struct dri_context *ctx,
cur = dPriv->pClipRects;
- for (i=0; i<dPriv->numClipRects; ++i) {
+ 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);
+ (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,
+ __DRIdrawablePrivate * dPriv,
const struct drm_clip_rect *sub_box,
struct pipe_fence_handle **fence)
{
@@ -503,15 +489,11 @@ dri1_copy_to_front(struct dri_context *ctx,
surf,
dPriv->pClipRects,
dPriv->numClipRects,
- dPriv->x,
- dPriv->y,
- &bbox,
- fence);
+ dPriv->x, dPriv->y, &bbox, fence);
} else if (visible && __dri1_api_hooks->front_srf_locked) {
- struct pipe_surface *front =
- __dri1_api_hooks->front_srf_locked(pipe);
+ struct pipe_surface *front = __dri1_api_hooks->front_srf_locked(pipe);
if (front)
dri1_swap_copy(ctx, front, surf, dPriv, &bbox);
@@ -534,8 +516,7 @@ dri1_copy_to_front(struct dri_context *ctx,
void
dri1_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf,
- void *context_private)
+ struct pipe_surface *surf, void *context_private)
{
struct dri_context *ctx = (struct dri_context *)context_private;
struct pipe_fence_handle *dummy_fence;
@@ -555,14 +536,15 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv)
struct dri_drawable *draw = dri_drawable(dPriv);
struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
struct pipe_fence_handle *fence;
+
GET_CURRENT_CONTEXT(glCtx);
assert(__dri1_api_hooks != NULL);
if (!glCtx)
- return; /* For now */
+ return; /* For now */
- ctx = (struct dri_context *) glCtx->st->pipe->priv;
+ ctx = (struct dri_context *)glCtx->st->pipe->priv;
st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
if (back_surf) {
@@ -570,7 +552,7 @@ dri_swap_buffers(__DRIdrawablePrivate * dPriv)
st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
fence = dri_swap_fences_pop_front(draw);
if (fence) {
- (void) screen->fence_finish(screen, fence, 0);
+ (void)screen->fence_finish(screen, fence, 0);
screen->fence_reference(screen, &fence, NULL);
}
dri1_copy_to_front(ctx, back_surf, dPriv, NULL, &fence);
@@ -587,6 +569,7 @@ dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
struct pipe_surface *back_surf;
struct dri_drawable *draw = dri_drawable(dPriv);
struct pipe_fence_handle *dummy_fence;
+
GET_CURRENT_CONTEXT(glCtx);
assert(__dri1_api_hooks != NULL);
@@ -594,7 +577,7 @@ dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
if (!glCtx)
return;
- ctx = (struct dri_context *) glCtx->st->pipe->priv;
+ ctx = (struct dri_context *)glCtx->st->pipe->priv;
sub_bbox.x1 = x;
sub_bbox.x2 = x + w;
diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/dri_drawable.h
index c1341deb521..78a66624aaf 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/dri_drawable.h
@@ -55,51 +55,40 @@ struct dri_drawable
unsigned int cur_fences;
};
-
static INLINE struct dri_drawable *
dri_drawable(__DRIdrawablePrivate * driDrawPriv)
{
- return (struct dri_drawable *) driDrawPriv->driverPrivate;
+ return (struct dri_drawable *)driDrawPriv->driverPrivate;
}
-
/***********************************************************************
* dri_drawable.c
*/
boolean
-dri_create_buffer(__DRIscreenPrivate *sPriv,
- __DRIdrawablePrivate *dPriv,
- const __GLcontextModes *visual,
- boolean isPixmap);
+dri_create_buffer(__DRIscreenPrivate * sPriv,
+ __DRIdrawablePrivate * dPriv,
+ const __GLcontextModes * visual, boolean isPixmap);
void
dri_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf,
- void *context_private);
+ struct pipe_surface *surf, void *context_private);
-void
-dri_swap_buffers(__DRIdrawablePrivate * dPriv);
+void dri_swap_buffers(__DRIdrawablePrivate * dPriv);
void
-dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv,
- int x, int y,
- int w, int h);
+dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h);
-void
-dri_get_buffers(__DRIdrawablePrivate * dPriv);
+void dri_get_buffers(__DRIdrawablePrivate * dPriv);
-void
-dri_destroy_buffer(__DRIdrawablePrivate *dPriv);
+void dri_destroy_buffer(__DRIdrawablePrivate * dPriv);
void
dri1_update_drawables(struct dri_context *ctx,
- struct dri_drawable *draw,
- struct dri_drawable *read);
+ struct dri_drawable *draw, struct dri_drawable *read);
void
dri1_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf,
- void *context_private);
+ struct pipe_surface *surf, void *context_private);
#endif
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c
index 732d1e89b0c..0c59d42d5c6 100644
--- a/src/gallium/state_trackers/dri/dri_extensions.c
+++ b/src/gallium/state_trackers/dri/dri_extensions.c
@@ -52,7 +52,6 @@
#define need_GL_NV_vertex_program
#include "extension_helper.h"
-
/**
* Extension strings exported by the driver.
*/
@@ -74,7 +73,8 @@ const struct dri_extension card_extensions[] = {
{"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
{"GL_ARB_window_pos", GL_ARB_window_pos_functions},
{"GL_EXT_blend_color", GL_EXT_blend_color_functions},
- {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
+ {"GL_EXT_blend_equation_separate",
+ GL_EXT_blend_equation_separate_functions},
{"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
{"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
{"GL_EXT_blend_subtract", NULL},
@@ -98,11 +98,10 @@ const struct dri_extension card_extensions[] = {
{"GL_NV_blend_square", NULL},
{"GL_NV_vertex_program", GL_NV_vertex_program_functions},
{"GL_NV_vertex_program1_1", NULL},
- {"GL_SGIS_generate_mipmap", NULL },
+ {"GL_SGIS_generate_mipmap", NULL},
{NULL, NULL}
};
-
void
dri_init_extensions(struct dri_context *ctx)
{
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index 418bb901156..d3392ee690b 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -46,34 +46,32 @@
#include "state_tracker/st_public.h"
#include "state_tracker/st_cb_fbo.h"
-
PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+ DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
+ DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
- /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/
- DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+ /*DRI_CONF_FORCE_S3TC_ENABLE(false) */
+ DRI_CONF_ALLOW_LARGE_TEXTURES(1)
DRI_CONF_SECTION_END DRI_CONF_END;
+ const uint __driNConfigOptions = 3;
-const uint __driNConfigOptions = 3;
-
-static const __DRIextension *dri_screen_extensions[] = {
- &driReadDrawableExtension,
- &driCopySubBufferExtension.base,
- &driSwapControlExtension.base,
- &driFrameTrackingExtension.base,
- &driMediaStreamCounterExtension.base,
- NULL
-};
+ static const __DRIextension *dri_screen_extensions[] = {
+ &driReadDrawableExtension,
+ &driCopySubBufferExtension.base,
+ &driSwapControlExtension.base,
+ &driFrameTrackingExtension.base,
+ &driMediaStreamCounterExtension.base,
+ NULL
+ };
struct dri1_api *__dri1_api_hooks = NULL;
static const __DRIconfig **
-dri_fill_in_modes(__DRIscreenPrivate *psp,
- unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer)
+dri_fill_in_modes(__DRIscreenPrivate * psp,
+ unsigned pixel_bits, unsigned depth_bits,
+ unsigned stencil_bits, GLboolean have_back_buffer)
{
__DRIconfig **configs;
__GLcontextModes *m;
@@ -97,9 +95,9 @@ dri_fill_in_modes(__DRIscreenPrivate *psp,
depth_bits_array[1] = 24;
depth_bits_array[2] = 24;
- stencil_bits_array[0] = 0; /* no depth or stencil */
- stencil_bits_array[1] = 0; /* z24x8 */
- stencil_bits_array[2] = 8; /* z24s8 */
+ stencil_bits_array[0] = 0; /* no depth or stencil */
+ stencil_bits_array[1] = 0; /* z24x8 */
+ stencil_bits_array[2] = 8; /* z24s8 */
msaa_samples_array[0] = 0;
@@ -107,22 +105,22 @@ dri_fill_in_modes(__DRIscreenPrivate *psp,
back_buffer_factor = 3;
msaa_samples_factor = 1;
- num_modes = depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4;
+ num_modes =
+ depth_buffer_factor * back_buffer_factor * msaa_samples_factor * 4;
if (pixel_bits == 16) {
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
- }
- else {
+ } else {
fb_format = GL_BGRA;
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
configs = driCreateConfigs(fb_format, fb_type,
depth_bits_array,
- stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- msaa_samples_array, msaa_samples_factor);
+ stencil_bits_array, depth_buffer_factor,
+ back_buffer_modes, back_buffer_factor,
+ msaa_samples_array, msaa_samples_factor);
if (configs == NULL) {
debug_printf("%s: driCreateConfigs failed\n", __FUNCTION__);
return NULL;
@@ -131,24 +129,20 @@ dri_fill_in_modes(__DRIscreenPrivate *psp,
for (i = 0; configs[i]; i++) {
m = &configs[i]->modes;
if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
- m->visualRating = GLX_SLOW_CONFIG;
+ m->visualRating = GLX_SLOW_CONFIG;
}
}
- return (const const __DRIconfig **) configs;
+ return (const const __DRIconfig **)configs;
}
-
/**
* Get information about previous buffer swaps.
*/
static int
-dri_get_swap_info(__DRIdrawablePrivate * dPriv,
- __DRIswapInfo * sInfo)
+dri_get_swap_info(__DRIdrawablePrivate * dPriv, __DRIswapInfo * sInfo)
{
- if (dPriv == NULL ||
- dPriv->driverPrivate == NULL ||
- sInfo == NULL)
+ if (dPriv == NULL || dPriv->driverPrivate == NULL || sInfo == NULL)
return -1;
else
return 0;
@@ -164,37 +158,36 @@ dri_copy_version(struct dri1_api_version *dst,
}
static const __DRIconfig **
-dri_init_screen(__DRIscreenPrivate *sPriv)
+dri_init_screen(__DRIscreenPrivate * sPriv)
{
- struct dri_screen *screen;
- const __DRIconfig **configs;
- struct dri1_create_screen_arg arg;
+ struct dri_screen *screen;
+ const __DRIconfig **configs;
+ struct dri1_create_screen_arg arg;
- dri_init_extensions(NULL);
+ dri_init_extensions(NULL);
- screen = CALLOC_STRUCT(dri_screen);
- if (!screen)
- return NULL;
+ screen = CALLOC_STRUCT(dri_screen);
+ if (!screen)
+ return NULL;
- screen->sPriv = sPriv;
- screen->fd = sPriv->fd;
- screen->drmLock = (drmLock *) &sPriv->pSAREA->lock;
+ screen->sPriv = sPriv;
+ screen->fd = sPriv->fd;
+ screen->drmLock = (drmLock *) & sPriv->pSAREA->lock;
- sPriv->private = (void *) screen;
- sPriv->extensions = dri_screen_extensions;
+ sPriv->private = (void *)screen;
+ sPriv->extensions = dri_screen_extensions;
- arg.base.mode = DRM_CREATE_DRI1;
- arg.lf = &dri1_lf;
- arg.ddx_info = sPriv->pDevPriv;
- arg.ddx_info_size = sPriv->devPrivSize;
- arg.sarea = sPriv->pSAREA;
- dri_copy_version(&arg.ddx_version, &sPriv->ddx_version);
- dri_copy_version(&arg.dri_version, &sPriv->dri_version);
- dri_copy_version(&arg.drm_version, &sPriv->drm_version);
- arg.api = NULL;
+ arg.base.mode = DRM_CREATE_DRI1;
+ arg.lf = &dri1_lf;
+ arg.ddx_info = sPriv->pDevPriv;
+ arg.ddx_info_size = sPriv->devPrivSize;
+ arg.sarea = sPriv->pSAREA;
+ dri_copy_version(&arg.ddx_version, &sPriv->ddx_version);
+ dri_copy_version(&arg.dri_version, &sPriv->dri_version);
+ dri_copy_version(&arg.drm_version, &sPriv->drm_version);
+ arg.api = NULL;
- screen->pipe_screen = drm_api_hooks.create_screen
- (screen->fd, &arg.base);
+ screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, &arg.base);
if (!screen->pipe_screen || !arg.api) {
debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__);
@@ -205,8 +198,7 @@ dri_init_screen(__DRIscreenPrivate *sPriv)
screen->pipe_screen->flush_frontbuffer = dri1_flush_frontbuffer;
driParseOptionInfo(&screen->optionCache,
- __driConfigOptions,
- __driNConfigOptions);
+ __driConfigOptions, __driNConfigOptions);
configs = dri_fill_in_modes(sPriv, sPriv->fbBPP, 24, 8, 1);
if (!configs)
@@ -220,14 +212,13 @@ dri_init_screen(__DRIscreenPrivate *sPriv)
return NULL;
}
-
/**
* This is the driver specific part of the createNewScreen entry point.
*
* Returns the __GLcontextModes supported by this driver.
*/
static const __DRIconfig **
-dri_init_screen2(__DRIscreenPrivate *sPriv)
+dri_init_screen2(__DRIscreenPrivate * sPriv)
{
struct dri_screen *screen;
struct drm_create_screen_arg arg;
@@ -241,7 +232,7 @@ dri_init_screen2(__DRIscreenPrivate *sPriv)
screen->sPriv = sPriv;
screen->fd = sPriv->fd;
- sPriv->private = (void *) screen;
+ sPriv->private = (void *)screen;
sPriv->extensions = dri_screen_extensions;
arg.mode = DRM_CREATE_NORMAL;
@@ -255,19 +246,13 @@ dri_init_screen2(__DRIscreenPrivate *sPriv)
screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer;
driParseOptionInfo(&screen->optionCache,
- __driConfigOptions,
- __driNConfigOptions);
-
- return dri_fill_in_modes(sPriv,
- 4 * 8,
- 24,
- 8,
- 1);
-fail:
+ __driConfigOptions, __driNConfigOptions);
+
+ return dri_fill_in_modes(sPriv, 4 * 8, 24, 8, 1);
+ fail:
return NULL;
}
-
static void
dri_destroy_screen(__DRIscreenPrivate * sPriv)
{
@@ -278,23 +263,22 @@ dri_destroy_screen(__DRIscreenPrivate * sPriv)
sPriv->private = NULL;
}
-
PUBLIC const struct __DriverAPIRec driDriverAPI = {
- .InitScreen = dri_init_screen,
- .DestroyScreen = dri_destroy_screen,
- .CreateContext = dri_create_context,
- .DestroyContext = dri_destroy_context,
- .CreateBuffer = dri_create_buffer,
- .DestroyBuffer = dri_destroy_buffer,
- .SwapBuffers = dri_swap_buffers,
- .MakeCurrent = dri_make_current,
- .UnbindContext = dri_unbind_context,
- .GetSwapInfo = dri_get_swap_info,
- .GetDrawableMSC = driDrawableGetMSC32,
- .WaitForMSC = driWaitForMSC32,
- .CopySubBuffer = dri_copy_sub_buffer,
- .InitScreen = dri_init_screen,
- .InitScreen2 = dri_init_screen2,
+ .InitScreen = dri_init_screen,
+ .DestroyScreen = dri_destroy_screen,
+ .CreateContext = dri_create_context,
+ .DestroyContext = dri_destroy_context,
+ .CreateBuffer = dri_create_buffer,
+ .DestroyBuffer = dri_destroy_buffer,
+ .SwapBuffers = dri_swap_buffers,
+ .MakeCurrent = dri_make_current,
+ .UnbindContext = dri_unbind_context,
+ .GetSwapInfo = dri_get_swap_info,
+ .GetDrawableMSC = driDrawableGetMSC32,
+ .WaitForMSC = driWaitForMSC32,
+ .CopySubBuffer = dri_copy_sub_buffer,
+ .InitScreen = dri_init_screen,
+ .InitScreen2 = dri_init_screen2,
};
/* 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 c358c351681..100d9e50e07 100644
--- a/src/gallium/state_trackers/dri/dri_screen.h
+++ b/src/gallium/state_trackers/dri/dri_screen.h
@@ -64,15 +64,13 @@ struct dri_screen
struct pipe_screen *pipe_screen;
};
-
/** cast wrapper */
static INLINE struct dri_screen *
-dri_screen(__DRIscreenPrivate *sPriv)
+dri_screen(__DRIscreenPrivate * sPriv)
{
- return (struct dri_screen *) sPriv->private;
+ return (struct dri_screen *)sPriv->private;
}
-
/***********************************************************************
* dri_screen.c
*/