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; |