Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 515602 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/image-format-conversions.c (-2 / +2 lines)
Lines 38-50 Link Here
38
#include "image-format-conversions.h"
38
#include "image-format-conversions.h"
39
39
40
/* Basic line-based copy for packed formats */
40
/* Basic line-based copy for packed formats */
41
void packed_line_copy(int w, int h, int stride, uint8_t *src, uint8_t *dest)
41
void packed_line_copy(int w, int h, int src_stride, int dst_stride, uint8_t *src, uint8_t *dest)
42
{
42
{
43
	int i;
43
	int i;
44
	int len = w * 2;
44
	int len = w * 2;
45
	for (i = 0; i < h; i++)
45
	for (i = 0; i < h; i++)
46
	{
46
	{
47
		memcpy(dest + i * len, src + i * stride, len);
47
		memcpy(dest + i * dst_stride, src + i * src_stride, len);
48
	}
48
	}
49
}
49
}
50
50
(-)a/src/image-format-conversions.h (-1 / +1 lines)
Lines 27-33 Link Here
27
#include <stdint.h>
27
#include <stdint.h>
28
28
29
/* Basic line-based copy for packed formats */
29
/* Basic line-based copy for packed formats */
30
void packed_line_copy(int w, int h, int stride, uint8_t *src, uint8_t *dest);
30
void packed_line_copy(int w, int h, int src_stride, int dst_stride, uint8_t *src, uint8_t *dest);
31
31
32
/* Basic C implementation of YV12/I420 to UYVY conversion */
32
/* Basic C implementation of YV12/I420 to UYVY conversion */
33
void uv12_to_uyvy(int w, int h, int y_pitch, int uv_pitch, uint8_t *y_p, uint8_t *u_p, uint8_t *v_p, uint8_t *dest);
33
void uv12_to_uyvy(int w, int h, int y_pitch, int uv_pitch, uint8_t *y_p, uint8_t *u_p, uint8_t *v_p, uint8_t *dest);
(-)a/src/omapfb-driver.c (-4 / +24 lines)
Lines 66-71 Link Here
66
#define OMAPFB_VERSION 1000
66
#define OMAPFB_VERSION 1000
67
#define OMAPFB_DRIVER_NAME "OMAPFB"
67
#define OMAPFB_DRIVER_NAME "OMAPFB"
68
#define OMAPFB_NAME "omapfb"
68
#define OMAPFB_NAME "omapfb"
69
#define ENFORCE_MODES
69
70
70
static Bool OMAPFBProbe(DriverPtr drv, int flags);
71
static Bool OMAPFBProbe(DriverPtr drv, int flags);
71
static Bool OMAPFBPreInit(ScrnInfoPtr pScrn, int flags);
72
static Bool OMAPFBPreInit(ScrnInfoPtr pScrn, int flags);
Lines 105-115 static SymTabRec OMAPFBChipsets[] = { Link Here
105
typedef enum {
106
typedef enum {
106
	OPTION_ACCELMETHOD,
107
	OPTION_ACCELMETHOD,
107
	OPTION_FB,
108
	OPTION_FB,
109
	OPTION_ROTATE,
108
} FBDevOpts;
110
} FBDevOpts;
109
111
110
static const OptionInfoRec OMAPFBOptions[] = {
112
static const OptionInfoRec OMAPFBOptions[] = {
111
	{ OPTION_ACCELMETHOD,	"AccelMethod",	OPTV_STRING,	{0},	FALSE },
113
	{ OPTION_ACCELMETHOD,	"AccelMethod",	OPTV_STRING,	{0},	FALSE },
112
	{ OPTION_FB,		"fb",		OPTV_STRING,	{0},	FALSE },
114
	{ OPTION_FB,		"fb",		OPTV_STRING,	{0},	FALSE },
115
	{ OPTION_ROTATE,	"rotation",	OPTV_STRING,	{0},	FALSE },
113
	{ -1,			NULL,		OPTV_NONE,	{0},	FALSE }
116
	{ -1,			NULL,		OPTV_NONE,	{0},	FALSE }
114
};
117
};
115
118
Lines 286-291 OMAPFBPreInit(ScrnInfoPtr pScrn, int flags) Link Here
286
{
289
{
287
	OMAPFBPtr ofb;
290
	OMAPFBPtr ofb;
288
	EntityInfoPtr pEnt;
291
	EntityInfoPtr pEnt;
292
	char *rotate;
289
	rgb zeros = { 0, 0, 0 };
293
	rgb zeros = { 0, 0, 0 };
290
	struct stat st;
294
	struct stat st;
291
295
Lines 379-384 OMAPFBPreInit(ScrnInfoPtr pScrn, int flags) Link Here
379
	pScrn->progClock = TRUE;
383
	pScrn->progClock = TRUE;
380
	pScrn->chipset   = "omapfb";
384
	pScrn->chipset   = "omapfb";
381
	
385
	
386
	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Rotate test version 0.02\n");
387
	
382
	/* Start with configured virtual size */
388
	/* Start with configured virtual size */
383
	pScrn->virtualX = pScrn->display->virtualX;
389
	pScrn->virtualX = pScrn->display->virtualX;
384
	pScrn->virtualY = pScrn->display->virtualY;
390
	pScrn->virtualY = pScrn->display->virtualY;
Lines 496-507 OMAPFBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) Link Here
496
	ofb->CloseScreen = pScreen->CloseScreen;
502
	ofb->CloseScreen = pScreen->CloseScreen;
497
	pScreen->CloseScreen = OMAPFBCloseScreen;
503
	pScreen->CloseScreen = OMAPFBCloseScreen;
498
504
505
	/* Enforce the default mode (this is silly I guess) */
506
#ifdef ENFORCE_MODES
507
	//xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enforcing modes\n");
508
	//set_mode(ofb, &ofb->default_mode);
509
	//pScrn->displayWidth = ofb->fixed_info.line_length /
510
	//  (ofb->state_info.bits_per_pixel>>3); //ofb->state_info.xres;
511
#endif
512
499
	/* Map our framebuffer memory */
513
	/* Map our framebuffer memory */
514
	ofb->mem_info.size = ofb->fixed_info.line_length * ofb->state_info.yres;
500
	ofb->fb = mmap (NULL, ofb->mem_info.size,
515
	ofb->fb = mmap (NULL, ofb->mem_info.size,
501
	                PROT_READ | PROT_WRITE, MAP_SHARED,
516
	                PROT_READ | PROT_WRITE, MAP_SHARED,
502
	                ofb->fd, 0);
517
	                ofb->fd, 0);
503
	if (ofb->fb == NULL) {
518
	if (ofb->fb == MAP_FAILED) {
504
		xf86DrvMsg(scrnIndex, X_ERROR, "Mapping framebuffer memory failed\n");
519
		xf86DrvMsg(scrnIndex, X_ERROR, "Mapping framebuffer memory failed, wanted %d bytes.\n", ofb->mem_info.size);
505
		return FALSE;
520
		return FALSE;
506
	}
521
	}
507
522
Lines 578-585 OMAPFBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) Link Here
578
	} else if (!ofb->dss) {
593
	} else if (!ofb->dss) {
579
594
580
		ofb->plane_info.enabled = 1;
595
		ofb->plane_info.enabled = 1;
581
		ofb->plane_info.out_width = ofb->state_info.xres;
596
		if (ofb->state_info.rotate == 0 || ofb->state_info.rotate == 2) {
582
		ofb->plane_info.out_height = ofb->state_info.yres;
597
			ofb->plane_info.out_width = ofb->state_info.xres;
598
			ofb->plane_info.out_height = ofb->state_info.yres;
599
		} else {
600
			ofb->plane_info.out_width = ofb->state_info.yres;
601
			ofb->plane_info.out_height = ofb->state_info.xres;
602
		}
583
603
584
		if (ioctl (ofb->fd, OMAPFB_SETUP_PLANE, &ofb->plane_info)) {
604
		if (ioctl (ofb->fd, OMAPFB_SETUP_PLANE, &ofb->plane_info)) {
585
			xf86DrvMsg(scrnIndex, X_ERROR,
605
			xf86DrvMsg(scrnIndex, X_ERROR,
(-)a/src/omapfb-xv-blizzard.c (+1 lines)
Lines 220-225 int OMAPFBXVPutImageBlizzard (ScrnInfoPtr pScrn, Link Here
220
			packed_line_copy(src_w & ~3,
220
			packed_line_copy(src_w & ~3,
221
			                 src_h & ~3,
221
			                 src_h & ~3,
222
			                 ((src_w + 1) & ~1) * 2,
222
			                 ((src_w + 1) & ~1) * 2,
223
					 ofb->port->fixed_info.line_length,
223
			                 (uint8_t*)buf,
224
			                 (uint8_t*)buf,
224
			                 (uint8_t*)ofb->port->fb);
225
			                 (uint8_t*)ofb->port->fb);
225
			break;
226
			break;
(-)a/src/omapfb-xv-generic.c (-15 / +57 lines)
Lines 62-68 int OMAPXVAllocPlane(ScrnInfoPtr pScrn) Link Here
62
{
62
{
63
	OMAPFBPtr ofb = OMAPFB(pScrn);
63
	OMAPFBPtr ofb = OMAPFB(pScrn);
64
64
65
	/* The memory size is already set in OMAPFBXVQueryImageAttributes */
65
	/* The memory size is already set before we get here */
66
	if (ioctl(ofb->port->fd, OMAPFB_SETUP_MEM, &ofb->port->mem_info) != 0) {
66
	if (ioctl(ofb->port->fd, OMAPFB_SETUP_MEM, &ofb->port->mem_info) != 0) {
67
		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
67
		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
68
		           "Failed to allocate video plane memory\n");
68
		           "Failed to allocate video plane memory\n");
Lines 73-91 int OMAPXVAllocPlane(ScrnInfoPtr pScrn) Link Here
73
	ofb->port->fb = mmap (NULL, ofb->port->mem_info.size,
73
	ofb->port->fb = mmap (NULL, ofb->port->mem_info.size,
74
	                PROT_READ | PROT_WRITE, MAP_SHARED,
74
	                PROT_READ | PROT_WRITE, MAP_SHARED,
75
	                ofb->port->fd, 0);
75
	                ofb->port->fd, 0);
76
	if (ofb->port->fb == NULL) {
76
	if (ofb->port->fb == MAP_FAILED) {
77
		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
77
		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
78
		           "Mapping video memory failed\n");
78
		           "Mapping video memory failed\n");
79
		return XvBadAlloc;
79
		return XvBadAlloc;
80
	}
80
	}
81
81
82
	/* Update the state info */
82
	/* Update the state info */
83
	/* Let's not - it's bad
83
	if (ioctl (ofb->port->fd, FBIOGET_VSCREENINFO, &ofb->port->state_info))
84
	if (ioctl (ofb->port->fd, FBIOGET_VSCREENINFO, &ofb->port->state_info))
84
	{
85
	{
85
		xf86Msg(X_ERROR, "%s: Reading state info failed\n", __FUNCTION__);
86
		xf86Msg(X_ERROR, "%s: Reading state info failed\n", __FUNCTION__);
86
		return XvBadAlloc;
87
		return XvBadAlloc;
87
	}
88
	}
88
89
	*/
89
	return Success;
90
	return Success;
90
}
91
}
91
92
Lines 93-98 int OMAPXVAllocPlane(ScrnInfoPtr pScrn) Link Here
93
int OMAPXVSetupVideoPlane(ScrnInfoPtr pScrn)
94
int OMAPXVSetupVideoPlane(ScrnInfoPtr pScrn)
94
{
95
{
95
	OMAPFBPtr ofb = OMAPFB(pScrn);
96
	OMAPFBPtr ofb = OMAPFB(pScrn);
97
	int ret;
96
98
97
	if (ioctl (ofb->port->fd, FBIOPUT_VSCREENINFO, &ofb->port->state_info))
99
	if (ioctl (ofb->port->fd, FBIOPUT_VSCREENINFO, &ofb->port->state_info))
98
	{
100
	{
Lines 104-109 int OMAPXVSetupVideoPlane(ScrnInfoPtr pScrn) Link Here
104
		xf86Msg(X_ERROR, "%s: Reading state info failed\n", __FUNCTION__);
106
		xf86Msg(X_ERROR, "%s: Reading state info failed\n", __FUNCTION__);
105
		return XvBadAlloc;
107
		return XvBadAlloc;
106
	}
108
	}
109
	/* Changing rotation/nonstd flags can change the fixed info! */
110
	if (ioctl (ofb->port->fd, FBIOGET_FSCREENINFO, &ofb->port->fixed_info))
111
	{
112
		xf86Msg(X_ERROR, "%s: Reading state info failed\n", __FUNCTION__);
113
		return XvBadAlloc;
114
	}
115
	/* Correct fixed info requires recalculation of needed memory */
116
	ofb->port->mem_info.size = ofb->port->fixed_info.line_length * ofb->port->state_info.yres;
117
118
	/* Allocate buffer memory */
119
	ret = OMAPXVAllocPlane(pScrn);
120
	if (ret != Success)
121
		return ret;
122
123
	/* Workaround for reset of mode after memory allo */
124
	if (ioctl (ofb->port->fd, FBIOPUT_VSCREENINFO, &ofb->port->state_info))
125
	{
126
		xf86Msg(X_ERROR, "%s: setting state info failed\n", __FUNCTION__);
127
		return XvBadAlloc;
128
	}
129
	if (ioctl (ofb->port->fd, FBIOGET_VSCREENINFO, &ofb->port->state_info))
130
	{
131
		xf86Msg(X_ERROR, "%s: Reading state info failed\n", __FUNCTION__);
132
		return XvBadAlloc;
133
	}
107
134
108
	if(ioctl(ofb->port->fd, OMAPFB_SETUP_PLANE,
135
	if(ioctl(ofb->port->fd, OMAPFB_SETUP_PLANE,
109
	   &ofb->port->plane_info) != 0) {
136
	   &ofb->port->plane_info) != 0) {
Lines 124-129 int OMAPFBXVPutImageGeneric (ScrnInfoPtr pScrn, Link Here
124
                             DrawablePtr pDraw)
151
                             DrawablePtr pDraw)
125
{
152
{
126
	OMAPFBPtr ofb = OMAPFB(pScrn);
153
	OMAPFBPtr ofb = OMAPFB(pScrn);
154
	short drw_temp;
155
	short rot_xres, rot_yres;
127
156
128
	if (!ofb->port->plane_info.enabled
157
	if (!ofb->port->plane_info.enabled
129
	 || ofb->port->update_window.x != src_x
158
	 || ofb->port->update_window.x != src_x
Lines 163-175 int OMAPFBXVPutImageGeneric (ScrnInfoPtr pScrn, Link Here
163
			return Success;
192
			return Success;
164
		}
193
		}
165
194
166
		/* If we don't have the plane running, enable it */
167
		if (!ofb->port->plane_info.enabled) {
168
			ret = OMAPXVAllocPlane(pScrn);
169
			if (ret != Success)
170
				return ret;
171
		}
172
173
		/* Set up the state info, xres and yres will be used for
195
		/* Set up the state info, xres and yres will be used for
174
		 * scaling to the values in the plane info struct
196
		 * scaling to the values in the plane info struct
175
		 */
197
		 */
Lines 179-190 int OMAPFBXVPutImageGeneric (ScrnInfoPtr pScrn, Link Here
179
		ofb->port->state_info.yres_virtual = 0;
201
		ofb->port->state_info.yres_virtual = 0;
180
		ofb->port->state_info.xoffset = 0;
202
		ofb->port->state_info.xoffset = 0;
181
		ofb->port->state_info.yoffset = 0;
203
		ofb->port->state_info.yoffset = 0;
182
		ofb->port->state_info.rotate = 0;
204
		//ofb->port->state_info.rotate = 0;
183
		ofb->port->state_info.grayscale = 0;
205
		ofb->port->state_info.grayscale = 0;
184
		ofb->port->state_info.activate = FB_ACTIVATE_NOW;
206
		ofb->port->state_info.activate = FB_ACTIVATE_NOW;
185
		ofb->port->state_info.bits_per_pixel = 0;
207
		ofb->port->state_info.bits_per_pixel = 0;
186
		ofb->port->state_info.nonstd = xv_to_omapfb_format(image);
208
		ofb->port->state_info.nonstd = xv_to_omapfb_format(image);
187
209
210
		/* Plane info does not rotate with state_info */
211
		if (ofb->port->state_info.rotate == 1 ||
212
		  ofb->port->state_info.rotate == 3) {
213
			drw_temp = drw_x;
214
			drw_x = drw_y;
215
			drw_y = drw_temp;
216
217
			drw_temp = drw_w;
218
			drw_w = drw_h;
219
			drw_h = drw_temp;
220
221
			rot_xres = ofb->port->state_info.yres;
222
			rot_yres = ofb->port->state_info.xres;
223
		} else {
224
			rot_xres = ofb->port->state_info.xres;
225
			rot_yres = ofb->port->state_info.yres;
226
		}
227
228
188
		/* Set up the video plane info */
229
		/* Set up the video plane info */
189
		ofb->port->plane_info.enabled = 1;
230
		ofb->port->plane_info.enabled = 1;
190
		ofb->port->plane_info.pos_x = drw_x;
231
		ofb->port->plane_info.pos_x = drw_x;
Lines 193-205 int OMAPFBXVPutImageGeneric (ScrnInfoPtr pScrn, Link Here
193
		ofb->port->plane_info.out_height = drw_h & ~15;
234
		ofb->port->plane_info.out_height = drw_h & ~15;
194
235
195
		/* Cap output to screen size */
236
		/* Cap output to screen size */
196
		if (ofb->port->plane_info.out_width > ofb->state_info.xres) {
237
		if (ofb->port->plane_info.out_width > rot_xres) {
197
			ofb->port->plane_info.pos_x = 0;
238
			ofb->port->plane_info.pos_x = 0;
198
			ofb->port->plane_info.out_width = ofb->state_info.xres;
239
			ofb->port->plane_info.out_width = rot_xres;
199
		}
240
		}
200
		if (ofb->port->plane_info.out_height > ofb->state_info.yres) {
241
		if (ofb->port->plane_info.out_height > rot_yres) {
201
			ofb->port->plane_info.pos_y = 0;
242
			ofb->port->plane_info.pos_y = 0;
202
			ofb->port->plane_info.out_height = ofb->state_info.yres;
243
			ofb->port->plane_info.out_height = rot_yres;
203
		}
244
		}
204
245
205
		ret = OMAPXVSetupVideoPlane(pScrn);
246
		ret = OMAPXVSetupVideoPlane(pScrn);
Lines 223-228 int OMAPFBXVPutImageGeneric (ScrnInfoPtr pScrn, Link Here
223
			packed_line_copy(src_w & ~15,
264
			packed_line_copy(src_w & ~15,
224
			                 src_h & ~15,
265
			                 src_h & ~15,
225
			                 ((src_w + 1) & ~1) * 2,
266
			                 ((src_w + 1) & ~1) * 2,
267
			                 ofb->port->fixed_info.line_length,
226
			                 (uint8_t*)buf,
268
			                 (uint8_t*)buf,
227
			                 (uint8_t*)ofb->port->fb);
269
			                 (uint8_t*)ofb->port->fb);
228
			break;
270
			break;
(-)a/src/omapfb-xv.c (-1 / +3 lines)
Lines 169-176 static int OMAPFBXVQueryImageAttributes (ScrnInfoPtr pScrn, Link Here
169
	h = *height;
169
	h = *height;
170
170
171
	w = (w + 1) & ~1;
171
	w = (w + 1) & ~1;
172
173
	/* Can't calculate these here - don't know line length
172
	ofb->port->mem_info.size = w << 1;
174
	ofb->port->mem_info.size = w << 1;
173
	ofb->port->mem_info.size *= h;
175
	ofb->port->mem_info.size *= h;
176
	*/
174
177
175
	return size;
178
	return size;
176
}
179
}
177
- 

Return to bug 515602