git-svn-id: svn://kolibrios.org@1313 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2009-12-10 19:32:56 +00:00
parent baae07dc05
commit 5da0aff00a
20 changed files with 146 additions and 90 deletions

View File

@ -662,6 +662,12 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
return NULL; return NULL;
} }
/* Some EDIDs have bogus h/vtotal values */
if (mode->hsync_end > mode->htotal)
mode->htotal = mode->hsync_end + 1;
if (mode->vsync_end > mode->vtotal)
mode->vtotal = mode->vsync_end + 1;
drm_mode_set_name(mode); drm_mode_set_name(mode);
if (pt->misc & DRM_EDID_PT_INTERLACED) if (pt->misc & DRM_EDID_PT_INTERLACED)

View File

@ -385,7 +385,7 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
struct drm_framebuffer *fb = fb_helper->fb; struct drm_framebuffer *fb = fb_helper->fb;
int depth; int depth;
if (var->pixclock == -1 || !var->pixclock) if (var->pixclock != 0)
return -EINVAL; return -EINVAL;
/* Need to resize the fb object !!! */ /* Need to resize the fb object !!! */
@ -477,7 +477,7 @@ int drm_fb_helper_set_par(struct fb_info *info)
int ret; int ret;
int i; int i;
if (var->pixclock != -1) { if (var->pixclock != 0) {
DRM_ERROR("PIXEL CLCOK SET\n"); DRM_ERROR("PIXEL CLCOK SET\n");
return -EINVAL; return -EINVAL;
} }
@ -690,7 +690,7 @@ int drm_fb_helper_single_fb_probe(struct drm_device *dev,
fb_helper->fb = fb; fb_helper->fb = fb;
if (new_fb) { if (new_fb) {
info->var.pixclock = -1; info->var.pixclock = 0;
// if (register_framebuffer(info) < 0) // if (register_framebuffer(info) < 0)
// return -EINVAL; // return -EINVAL;
} else { } else {

View File

@ -229,13 +229,15 @@ static inline void* __CreateObject(u32_t pid, size_t size)
return retval; return retval;
} }
static inline void *__DestroyObject(void *obj) static inline void __DestroyObject(void *obj)
{ {
__asm__ __volatile__ ( __asm__ __volatile__ (
"call *__imp__DestroyObject" "call *__imp__DestroyObject"
: :
:"a" (obj) :"a" (obj));
:"ebx","edx","esi","edi", "memory"); __asm__ __volatile__ (
""
:::"eax","ebx","ecx","edx","esi","edi","cc","memory");
} }

View File

@ -107,6 +107,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
base += 3; base += 3;
break; break;
case ATOM_IIO_WRITE: case ATOM_IIO_WRITE:
(void)ctx->card->reg_read(ctx->card, CU16(base + 1));
ctx->card->reg_write(ctx->card, CU16(base + 1), temp); ctx->card->reg_write(ctx->card, CU16(base + 1), temp);
base += 3; base += 3;
break; break;

View File

@ -1141,7 +1141,7 @@ typedef struct _LVDS_ENCODER_CONTROL_PARAMETERS {
/* ucTableFormatRevision=1,ucTableContentRevision=2 */ /* ucTableFormatRevision=1,ucTableContentRevision=2 */
typedef struct _LVDS_ENCODER_CONTROL_PARAMETERS_V2 { typedef struct _LVDS_ENCODER_CONTROL_PARAMETERS_V2 {
USHORT usPixelClock; /* in 10KHz; for bios convenient */ USHORT usPixelClock; /* in 10KHz; for bios convenient */
UCHAR ucMisc; /* see PANEL_ENCODER_MISC_xx defintions below */ UCHAR ucMisc; /* see PANEL_ENCODER_MISC_xx definitions below */
UCHAR ucAction; /* 0: turn off encoder */ UCHAR ucAction; /* 0: turn off encoder */
/* 1: setup and turn on encoder */ /* 1: setup and turn on encoder */
UCHAR ucTruncate; /* bit0=0: Disable truncate */ UCHAR ucTruncate; /* bit0=0: Disable truncate */
@ -1424,7 +1424,7 @@ typedef struct _ATOM_MULTIMEDIA_CONFIG_INFO {
/* Structures used in FirmwareInfoTable */ /* Structures used in FirmwareInfoTable */
/****************************************************************************/ /****************************************************************************/
/* usBIOSCapability Defintion: */ /* usBIOSCapability Definition: */
/* Bit 0 = 0: Bios image is not Posted, =1:Bios image is Posted; */ /* Bit 0 = 0: Bios image is not Posted, =1:Bios image is Posted; */
/* Bit 1 = 0: Dual CRTC is not supported, =1: Dual CRTC is supported; */ /* Bit 1 = 0: Dual CRTC is not supported, =1: Dual CRTC is supported; */
/* Bit 2 = 0: Extended Desktop is not supported, =1: Extended Desktop is supported; */ /* Bit 2 = 0: Extended Desktop is not supported, =1: Extended Desktop is supported; */
@ -2386,7 +2386,7 @@ typedef struct _ATOM_ANALOG_TV_INFO_V1_2 {
} ATOM_ANALOG_TV_INFO_V1_2; } ATOM_ANALOG_TV_INFO_V1_2;
/**************************************************************************/ /**************************************************************************/
/* VRAM usage and their defintions */ /* VRAM usage and their definitions */
/* One chunk of VRAM used by Bios are for HWICON surfaces,EDID data. */ /* One chunk of VRAM used by Bios are for HWICON surfaces,EDID data. */
/* Current Mode timing and Dail Timing and/or STD timing data EACH device. They can be broken down as below. */ /* Current Mode timing and Dail Timing and/or STD timing data EACH device. They can be broken down as below. */
@ -3046,7 +3046,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO {
#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_DC 2 #define ATOM_S0_SYSTEM_POWER_STATE_VALUE_DC 2
#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_LITEAC 3 #define ATOM_S0_SYSTEM_POWER_STATE_VALUE_LITEAC 3
/* Byte aligned defintion for BIOS usage */ /* Byte aligned definition for BIOS usage */
#define ATOM_S0_CRT1_MONOb0 0x01 #define ATOM_S0_CRT1_MONOb0 0x01
#define ATOM_S0_CRT1_COLORb0 0x02 #define ATOM_S0_CRT1_COLORb0 0x02
#define ATOM_S0_CRT1_MASKb0 (ATOM_S0_CRT1_MONOb0+ATOM_S0_CRT1_COLORb0) #define ATOM_S0_CRT1_MASKb0 (ATOM_S0_CRT1_MONOb0+ATOM_S0_CRT1_COLORb0)
@ -3131,7 +3131,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO {
#define ATOM_S2_DISPLAY_ROTATION_DEGREE_SHIFT 30 #define ATOM_S2_DISPLAY_ROTATION_DEGREE_SHIFT 30
#define ATOM_S2_DISPLAY_ROTATION_ANGLE_MASK 0xC0000000L #define ATOM_S2_DISPLAY_ROTATION_ANGLE_MASK 0xC0000000L
/* Byte aligned defintion for BIOS usage */ /* Byte aligned definition for BIOS usage */
#define ATOM_S2_TV1_STANDARD_MASKb0 0x0F #define ATOM_S2_TV1_STANDARD_MASKb0 0x0F
#define ATOM_S2_CURRENT_BL_LEVEL_MASKb1 0xFF #define ATOM_S2_CURRENT_BL_LEVEL_MASKb1 0xFF
#define ATOM_S2_CRT1_DPMS_STATEb2 0x01 #define ATOM_S2_CRT1_DPMS_STATEb2 0x01
@ -3190,7 +3190,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO {
#define ATOM_S3_ALLOW_FAST_PWR_SWITCH 0x40000000L #define ATOM_S3_ALLOW_FAST_PWR_SWITCH 0x40000000L
#define ATOM_S3_RQST_GPU_USE_MIN_PWR 0x80000000L #define ATOM_S3_RQST_GPU_USE_MIN_PWR 0x80000000L
/* Byte aligned defintion for BIOS usage */ /* Byte aligned definition for BIOS usage */
#define ATOM_S3_CRT1_ACTIVEb0 0x01 #define ATOM_S3_CRT1_ACTIVEb0 0x01
#define ATOM_S3_LCD1_ACTIVEb0 0x02 #define ATOM_S3_LCD1_ACTIVEb0 0x02
#define ATOM_S3_TV1_ACTIVEb0 0x04 #define ATOM_S3_TV1_ACTIVEb0 0x04
@ -3230,7 +3230,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO {
#define ATOM_S4_LCD1_REFRESH_MASK 0x0000FF00L #define ATOM_S4_LCD1_REFRESH_MASK 0x0000FF00L
#define ATOM_S4_LCD1_REFRESH_SHIFT 8 #define ATOM_S4_LCD1_REFRESH_SHIFT 8
/* Byte aligned defintion for BIOS usage */ /* Byte aligned definition for BIOS usage */
#define ATOM_S4_LCD1_PANEL_ID_MASKb0 0x0FF #define ATOM_S4_LCD1_PANEL_ID_MASKb0 0x0FF
#define ATOM_S4_LCD1_REFRESH_MASKb1 ATOM_S4_LCD1_PANEL_ID_MASKb0 #define ATOM_S4_LCD1_REFRESH_MASKb1 ATOM_S4_LCD1_PANEL_ID_MASKb0
#define ATOM_S4_VRAM_INFO_MASKb2 ATOM_S4_LCD1_PANEL_ID_MASKb0 #define ATOM_S4_VRAM_INFO_MASKb2 ATOM_S4_LCD1_PANEL_ID_MASKb0
@ -3310,7 +3310,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO {
#define ATOM_S6_VRI_BRIGHTNESS_CHANGE 0x40000000L #define ATOM_S6_VRI_BRIGHTNESS_CHANGE 0x40000000L
#define ATOM_S6_CONFIG_DISPLAY_CHANGE_MASK 0x80000000L #define ATOM_S6_CONFIG_DISPLAY_CHANGE_MASK 0x80000000L
/* Byte aligned defintion for BIOS usage */ /* Byte aligned definition for BIOS usage */
#define ATOM_S6_DEVICE_CHANGEb0 0x01 #define ATOM_S6_DEVICE_CHANGEb0 0x01
#define ATOM_S6_SCALER_CHANGEb0 0x02 #define ATOM_S6_SCALER_CHANGEb0 0x02
#define ATOM_S6_LID_CHANGEb0 0x04 #define ATOM_S6_LID_CHANGEb0 0x04

View File

@ -50,7 +50,7 @@ struct tag_display
void (*show_cursor)(int show); void (*show_cursor)(int show);
void (__stdcall *move_cursor)(cursor_t *cursor, int x, int y); void (__stdcall *move_cursor)(cursor_t *cursor, int x, int y);
void (__stdcall *restore_cursor)(int x, int y); void (__stdcall *restore_cursor)(int x, int y);
void (*disable_mouse)(void);
}; };
extern display_t *rdisplay; extern display_t *rdisplay;

View File

@ -73,13 +73,14 @@ NAME_SRC= \
rdisplay.c \ rdisplay.c \
rdisplay_kms.c \ rdisplay_kms.c \
radeon_pm.c \ radeon_pm.c \
cmdline.c cmdline.c \
cursor.S
SRC_DEP:= SRC_DEP:=
NAME_OBJS = $(patsubst %.s, %.o, $(patsubst %.asm, %.o,\ NAME_OBJS = $(patsubst %.S, %.o, $(patsubst %.asm, %.o,\
$(patsubst %.c, %.o, $(NAME_SRC)))) $(patsubst %.c, %.o, $(NAME_SRC))))
@ -92,3 +93,6 @@ $(NAME).dll: $(NAME_OBJS) $(SRC_DEP) $(HFILES) atikms.lds Makefile
%.o : %.c $(HFILES) Makefile %.o : %.c $(HFILES) Makefile
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ -c $< $(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ -c $<
%.o : %.S $(HFILES) Makefile
as -o $@ $<

View File

@ -393,11 +393,11 @@ int r600_mc_init(struct radeon_device *rdev)
* AGP so that GPU can catch out of VRAM/AGP access * AGP so that GPU can catch out of VRAM/AGP access
*/ */
if (rdev->mc.gtt_location > rdev->mc.mc_vram_size) { if (rdev->mc.gtt_location > rdev->mc.mc_vram_size) {
/* Enought place before */ /* Enough place before */
rdev->mc.vram_location = rdev->mc.gtt_location - rdev->mc.vram_location = rdev->mc.gtt_location -
rdev->mc.mc_vram_size; rdev->mc.mc_vram_size;
} else if (tmp > rdev->mc.mc_vram_size) { } else if (tmp > rdev->mc.mc_vram_size) {
/* Enought place after */ /* Enough place after */
rdev->mc.vram_location = rdev->mc.gtt_location + rdev->mc.vram_location = rdev->mc.gtt_location +
rdev->mc.gtt_size; rdev->mc.gtt_size;
} else { } else {

View File

@ -237,6 +237,18 @@ int radeon_agp_init(struct radeon_device *rdev)
#endif #endif
} }
void radeon_agp_resume(struct radeon_device *rdev)
{
#if __OS_HAS_AGP
int r;
if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev);
if (r)
dev_warn(rdev->dev, "radeon AGP reinit failed\n");
}
#endif
}
void radeon_agp_fini(struct radeon_device *rdev) void radeon_agp_fini(struct radeon_device *rdev)
{ {
#if __OS_HAS_AGP #if __OS_HAS_AGP

View File

@ -566,8 +566,9 @@ static enum drm_connector_status radeon_vga_detect(struct drm_connector *connect
radeon_i2c_do_lock(radeon_connector, 0); radeon_i2c_do_lock(radeon_connector, 0);
if (!radeon_connector->edid) { if (!radeon_connector->edid) {
DRM_ERROR("DDC responded but not EDID found for %s\n", DRM_ERROR("%s: probed a monitor but no|invalid EDID\n",
drm_get_connector_name(connector)); drm_get_connector_name(connector));
ret = connector_status_connected;
} else { } else {
radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL);
@ -720,7 +721,7 @@ static enum drm_connector_status radeon_dvi_detect(struct drm_connector *connect
radeon_i2c_do_lock(radeon_connector, 0); radeon_i2c_do_lock(radeon_connector, 0);
if (!radeon_connector->edid) { if (!radeon_connector->edid) {
DRM_ERROR("DDC responded but not EDID found for %s\n", DRM_ERROR("%s: probed a monitor but no|invalid EDID\n",
drm_get_connector_name(connector)); drm_get_connector_name(connector));
} else { } else {
radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL);
@ -1070,10 +1071,6 @@ radeon_add_legacy_connector(struct drm_device *dev,
uint32_t subpixel_order = SubPixelNone; uint32_t subpixel_order = SubPixelNone;
int ret; int ret;
ENTER();
dbgprintf("id %d device %x type %x i2c %x\n",
connector_id, supported_device, connector_type, i2c_bus);
/* fixme - tv/cv/din */ /* fixme - tv/cv/din */
if (connector_type == DRM_MODE_CONNECTOR_Unknown) if (connector_type == DRM_MODE_CONNECTOR_Unknown)
return; return;
@ -1083,7 +1080,6 @@ radeon_add_legacy_connector(struct drm_device *dev,
radeon_connector = to_radeon_connector(connector); radeon_connector = to_radeon_connector(connector);
if (radeon_connector->connector_id == connector_id) { if (radeon_connector->connector_id == connector_id) {
radeon_connector->devices |= supported_device; radeon_connector->devices |= supported_device;
LEAVE();
return; return;
} }
} }
@ -1154,6 +1150,13 @@ radeon_add_legacy_connector(struct drm_device *dev,
if (ret) if (ret)
goto failed; goto failed;
radeon_connector->dac_load_detect = true; radeon_connector->dac_load_detect = true;
/* RS400,RC410,RS480 chipset seems to report a lot
* of false positive on load detect, we haven't yet
* found a way to make load detect reliable on those
* chipset, thus just disable it for TV.
*/
if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480)
radeon_connector->dac_load_detect = false;
drm_connector_attach_property(&radeon_connector->base, drm_connector_attach_property(&radeon_connector->base,
rdev->mode_info.load_detect_property, rdev->mode_info.load_detect_property,
1); 1);
@ -1178,7 +1181,6 @@ radeon_add_legacy_connector(struct drm_device *dev,
connector->display_info.subpixel_order = subpixel_order; connector->display_info.subpixel_order = subpixel_order;
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
LEAVE();
return; return;
failed: failed:
@ -1186,5 +1188,4 @@ failed:
radeon_i2c_destroy(radeon_connector->ddc_bus); radeon_i2c_destroy(radeon_connector->ddc_bus);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(connector); kfree(connector);
LEAVE();
} }

View File

@ -895,7 +895,7 @@ u32_t drvEntry(int action, char *cmdline)
return 0; return 0;
}; };
} }
dbgprintf("Radeon RC07 cmdline %s\n", cmdline); dbgprintf("Radeon RC08 cmdline %s\n", cmdline);
enum_pci_devices(); enum_pci_devices();

View File

@ -397,7 +397,7 @@ int radeon_gem_fb_object_create(struct radeon_device *rdev, int size,
vm_node = kzalloc(sizeof(*vm_node),0); vm_node = kzalloc(sizeof(*vm_node),0);
vm_node->free = 0; vm_node->free = 0;
vm_node->size = 0x800000 >> 12; vm_node->size = 0xC00000 >> 12;
vm_node->start = 0; vm_node->start = 0;
vm_node->mm = NULL; vm_node->mm = NULL;

View File

@ -52,8 +52,8 @@ int radeon_object_init(struct radeon_device *rdev)
ENTER(); ENTER();
r = drm_mm_init(&mm_vram, 0x800000 >> PAGE_SHIFT, r = drm_mm_init(&mm_vram, 0xC00000 >> PAGE_SHIFT,
((rdev->mc.real_vram_size - 0x800000) >> PAGE_SHIFT)); ((rdev->mc.real_vram_size - 0xC00000) >> PAGE_SHIFT));
if (r) { if (r) {
DRM_ERROR("Failed initializing VRAM heap.\n"); DRM_ERROR("Failed initializing VRAM heap.\n");
return r; return r;
@ -297,8 +297,6 @@ int radeon_object_kmap(struct radeon_object *robj, void **ptr)
(robj->vm_addr << PAGE_SHIFT); (robj->vm_addr << PAGE_SHIFT);
robj->kptr = (void*)MapIoMem(robj->cpu_addr, robj->kptr = (void*)MapIoMem(robj->cpu_addr,
robj->mm_node->size << 12, PG_SW); robj->mm_node->size << 12, PG_SW);
// dbgprintf("map io mem %x at %x\n", robj->cpu_addr, robj->kptr);
} }
else else
{ {
@ -328,7 +326,6 @@ void radeon_object_kunmap(struct radeon_object *robj)
// spin_unlock(&robj->tobj.lock); // spin_unlock(&robj->tobj.lock);
} }
#if 0
void radeon_object_unpin(struct radeon_object *robj) void radeon_object_unpin(struct radeon_object *robj)
{ {
@ -347,24 +344,14 @@ void radeon_object_unpin(struct radeon_object *robj)
return; return;
} }
// spin_unlock(&robj->tobj.lock); // spin_unlock(&robj->tobj.lock);
r = radeon_object_reserve(robj, false);
if (unlikely(r != 0)) { drm_mm_put_block(robj->mm_node);
DRM_ERROR("radeon: failed to reserve object for unpinning it.\n");
return; kfree(robj);
}
flags = robj->tobj.mem.placement;
robj->tobj.proposed_placement = flags & ~TTM_PL_FLAG_NO_EVICT;
r = ttm_buffer_object_validate(&robj->tobj,
robj->tobj.proposed_placement,
false, false);
if (unlikely(r != 0)) {
DRM_ERROR("radeon: failed to unpin buffer.\n");
}
radeon_object_unreserve(robj);
} }
#if 0
/* /*

View File

@ -13,6 +13,11 @@ display_t *rdisplay;
static cursor_t* __stdcall select_cursor(cursor_t *cursor); static cursor_t* __stdcall select_cursor(cursor_t *cursor);
static void __stdcall move_cursor(cursor_t *cursor, int x, int y); static void __stdcall move_cursor(cursor_t *cursor, int x, int y);
extern void destroy_cursor(void);
void disable_mouse(void)
{};
int init_cursor(cursor_t *cursor) int init_cursor(cursor_t *cursor)
{ {
struct radeon_device *rdev; struct radeon_device *rdev;
@ -55,9 +60,20 @@ int init_cursor(cursor_t *cursor)
radeon_object_kunmap(cursor->robj); radeon_object_kunmap(cursor->robj);
cursor->header.destroy = destroy_cursor;
return 0; return 0;
}; };
void fini_cursor(cursor_t *cursor)
{
list_del(&cursor->list);
radeon_object_unpin(cursor->robj);
KernelFree(cursor->data);
__DestroyObject(cursor);
};
static void radeon_show_cursor() static void radeon_show_cursor()
{ {
struct radeon_device *rdev = (struct radeon_device *)rdisplay->ddev->dev_private; struct radeon_device *rdev = (struct radeon_device *)rdisplay->ddev->dev_private;
@ -188,6 +204,7 @@ bool init_display(struct radeon_device *rdev, mode_t *usermode)
rdisplay->show_cursor = NULL; rdisplay->show_cursor = NULL;
rdisplay->move_cursor = move_cursor; rdisplay->move_cursor = move_cursor;
rdisplay->restore_cursor = restore_cursor; rdisplay->restore_cursor = restore_cursor;
rdisplay->disable_mouse = disable_mouse;
select_cursor(rdisplay->cursor); select_cursor(rdisplay->cursor);
radeon_show_cursor(); radeon_show_cursor();

View File

@ -14,6 +14,8 @@ 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); int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled);
void disable_mouse(void);
static void radeon_show_cursor_kms(struct drm_crtc *crtc) static void radeon_show_cursor_kms(struct drm_crtc *crtc)
{ {
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
@ -369,6 +371,7 @@ bool init_display_kms(struct radeon_device *rdev, mode_t *usermode)
rdisplay->show_cursor = NULL; rdisplay->show_cursor = NULL;
rdisplay->move_cursor = move_cursor_kms; rdisplay->move_cursor = move_cursor_kms;
rdisplay->restore_cursor = restore_cursor; rdisplay->restore_cursor = restore_cursor;
rdisplay->disable_mouse = disable_mouse;
select_cursor_kms(rdisplay->cursor); select_cursor_kms(rdisplay->cursor);
radeon_show_cursor_kms(rdisplay->crtc); radeon_show_cursor_kms(rdisplay->crtc);

View File

@ -142,8 +142,6 @@ int rv515_mc_wait_for_idle(struct radeon_device *rdev)
void rv515_vga_render_disable(struct radeon_device *rdev) void rv515_vga_render_disable(struct radeon_device *rdev)
{ {
WREG32(R_000330_D1VGA_CONTROL, 0);
WREG32(R_000338_D2VGA_CONTROL, 0);
WREG32(R_000300_VGA_RENDER_CONTROL, WREG32(R_000300_VGA_RENDER_CONTROL,
RREG32(R_000300_VGA_RENDER_CONTROL) & C_000300_VGA_VSTATUS_CNTL); RREG32(R_000300_VGA_RENDER_CONTROL) & C_000300_VGA_VSTATUS_CNTL);
} }
@ -391,7 +389,6 @@ void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save)
save->d2crtc_control = RREG32(R_006880_D2CRTC_CONTROL); save->d2crtc_control = RREG32(R_006880_D2CRTC_CONTROL);
/* Stop all video */ /* Stop all video */
WREG32(R_000330_D1VGA_CONTROL, 0);
WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0); WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0);
WREG32(R_000300_VGA_RENDER_CONTROL, 0); WREG32(R_000300_VGA_RENDER_CONTROL, 0);
WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 1); WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 1);
@ -400,6 +397,8 @@ void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save)
WREG32(R_006880_D2CRTC_CONTROL, 0); WREG32(R_006880_D2CRTC_CONTROL, 0);
WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 0); WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 0);
WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0); WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0);
WREG32(R_000330_D1VGA_CONTROL, 0);
WREG32(R_000338_D2VGA_CONTROL, 0);
} }
void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save) void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save)
@ -413,14 +412,14 @@ void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save)
WREG32(R_000328_VGA_HDP_CONTROL, save->vga_hdp_control); WREG32(R_000328_VGA_HDP_CONTROL, save->vga_hdp_control);
mdelay(1); mdelay(1);
/* Restore video state */ /* Restore video state */
WREG32(R_000330_D1VGA_CONTROL, save->d1vga_control);
WREG32(R_000338_D2VGA_CONTROL, save->d2vga_control);
WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 1); WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 1);
WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 1); WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 1);
WREG32(R_006080_D1CRTC_CONTROL, save->d1crtc_control); WREG32(R_006080_D1CRTC_CONTROL, save->d1crtc_control);
WREG32(R_006880_D2CRTC_CONTROL, save->d2crtc_control); WREG32(R_006880_D2CRTC_CONTROL, save->d2crtc_control);
WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 0); WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 0);
WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0); WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0);
WREG32(R_000330_D1VGA_CONTROL, save->d1vga_control);
WREG32(R_000338_D2VGA_CONTROL, save->d2vga_control);
WREG32(R_000300_VGA_RENDER_CONTROL, save->vga_render_control); WREG32(R_000300_VGA_RENDER_CONTROL, save->vga_render_control);
} }

View File

@ -831,11 +831,11 @@ int rv770_mc_init(struct radeon_device *rdev)
* AGP so that GPU can catch out of VRAM/AGP access * AGP so that GPU can catch out of VRAM/AGP access
*/ */
if (rdev->mc.gtt_location > rdev->mc.mc_vram_size) { if (rdev->mc.gtt_location > rdev->mc.mc_vram_size) {
/* Enought place before */ /* Enough place before */
rdev->mc.vram_location = rdev->mc.gtt_location - rdev->mc.vram_location = rdev->mc.gtt_location -
rdev->mc.mc_vram_size; rdev->mc.mc_vram_size;
} else if (tmp > rdev->mc.mc_vram_size) { } else if (tmp > rdev->mc.mc_vram_size) {
/* Enought place after */ /* Enough place after */
rdev->mc.vram_location = rdev->mc.gtt_location + rdev->mc.vram_location = rdev->mc.gtt_location +
rdev->mc.gtt_size; rdev->mc.gtt_size;
} else { } else {

View File

@ -338,37 +338,58 @@ addr_t __fastcall mem_alloc(size_t size, u32_t flags)
addr_t *pte = &((addr_t*)page_tabs)[heap >> PAGE_WIDTH]; addr_t *pte = &((addr_t*)page_tabs)[heap >> PAGE_WIDTH];
addr_t *mpte = &map->pte[0]; addr_t *mpte = &map->pte[0];
#if 0 mem = heap;
if( flags & PG_MAP ) if( flags & PG_MAP )
{
#ifdef ALLOC_IMM
while( pages )
{
u32_t order;
addr_t page_frame;
asm volatile ("bsr %0, %1":"=&r"(order):"r"(tmp):"cc");
asm volatile ("btr %0, %1" :"=r"(tmp):"r"(order):"cc");
page_frame = frame_alloc(1 << order) | (flags & 0xFFF);
for(i = 0; i < 1 << order; i++)
{
*pte++ = 0; //page;
*mpte++ = page;
asm volatile ( "invlpg (%0)" ::"r" (mem) );
mem+= 4096;
};
}
#else
page = PG_DEMAND | (flags & 0xFFF); page = PG_DEMAND | (flags & 0xFFF);
mem = heap; while(pages--)
while(pages--) {
{ *pte++ = 0;
*pte++ = 0; //page; *mpte++ = page;
*mpte++ = page; asm volatile ( "invlpg (%0)" ::"r" (mem) );
mem+= 4096;
asm volatile ( "invlpg (%0)" ::"r" (mem) ); };
mem+= 4096;
};
#else
mem = heap;
while(pages--)
{
if( flags & PG_MAP )
page = alloc_page();
page |= flags & 0xFFF;
*pte++ = 0;
*mpte++ = page;
asm volatile ( "invlpg (%0)" ::"r" (mem) );
mem+= 4096;
};
#endif #endif
}
else
{
while(pages--)
{
*pte++ = 0; //page;
*mpte++ = 0;
asm volatile ( "invlpg (%0)" ::"r" (mem) );
mem+= 4096;
};
}
#endif
DBG("%s %x size %d order %d\n", __FUNCTION__, heap, size, order); DBG("%s %x size %d order %d\n", __FUNCTION__, heap, size, order);
return heap; return heap;
@ -429,8 +450,10 @@ void __fastcall mem_free(addr_t addr)
spinlock_unlock(&z_heap.lock); spinlock_unlock(&z_heap.lock);
safe_sti(efl); safe_sti(efl);
for( i = 0; i < (map->size >> PAGE_WIDTH); i++) for( i = 0; i < (map->size >> PAGE_WIDTH); )
frame_free(map->pte[i]); {
i+= frame_free(map->pte[i]);
}
frame_free( KA2PA(map) ); frame_free( KA2PA(map) );
} }
@ -441,7 +464,6 @@ void __fastcall mem_free(addr_t addr)
}; };
}; };
void __fastcall heap_fault(addr_t faddr, u32_t code) void __fastcall heap_fault(addr_t faddr, u32_t code)
{ {
index_t idx; index_t idx;
@ -466,7 +488,6 @@ void __fastcall heap_fault(addr_t faddr, u32_t code)
if( page != 0) if( page != 0)
{ {
#if 0
if( page & PG_DEMAND) if( page & PG_DEMAND)
{ {
page &= ~PG_DEMAND; page &= ~PG_DEMAND;
@ -474,7 +495,6 @@ void __fastcall heap_fault(addr_t faddr, u32_t code)
map->pte[idx] = page; map->pte[idx] = page;
}; };
#endif
((addr_t*)page_tabs)[faddr >> PAGE_WIDTH] = page; ((addr_t*)page_tabs)[faddr >> PAGE_WIDTH] = page;
}; };
}; };

View File

@ -449,13 +449,17 @@ struc CURSOR
.base dd ? ;allocated memory .base dd ? ;allocated memory
.hot_x dd ? ;hotspot coords .hot_x dd ? ;hotspot coords
.hot_y dd ? .hot_y dd ?
.list_next dd ? ;next cursor in cursor list
.list_prev dd ? ;prev cursor in cursor list
.dev_obj dd ? ;device depended data
.sizeof: .sizeof:
} }
virtual at 0 virtual at 0
CURSOR CURSOR CURSOR CURSOR
end virtual end virtual
CURSOR_SIZE equ 32
struc EVENT struc EVENT
{ {

View File

@ -300,7 +300,7 @@ vesa_cursor:
push ebx push ebx
mov ebx, eax mov ebx, eax
mov eax, CURSOR_SIZE mov eax, CURSOR.sizeof
call create_kernel_object call create_kernel_object
test eax, eax test eax, eax
jz .fail jz .fail