xref: /haiku/src/add-ons/accelerants/nvidia/Overlay.c (revision 2f470aec1c92ce6917b8a903e343795dc77af41f)
1 /* Written by Rudolf Cornelissen 05/2002-4/2006 */
2 
3 /* Note on 'missing features' in BeOS 5.0.3 and DANO:
4  * BeOS needs to define more colorspaces! It would be nice if BeOS would support the FourCC 'definitions'
5  * of colorspaces. These colorspaces are 32bit words, so it could be simply done (or is it already so?)
6  */
7 
8 #define MODULE_BIT 0x00000400
9 
10 #include "acc_std.h"
11 
12 /* define the supported overlay input colorspaces */
13 /* It would be nice to have the YUV4:2:0 2-plane mode implemented also later on, but the Be colorspace
14  * definitions (in GraphicsDefs.h, R5.0.3 and DANO5.1d0) do not include this one... */
15 static uint32 overlay_colorspaces [] = { (uint32)B_YCbCr422, (uint32)B_NO_COLOR_SPACE };
16 
17 uint32 OVERLAY_COUNT(const display_mode *dm)
18 // This method is never used AFAIK though it *is* exported on R5.0.3 and DANO.
19 // Does someone know howto invoke it?
20 {
21 	LOG(4,("Overlay: count called\n"));
22 
23 	/* check for NULL pointer */
24 	if (dm == NULL)
25 	{
26 		LOG(4,("Overlay: No display mode specified!\n"));
27 	}
28 	/* apparantly overlay count should report the number of 'overlay units' on the card */
29 	return 1;
30 }
31 
32 const uint32 *OVERLAY_SUPPORTED_SPACES(const display_mode *dm)
33 // This method is never used AFAIK though it *is* exported on R5.0.3 and DANO.
34 // Does someone know howto invoke it?
35 {
36 	LOG(4,("Overlay: supported_spaces called.\n"));
37 
38 	/* check for NULL pointer */
39 	if (dm == NULL)
40 	{
41 		LOG(4,("Overlay: No display mode specified!\n"));
42 		return NULL;
43 	}
44 
45 	/* assuming interlaced VGA is not supported */
46 	if (dm->timing.flags & B_TIMING_INTERLACED)
47 	{
48 		return NULL;
49 	}
50 	/* return a B_NO_COLOR_SPACE terminated list */
51 	return &overlay_colorspaces[0];
52 }
53 
54 uint32 OVERLAY_SUPPORTED_FEATURES(uint32 a_color_space)
55 // This method is never used AFAIK. On R5.0.3 and DANO it is not even exported!
56 {
57 	LOG(4,("Overlay: supported_features: color_space $%08x\n",a_color_space));
58 
59 	/* check what features are supported for the current overlaybitmap colorspace */
60 	switch (a_color_space)
61 	{
62 	default:
63 			return
64 				( B_OVERLAY_KEYING_USES_ALPHA 	 |
65 				  B_OVERLAY_COLOR_KEY 			 |
66 				  B_OVERLAY_HORIZONTAL_FILTERING |
67 				  B_OVERLAY_VERTICAL_FILTERING );
68 	}
69 }
70 
71 const overlay_buffer *ALLOCATE_OVERLAY_BUFFER(color_space cs, uint16 width, uint16 height)
72 {
73 	int offset = 0;					/* used to determine next buffer to create */
74 	uint32 adress, adress2, temp32;	/* used to calculate buffer adresses */
75 	uint32 oldsize = 0;				/* used to 'squeeze' new buffers between already existing ones */
76 	int cnt;						/* loopcounter */
77 
78 	/* acquire the shared benaphore */
79 	AQUIRE_BEN(si->overlay.lock)
80 
81 	LOG(4,("Overlay: cardRAM_start = $%08x\n",(uint32)((uint8*)si->framebuffer)));
82 	LOG(4,("Overlay: cardRAM_start_DMA = $%08x\n",(uint32)((uint8*)si->framebuffer_pci)));
83 	LOG(4,("Overlay: cardRAM_size = %3.3fMb\n",(si->ps.memory_size / (1024.0 * 1024.0))));
84 
85 	/* find first empty slot (room for another buffer?) */
86 	for (offset = 0; offset < MAXBUFFERS; offset++)
87 	{
88 		if (si->overlay.myBuffer[offset].buffer == NULL) break;
89 	}
90 
91 	LOG(4,("Overlay: Allocate_buffer offset = %d\n",offset));
92 
93 	if (offset < MAXBUFFERS)
94 	/* setup new scaler input buffer */
95 	{
96 		switch (cs)
97 		{
98 			case B_YCbCr422:
99 					if (si->ps.card_arch < NV10A)
100 					{
101 						/* check if slopspace is needed: RIVA128 and TNT need ~0x000f. */
102 						si->overlay.myBuffer[offset].width = ((width + 0x000f) & ~0x000f);
103 					}
104 					else
105 					{
106 						/* check if slopspace is needed: GeForce need ~0x001f. */
107 						/* fixme:
108 						 * update needed for GF DVDmax support to adhere to CRTC2 constraints?? */
109 						si->overlay.myBuffer[offset].width = ((width + 0x001f) & ~0x001f);
110 					}
111 					si->overlay.myBuffer[offset].bytes_per_row = 2 * si->overlay.myBuffer[offset].width;
112 
113 					/* check if the requested horizontal pitch is supported: */
114 					//fixme: tune for GF and TNT...
115 					if (si->overlay.myBuffer[offset].width > 4088)
116 					{
117 						LOG(4,("Overlay: Sorry, requested buffer pitch not supported, aborted\n"));
118 
119 						/* release the shared benaphore */
120 						RELEASE_BEN(si->overlay.lock)
121 
122 						return NULL;
123 					}
124 					break;
125 			default:
126 					/* unsupported colorspace! */
127 					LOG(4,("Overlay: Sorry, colorspace $%08x not supported, aborted\n",cs));
128 
129 					/* release the shared benaphore */
130 					RELEASE_BEN(si->overlay.lock)
131 
132 					return NULL;
133 					break;
134 		}
135 
136 		/* check if the requested buffer width is supported */
137 		if (si->overlay.myBuffer[offset].width > 1024)
138 		{
139 			LOG(4,("Overlay: Sorry, requested buffer width not supported, aborted\n"));
140 
141 			/* release the shared benaphore */
142 			RELEASE_BEN(si->overlay.lock)
143 
144 			return NULL;
145 		}
146 		/* check if the requested buffer height is supported */
147 		if (height > 1024)
148 		{
149 			LOG(4,("Overlay: Sorry, requested buffer height not supported, aborted\n"));
150 
151 			/* release the shared benaphore */
152 			RELEASE_BEN(si->overlay.lock)
153 
154 			return NULL;
155 		}
156 
157 		/* store slopspace (in pixels) for each bitmap for use by 'overlay unit' (BES) */
158 		si->overlay.myBufInfo[offset].slopspace = si->overlay.myBuffer[offset].width - width;
159 
160 		si->overlay.myBuffer[offset].space = cs;
161 		si->overlay.myBuffer[offset].height = height;
162 
163 		/* we define the overlay buffers to reside 'in the back' of the cards RAM */
164 		/* NOTE to app programmers:
165 		 * Beware that an app using overlay needs to track workspace switches and screenprefs
166 		 * changes. If such an action is detected, the app needs to reset it's pointers to the
167 		 * newly created overlay bitmaps, which will be assigned by BeOS automatically after such
168 		 * an event. (Also the app needs to respect the new overlay_constraints that will be applicable!)
169 		 *
170 		 * It is entirely possible that new bitmaps may *not* be re-setup at all, or less of them
171 		 * than previously setup by the app might be re-setup. This is due to cardRAM restraints then.
172 		 * This means that the app should also check for NULL pointers returned by the bitmaps,
173 		 * and if this happens, it needs to fallback to single buffered overlay or even fallback to
174 		 * bitmap output for the new situation. */
175 
176 		/* Another NOTE for app programmers:
177 		 * A *positive* side-effect of assigning the first overlay buffer exactly at the end of the
178 		 * cardRAM is that apps that try to write beyond the buffer's space get a segfault immediately.
179 		 * This *greatly* simplifies tracking such errors!
180 		 * Of course such errors may lead to strange effects in the app or driver behaviour if they are
181 		 * not hunted down and removed.. */
182 
183 		/* calculate first free RAM adress in card:
184 		 * Driver setup is as follows:
185 		 * card base: 		- hardware cursor bitmap (if used),
186 		 * directly above	- screen memory for both heads */
187 		adress2 = (((uint32)((uint8*)si->fbc.frame_buffer)) +	/* cursor already included here */
188 			(si->fbc.bytes_per_row * si->dm.virtual_height));	/* size in bytes of screen(s) */
189 		LOG(4,("Overlay: first free cardRAM virtual adress $%08x\n", adress2));
190 
191 		/* calculate 'preliminary' buffer size including slopspace */
192 		oldsize = si->overlay.myBufInfo[offset].size;
193 		si->overlay.myBufInfo[offset].size =
194 			si->overlay.myBuffer[offset].bytes_per_row * si->overlay.myBuffer[offset].height;
195 
196 		/* calculate virtual memory adress that would be needed for a new bitmap */
197 		/* NOTE to app programmers:
198 		 * For testing app behaviour regarding workspace switches or screen prefs changes to settings
199 		 * that do not have enough cardRAM left for allocation of overlay bitmaps, you need a card with
200 		 * a low amount of RAM. Or you can set in the file nv.settings for example:
201 		 * memory 8 #8Mb RAM on card
202 		 * and reboot (this simulates 8Mb RAM on the card).
203 		 *
204 		 * If you switch now to settings: 1600x1200x32bit (single head) the app needs to fallback to
205 		 * bitmap output or maybe single buffered overlay output if small bitmaps are used. */
206 
207 		adress = (((uint32)((uint8*)si->framebuffer)) + si->ps.memory_size);
208 		/* Keep some extra distance as a workaround for certain bugs (see
209 		 * DriverInterface.h for an explanation). */
210 		if (si->ps.card_arch < NV40A)
211 			adress -= PRE_NV40_OFFSET;
212 		else
213 			adress -= NV40_PLUS_OFFSET;
214 
215 		for (cnt = 0; cnt <= offset; cnt++)
216 		{
217 			adress -= si->overlay.myBufInfo[cnt].size;
218 		}
219 
220 		/* the > G200 scalers require buffers to be aligned to 16 byte pages cardRAM offset, G200 can do with
221 		 * 8 byte pages cardRAM offset. Compatible settings used, has no real downside consequences here */
222 
223 		/* Check if we need to modify the buffers starting adress and thus the size */
224 		/* calculate 'would be' cardRAM offset */
225 		temp32 = (adress - ((uint32)((vuint32 *)si->framebuffer)));
226 		/* check if it is aligned */
227 		if (temp32 != (temp32 & 0xfffffff0))
228 		{
229 			/* update the (already calculated) buffersize to get it aligned */
230 			si->overlay.myBufInfo[offset].size += (temp32 - (temp32 & 0xfffffff0));
231 			/* update the (already calculated) adress to get it aligned */
232 			adress -= (temp32 - (temp32 & 0xfffffff0));
233 		}
234 		LOG(4,("Overlay: new buffer needs virtual adress $%08x\n", adress));
235 
236 		/* First check now if buffer to be defined is 'last one' in memory (speaking backwards):
237 		 * this is done to prevent a large buffer getting created in the space a small buffer
238 		 * occupied earlier, if not all buffers created were deleted.
239 		 * Note also that the app can delete the buffers in any order desired. */
240 
241 		/* NOTE to app programmers:
242 		 * If you are going to delete a overlay buffer you created, you should delete them *all* and
243 		 * then re-create only the new ones needed. This way you are sure not to get unused memory-
244 		 * space in between your overlay buffers for instance, so cardRAM is used 'to the max'.
245 		 * If you don't, you might not get a buffer at all if you are trying to set up a larger one
246 		 * than before.
247 		 * (Indeed: not all buffers *have* to be of the same type and size...) */
248 
249 		for (cnt = offset; cnt < MAXBUFFERS; cnt++)
250 		{
251 			if (si->overlay.myBuffer[cnt].buffer != NULL)
252 			{
253 				/* Check if the new buffer would fit into the space the single old one used here */
254 				if (si->overlay.myBufInfo[offset].size <= oldsize)
255 				{
256 					/* It does, so we reset to the old size and adresses to prevent the space from shrinking
257 					 * if we get here again... */
258 					adress -= (oldsize - si->overlay.myBufInfo[offset].size);
259 					si->overlay.myBufInfo[offset].size = oldsize;
260 					LOG(4,("Overlay: 'squeezing' in buffer:\n"
261 						   "Overlay: resetting it to virtual adress $%08x and size $%08x\n", adress,oldsize));
262 					/* force exiting the FOR loop */
263 					cnt = MAXBUFFERS;
264 				}
265 				else
266 				{
267 					/* nogo, sorry */
268 					LOG(4,("Overlay: Other buffer(s) exist after this one:\n"
269 						   "Overlay: not enough space to 'squeeze' this one in, aborted\n"));
270 
271 					/* Reset to the old size to prevent the space from 'growing' if we get here again... */
272 					si->overlay.myBufInfo[offset].size = oldsize;
273 
274 					/* release the shared benaphore */
275 					RELEASE_BEN(si->overlay.lock)
276 
277 					return NULL;
278 				}
279 			}
280 		}
281 
282 		/* check if we have enough space to setup this new bitmap
283 		 * (preventing overlap of desktop RAMspace & overlay bitmap RAMspace here) */
284 		if (adress < adress2)
285 		/* nope, sorry */
286 		{
287 			LOG(4,("Overlay: Sorry, no more space for buffers: aborted\n"));
288 
289 			/* release the shared benaphore */
290 			RELEASE_BEN(si->overlay.lock)
291 
292 			return NULL;
293 		}
294 		/* continue buffer setup */
295 		si->overlay.myBuffer[offset].buffer = (void *) adress;
296 
297 		/* calculate physical memory adress (for dma use) */
298 		adress = (((uint32)((uint8*)si->framebuffer_pci)) + si->ps.memory_size);
299 		/* Keep some extra distance as a workaround for certain bugs (see
300 		 * DriverInterface.h for an explanation). */
301 		if (si->ps.card_arch < NV40A)
302 			adress -= PRE_NV40_OFFSET;
303 		else
304 			adress -= NV40_PLUS_OFFSET;
305 
306 		for (cnt = 0; cnt <= offset; cnt++)
307 		{
308 			adress -= si->overlay.myBufInfo[cnt].size;
309 		}
310 		/* this adress is already aligned to the scaler's requirements (via the already modified sizes) */
311 		si->overlay.myBuffer[offset].buffer_dma = (void *) adress;
312 
313 		LOG(4,("Overlay: New buffer: addr $%08x, dma_addr $%08x, color space $%08x\n",
314 			(uint32)((uint8*)si->overlay.myBuffer[offset].buffer),
315 			(uint32)((uint8*)si->overlay.myBuffer[offset].buffer_dma), cs));
316 		LOG(4,("Overlay: New buffer's size is $%08x\n", si->overlay.myBufInfo[offset].size));
317 
318 		/* release the shared benaphore */
319 		RELEASE_BEN(si->overlay.lock)
320 
321 		return &si->overlay.myBuffer[offset];
322 	}
323 	else
324 	/* sorry, no more room for buffers */
325 	{
326 		LOG(4,("Overlay: Sorry, no more space for buffers: aborted\n"));
327 
328 		/* release the shared benaphore */
329 		RELEASE_BEN(si->overlay.lock)
330 
331 		return NULL;
332 	}
333 }
334 
335 status_t RELEASE_OVERLAY_BUFFER(const overlay_buffer *ob)
336 /* Note that the user can delete the buffers in any order desired! */
337 {
338 	int offset = 0;
339 
340 	if (ob != NULL)
341 	{
342 		/* find the buffer */
343 		for (offset = 0; offset < MAXBUFFERS; offset++)
344 		{
345 			if (si->overlay.myBuffer[offset].buffer == ob->buffer) break;
346 		}
347 
348 		if (offset < MAXBUFFERS)
349 		/* delete current buffer */
350 		{
351 			si->overlay.myBuffer[offset].buffer = NULL;
352 			si->overlay.myBuffer[offset].buffer_dma = NULL;
353 
354 			LOG(4,("Overlay: Release_buffer offset = %d, buffer released\n",offset));
355 
356 			return B_OK;
357 		}
358 		else
359 		{
360 			/* this is no buffer of ours! */
361 			LOG(4,("Overlay: Release_overlay_buffer: not ours, aborted!\n"));
362 
363 			return B_ERROR;
364 		}
365 	}
366 	else
367 	/* no buffer specified! */
368 	{
369 		LOG(4,("Overlay: Release_overlay_buffer: no buffer specified, aborted!\n"));
370 
371 		return B_ERROR;
372 	}
373 }
374 
375 status_t GET_OVERLAY_CONSTRAINTS
376 	(const display_mode *dm, const overlay_buffer *ob, overlay_constraints *oc)
377 {
378 	int offset = 0;
379 
380 	LOG(4,("Overlay: Get_overlay_constraints called\n"));
381 
382 	/* check for NULL pointers */
383 	if ((dm == NULL) || (ob == NULL) || (oc == NULL))
384 	{
385 		LOG(4,("Overlay: Get_overlay_constraints: Null pointer(s) detected!\n"));
386 		return B_ERROR;
387 	}
388 
389 	/* find the buffer */
390 	for (offset = 0; offset < MAXBUFFERS; offset++)
391 	{
392 		if (si->overlay.myBuffer[offset].buffer == ob->buffer) break;
393 	}
394 
395 	if (offset < MAXBUFFERS)
396 	{
397 		/* scaler input (values are in pixels) */
398 		oc->view.h_alignment = 0;
399 		oc->view.v_alignment = 0;
400 
401 		switch (ob->space)
402 		{
403 			case B_YCbCr422:
404 					if (si->ps.card_arch < NV10A)
405 					{
406 						/* RIVA128 and TNT need 15.
407 						 * Note: this has to be in sync with the slopspace setup during buffer allocation.. */
408 						oc->view.width_alignment = 15;
409 					}
410 					else
411 					{
412 						/* GeForce need 31.
413 						 * Note: this has to be in sync with the slopspace setup during buffer allocation.. */
414 						oc->view.width_alignment = 31;
415 					}
416 					break;
417 			default:
418 					/* we should not be here, but set the worst-case value just to be safe anyway */
419 					oc->view.width_alignment = 31;
420 					break;
421 		}
422 
423 		oc->view.height_alignment = 0;
424 		oc->view.width.min = 1;
425 		oc->view.height.min = 2; /* two fields */
426 		oc->view.width.max = ob->width;
427 		oc->view.height.max = ob->height;
428 
429 		/* scaler output restrictions */
430 		oc->window.h_alignment = 0;
431 		oc->window.v_alignment = 0;
432 		oc->window.width_alignment = 0;
433 		oc->window.height_alignment = 0;
434 		oc->window.width.min = 2;
435 		/* GeForce cards can output upto and including 2046 pixels in width */
436 		//fixme: how about TNT?
437 		if (dm->virtual_width > 2046)
438 		{
439 			oc->window.width.max = 2046;
440 		}
441 		else
442 		{
443 			oc->window.width.max = dm->virtual_width;
444 		}
445 		oc->window.height.min = 2;
446 		/* GeForce cards can output upto and including 2046 pixels in height */
447 		//fixme: how about TNT?
448 		if (dm->virtual_height > 2046)
449 		{
450 			oc->window.height.max = 2046;
451 		}
452 		else
453 		{
454 			oc->window.height.max = dm->virtual_height;
455 		}
456 
457 		/* GeForce scaling restrictions */
458 		switch (si->ps.card_arch)
459 		{
460 		case NV04A:
461 			/* Riva128-TNT2 series have an old BES engine... */
462 			oc->h_scale.min = 1.0;
463 			oc->v_scale.min = 1.0;
464 			break;
465 		case NV30A:
466 		case NV40A:
467 			/* GeForceFX series and up have a new BES engine... */
468 			oc->h_scale.min = 0.5;
469 			oc->v_scale.min = 0.5;
470 			/* NV31 (confirmed GeForceFX 5600) has NV20A scaling limits!
471 			 * So let it fall through... */
472 			if (si->ps.card_type != NV31) break;
473 		default:
474 			/* the rest in between... */
475 			oc->h_scale.min = 0.125;
476 			oc->v_scale.min = 0.125;
477 			break;
478 		}
479 		/* all cards have a upscaling limit of 8.0 (see official nVidia specsheets) */
480 		oc->h_scale.max = 8.0;
481 		oc->v_scale.max = 8.0;
482 
483 		return B_OK;
484 	}
485 	else
486 	{
487 		/* this is no buffer of ours! */
488 		LOG(4,("Overlay: Get_overlay_constraints: buffer is not ours, aborted!\n"));
489 
490 		return B_ERROR;
491 	}
492 }
493 
494 overlay_token ALLOCATE_OVERLAY(void)
495 {
496 	uint32 tmpToken;
497 	LOG(4,("Overlay: Allocate_overlay called: "));
498 
499 	/* come up with a token */
500 	tmpToken = 0x12345678;
501 
502 	/* acquire the shared benaphore */
503 	AQUIRE_BEN(si->overlay.lock)
504 
505 	/* overlay unit already in use? */
506 	if (si->overlay.myToken == NULL)
507 	/* overlay unit is available */
508 	{
509 		LOG(4,("succesfull\n"));
510 
511 		si->overlay.myToken = &tmpToken;
512 
513 		/* release the shared benaphore */
514 		RELEASE_BEN(si->overlay.lock)
515 
516 		return si->overlay.myToken;
517 	}
518 	else
519 	/* sorry, overlay unit is occupied */
520 	{
521 		LOG(4,("failed: already in use!\n"));
522 
523 		/* release the shared benaphore */
524 		RELEASE_BEN(si->overlay.lock)
525 
526 		return NULL;
527 	}
528 }
529 
530 status_t RELEASE_OVERLAY(overlay_token ot)
531 {
532 	LOG(4,("Overlay: Release_overlay called: "));
533 
534 	/* is this call for real? */
535 	if ((ot == NULL) || (si->overlay.myToken == NULL) || (ot != si->overlay.myToken))
536 	/* nope, abort */
537 	{
538 		LOG(4,("failed, not in use!\n"));
539 
540 		return B_ERROR;
541 	}
542 	else
543 	/* call is for real */
544 	{
545 
546 		nv_release_bes();
547 
548 		LOG(4,("succesfull\n"));
549 
550 		si->overlay.myToken = NULL;
551 		return B_OK;
552 	}
553 }
554 
555 status_t CONFIGURE_OVERLAY
556 	(overlay_token ot, const overlay_buffer *ob, const overlay_window *ow, const overlay_view *ov)
557 {
558 	int offset = 0; /* used for buffer index */
559 
560 	LOG(4,("Overlay: Configure_overlay called: "));
561 
562 	/* Note:
563 	 * When a Workspace switch, screen prefs change, or overlay app shutdown occurs, BeOS will
564 	 * release all overlay buffers. The buffer currently displayed at that moment, may need some
565 	 * 'hardware releasing' in the CONFIGURE_OVERLAY routine. This is why CONFIGURE_OVERLAY gets
566 	 * called one more time then, with a null pointer for overlay_window and overlay_view, while
567 	 * the currently displayed overlay_buffer is given.
568 	 * The G200-G550 do not need to do anything on such an occasion, so we simply return if we
569 	 * get called then. */
570 	if ((ow == NULL) || (ov == NULL))
571 	{
572 		LOG(4,("output properties changed\n"));
573 
574 		return B_OK;
575 	}
576 
577 	/* Note:
578 	 * If during overlay use the screen prefs are changed, or the workspace has changed, it
579 	 * may be that we were not able to re-allocate the requested overlay buffers (or only partly)
580 	 * due to lack of cardRAM. If the app does not respond properly to this, we might end up
581 	 * with a NULL pointer instead of a overlay_buffer to work with here.
582 	 * Of course, we need to abort then to prevent the system from 'going down'.
583 	 * The app will probably crash because it will want to write into this non-existant buffer
584 	 * at some point. */
585 	if (ob == NULL)
586 	{
587 		LOG(4,("no overlay buffer specified\n"));
588 
589 		return B_ERROR;
590 	}
591 
592 	/* is this call done by the app that owns us? */
593 	if ((ot == NULL) || (si->overlay.myToken == NULL) || (ot != si->overlay.myToken))
594 	/* nope, abort */
595 	{
596 		LOG(4,("failed\n"));
597 
598 		return B_ERROR;
599 	}
600 	else
601 	/* call is for real */
602 	{
603 		/* find the buffer's offset */
604 		for (offset = 0; offset < MAXBUFFERS; offset++)
605 		{
606 			if (si->overlay.myBuffer[offset].buffer == ob->buffer) break;
607 		}
608 
609 		if (offset < MAXBUFFERS)
610 		{
611 			LOG(4,("succesfull, switching to buffer %d\n", offset));
612 
613 			/* program overlay hardware */
614 			nv_configure_bes(ob, ow, ov, offset);
615 
616 			return B_OK;
617 		}
618 		else
619 		{
620 			/* this is no buffer of ours! */
621 			LOG(4,("buffer is not ours, aborted!\n"));
622 
623 			return B_ERROR;
624 		}
625 	}
626 }
627