summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/directfb/idirectfbgl_mesa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/directfb/idirectfbgl_mesa.c')
-rw-r--r--src/mesa/drivers/directfb/idirectfbgl_mesa.c92
1 files changed, 77 insertions, 15 deletions
diff --git a/src/mesa/drivers/directfb/idirectfbgl_mesa.c b/src/mesa/drivers/directfb/idirectfbgl_mesa.c
index 694eeb054d..a364ada1f1 100644
--- a/src/mesa/drivers/directfb/idirectfbgl_mesa.c
+++ b/src/mesa/drivers/directfb/idirectfbgl_mesa.c
@@ -102,7 +102,7 @@ typedef struct {
static pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
static unsigned int global_ref = 0;
-static inline int directfbgl_init( void )
+static INLINE int directfbgl_init( void )
{
pthread_mutexattr_t attr;
int ret;
@@ -118,7 +118,7 @@ static inline int directfbgl_init( void )
return ret;
}
-static inline void directfbgl_finish( void )
+static INLINE void directfbgl_finish( void )
{
if (--global_ref == 0)
pthread_mutex_destroy( &global_lock );
@@ -503,10 +503,31 @@ dfbRenderbufferStorage( GLcontext *ctx, struct gl_renderbuffer *render,
(((S[GCOMP]) & 0xf0) ) | \
(((S[BCOMP]) & 0xf0) >> 4) )
#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x0f00) >> 4); \
- D[GCOMP] = ((*P & 0x00f0) ); \
- D[BCOMP] = ((*P & 0x000f) << 4); \
- D[ACOMP] = ((*P & 0xf000) >> 8)
+ D[RCOMP] = ((*P & 0x0f00) >> 4) | ((*P & 0x0f00) >> 8); \
+ D[GCOMP] = ((*P & 0x00f0) ) | ((*P & 0x00f0) >> 4); \
+ D[BCOMP] = ((*P & 0x000f) << 4) | ((*P & 0x000f) ); \
+ D[ACOMP] = ((*P & 0xf000) >> 8) | ((*P & 0xf000) >> 12)
+
+#include "swrast/s_spantemp.h"
+
+/* RGB444 */
+#define NAME(PREFIX) PREFIX##_RGB444
+#define FORMAT GL_RGBA8
+#define RB_TYPE GLubyte
+#define SPAN_VARS \
+ IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
+#define INIT_PIXEL_PTR(P, X, Y) \
+ GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
+#define INC_PIXEL_PTR(P) P += 1
+#define STORE_PIXEL(P, X, Y, S) \
+ *P = ( (((S[RCOMP]) & 0xf0) << 4) | \
+ (((S[GCOMP]) & 0xf0) ) | \
+ (((S[BCOMP]) & 0xf0) >> 4) )
+#define FETCH_PIXEL(D, P) \
+ D[RCOMP] = ((*P & 0x0f00) >> 4) | ((*P & 0x0f00) >> 8); \
+ D[GCOMP] = ((*P & 0x00f0) ) | ((*P & 0x00f0) >> 4); \
+ D[BCOMP] = ((*P & 0x000f) << 4) | ((*P & 0x000f) ); \
+ D[ACOMP] = 0xff
#include "swrast/s_spantemp.h"
@@ -557,13 +578,34 @@ dfbRenderbufferStorage( GLcontext *ctx, struct gl_renderbuffer *render,
(((S[GCOMP]) & 0xf8) << 2) | \
(((S[BCOMP]) ) >> 3) )
#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x7c00) >> 7); \
- D[GCOMP] = ((*P & 0x03e0) >> 2); \
- D[BCOMP] = ((*P & 0x001f) << 3); \
+ D[RCOMP] = ((*P & 0x7c00) >> 7) | ((*P & 0x7c00) >> 12); \
+ D[GCOMP] = ((*P & 0x03e0) >> 2) | ((*P & 0x03e0) >> 7); \
+ D[BCOMP] = ((*P & 0x001f) << 3) | ((*P & 0x001f) << 2); \
D[ACOMP] = ((*P & 0x8000) ? 0xff : 0)
#include "swrast/s_spantemp.h"
+/* RGB555 */
+#define NAME(PREFIX) PREFIX##_RGB555
+#define FORMAT GL_RGBA8
+#define RB_TYPE GLubyte
+#define SPAN_VARS \
+ IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
+#define INIT_PIXEL_PTR(P, X, Y) \
+ GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
+#define INC_PIXEL_PTR(P) P += 1
+#define STORE_PIXEL(P, X, Y, S) \
+ *P = ( (((S[RCOMP]) & 0xf8) << 7) | \
+ (((S[GCOMP]) & 0xf8) << 2) | \
+ (((S[BCOMP]) ) >> 3) )
+#define FETCH_PIXEL(D, P) \
+ D[RCOMP] = ((*P & 0x7c00) >> 7) | ((*P & 0x7c00) >> 12); \
+ D[GCOMP] = ((*P & 0x03e0) >> 2) | ((*P & 0x03e0) >> 7); \
+ D[BCOMP] = ((*P & 0x001f) << 3) | ((*P & 0x001f) << 2); \
+ D[ACOMP] = 0xff
+
+#include "swrast/s_spantemp.h"
+
/* RGB16 */
#define NAME(PREFIX) PREFIX##_RGB16
#define FORMAT GL_RGBA8
@@ -578,9 +620,9 @@ dfbRenderbufferStorage( GLcontext *ctx, struct gl_renderbuffer *render,
(((S[GCOMP]) & 0xfc) << 3) | \
(((S[BCOMP]) ) >> 3) )
#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0xf800) >> 8); \
- D[GCOMP] = ((*P & 0x07e0) >> 3); \
- D[BCOMP] = ((*P & 0x001f) << 3); \
+ D[RCOMP] = ((*P & 0xf800) >> 8) | ((*P & 0xf800) >> 13); \
+ D[GCOMP] = ((*P & 0x07e0) >> 3) | ((*P & 0x07e0) >> 9); \
+ D[BCOMP] = ((*P & 0x001f) << 3) | ((*P & 0x001f) >> 2); \
D[ACOMP] = 0xff
#include "swrast/s_spantemp.h"
@@ -706,22 +748,24 @@ directfbgl_init_visual( GLvisual *visual,
blueBits = 2;
break;
case DSPF_ARGB4444:
+ alphaBits = 4;
+ case DSPF_RGB444:
redBits = 4;
greenBits = 4;
blueBits = 4;
- alphaBits = 4;
break;
case DSPF_ARGB2554:
+ alphaBits = 2;
redBits = 5;
greenBits = 5;
blueBits = 4;
- alphaBits = 2;
break;
case DSPF_ARGB1555:
+ alphaBits = 1;
+ case DSPF_RGB555:
redBits = 5;
greenBits = 5;
blueBits = 5;
- alphaBits = 1;
break;
case DSPF_RGB16:
redBits = 5;
@@ -818,6 +862,15 @@ directfbgl_create_context( GLcontext *context,
data->render.PutValues = put_values_ARGB4444;
data->render.PutMonoValues = put_mono_values_ARGB4444;
break;
+ case DSPF_RGB444:
+ data->render.GetRow = get_row_RGB444;
+ data->render.GetValues = get_values_RGB444;
+ data->render.PutRow = put_row_RGB444;
+ data->render.PutRowRGB = put_row_rgb_RGB444;
+ data->render.PutMonoRow = put_mono_row_RGB444;
+ data->render.PutValues = put_values_RGB444;
+ data->render.PutMonoValues = put_mono_values_RGB444;
+ break;
case DSPF_ARGB2554:
data->render.GetRow = get_row_ARGB2554;
data->render.GetValues = get_values_ARGB2554;
@@ -836,6 +889,15 @@ directfbgl_create_context( GLcontext *context,
data->render.PutValues = put_values_ARGB1555;
data->render.PutMonoValues = put_mono_values_ARGB1555;
break;
+ case DSPF_RGB555:
+ data->render.GetRow = get_row_RGB555;
+ data->render.GetValues = get_values_RGB555;
+ data->render.PutRow = put_row_RGB555;
+ data->render.PutRowRGB = put_row_rgb_RGB555;
+ data->render.PutMonoRow = put_mono_row_RGB555;
+ data->render.PutValues = put_values_RGB555;
+ data->render.PutMonoValues = put_mono_values_RGB555;
+ break;
case DSPF_RGB16:
data->render.GetRow = get_row_RGB16;
data->render.GetValues = get_values_RGB16;