summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/vl/vl_winsys.h2
-rw-r--r--src/gallium/auxiliary/vl/vl_winsys_dri.c54
2 files changed, 34 insertions, 22 deletions
diff --git a/src/gallium/auxiliary/vl/vl_winsys.h b/src/gallium/auxiliary/vl/vl_winsys.h
index 7d3c9410537..1af7653d650 100644
--- a/src/gallium/auxiliary/vl/vl_winsys.h
+++ b/src/gallium/auxiliary/vl/vl_winsys.h
@@ -63,7 +63,7 @@ struct vl_screen
struct pipe_loader_device *dev;
};
-struct vl_screen*
+struct vl_screen *
vl_dri2_screen_create(Display *display, int screen);
struct vl_screen *
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index 098b9a90b84..e0683a5e7d6 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -73,26 +73,27 @@ struct vl_dri_screen
int64_t last_ust, ns_frame, last_msc, next_msc;
};
-static const unsigned int attachments[1] = { XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT };
+static const unsigned attachments[1] = { XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT };
static void vl_dri2_screen_destroy(struct vl_screen *vscreen);
static void
-vl_dri2_handle_stamps(struct vl_dri_screen* scrn,
+vl_dri2_handle_stamps(struct vl_dri_screen *scrn,
uint32_t ust_hi, uint32_t ust_lo,
uint32_t msc_hi, uint32_t msc_lo)
{
int64_t ust = ((((uint64_t)ust_hi) << 32) | ust_lo) * 1000;
int64_t msc = (((uint64_t)msc_hi) << 32) | msc_lo;
- if (scrn->last_ust && scrn->last_msc && (ust > scrn->last_ust) && (msc > scrn->last_msc))
+ if (scrn->last_ust && (ust > scrn->last_ust) &&
+ scrn->last_msc && (msc > scrn->last_msc))
scrn->ns_frame = (ust - scrn->last_ust) / (msc - scrn->last_msc);
scrn->last_ust = ust;
scrn->last_msc = msc;
}
-static xcb_dri2_get_buffers_reply_t*
+static xcb_dri2_get_buffers_reply_t *
vl_dri2_get_flush_reply(struct vl_dri_screen *scrn)
{
xcb_dri2_wait_sbc_reply_t *wait_sbc_reply;
@@ -122,7 +123,7 @@ vl_dri2_flush_frontbuffer(struct pipe_screen *screen,
unsigned level, unsigned layer,
void *context_private, struct pipe_box *sub_box)
{
- struct vl_dri_screen *scrn = (struct vl_dri_screen*)context_private;
+ struct vl_dri_screen *scrn = (struct vl_dri_screen *)context_private;
uint32_t msc_hi, msc_lo;
assert(screen);
@@ -134,9 +135,11 @@ vl_dri2_flush_frontbuffer(struct pipe_screen *screen,
msc_hi = scrn->next_msc >> 32;
msc_lo = scrn->next_msc & 0xFFFFFFFF;
- scrn->swap_cookie = xcb_dri2_swap_buffers_unchecked(scrn->conn, scrn->drawable, msc_hi, msc_lo, 0, 0, 0, 0);
+ scrn->swap_cookie = xcb_dri2_swap_buffers_unchecked(scrn->conn, scrn->drawable,
+ msc_hi, msc_lo, 0, 0, 0, 0);
scrn->wait_cookie = xcb_dri2_wait_sbc_unchecked(scrn->conn, scrn->drawable, 0, 0);
- scrn->buffers_cookie = xcb_dri2_get_buffers_unchecked(scrn->conn, scrn->drawable, 1, 1, attachments);
+ scrn->buffers_cookie = xcb_dri2_get_buffers_unchecked(scrn->conn, scrn->drawable,
+ 1, 1, attachments);
scrn->flushed = true;
scrn->current_buffer = !scrn->current_buffer;
@@ -175,7 +178,7 @@ vl_dri2_set_drawable(struct vl_dri_screen *scrn, Drawable drawable)
static struct pipe_resource *
vl_dri2_screen_texture_from_drawable(struct vl_screen *vscreen, void *drawable)
{
- struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+ struct vl_dri_screen *scrn = (struct vl_dri_screen *)vscreen;
struct winsys_handle dri2_handle;
struct pipe_resource template, *tex;
@@ -244,7 +247,8 @@ vl_dri2_screen_texture_from_drawable(struct vl_screen *vscreen, void *drawable)
template.bind = PIPE_BIND_RENDER_TARGET;
template.flags = 0;
- tex = scrn->base.pscreen->resource_from_handle(scrn->base.pscreen, &template, &dri2_handle);
+ tex = scrn->base.pscreen->resource_from_handle(scrn->base.pscreen, &template,
+ &dri2_handle);
free(reply);
return tex;
@@ -253,7 +257,7 @@ vl_dri2_screen_texture_from_drawable(struct vl_screen *vscreen, void *drawable)
static struct u_rect *
vl_dri2_screen_get_dirty_area(struct vl_screen *vscreen)
{
- struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+ struct vl_dri_screen *scrn = (struct vl_dri_screen *)vscreen;
assert(scrn);
return &scrn->dirty_areas[scrn->current_buffer];
}
@@ -261,7 +265,7 @@ vl_dri2_screen_get_dirty_area(struct vl_screen *vscreen)
static uint64_t
vl_dri2_screen_get_timestamp(struct vl_screen *vscreen, void *drawable)
{
- struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+ struct vl_dri_screen *scrn = (struct vl_dri_screen *)vscreen;
xcb_dri2_get_msc_cookie_t cookie;
xcb_dri2_get_msc_reply_t *reply;
@@ -284,10 +288,11 @@ vl_dri2_screen_get_timestamp(struct vl_screen *vscreen, void *drawable)
static void
vl_dri2_screen_set_next_timestamp(struct vl_screen *vscreen, uint64_t stamp)
{
- struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+ struct vl_dri_screen *scrn = (struct vl_dri_screen *)vscreen;
assert(scrn);
if (stamp && scrn->last_ust && scrn->ns_frame && scrn->last_msc)
- scrn->next_msc = ((int64_t)stamp - scrn->last_ust + scrn->ns_frame/2) / scrn->ns_frame + scrn->last_msc;
+ scrn->next_msc = ((int64_t)stamp - scrn->last_ust + scrn->ns_frame/2) /
+ scrn->ns_frame + scrn->last_msc;
else
scrn->next_msc = 0;
}
@@ -308,7 +313,7 @@ get_xcb_screen(xcb_screen_iterator_t iter, int screen)
return NULL;
}
-struct vl_screen*
+struct vl_screen *
vl_dri2_screen_create(Display *display, int screen)
{
struct vl_dri_screen *scrn;
@@ -323,7 +328,7 @@ vl_dri2_screen_create(Display *display, int screen)
xcb_generic_error_t *error = NULL;
char *device_name;
int fd, device_name_length;
- unsigned int driverType;
+ unsigned driverType;
drm_magic_t magic;
@@ -343,7 +348,9 @@ vl_dri2_screen_create(Display *display, int screen)
if (!(extension && extension->present))
goto free_screen;
- dri2_query_cookie = xcb_dri2_query_version (scrn->conn, XCB_DRI2_MAJOR_VERSION, XCB_DRI2_MINOR_VERSION);
+ dri2_query_cookie = xcb_dri2_query_version (scrn->conn,
+ XCB_DRI2_MAJOR_VERSION,
+ XCB_DRI2_MINOR_VERSION);
dri2_query = xcb_dri2_query_version_reply (scrn->conn, dri2_query_cookie, &error);
if (dri2_query == NULL || error != NULL || dri2_query->minor_version < 2)
goto free_query;
@@ -355,7 +362,7 @@ vl_dri2_screen_create(Display *display, int screen)
{
char *prime = getenv("DRI_PRIME");
if (prime) {
- unsigned int primeid;
+ unsigned primeid;
errno = 0;
primeid = strtoul(prime, NULL, 0);
if (errno == 0)
@@ -365,9 +372,12 @@ vl_dri2_screen_create(Display *display, int screen)
}
#endif
- connect_cookie = xcb_dri2_connect_unchecked(scrn->conn, get_xcb_screen(s, screen)->root, driverType);
+ connect_cookie = xcb_dri2_connect_unchecked(scrn->conn,
+ get_xcb_screen(s, screen)->root,
+ driverType);
connect = xcb_dri2_connect_reply(scrn->conn, connect_cookie, NULL);
- if (connect == NULL || connect->driver_name_length + connect->device_name_length == 0)
+ if (connect == NULL ||
+ connect->driver_name_length + connect->device_name_length == 0)
goto free_connect;
device_name_length = xcb_dri2_connect_device_name_length(connect);
@@ -384,7 +394,9 @@ vl_dri2_screen_create(Display *display, int screen)
if (drmGetMagic(fd, &magic))
goto free_connect;
- authenticate_cookie = xcb_dri2_authenticate_unchecked(scrn->conn, get_xcb_screen(s, screen)->root, magic);
+ authenticate_cookie = xcb_dri2_authenticate_unchecked(scrn->conn,
+ get_xcb_screen(s, screen)->root,
+ magic);
authenticate = xcb_dri2_authenticate_reply(scrn->conn, authenticate_cookie, NULL);
if (authenticate == NULL || !authenticate->authenticated)
@@ -438,7 +450,7 @@ free_screen:
static void
vl_dri2_screen_destroy(struct vl_screen *vscreen)
{
- struct vl_dri_screen *scrn = (struct vl_dri_screen*)vscreen;
+ struct vl_dri_screen *scrn = (struct vl_dri_screen *)vscreen;
assert(vscreen);