diff --git a/drivers/video/drm/drm_crtc_helper.c b/drivers/video/drm/drm_crtc_helper.c index 59c5bb02ed..e1b2c94a15 100644 --- a/drivers/video/drm/drm_crtc_helper.c +++ b/drivers/video/drm/drm_crtc_helper.c @@ -429,8 +429,8 @@ static void drm_setup_crtcs(struct drm_device *dev) DRM_DEBUG_KMS("\n"); - width = 1280; //dev->mode_config.max_width; - height = 1024; //dev->mode_config.max_height; + width = dev->mode_config.max_width; + height = dev->mode_config.max_height; /* clean out all the encoder/crtc combos */ list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { diff --git a/drivers/video/drm/radeon/atombios_crtc.c b/drivers/video/drm/radeon/atombios_crtc.c index 8e1409e7c5..2b30d03396 100644 --- a/drivers/video/drm/radeon/atombios_crtc.c +++ b/drivers/video/drm/radeon/atombios_crtc.c @@ -478,10 +478,6 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y, if (!crtc->fb) 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); 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; - dbgprintf("fb_location %x\n", fb_location); - dbgprintf("bpp %d\n", crtc->fb->bits_per_pixel); switch (crtc->fb->bits_per_pixel) { case 8: diff --git a/drivers/video/drm/radeon/makefile b/drivers/video/drm/radeon/makefile index 2246f82dac..6a3997f7c3 100644 --- a/drivers/video/drm/radeon/makefile +++ b/drivers/video/drm/radeon/makefile @@ -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 DRM_TOPDIR = $(CURDIR)/.. -DRM_INCLUDES = $(DRM_TOPDIR)/include +DRM_INCLUDES = $(DRM_TOPDIR)/includes LIBPATH:= . @@ -13,7 +13,7 @@ LIBS:= -ldrv -lcore 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 \ $(DRM_INCLUDES)/linux/list.h \ @@ -23,7 +23,7 @@ HFILES:= $(DRM_INCLUDES)/linux/types.h \ $(DRM_INCLUDES)/drm_edid.h \ $(DRM_INCLUDES)/drm/drm_crtc.h \ $(DRM_INCLUDES)/drm/drm_mode.h \ - $(DRM_INCLUDES)/drm_mm.h \ + $(DRM_INCLUDES)/drm/drm_mm.h \ atom.h \ radeon.h \ radeon_asic.h @@ -68,7 +68,8 @@ NAME_SRC= \ rs400.c \ rs600.c \ rs690.c \ - radeon_fb.c + radeon_fb.c \ + rdisplay.c SRC_DEP:= diff --git a/drivers/video/drm/radeon/radeon_device.c b/drivers/video/drm/radeon/radeon_device.c index 7346920ae3..5ff24c0296 100644 --- a/drivers/video/drm/radeon/radeon_device.c +++ b/drivers/video/drm/radeon/radeon_device.c @@ -658,7 +658,6 @@ int radeon_device_init(struct radeon_device *rdev, return 0; #endif rdev->accel_working = true; - r = radeon_modeset_init(rdev); } DRM_INFO("radeon: kernel modesetting successfully initialized.\n"); // if (radeon_testing) { @@ -789,7 +788,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) struct radeon_device *rdev; int r; - dbgprintf("%s\n",__FUNCTION__); + ENTER(); rdev = kzalloc(sizeof(struct radeon_device), GFP_KERNEL); if (rdev == NULL) { @@ -807,10 +806,23 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) // 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); if (r) { - dbgprintf("Failed to initialize Radeon, disabling IOCTL\n"); -// radeon_device_fini(rdev); + DRM_ERROR("Fatal error while trying to initialize radeon.\n"); + 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 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->date, pci_name(pdev), dev->primary->index); - set_mode(dev, 1024, 768); + set_mode(dev, 1280, 1024); return 0; diff --git a/drivers/video/drm/radeon/radeon_display.c b/drivers/video/drm/radeon/radeon_display.c index ebd0c41dfa..56c3ec29a7 100644 --- a/drivers/video/drm/radeon/radeon_display.c +++ b/drivers/video/drm/radeon/radeon_display.c @@ -759,6 +759,8 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, struct radeon_encoder *radeon_encoder; bool first = true; + ENTER(); + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { radeon_encoder = to_radeon_encoder(encoder); 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) { + + 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; a.full = rfixed_const(crtc->mode.vdisplay); 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->hsc.full = rfixed_const(1); } + + LEAVE(); + return true; } diff --git a/drivers/video/drm/radeon/radeon_encoders.c b/drivers/video/drm/radeon/radeon_encoders.c index 48e27e6f72..280ebce347 100644 --- a/drivers/video/drm/radeon/radeon_encoders.c +++ b/drivers/video/drm/radeon/radeon_encoders.c @@ -213,6 +213,7 @@ void radeon_rmx_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 *adjusted_mode) diff --git a/drivers/video/drm/radeon/radeon_fb.c b/drivers/video/drm/radeon/radeon_fb.c index 3beae9f6e2..79e6ed2cab 100644 --- a/drivers/video/drm/radeon/radeon_fb.c +++ b/drivers/video/drm/radeon/radeon_fb.c @@ -444,7 +444,7 @@ bool set_mode(struct drm_device *dev, int width, int height) { struct drm_connector *connector; - bool ret; + bool ret = false; 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) 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) { 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); - sysSetScreen(width, height, fb->pitch); + sysSetScreen(fb->width, fb->height, fb->pitch); 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 { 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; }; diff --git a/drivers/video/drm/radeon/radeon_fence.c b/drivers/video/drm/radeon/radeon_fence.c index 1ec85aefc4..e29b1db486 100644 --- a/drivers/video/drm/radeon/radeon_fence.c +++ b/drivers/video/drm/radeon/radeon_fence.c @@ -207,7 +207,6 @@ int radeon_fence_wait(struct radeon_fence *fence, bool intr) bool expired = false; int r; - if (fence == NULL) { WARN(1, "Querying an invalid fence : %p !\n", fence); return 0; @@ -230,6 +229,7 @@ retry: if (time_after(fence->timeout, cur_jiffies)) { timeout = fence->timeout - cur_jiffies; } + if (intr) { r = wait_event_interruptible_timeout(rdev->fence_drv.queue, radeon_fence_signaled(fence), timeout); diff --git a/drivers/video/drm/radeon/radeon_object.c b/drivers/video/drm/radeon/radeon_object.c index 1aaa54b458..32bab20396 100644 --- a/drivers/video/drm/radeon/radeon_object.c +++ b/drivers/video/drm/radeon/radeon_object.c @@ -50,7 +50,7 @@ int radeon_object_init(struct radeon_device *rdev) { int r = 0; - dbgprintf("%s\n",__FUNCTION__); + ENTER(); r = drm_mm_init(&mm_vram, 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; int r; - dbgprintf("%s\n",__FUNCTION__); - if (kernel) { type = ttm_bo_type_kernel; } else { @@ -121,8 +119,6 @@ int radeon_object_create(struct radeon_device *rdev, robj->flags = flags; - dbgprintf("robj flags %x\n", robj->flags); - if( flags & TTM_PL_FLAG_VRAM) { size_t num_pages; @@ -132,7 +128,7 @@ int radeon_object_create(struct radeon_device *rdev, num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; if (num_pages == 0) { - printk("Illegal buffer object size.\n"); + dbgprintf("Illegal buffer object size.\n"); return -EINVAL; } retry_pre_get: @@ -170,7 +166,7 @@ retry_pre_get: num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; if (num_pages == 0) { - printk("Illegal buffer object size.\n"); + dbgprintf("Illegal buffer object size.\n"); return -EINVAL; } retry_pre_get1: @@ -223,8 +219,6 @@ int radeon_object_pin(struct radeon_object *robj, uint32_t domain, uint32_t tmp; int r = 0; - dbgprintf("%s\n",__FUNCTION__); - // flags = radeon_object_flags_from_domain(domain); // spin_lock(&robj->tobj.lock); 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"); } - dbgprintf("done %s\n",__FUNCTION__); - return r; } @@ -289,8 +281,6 @@ int radeon_object_kmap(struct radeon_object *robj, void **ptr) { int r = 0; - dbgprintf("%s\n",__FUNCTION__); - // spin_lock(&robj->tobj.lock); if (robj->kptr) { if (ptr) { @@ -319,11 +309,24 @@ int radeon_object_kmap(struct radeon_object *robj, void **ptr) *ptr = robj->kptr; } - dbgprintf("done %s\n",__FUNCTION__); - 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