Skip to content

Instantly share code, notes, and snippets.

View Themaister's full-sized avatar

Hans-Kristian Arntzen Themaister

View GitHub Profile
#if __SSE2__
#include <emmintrin.h>
// There's no equivalent in libc, you'd think so ... std::mismatch exists, but it's not optimized at all. :(
static unsigned find_mismatch(const uint32_t *a, const uint32_t *b, unsigned samples)
{
unsigned i;
unsigned sse_samples = samples & ~3;
for (i = 0; i < sse_samples; i += 4)
{
__m128i v0 = _mm_loadu_si128((const __m128i*)(a + i));
#if defined(VERTEX)
#if __VERSION__ >= 130
#define COMPAT_varying out
#define COMPAT_attribute in
#else
#define COMPAT_varying varying
#define COMPAT_attribute attribute
#endif
commit 63d946c69f3a09fcdaa19ff4d16c73ce1a4245b9
Author: Themaister <[email protected]>
Date: Sun Mar 10 19:14:28 2013 +0100
Add set_rgui_texture interface to video_poke.
diff --git a/driver.h b/driver.h
index 33d7157..b8bab0f 100644
--- a/driver.h
+++ b/driver.h
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <limits.h>
#include <assert.h>
struct bitstream
{
<?xml version="1.0" encoding="UTF-8"?>
<!-- XML/GLSL shader autogenerated by cg2xml.py -->
<shader language="GLSL" style="GLES2">
<vertex><![CDATA[
varying vec2 pixel_no;
varying vec2 c11;
varying vec4 c12_22;
varying vec4 c21_02;
varying vec4 c20_01;
varying vec4 c00_10;
#!/usr/bin/env python
"""Python 3 script which converts simple RetroArch Cg shaders to modern XML/GLSL format."""
import sys
import os
def remove_comments(source_lines):
ret = []
killed_comments = [line.split('//')[0] for line in source_lines]
@Themaister
Themaister / gist:4081633
Created November 15, 2012 22:03
Cg to XML converter, test
#!/usr/bin/env python
"""Python 3 script which converts simple RetroArch Cg shaders to modern XML/GLSL format."""
import sys
import os
def remove_comments(source_lines):
ret = []
killed_comments = [line.split('//')[0] for line in source_lines]
From a4cf36d4f918195c7d39e58a893aac6f528514a4 Mon Sep 17 00:00:00 2001
From: Themaister <[email protected]>
Date: Thu, 20 Sep 2012 16:09:33 +0200
Subject: [PATCH] Always assume that page flip works in radeon.
This is a hack that avoids prolonged stalling in userspace when a page
flip doesn't go through on first try. This patch assumes that it is more
important that userspace is allowed to continue rendering new frames
rather than stalling for a whole frame waiting for old data to render.
---
[ 669.273505] Radeon: CRTC handle flip.
[ 669.273514] Radeon: Radeon wakeup: (Frame 40019).
[ 669.290189] Radeon: CRTC handle flip.
[ 669.290198] Radeon: Radeon wakeup: (Frame 40020).
[ 669.306827] Radeon: CRTC handle flip.
[ 669.306834] Radeon: Deferred page flip.
[ 669.323535] Radeon: CRTC handle flip.
[ 669.323541] Radeon: Radeon wakeup: (Frame 40022).
[ 669.340242] Radeon: CRTC handle flip.
[ 669.340251] Radeon: Radeon wakeup: (Frame 40023).
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 7ddef8f..43a8344 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -277,11 +277,14 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
u32 update_pending;
int vpos, hpos;
+ printk(KERN_DEBUG "Radeon: CRTC handle flip.\n");
+