forked from KolibriOS/kolibrios
fix modeset
git-svn-id: svn://kolibrios.org@1182 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
a864f1a57e
commit
a5563b0c1a
@ -429,8 +429,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
|
|||||||
|
|
||||||
DRM_DEBUG_KMS("\n");
|
DRM_DEBUG_KMS("\n");
|
||||||
|
|
||||||
width = 1280; //dev->mode_config.max_width;
|
width = dev->mode_config.max_width;
|
||||||
height = 1024; //dev->mode_config.max_height;
|
height = dev->mode_config.max_height;
|
||||||
|
|
||||||
/* clean out all the encoder/crtc combos */
|
/* clean out all the encoder/crtc combos */
|
||||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
||||||
|
@ -478,10 +478,6 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,
|
|||||||
if (!crtc->fb)
|
if (!crtc->fb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
dbgprintf("x = %d y = %d width = %d height = %d\n",
|
|
||||||
x, y, crtc->fb->width, crtc->fb->height);
|
|
||||||
dbgprintf("hdisplay = %d\n", crtc->mode.hdisplay);
|
|
||||||
|
|
||||||
radeon_fb = to_radeon_framebuffer(crtc->fb);
|
radeon_fb = to_radeon_framebuffer(crtc->fb);
|
||||||
|
|
||||||
obj = radeon_fb->obj;
|
obj = radeon_fb->obj;
|
||||||
@ -493,8 +489,6 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,
|
|||||||
|
|
||||||
fb_location = 0; //rdev->mc.vram_location;
|
fb_location = 0; //rdev->mc.vram_location;
|
||||||
|
|
||||||
dbgprintf("fb_location %x\n", fb_location);
|
|
||||||
dbgprintf("bpp %d\n", crtc->fb->bits_per_pixel);
|
|
||||||
|
|
||||||
switch (crtc->fb->bits_per_pixel) {
|
switch (crtc->fb->bits_per_pixel) {
|
||||||
case 8:
|
case 8:
|
||||||
|
@ -5,7 +5,7 @@ CFLAGS = -c -O2 -fomit-frame-pointer -fno-builtin-printf
|
|||||||
LDFLAGS = -nostdlib -shared -s -Map atikms.map --image-base 0 --file-alignment 512 --section-alignment 4096
|
LDFLAGS = -nostdlib -shared -s -Map atikms.map --image-base 0 --file-alignment 512 --section-alignment 4096
|
||||||
|
|
||||||
DRM_TOPDIR = $(CURDIR)/..
|
DRM_TOPDIR = $(CURDIR)/..
|
||||||
DRM_INCLUDES = $(DRM_TOPDIR)/include
|
DRM_INCLUDES = $(DRM_TOPDIR)/includes
|
||||||
|
|
||||||
LIBPATH:= .
|
LIBPATH:= .
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ LIBS:= -ldrv -lcore
|
|||||||
|
|
||||||
NAME:= atikms
|
NAME:= atikms
|
||||||
|
|
||||||
INCLUDES = -I $(DRM_INCLUDES) -I $(DRM_INCLUDES)/linux -I $(DRM_INCLUDES)/drm
|
INCLUDES = -I$(DRM_INCLUDES) -I$(DRM_INCLUDES)/linux -I$(DRM_INCLUDES)/drm
|
||||||
|
|
||||||
HFILES:= $(DRM_INCLUDES)/linux/types.h \
|
HFILES:= $(DRM_INCLUDES)/linux/types.h \
|
||||||
$(DRM_INCLUDES)/linux/list.h \
|
$(DRM_INCLUDES)/linux/list.h \
|
||||||
@ -23,7 +23,7 @@ HFILES:= $(DRM_INCLUDES)/linux/types.h \
|
|||||||
$(DRM_INCLUDES)/drm_edid.h \
|
$(DRM_INCLUDES)/drm_edid.h \
|
||||||
$(DRM_INCLUDES)/drm/drm_crtc.h \
|
$(DRM_INCLUDES)/drm/drm_crtc.h \
|
||||||
$(DRM_INCLUDES)/drm/drm_mode.h \
|
$(DRM_INCLUDES)/drm/drm_mode.h \
|
||||||
$(DRM_INCLUDES)/drm_mm.h \
|
$(DRM_INCLUDES)/drm/drm_mm.h \
|
||||||
atom.h \
|
atom.h \
|
||||||
radeon.h \
|
radeon.h \
|
||||||
radeon_asic.h
|
radeon_asic.h
|
||||||
@ -68,7 +68,8 @@ NAME_SRC= \
|
|||||||
rs400.c \
|
rs400.c \
|
||||||
rs600.c \
|
rs600.c \
|
||||||
rs690.c \
|
rs690.c \
|
||||||
radeon_fb.c
|
radeon_fb.c \
|
||||||
|
rdisplay.c
|
||||||
|
|
||||||
|
|
||||||
SRC_DEP:=
|
SRC_DEP:=
|
||||||
|
@ -658,7 +658,6 @@ int radeon_device_init(struct radeon_device *rdev,
|
|||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
rdev->accel_working = true;
|
rdev->accel_working = true;
|
||||||
r = radeon_modeset_init(rdev);
|
|
||||||
}
|
}
|
||||||
DRM_INFO("radeon: kernel modesetting successfully initialized.\n");
|
DRM_INFO("radeon: kernel modesetting successfully initialized.\n");
|
||||||
// if (radeon_testing) {
|
// if (radeon_testing) {
|
||||||
@ -789,7 +788,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
|
|||||||
struct radeon_device *rdev;
|
struct radeon_device *rdev;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
dbgprintf("%s\n",__FUNCTION__);
|
ENTER();
|
||||||
|
|
||||||
rdev = kzalloc(sizeof(struct radeon_device), GFP_KERNEL);
|
rdev = kzalloc(sizeof(struct radeon_device), GFP_KERNEL);
|
||||||
if (rdev == NULL) {
|
if (rdev == NULL) {
|
||||||
@ -807,10 +806,23 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
|
|||||||
// flags |= RADEON_IS_PCI;
|
// flags |= RADEON_IS_PCI;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/* radeon_device_init should report only fatal error
|
||||||
|
* like memory allocation failure or iomapping failure,
|
||||||
|
* or memory manager initialization failure, it must
|
||||||
|
* properly initialize the GPU MC controller and permit
|
||||||
|
* VRAM allocation
|
||||||
|
*/
|
||||||
r = radeon_device_init(rdev, dev, dev->pdev, flags);
|
r = radeon_device_init(rdev, dev, dev->pdev, flags);
|
||||||
if (r) {
|
if (r) {
|
||||||
dbgprintf("Failed to initialize Radeon, disabling IOCTL\n");
|
DRM_ERROR("Fatal error while trying to initialize radeon.\n");
|
||||||
// radeon_device_fini(rdev);
|
return r;
|
||||||
|
}
|
||||||
|
/* Again modeset_init should fail only on fatal error
|
||||||
|
* otherwise it should provide enough functionalities
|
||||||
|
* for shadowfb to run
|
||||||
|
*/
|
||||||
|
r = radeon_modeset_init(rdev);
|
||||||
|
if (r) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -868,7 +880,7 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||||||
// driver->name, driver->major, driver->minor, driver->patchlevel,
|
// driver->name, driver->major, driver->minor, driver->patchlevel,
|
||||||
// driver->date, pci_name(pdev), dev->primary->index);
|
// driver->date, pci_name(pdev), dev->primary->index);
|
||||||
|
|
||||||
set_mode(dev, 1024, 768);
|
set_mode(dev, 1280, 1024);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -759,6 +759,8 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
|
|||||||
struct radeon_encoder *radeon_encoder;
|
struct radeon_encoder *radeon_encoder;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
||||||
radeon_encoder = to_radeon_encoder(encoder);
|
radeon_encoder = to_radeon_encoder(encoder);
|
||||||
if (encoder->crtc != crtc)
|
if (encoder->crtc != crtc)
|
||||||
@ -783,6 +785,11 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (radeon_crtc->rmx_type != RMX_OFF) {
|
if (radeon_crtc->rmx_type != RMX_OFF) {
|
||||||
|
|
||||||
|
dbgprintf("\nset scaler panel_xres %d panel_yres %d\n",
|
||||||
|
radeon_crtc->native_mode.panel_xres,
|
||||||
|
radeon_crtc->native_mode.panel_yres);
|
||||||
|
|
||||||
fixed20_12 a, b;
|
fixed20_12 a, b;
|
||||||
a.full = rfixed_const(crtc->mode.vdisplay);
|
a.full = rfixed_const(crtc->mode.vdisplay);
|
||||||
b.full = rfixed_const(radeon_crtc->native_mode.panel_xres);
|
b.full = rfixed_const(radeon_crtc->native_mode.panel_xres);
|
||||||
@ -794,5 +801,8 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
|
|||||||
radeon_crtc->vsc.full = rfixed_const(1);
|
radeon_crtc->vsc.full = rfixed_const(1);
|
||||||
radeon_crtc->hsc.full = rfixed_const(1);
|
radeon_crtc->hsc.full = rfixed_const(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LEAVE();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,7 @@ void radeon_rmx_mode_fixup(struct drm_encoder *encoder,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
|
static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
|
||||||
struct drm_display_mode *mode,
|
struct drm_display_mode *mode,
|
||||||
struct drm_display_mode *adjusted_mode)
|
struct drm_display_mode *adjusted_mode)
|
||||||
|
@ -444,7 +444,7 @@ bool set_mode(struct drm_device *dev, int width, int height)
|
|||||||
{
|
{
|
||||||
struct drm_connector *connector;
|
struct drm_connector *connector;
|
||||||
|
|
||||||
bool ret;
|
bool ret = false;
|
||||||
|
|
||||||
list_for_each_entry(connector, &dev->mode_config.connector_list, head)
|
list_for_each_entry(connector, &dev->mode_config.connector_list, head)
|
||||||
{
|
{
|
||||||
@ -465,6 +465,29 @@ bool set_mode(struct drm_device *dev, int width, int height)
|
|||||||
if(crtc == NULL)
|
if(crtc == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
list_for_each_entry(mode, &connector->modes, head)
|
||||||
|
{
|
||||||
|
if (mode->type & DRM_MODE_TYPE_PREFERRED);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
|
||||||
|
struct radeon_native_mode *native_mode = &radeon_encoder->native_mode;
|
||||||
|
|
||||||
|
native_mode->panel_xres = mode->hdisplay;
|
||||||
|
native_mode->panel_yres = mode->vdisplay;
|
||||||
|
|
||||||
|
native_mode->hblank = mode->htotal - mode->hdisplay;
|
||||||
|
native_mode->hoverplus = mode->hsync_start - mode->hdisplay;
|
||||||
|
native_mode->hsync_width = mode->hsync_end - mode->hsync_start;
|
||||||
|
native_mode->vblank = mode->vtotal - mode->vdisplay;
|
||||||
|
native_mode->voverplus = mode->vsync_start - mode->vdisplay;
|
||||||
|
native_mode->vsync_width = mode->vsync_end - mode->vsync_start;
|
||||||
|
native_mode->dotclock = mode->clock;
|
||||||
|
native_mode->flags = mode->flags;
|
||||||
|
*/
|
||||||
list_for_each_entry(mode, &connector->modes, head)
|
list_for_each_entry(mode, &connector->modes, head)
|
||||||
{
|
{
|
||||||
char *con_name, *enc_name;
|
char *con_name, *enc_name;
|
||||||
@ -502,24 +525,22 @@ bool set_mode(struct drm_device *dev, int width, int height)
|
|||||||
|
|
||||||
ret = drm_crtc_helper_set_mode(crtc, mode, 0, 0, fb);
|
ret = drm_crtc_helper_set_mode(crtc, mode, 0, 0, fb);
|
||||||
|
|
||||||
sysSetScreen(width, height, fb->pitch);
|
sysSetScreen(fb->width, fb->height, fb->pitch);
|
||||||
|
|
||||||
if (ret == true)
|
if (ret == true)
|
||||||
{
|
{
|
||||||
dbgprintf("new mode %d %d pitch %d\n", width, height, fb->pitch);
|
dbgprintf("new mode %d %d pitch %d\n",fb->width, fb->height, fb->pitch);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DRM_ERROR("failed to set mode %d_%d on crtc %p\n",
|
DRM_ERROR("failed to set mode %d_%d on crtc %p\n",
|
||||||
width, height, crtc);
|
fb->width, fb->height, crtc);
|
||||||
};
|
};
|
||||||
|
|
||||||
return ret;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return false;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,7 +207,6 @@ int radeon_fence_wait(struct radeon_fence *fence, bool intr)
|
|||||||
bool expired = false;
|
bool expired = false;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|
||||||
if (fence == NULL) {
|
if (fence == NULL) {
|
||||||
WARN(1, "Querying an invalid fence : %p !\n", fence);
|
WARN(1, "Querying an invalid fence : %p !\n", fence);
|
||||||
return 0;
|
return 0;
|
||||||
@ -230,6 +229,7 @@ retry:
|
|||||||
if (time_after(fence->timeout, cur_jiffies)) {
|
if (time_after(fence->timeout, cur_jiffies)) {
|
||||||
timeout = fence->timeout - cur_jiffies;
|
timeout = fence->timeout - cur_jiffies;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intr) {
|
if (intr) {
|
||||||
r = wait_event_interruptible_timeout(rdev->fence_drv.queue,
|
r = wait_event_interruptible_timeout(rdev->fence_drv.queue,
|
||||||
radeon_fence_signaled(fence), timeout);
|
radeon_fence_signaled(fence), timeout);
|
||||||
|
@ -50,7 +50,7 @@ int radeon_object_init(struct radeon_device *rdev)
|
|||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
dbgprintf("%s\n",__FUNCTION__);
|
ENTER();
|
||||||
|
|
||||||
r = drm_mm_init(&mm_vram, 0x800000 >> PAGE_SHIFT,
|
r = drm_mm_init(&mm_vram, 0x800000 >> PAGE_SHIFT,
|
||||||
((rdev->mc.aper_size - 0x800000) >> PAGE_SHIFT));
|
((rdev->mc.aper_size - 0x800000) >> PAGE_SHIFT));
|
||||||
@ -101,8 +101,6 @@ int radeon_object_create(struct radeon_device *rdev,
|
|||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
dbgprintf("%s\n",__FUNCTION__);
|
|
||||||
|
|
||||||
if (kernel) {
|
if (kernel) {
|
||||||
type = ttm_bo_type_kernel;
|
type = ttm_bo_type_kernel;
|
||||||
} else {
|
} else {
|
||||||
@ -121,8 +119,6 @@ int radeon_object_create(struct radeon_device *rdev,
|
|||||||
|
|
||||||
robj->flags = flags;
|
robj->flags = flags;
|
||||||
|
|
||||||
dbgprintf("robj flags %x\n", robj->flags);
|
|
||||||
|
|
||||||
if( flags & TTM_PL_FLAG_VRAM)
|
if( flags & TTM_PL_FLAG_VRAM)
|
||||||
{
|
{
|
||||||
size_t num_pages;
|
size_t num_pages;
|
||||||
@ -132,7 +128,7 @@ int radeon_object_create(struct radeon_device *rdev,
|
|||||||
num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
|
|
||||||
if (num_pages == 0) {
|
if (num_pages == 0) {
|
||||||
printk("Illegal buffer object size.\n");
|
dbgprintf("Illegal buffer object size.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
retry_pre_get:
|
retry_pre_get:
|
||||||
@ -170,7 +166,7 @@ retry_pre_get:
|
|||||||
num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
|
|
||||||
if (num_pages == 0) {
|
if (num_pages == 0) {
|
||||||
printk("Illegal buffer object size.\n");
|
dbgprintf("Illegal buffer object size.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
retry_pre_get1:
|
retry_pre_get1:
|
||||||
@ -223,8 +219,6 @@ int radeon_object_pin(struct radeon_object *robj, uint32_t domain,
|
|||||||
uint32_t tmp;
|
uint32_t tmp;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
dbgprintf("%s\n",__FUNCTION__);
|
|
||||||
|
|
||||||
// flags = radeon_object_flags_from_domain(domain);
|
// flags = radeon_object_flags_from_domain(domain);
|
||||||
// spin_lock(&robj->tobj.lock);
|
// spin_lock(&robj->tobj.lock);
|
||||||
if (robj->pin_count) {
|
if (robj->pin_count) {
|
||||||
@ -280,8 +274,6 @@ int radeon_object_pin(struct radeon_object *robj, uint32_t domain,
|
|||||||
DRM_ERROR("radeon: failed to pin object.\n");
|
DRM_ERROR("radeon: failed to pin object.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgprintf("done %s\n",__FUNCTION__);
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,8 +281,6 @@ int radeon_object_kmap(struct radeon_object *robj, void **ptr)
|
|||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
dbgprintf("%s\n",__FUNCTION__);
|
|
||||||
|
|
||||||
// spin_lock(&robj->tobj.lock);
|
// spin_lock(&robj->tobj.lock);
|
||||||
if (robj->kptr) {
|
if (robj->kptr) {
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
@ -319,11 +309,24 @@ int radeon_object_kmap(struct radeon_object *robj, void **ptr)
|
|||||||
*ptr = robj->kptr;
|
*ptr = robj->kptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgprintf("done %s\n",__FUNCTION__);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void radeon_object_kunmap(struct radeon_object *robj)
|
||||||
|
{
|
||||||
|
// spin_lock(&robj->tobj.lock);
|
||||||
|
if (robj->kptr == NULL) {
|
||||||
|
// spin_unlock(&robj->tobj.lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (robj->flags & TTM_PL_FLAG_VRAM)
|
||||||
|
{
|
||||||
|
FreeKernelSpace(robj->kptr);
|
||||||
|
robj->kptr = NULL;
|
||||||
|
}
|
||||||
|
// spin_unlock(&robj->tobj.lock);
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user