2009-11-02 21:36:12 +01:00
|
|
|
|
|
|
|
#include <drm/drmP.h>
|
2014-09-01 13:49:48 +02:00
|
|
|
#include <drm/radeon_drm.h>
|
2009-11-02 21:36:12 +01:00
|
|
|
#include "radeon.h"
|
|
|
|
#include "radeon_object.h"
|
2011-06-29 07:52:36 +02:00
|
|
|
#include "drm_fb_helper.h"
|
2012-12-16 20:05:06 +01:00
|
|
|
#include "hmm.h"
|
|
|
|
#include "bitmap.h"
|
|
|
|
#include "display.h"
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
extern struct drm_framebuffer *main_fb;
|
|
|
|
extern struct drm_gem_object *main_fb_obj;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
display_t *os_display;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
|
|
|
static cursor_t* __stdcall select_cursor_kms(cursor_t *cursor);
|
|
|
|
static void __stdcall move_cursor_kms(cursor_t *cursor, int x, int y);
|
|
|
|
|
|
|
|
int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled);
|
|
|
|
|
2009-12-10 20:32:56 +01:00
|
|
|
void disable_mouse(void);
|
|
|
|
|
2009-11-02 21:36:12 +01:00
|
|
|
static void radeon_show_cursor_kms(struct drm_crtc *crtc)
|
|
|
|
{
|
|
|
|
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
|
|
|
|
struct radeon_device *rdev = crtc->dev->dev_private;
|
|
|
|
|
2011-07-15 08:38:31 +02:00
|
|
|
if (ASIC_IS_DCE4(rdev)) {
|
|
|
|
WREG32(RADEON_MM_INDEX, EVERGREEN_CUR_CONTROL + radeon_crtc->crtc_offset);
|
|
|
|
WREG32(RADEON_MM_DATA, EVERGREEN_CURSOR_EN |
|
|
|
|
EVERGREEN_CURSOR_MODE(EVERGREEN_CURSOR_24_8_PRE_MULT));
|
|
|
|
} else if (ASIC_IS_AVIVO(rdev)) {
|
2009-11-02 21:36:12 +01:00
|
|
|
WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset);
|
|
|
|
WREG32(RADEON_MM_DATA, AVIVO_D1CURSOR_EN |
|
|
|
|
(AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT));
|
|
|
|
} else {
|
|
|
|
switch (radeon_crtc->crtc_id) {
|
|
|
|
case 0:
|
|
|
|
WREG32(RADEON_MM_INDEX, RADEON_CRTC_GEN_CNTL);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
WREG32(RADEON_MM_INDEX, RADEON_CRTC2_GEN_CNTL);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
WREG32_P(RADEON_MM_DATA, (RADEON_CRTC_CUR_EN |
|
|
|
|
(RADEON_CRTC_CUR_MODE_24BPP << RADEON_CRTC_CUR_MODE_SHIFT)),
|
|
|
|
~(RADEON_CRTC_CUR_EN | RADEON_CRTC_CUR_MODE_MASK));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void radeon_lock_cursor_kms(struct drm_crtc *crtc, bool lock)
|
|
|
|
{
|
|
|
|
struct radeon_device *rdev = crtc->dev->dev_private;
|
|
|
|
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
|
|
|
|
uint32_t cur_lock;
|
|
|
|
|
2011-07-15 08:38:31 +02:00
|
|
|
if (ASIC_IS_DCE4(rdev)) {
|
|
|
|
cur_lock = RREG32(EVERGREEN_CUR_UPDATE + radeon_crtc->crtc_offset);
|
|
|
|
if (lock)
|
|
|
|
cur_lock |= EVERGREEN_CURSOR_UPDATE_LOCK;
|
|
|
|
else
|
|
|
|
cur_lock &= ~EVERGREEN_CURSOR_UPDATE_LOCK;
|
|
|
|
WREG32(EVERGREEN_CUR_UPDATE + radeon_crtc->crtc_offset, cur_lock);
|
|
|
|
} else if (ASIC_IS_AVIVO(rdev)) {
|
2009-11-02 21:36:12 +01:00
|
|
|
cur_lock = RREG32(AVIVO_D1CUR_UPDATE + radeon_crtc->crtc_offset);
|
|
|
|
if (lock)
|
|
|
|
cur_lock |= AVIVO_D1CURSOR_UPDATE_LOCK;
|
|
|
|
else
|
|
|
|
cur_lock &= ~AVIVO_D1CURSOR_UPDATE_LOCK;
|
|
|
|
WREG32(AVIVO_D1CUR_UPDATE + radeon_crtc->crtc_offset, cur_lock);
|
|
|
|
} else {
|
|
|
|
cur_lock = RREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset);
|
|
|
|
if (lock)
|
|
|
|
cur_lock |= RADEON_CUR_LOCK;
|
|
|
|
else
|
|
|
|
cur_lock &= ~RADEON_CUR_LOCK;
|
|
|
|
WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, cur_lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cursor_t* __stdcall select_cursor_kms(cursor_t *cursor)
|
|
|
|
{
|
|
|
|
struct radeon_device *rdev;
|
|
|
|
struct radeon_crtc *radeon_crtc;
|
|
|
|
cursor_t *old;
|
|
|
|
uint32_t gpu_addr;
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
rdev = (struct radeon_device *)os_display->ddev->dev_private;
|
|
|
|
radeon_crtc = to_radeon_crtc(os_display->crtc);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
old = os_display->cursor;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
os_display->cursor = cursor;
|
2010-02-12 14:55:15 +01:00
|
|
|
gpu_addr = radeon_bo_gpu_offset(cursor->robj);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2011-07-15 08:38:31 +02:00
|
|
|
if (ASIC_IS_DCE4(rdev)) {
|
|
|
|
WREG32(EVERGREEN_CUR_SURFACE_ADDRESS_HIGH + radeon_crtc->crtc_offset,
|
|
|
|
0);
|
|
|
|
WREG32(EVERGREEN_CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset,
|
|
|
|
gpu_addr);
|
|
|
|
} else if (ASIC_IS_AVIVO(rdev)) {
|
|
|
|
if (rdev->family >= CHIP_RV770)
|
|
|
|
WREG32(R700_D1CUR_SURFACE_ADDRESS_HIGH, 0);
|
2009-11-02 21:36:12 +01:00
|
|
|
WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, gpu_addr);
|
2011-07-15 08:38:31 +02:00
|
|
|
}
|
2009-11-02 21:36:12 +01:00
|
|
|
else {
|
2010-03-10 11:23:24 +01:00
|
|
|
radeon_crtc->legacy_cursor_offset = gpu_addr - rdev->mc.vram_start;
|
2009-11-02 21:36:12 +01:00
|
|
|
/* offset is from DISP(2)_BASE_ADDRESS */
|
|
|
|
WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, radeon_crtc->legacy_cursor_offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
return old;
|
|
|
|
};
|
|
|
|
|
|
|
|
void __stdcall move_cursor_kms(cursor_t *cursor, int x, int y)
|
|
|
|
{
|
|
|
|
struct radeon_device *rdev;
|
2014-09-01 13:49:48 +02:00
|
|
|
rdev = (struct radeon_device *)os_display->ddev->dev_private;
|
|
|
|
struct drm_crtc *crtc = os_display->crtc;
|
2009-11-02 21:36:12 +01:00
|
|
|
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
|
|
|
|
|
|
|
|
int hot_x = cursor->hot_x;
|
|
|
|
int hot_y = cursor->hot_y;
|
2011-07-15 08:38:31 +02:00
|
|
|
int w = 32;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
|
|
|
radeon_lock_cursor_kms(crtc, true);
|
2011-07-15 08:38:31 +02:00
|
|
|
|
|
|
|
if (ASIC_IS_DCE4(rdev)) {
|
|
|
|
WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset,
|
|
|
|
(x << 16) | y);
|
|
|
|
WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset,
|
|
|
|
(hot_x << 16) | hot_y);
|
|
|
|
WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset,
|
|
|
|
((w - 1) << 16) | 31);
|
|
|
|
} else if (ASIC_IS_AVIVO(rdev)) {
|
2009-11-02 21:36:12 +01:00
|
|
|
WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset,
|
|
|
|
(x << 16) | y);
|
|
|
|
WREG32(AVIVO_D1CUR_HOT_SPOT + radeon_crtc->crtc_offset,
|
|
|
|
(hot_x << 16) | hot_y);
|
|
|
|
WREG32(AVIVO_D1CUR_SIZE + radeon_crtc->crtc_offset,
|
|
|
|
((w - 1) << 16) | 31);
|
|
|
|
} else {
|
|
|
|
if (crtc->mode.flags & DRM_MODE_FLAG_DBLSCAN)
|
|
|
|
y *= 2;
|
|
|
|
|
2010-02-12 14:55:15 +01:00
|
|
|
uint32_t gpu_addr;
|
|
|
|
int xorg =0, yorg=0;
|
|
|
|
|
|
|
|
x = x - hot_x;
|
|
|
|
y = y - hot_y;
|
|
|
|
|
|
|
|
if( x < 0 )
|
|
|
|
{
|
|
|
|
xorg = -x + 1;
|
|
|
|
x = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( y < 0 )
|
|
|
|
{
|
|
|
|
yorg = -hot_y + 1;
|
|
|
|
y = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
WREG32(RADEON_CUR_HORZ_VERT_OFF,
|
|
|
|
(RADEON_CUR_LOCK | (xorg << 16) | yorg ));
|
|
|
|
WREG32(RADEON_CUR_HORZ_VERT_POSN,
|
2009-11-02 21:36:12 +01:00
|
|
|
(RADEON_CUR_LOCK | (x << 16) | y));
|
|
|
|
|
2010-02-12 14:55:15 +01:00
|
|
|
gpu_addr = radeon_bo_gpu_offset(cursor->robj);
|
|
|
|
|
2009-11-02 21:36:12 +01:00
|
|
|
/* offset is from DISP(2)_BASE_ADDRESS */
|
2010-02-12 14:55:15 +01:00
|
|
|
WREG32(RADEON_CUR_OFFSET,
|
2010-03-10 11:23:24 +01:00
|
|
|
(gpu_addr - rdev->mc.vram_start + (yorg * 256)));
|
2009-11-02 21:36:12 +01:00
|
|
|
}
|
|
|
|
radeon_lock_cursor_kms(crtc, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *manufacturer_name(unsigned char *x)
|
|
|
|
{
|
|
|
|
static char name[4];
|
|
|
|
|
|
|
|
name[0] = ((x[0] & 0x7C) >> 2) + '@';
|
|
|
|
name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@';
|
|
|
|
name[2] = (x[1] & 0x1F) + '@';
|
|
|
|
name[3] = 0;
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
static int set_mode(struct drm_device *dev, struct drm_connector *connector,
|
|
|
|
struct drm_crtc *crtc, videomode_t *reqmode, bool strict)
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
|
|
|
struct drm_display_mode *mode = NULL, *tmpmode;
|
2014-09-01 13:49:48 +02:00
|
|
|
struct drm_framebuffer *fb = NULL;
|
|
|
|
struct drm_mode_set set;
|
|
|
|
const char *con_name;
|
|
|
|
unsigned hdisplay, vdisplay;
|
|
|
|
int ret;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
drm_modeset_lock_all(dev);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
|
|
|
list_for_each_entry(tmpmode, &connector->modes, head)
|
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
if( (tmpmode->hdisplay == reqmode->width) &&
|
|
|
|
(tmpmode->vdisplay == reqmode->height) &&
|
2009-11-02 21:36:12 +01:00
|
|
|
(drm_mode_vrefresh(tmpmode) == reqmode->freq) )
|
|
|
|
{
|
|
|
|
mode = tmpmode;
|
|
|
|
goto do_set;
|
|
|
|
}
|
2014-09-01 13:49:48 +02:00
|
|
|
};
|
2009-11-02 21:36:12 +01:00
|
|
|
|
|
|
|
if( (mode == NULL) && (strict == false) )
|
|
|
|
{
|
|
|
|
list_for_each_entry(tmpmode, &connector->modes, head)
|
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
if( (tmpmode->hdisplay == reqmode->width) &&
|
|
|
|
(tmpmode->vdisplay == reqmode->height) )
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
|
|
|
mode = tmpmode;
|
|
|
|
goto do_set;
|
|
|
|
}
|
2014-09-01 13:49:48 +02:00
|
|
|
};
|
2009-11-02 21:36:12 +01:00
|
|
|
};
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
DRM_ERROR("%s failed\n", __FUNCTION__);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
return -1;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
do_set:
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
con_name = connector->name;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
DRM_DEBUG_KMS("set mode %d %d: crtc %d connector %s\n",
|
|
|
|
reqmode->width, reqmode->height, crtc->base.id,
|
|
|
|
con_name);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
hdisplay = mode->hdisplay;
|
|
|
|
vdisplay = mode->vdisplay;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
if (crtc->invert_dimensions)
|
|
|
|
swap(hdisplay, vdisplay);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
fb = main_fb;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
fb->width = reqmode->width;
|
|
|
|
fb->height = reqmode->height;
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
fb->pitches[0] =
|
|
|
|
fb->pitches[1] =
|
|
|
|
fb->pitches[2] =
|
|
|
|
fb->pitches[3] = radeon_align_pitch(dev->dev_private, reqmode->width, 32, false) * ((32 + 1) / 8);
|
|
|
|
fb->bits_per_pixel = 32;
|
|
|
|
fb->depth = 24;
|
2012-11-03 03:41:31 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
crtc->enabled = true;
|
|
|
|
os_display->crtc = crtc;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
set.crtc = crtc;
|
|
|
|
set.x = 0;
|
|
|
|
set.y = 0;
|
|
|
|
set.mode = mode;
|
|
|
|
set.connectors = &connector;
|
|
|
|
set.num_connectors = 1;
|
|
|
|
set.fb = fb;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
ret = drm_mode_set_config_internal(&set);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
drm_modeset_unlock_all(dev);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
select_cursor_kms(os_display->cursor);
|
|
|
|
radeon_show_cursor_kms(crtc);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
if ( !ret )
|
|
|
|
{
|
|
|
|
os_display->width = fb->width;
|
|
|
|
os_display->height = fb->height;
|
|
|
|
os_display->vrefresh = drm_mode_vrefresh(mode);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
sysSetScreen(fb->width, fb->height, fb->pitches[0]);
|
|
|
|
|
|
|
|
DRM_DEBUG_KMS("new mode %d x %d pitch %d\n",
|
2012-11-03 03:41:31 +01:00
|
|
|
fb->width, fb->height, fb->pitches[0]);
|
2009-11-02 21:36:12 +01:00
|
|
|
}
|
2014-09-01 13:49:48 +02:00
|
|
|
else
|
|
|
|
DRM_ERROR("failed to set mode %d_%d on crtc %p\n",
|
|
|
|
fb->width, fb->height, crtc);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
|
|
|
return ret;
|
2014-09-01 13:49:48 +02:00
|
|
|
}
|
2009-11-02 21:36:12 +01:00
|
|
|
|
|
|
|
static int count_connector_modes(struct drm_connector* connector)
|
|
|
|
{
|
|
|
|
struct drm_display_mode *mode;
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
list_for_each_entry(mode, &connector->modes, head)
|
|
|
|
{
|
|
|
|
count++;
|
|
|
|
};
|
|
|
|
return count;
|
|
|
|
};
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
static struct drm_crtc *get_possible_crtc(struct drm_device *dev, struct drm_encoder *encoder)
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
struct drm_crtc *tmp_crtc;
|
|
|
|
int crtc_mask = 1;
|
|
|
|
|
|
|
|
list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head)
|
|
|
|
{
|
|
|
|
if (encoder->possible_crtcs & crtc_mask)
|
|
|
|
{
|
|
|
|
encoder->crtc = tmp_crtc;
|
|
|
|
DRM_DEBUG_KMS("use CRTC %p ID %d\n", tmp_crtc, tmp_crtc->base.id);
|
|
|
|
return tmp_crtc;
|
|
|
|
};
|
|
|
|
crtc_mask <<= 1;
|
|
|
|
};
|
|
|
|
return NULL;
|
|
|
|
};
|
2011-06-24 12:44:10 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
static int choose_config(struct drm_device *dev, struct drm_connector **boot_connector,
|
|
|
|
struct drm_crtc **boot_crtc)
|
|
|
|
{
|
|
|
|
struct drm_connector_helper_funcs *connector_funcs;
|
|
|
|
struct drm_connector *connector;
|
|
|
|
struct drm_encoder *encoder;
|
|
|
|
struct drm_crtc *crtc;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
|
|
|
list_for_each_entry(connector, &dev->mode_config.connector_list, head)
|
|
|
|
{
|
|
|
|
if( connector->status != connector_status_connected)
|
|
|
|
continue;
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
encoder = connector->encoder;
|
2011-06-24 12:44:10 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
if(encoder == NULL)
|
|
|
|
{
|
|
|
|
connector_funcs = connector->helper_private;
|
|
|
|
encoder = connector_funcs->best_encoder(connector);
|
2011-06-24 12:44:10 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
if( encoder == NULL)
|
|
|
|
{
|
|
|
|
DRM_DEBUG_KMS("CONNECTOR %x ID: %d no active encoders\n",
|
|
|
|
connector, connector->base.id);
|
|
|
|
continue;
|
|
|
|
};
|
|
|
|
}
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
crtc = encoder->crtc;
|
|
|
|
if(crtc == NULL)
|
|
|
|
crtc = get_possible_crtc(dev, encoder);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
if(crtc != NULL)
|
|
|
|
{
|
|
|
|
*boot_connector = connector;
|
|
|
|
*boot_crtc = crtc;
|
|
|
|
connector->encoder = encoder;
|
|
|
|
DRM_DEBUG_KMS("CONNECTOR %p ID:%d status:%d ENCODER %p ID: %d CRTC %p ID:%d\n",
|
|
|
|
connector, connector->base.id, connector->status,
|
|
|
|
encoder, encoder->base.id, crtc, crtc->base.id );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
DRM_DEBUG_KMS("No CRTC for encoder %d\n", encoder->base.id);
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2009-11-02 21:36:12 +01:00
|
|
|
};
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
return -ENOENT;
|
2009-11-02 21:36:12 +01:00
|
|
|
};
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
static int get_boot_mode(struct drm_connector *connector, videomode_t *usermode)
|
|
|
|
{
|
|
|
|
struct drm_display_mode *mode;
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
list_for_each_entry(mode, &connector->modes, head)
|
|
|
|
{
|
|
|
|
DRM_DEBUG_KMS("check mode w:%d h:%d %dHz\n",
|
|
|
|
mode->hdisplay, mode->vdisplay,
|
|
|
|
drm_mode_vrefresh(mode));
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
if( os_display->width == mode->hdisplay &&
|
|
|
|
os_display->height == mode->vdisplay &&
|
|
|
|
drm_mode_vrefresh(mode) == 60)
|
|
|
|
{
|
|
|
|
usermode->width = os_display->width;
|
|
|
|
usermode->height = os_display->height;
|
|
|
|
usermode->freq = 60;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
int init_display_kms(struct drm_device *dev, videomode_t *usermode)
|
|
|
|
{
|
2012-11-03 03:41:31 +01:00
|
|
|
struct drm_connector_helper_funcs *connector_funcs;
|
2014-09-01 13:49:48 +02:00
|
|
|
struct drm_connector *connector = NULL;
|
2012-11-03 03:41:31 +01:00
|
|
|
struct drm_crtc *crtc = NULL;
|
|
|
|
struct drm_framebuffer *fb;
|
|
|
|
|
2014-12-27 16:58:21 +01:00
|
|
|
cursor_t *cursor;
|
|
|
|
u32 ifl;
|
2014-09-01 13:49:48 +02:00
|
|
|
int ret;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
mutex_lock(&dev->mode_config.mutex);
|
2012-11-03 03:41:31 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
ret = choose_config(dev, &connector, &crtc);
|
|
|
|
if(ret)
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
DRM_DEBUG_KMS("No active connectors!\n");
|
|
|
|
mutex_unlock(&dev->mode_config.mutex);
|
2012-11-03 03:41:31 +01:00
|
|
|
return -1;
|
|
|
|
};
|
|
|
|
|
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
struct drm_display_mode *tmp, *native = NULL;
|
|
|
|
struct radeon_device *rdev = dev->dev_private;
|
2012-11-03 03:41:31 +01:00
|
|
|
|
|
|
|
list_for_each_entry(tmp, &connector->modes, head) {
|
2014-09-01 13:49:48 +02:00
|
|
|
if (tmp->hdisplay > 16384 ||
|
|
|
|
tmp->vdisplay > 16384)
|
2012-11-03 03:41:31 +01:00
|
|
|
continue;
|
|
|
|
if (tmp->type & DRM_MODE_TYPE_PREFERRED)
|
|
|
|
{
|
|
|
|
native = tmp;
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
if( ASIC_IS_AVIVO(rdev) && native )
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
struct radeon_encoder *radeon_encoder = to_radeon_encoder(connector->encoder);
|
|
|
|
radeon_encoder->rmx_type = RMX_FULL;
|
|
|
|
radeon_encoder->native_mode = *native;
|
2009-11-02 21:36:12 +01:00
|
|
|
};
|
2014-09-01 13:49:48 +02:00
|
|
|
}
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
#if 0
|
|
|
|
mutex_lock(&dev->object_name_lock);
|
|
|
|
idr_preload(GFP_KERNEL);
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
if (!main_fb_obj->name) {
|
|
|
|
ret = idr_alloc(&dev->object_name_idr, &main_fb_obj, 1, 0, GFP_NOWAIT);
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
main_fb_obj->name = ret;
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
/* Allocate a reference for the name table. */
|
|
|
|
drm_gem_object_reference(main_fb_obj);
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
DRM_DEBUG_KMS("%s allocate fb name %d\n", __FUNCTION__, main_fb_obj->name );
|
|
|
|
}
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
idr_preload_end();
|
|
|
|
mutex_unlock(&dev->object_name_lock);
|
|
|
|
drm_gem_object_unreference(main_fb_obj);
|
|
|
|
#endif
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
os_display = GetDisplay();
|
|
|
|
os_display->ddev = dev;
|
|
|
|
os_display->connector = connector;
|
|
|
|
os_display->crtc = crtc;
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
os_display->supported_modes = count_connector_modes(connector);
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2012-11-03 03:41:31 +01:00
|
|
|
ifl = safe_cli();
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
list_for_each_entry(cursor, &os_display->cursors, list)
|
2012-11-03 03:41:31 +01:00
|
|
|
{
|
|
|
|
init_cursor(cursor);
|
|
|
|
};
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
os_display->restore_cursor(0,0);
|
|
|
|
os_display->init_cursor = init_cursor;
|
|
|
|
os_display->select_cursor = select_cursor_kms;
|
|
|
|
os_display->show_cursor = NULL;
|
|
|
|
os_display->move_cursor = move_cursor_kms;
|
|
|
|
os_display->restore_cursor = restore_cursor;
|
|
|
|
os_display->disable_mouse = disable_mouse;
|
|
|
|
select_cursor_kms(os_display->cursor);
|
2012-11-03 03:41:31 +01:00
|
|
|
};
|
|
|
|
safe_sti(ifl);
|
2011-06-29 07:52:36 +02:00
|
|
|
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
// dbgprintf("current mode %d x %d x %d\n",
|
|
|
|
// os_display->width, os_display->height, os_display->vrefresh);
|
|
|
|
// dbgprintf("user mode mode %d x %d x %d\n",
|
|
|
|
// usermode->width, usermode->height, usermode->freq);
|
2009-11-12 16:36:53 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
if( (usermode->width == 0) ||
|
|
|
|
(usermode->height == 0))
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
if( !get_boot_mode(connector, usermode))
|
|
|
|
{
|
|
|
|
struct drm_display_mode *mode;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
mode = list_entry(connector->modes.next, typeof(*mode), head);
|
|
|
|
usermode->width = mode->hdisplay;
|
|
|
|
usermode->height = mode->vdisplay;
|
|
|
|
usermode->freq = drm_mode_vrefresh(mode);
|
|
|
|
};
|
2012-11-03 03:41:31 +01:00
|
|
|
};
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
mutex_unlock(&dev->mode_config.mutex);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
set_mode(dev, os_display->connector, os_display->crtc, usermode, false);
|
2012-12-16 20:05:06 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
radeon_show_cursor_kms(os_display->crtc);
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
return 0;
|
2009-11-02 21:36:12 +01:00
|
|
|
};
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
|
|
|
|
int get_videomodes(videomode_t *mode, int *count)
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
|
|
|
int err = -1;
|
|
|
|
|
|
|
|
if( *count == 0 )
|
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
*count = os_display->supported_modes;
|
2009-11-02 21:36:12 +01:00
|
|
|
err = 0;
|
|
|
|
}
|
|
|
|
else if( mode != NULL )
|
|
|
|
{
|
|
|
|
struct drm_display_mode *drmmode;
|
|
|
|
int i = 0;
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
if( *count > os_display->supported_modes)
|
|
|
|
*count = os_display->supported_modes;
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
list_for_each_entry(drmmode, &os_display->connector->modes, head)
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
|
|
|
if( i < *count)
|
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
mode->width = drmmode->hdisplay;
|
|
|
|
mode->height = drmmode->vdisplay;
|
2009-11-02 21:36:12 +01:00
|
|
|
mode->bpp = 32;
|
|
|
|
mode->freq = drm_mode_vrefresh(drmmode);
|
|
|
|
i++;
|
|
|
|
mode++;
|
|
|
|
}
|
|
|
|
else break;
|
|
|
|
};
|
|
|
|
*count = i;
|
|
|
|
err = 0;
|
|
|
|
};
|
|
|
|
return err;
|
2014-09-01 13:49:48 +02:00
|
|
|
};
|
2009-11-02 21:36:12 +01:00
|
|
|
|
2010-02-11 16:24:47 +01:00
|
|
|
int set_user_mode(videomode_t *mode)
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
|
|
|
int err = -1;
|
|
|
|
|
|
|
|
if( (mode->width != 0) &&
|
|
|
|
(mode->height != 0) &&
|
|
|
|
(mode->freq != 0 ) &&
|
2014-09-01 13:49:48 +02:00
|
|
|
( (mode->width != os_display->width) ||
|
|
|
|
(mode->height != os_display->height) ||
|
|
|
|
(mode->freq != os_display->vrefresh) ) )
|
2009-11-02 21:36:12 +01:00
|
|
|
{
|
2014-09-01 13:49:48 +02:00
|
|
|
return set_mode(os_display->ddev, os_display->connector, os_display->crtc, mode, true);
|
2009-11-02 21:36:12 +01:00
|
|
|
};
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
return -1;
|
2009-11-02 21:36:12 +01:00
|
|
|
};
|
|
|
|
|
2010-02-12 14:55:15 +01:00
|
|
|
|
2011-06-29 07:52:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-05 09:43:48 +02:00
|
|
|
#if 0
|
2012-12-16 20:05:06 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int left;
|
|
|
|
int top;
|
|
|
|
int right;
|
|
|
|
int bottom;
|
|
|
|
}rect_t;
|
|
|
|
|
|
|
|
extern struct hmm bm_mm;
|
2014-09-01 13:49:48 +02:00
|
|
|
struct drm_device *main_device;
|
2012-12-16 20:05:06 +01:00
|
|
|
|
|
|
|
void FASTCALL GetWindowRect(rect_t *rc)__asm__("GetWindowRect");
|
|
|
|
|
|
|
|
#define CURRENT_TASK (0x80003000)
|
|
|
|
|
|
|
|
static u32_t get_display_map()
|
|
|
|
{
|
|
|
|
u32_t addr;
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
addr = (u32_t)os_display;
|
2012-12-16 20:05:06 +01:00
|
|
|
addr+= sizeof(display_t); /* shoot me */
|
|
|
|
return *(u32_t*)addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "clip.inc"
|
|
|
|
#include "r100d.h"
|
|
|
|
|
2013-07-05 09:43:48 +02:00
|
|
|
# define PACKET3_BITBLT 0x92
|
2012-12-17 10:14:29 +01:00
|
|
|
# define PACKET3_TRANS_BITBLT 0x9C
|
|
|
|
# define R5XX_SRC_CMP_EQ_COLOR (4 << 0)
|
|
|
|
# define R5XX_SRC_CMP_NEQ_COLOR (5 << 0)
|
|
|
|
# define R5XX_CLR_CMP_SRC_SOURCE (1 << 24)
|
2012-12-16 20:05:06 +01:00
|
|
|
|
|
|
|
int srv_blit_bitmap(u32 hbitmap, int dst_x, int dst_y,
|
|
|
|
int src_x, int src_y, u32 w, u32 h)
|
|
|
|
{
|
|
|
|
struct context *context;
|
|
|
|
|
|
|
|
bitmap_t *bitmap;
|
|
|
|
rect_t winrc;
|
|
|
|
clip_t dst_clip;
|
|
|
|
clip_t src_clip;
|
|
|
|
u32_t width;
|
|
|
|
u32_t height;
|
|
|
|
|
|
|
|
u32_t br13, cmd, slot_mask, *b;
|
|
|
|
u32_t offset;
|
|
|
|
u8 slot;
|
|
|
|
int n=0;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if(unlikely(hbitmap==0))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
bitmap = (bitmap_t*)hmm_get_data(&bm_mm, hbitmap);
|
|
|
|
|
|
|
|
if(unlikely(bitmap==NULL))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
context = get_context(main_drm_device);
|
|
|
|
if(unlikely(context == NULL))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
GetWindowRect(&winrc);
|
|
|
|
{
|
|
|
|
static warn_count;
|
|
|
|
|
|
|
|
if(warn_count < 1)
|
|
|
|
{
|
|
|
|
printf("left %d top %d right %d bottom %d\n",
|
|
|
|
winrc.left, winrc.top, winrc.right, winrc.bottom);
|
|
|
|
printf("bitmap width %d height %d\n", w, h);
|
|
|
|
warn_count++;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
dst_clip.xmin = 0;
|
|
|
|
dst_clip.ymin = 0;
|
|
|
|
dst_clip.xmax = winrc.right-winrc.left;
|
|
|
|
dst_clip.ymax = winrc.bottom -winrc.top;
|
|
|
|
|
|
|
|
src_clip.xmin = 0;
|
|
|
|
src_clip.ymin = 0;
|
|
|
|
src_clip.xmax = bitmap->width - 1;
|
|
|
|
src_clip.ymax = bitmap->height - 1;
|
|
|
|
|
|
|
|
width = w;
|
|
|
|
height = h;
|
|
|
|
|
|
|
|
if( blit_clip(&dst_clip, &dst_x, &dst_y,
|
|
|
|
&src_clip, &src_x, &src_y,
|
|
|
|
&width, &height) )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
dst_x+= winrc.left;
|
|
|
|
dst_y+= winrc.top;
|
|
|
|
|
|
|
|
slot = *((u8*)CURRENT_TASK);
|
|
|
|
|
|
|
|
slot_mask = (u32_t)slot<<24;
|
|
|
|
|
|
|
|
{
|
2012-12-17 10:14:29 +01:00
|
|
|
#if 0
|
2012-12-16 20:05:06 +01:00
|
|
|
#else
|
|
|
|
u8* src_offset;
|
|
|
|
u8* dst_offset;
|
2012-12-17 10:14:29 +01:00
|
|
|
u32 color;
|
|
|
|
|
2012-12-16 20:05:06 +01:00
|
|
|
u32 ifl;
|
|
|
|
|
|
|
|
src_offset = (u8*)(src_y*bitmap->pitch + src_x*4);
|
|
|
|
src_offset += (u32)bitmap->uaddr;
|
|
|
|
|
2014-09-01 13:49:48 +02:00
|
|
|
dst_offset = (u8*)(dst_y*os_display->width + dst_x);
|
2012-12-16 20:05:06 +01:00
|
|
|
dst_offset+= get_display_map();
|
|
|
|
|
|
|
|
u32_t tmp_h = height;
|
|
|
|
|
|
|
|
ifl = safe_cli();
|
|
|
|
while( tmp_h--)
|
|
|
|
{
|
2012-12-17 10:14:29 +01:00
|
|
|
u32 tmp_w = width;
|
2012-12-16 20:05:06 +01:00
|
|
|
|
2012-12-17 10:14:29 +01:00
|
|
|
u32* tmp_src = src_offset;
|
2013-07-05 09:43:48 +02:00
|
|
|
u8* tmp_dst = dst_offset;
|
2012-12-16 20:05:06 +01:00
|
|
|
|
|
|
|
src_offset+= bitmap->pitch;
|
2014-09-01 13:49:48 +02:00
|
|
|
dst_offset+= os_display->width;
|
2012-12-16 20:05:06 +01:00
|
|
|
|
|
|
|
while( tmp_w--)
|
|
|
|
{
|
2012-12-17 10:14:29 +01:00
|
|
|
color = *tmp_src;
|
|
|
|
|
|
|
|
if(*tmp_dst == slot)
|
|
|
|
color |= 0xFF000000;
|
|
|
|
else
|
|
|
|
color = 0x00;
|
|
|
|
|
|
|
|
*tmp_src = color;
|
|
|
|
tmp_src++;
|
2012-12-16 20:05:06 +01:00
|
|
|
tmp_dst++;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
safe_sti(ifl);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
static warn_count;
|
|
|
|
|
|
|
|
if(warn_count < 1)
|
|
|
|
{
|
|
|
|
printf("blit width %d height %d\n",
|
|
|
|
width, height);
|
|
|
|
warn_count++;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// if((context->cmd_buffer & 0xFC0)==0xFC0)
|
|
|
|
// context->cmd_buffer&= 0xFFFFF000;
|
|
|
|
|
|
|
|
// b = (u32_t*)ALIGN(context->cmd_buffer,64);
|
|
|
|
|
|
|
|
// offset = context->cmd_offset + ((u32_t)b & 0xFFF);
|
|
|
|
|
|
|
|
|
|
|
|
// context->cmd_buffer+= n*4;
|
|
|
|
|
|
|
|
struct radeon_device *rdev = main_drm_device->dev_private;
|
|
|
|
struct radeon_ib *ib = &context->ib;
|
|
|
|
|
2012-12-17 10:14:29 +01:00
|
|
|
ib->ptr[0] = PACKET0(0x15cc, 0);
|
|
|
|
ib->ptr[1] = 0xFFFFFFFF;
|
|
|
|
ib->ptr[2] = PACKET3(PACKET3_TRANS_BITBLT, 11);
|
|
|
|
ib->ptr[3] = RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
|
2012-12-16 20:05:06 +01:00
|
|
|
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
|
|
|
|
RADEON_GMC_SRC_CLIPPING |
|
|
|
|
RADEON_GMC_DST_CLIPPING |
|
|
|
|
RADEON_GMC_BRUSH_NONE |
|
|
|
|
(RADEON_COLOR_FORMAT_ARGB8888 << 8) |
|
|
|
|
RADEON_GMC_SRC_DATATYPE_COLOR |
|
|
|
|
RADEON_ROP3_S |
|
|
|
|
RADEON_DP_SRC_SOURCE_MEMORY |
|
|
|
|
RADEON_GMC_WR_MSK_DIS;
|
|
|
|
|
2012-12-17 10:14:29 +01:00
|
|
|
ib->ptr[4] = ((bitmap->pitch/64) << 22) | (bitmap->gaddr >> 10);
|
2014-09-01 13:49:48 +02:00
|
|
|
ib->ptr[5] = ((os_display->pitch/64) << 22) | (rdev->mc.vram_start >> 10);
|
2012-12-16 20:05:06 +01:00
|
|
|
ib->ptr[6] = (0x1fff) | (0x1fff << 16);
|
2012-12-17 10:14:29 +01:00
|
|
|
ib->ptr[7] = 0;
|
|
|
|
ib->ptr[8] = (0x1fff) | (0x1fff << 16);
|
|
|
|
|
|
|
|
ib->ptr[9] = R5XX_CLR_CMP_SRC_SOURCE | R5XX_SRC_CMP_EQ_COLOR;
|
|
|
|
ib->ptr[10] = 0x00000000;
|
|
|
|
ib->ptr[11] = 0xFFFFFFFF;
|
2012-12-16 20:05:06 +01:00
|
|
|
|
2012-12-17 10:14:29 +01:00
|
|
|
ib->ptr[12] = (src_x << 16) | src_y;
|
|
|
|
ib->ptr[13] = (dst_x << 16) | dst_y;
|
|
|
|
ib->ptr[14] = (width << 16) | height;
|
2012-12-16 20:05:06 +01:00
|
|
|
|
|
|
|
ib->ptr[15] = PACKET2(0);
|
|
|
|
|
|
|
|
ib->length_dw = 16;
|
|
|
|
|
|
|
|
ret = radeon_ib_schedule(rdev, ib, NULL);
|
|
|
|
if (ret) {
|
|
|
|
DRM_ERROR("radeon: failed to schedule ib (%d).\n", ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = radeon_fence_wait(ib->fence, false);
|
|
|
|
if (ret) {
|
|
|
|
DRM_ERROR("radeon: fence wait failed (%d).\n", ret);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2013-01-22 16:16:44 +01:00
|
|
|
radeon_fence_unref(&ib->fence);
|
|
|
|
|
2012-12-16 20:05:06 +01:00
|
|
|
fail:
|
|
|
|
return ret;
|
|
|
|
};
|
|
|
|
|
2013-07-05 09:43:48 +02:00
|
|
|
#endif
|