Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307249
b: refs/heads/master
c: 4f256e8
h: refs/heads/master
i:
  307247: 2ca9735
v: v3
  • Loading branch information
Dave Airlie committed May 7, 2012
1 parent 9961dcf commit fb258b6
Show file tree
Hide file tree
Showing 51 changed files with 1,168 additions and 852 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dc257cf154be708ecc47b8b89c12ad8cd2cc35e4
refs/heads/master: 4f256e8aa3eda15c11c3cec3ec5336e1fc579cbd
18 changes: 9 additions & 9 deletions trunk/drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2104,7 +2104,7 @@ int drm_mode_addfb(struct drm_device *dev,

fb = dev->mode_config.funcs->fb_create(dev, file_priv, &r);
if (IS_ERR(fb)) {
DRM_ERROR("could not create framebuffer\n");
DRM_DEBUG_KMS("could not create framebuffer\n");
ret = PTR_ERR(fb);
goto out;
}
Expand Down Expand Up @@ -2193,7 +2193,7 @@ static int framebuffer_check(struct drm_mode_fb_cmd2 *r)

ret = format_check(r);
if (ret) {
DRM_ERROR("bad framebuffer format 0x%08x\n", r->pixel_format);
DRM_DEBUG_KMS("bad framebuffer format 0x%08x\n", r->pixel_format);
return ret;
}

Expand All @@ -2202,25 +2202,25 @@ static int framebuffer_check(struct drm_mode_fb_cmd2 *r)
num_planes = drm_format_num_planes(r->pixel_format);

if (r->width == 0 || r->width % hsub) {
DRM_ERROR("bad framebuffer width %u\n", r->height);
DRM_DEBUG_KMS("bad framebuffer width %u\n", r->height);
return -EINVAL;
}

if (r->height == 0 || r->height % vsub) {
DRM_ERROR("bad framebuffer height %u\n", r->height);
DRM_DEBUG_KMS("bad framebuffer height %u\n", r->height);
return -EINVAL;
}

for (i = 0; i < num_planes; i++) {
unsigned int width = r->width / (i != 0 ? hsub : 1);

if (!r->handles[i]) {
DRM_ERROR("no buffer object handle for plane %d\n", i);
DRM_DEBUG_KMS("no buffer object handle for plane %d\n", i);
return -EINVAL;
}

if (r->pitches[i] < drm_format_plane_cpp(r->pixel_format, i) * width) {
DRM_ERROR("bad pitch %u for plane %d\n", r->pitches[i], i);
DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i);
return -EINVAL;
}
}
Expand Down Expand Up @@ -2257,12 +2257,12 @@ int drm_mode_addfb2(struct drm_device *dev,
return -EINVAL;

if ((config->min_width > r->width) || (r->width > config->max_width)) {
DRM_ERROR("bad framebuffer width %d, should be >= %d && <= %d\n",
DRM_DEBUG_KMS("bad framebuffer width %d, should be >= %d && <= %d\n",
r->width, config->min_width, config->max_width);
return -EINVAL;
}
if ((config->min_height > r->height) || (r->height > config->max_height)) {
DRM_ERROR("bad framebuffer height %d, should be >= %d && <= %d\n",
DRM_DEBUG_KMS("bad framebuffer height %d, should be >= %d && <= %d\n",
r->height, config->min_height, config->max_height);
return -EINVAL;
}
Expand All @@ -2275,7 +2275,7 @@ int drm_mode_addfb2(struct drm_device *dev,

fb = dev->mode_config.funcs->fb_create(dev, file_priv, r);
if (IS_ERR(fb)) {
DRM_ERROR("could not create framebuffer\n");
DRM_DEBUG_KMS("could not create framebuffer\n");
ret = PTR_ERR(fb);
goto out;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/gpu/drm/gma500/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# KMS driver for the GMA500
#
ccflags-y += -Iinclude/drm
ccflags-y += -I$(srctree)/include/drm

gma500_gfx-y += gem_glue.o \
accel_2d.o \
Expand All @@ -12,8 +12,8 @@ gma500_gfx-y += gem_glue.o \
intel_bios.o \
intel_i2c.o \
intel_gmbus.o \
intel_opregion.o \
mmu.o \
opregion.o \
power.o \
psb_drv.o \
psb_intel_display.o \
Expand Down
117 changes: 53 additions & 64 deletions trunk/drivers/gpu/drm/gma500/cdv_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ static int cdv_output_init(struct drm_device *dev)
cdv_intel_crt_init(dev, &dev_priv->mode_dev);
cdv_intel_lvds_init(dev, &dev_priv->mode_dev);

/* These bits indicate HDMI not SDVO on CDV, but we don't yet support
the HDMI interface */
/* These bits indicate HDMI not SDVO on CDV */
if (REG_READ(SDVOB) & SDVO_DETECTED)
cdv_hdmi_init(dev, &dev_priv->mode_dev, SDVOB);
if (REG_READ(SDVOC) & SDVO_DETECTED)
Expand All @@ -69,76 +68,71 @@ static int cdv_output_init(struct drm_device *dev)
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE

/*
* Poulsbo Backlight Interfaces
* Cedartrail Backlght Interfaces
*/

#define BLC_PWM_PRECISION_FACTOR 100 /* 10000000 */
#define BLC_PWM_FREQ_CALC_CONSTANT 32
#define MHz 1000000

#define PSB_BLC_PWM_PRECISION_FACTOR 10
#define PSB_BLC_MAX_PWM_REG_FREQ 0xFFFE
#define PSB_BLC_MIN_PWM_REG_FREQ 0x2

#define PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR (0xFFFE)
#define PSB_BACKLIGHT_PWM_CTL_SHIFT (16)

static int cdv_brightness;
static struct backlight_device *cdv_backlight_device;

static int cdv_get_brightness(struct backlight_device *bd)
static int cdv_backlight_combination_mode(struct drm_device *dev)
{
/* return locally cached var instead of HW read (due to DPST etc.) */
/* FIXME: ideally return actual value in case firmware fiddled with
it */
return cdv_brightness;
return REG_READ(BLC_PWM_CTL2) & PWM_LEGACY_MODE;
}


static int cdv_backlight_setup(struct drm_device *dev)
static int cdv_get_brightness(struct backlight_device *bd)
{
struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long core_clock;
/* u32 bl_max_freq; */
/* unsigned long value; */
u16 bl_max_freq;
uint32_t value;
uint32_t blc_pwm_precision_factor;

/* get bl_max_freq and pol from dev_priv*/
if (!dev_priv->lvds_bl) {
dev_err(dev->dev, "Has no valid LVDS backlight info\n");
return -ENOENT;
}
bl_max_freq = dev_priv->lvds_bl->freq;
blc_pwm_precision_factor = PSB_BLC_PWM_PRECISION_FACTOR;
struct drm_device *dev = bl_get_data(bd);
u32 val = REG_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;

core_clock = dev_priv->core_freq;
if (cdv_backlight_combination_mode(dev)) {
u8 lbpc;

value = (core_clock * MHz) / BLC_PWM_FREQ_CALC_CONSTANT;
value *= blc_pwm_precision_factor;
value /= bl_max_freq;
value /= blc_pwm_precision_factor;
val &= ~1;
pci_read_config_byte(dev->pdev, 0xF4, &lbpc);
val *= lbpc;
}
return val;
}

if (value > (unsigned long long)PSB_BLC_MAX_PWM_REG_FREQ ||
value < (unsigned long long)PSB_BLC_MIN_PWM_REG_FREQ)
return -ERANGE;
else {
/* FIXME */
static u32 cdv_get_max_backlight(struct drm_device *dev)
{
u32 max = REG_READ(BLC_PWM_CTL);

if (max == 0) {
DRM_DEBUG_KMS("LVDS Panel PWM value is 0!\n");
/* i915 does this, I believe which means that we should not
* smash PWM control as firmware will take control of it. */
return 1;
}
return 0;

max >>= 16;
if (cdv_backlight_combination_mode(dev))
max *= 0xff;
return max;
}

static int cdv_set_brightness(struct backlight_device *bd)
{
struct drm_device *dev = bl_get_data(bd);
int level = bd->props.brightness;
u32 blc_pwm_ctl;

/* Percentage 1-100% being valid */
if (level < 1)
level = 1;

/*cdv_intel_lvds_set_brightness(dev, level); FIXME */
cdv_brightness = level;
if (cdv_backlight_combination_mode(dev)) {
u32 max = cdv_get_max_backlight(dev);
u8 lbpc;

lbpc = level * 0xfe / max + 1;
level /= lbpc;

pci_write_config_byte(dev->pdev, 0xF4, lbpc);
}

blc_pwm_ctl = REG_READ(BLC_PWM_CTL) & ~BACKLIGHT_DUTY_CYCLE_MASK;
REG_WRITE(BLC_PWM_CTL, (blc_pwm_ctl |
(level << BACKLIGHT_DUTY_CYCLE_SHIFT)));
return 0;
}

Expand All @@ -150,7 +144,6 @@ static const struct backlight_ops cdv_ops = {
static int cdv_backlight_init(struct drm_device *dev)
{
struct drm_psb_private *dev_priv = dev->dev_private;
int ret;
struct backlight_properties props;

memset(&props, 0, sizeof(struct backlight_properties));
Expand All @@ -162,14 +155,9 @@ static int cdv_backlight_init(struct drm_device *dev)
if (IS_ERR(cdv_backlight_device))
return PTR_ERR(cdv_backlight_device);

ret = cdv_backlight_setup(dev);
if (ret < 0) {
backlight_device_unregister(cdv_backlight_device);
cdv_backlight_device = NULL;
return ret;
}
cdv_backlight_device->props.brightness = 100;
cdv_backlight_device->props.max_brightness = 100;
cdv_backlight_device->props.brightness =
cdv_get_brightness(cdv_backlight_device);
cdv_backlight_device->props.max_brightness = cdv_get_max_backlight(dev);
backlight_update_status(cdv_backlight_device);
dev_priv->backlight_device = cdv_backlight_device;
return 0;
Expand Down Expand Up @@ -244,11 +232,12 @@ static void cdv_init_pm(struct drm_device *dev)
static void cdv_errata(struct drm_device *dev)
{
/* Disable bonus launch.
* CPU and GPU competes for memory and display misses updates and flickers.
* Worst with dual core, dual displays.
* CPU and GPU competes for memory and display misses updates and
* flickers. Worst with dual core, dual displays.
*
* Fixes were done to Win 7 gfx driver to disable a feature called Bonus
* Launch to work around the issue, by degrading performance.
* Fixes were done to Win 7 gfx driver to disable a feature called
* Bonus Launch to work around the issue, by degrading
* performance.
*/
CDV_MSG_WRITE32(3, 0x30, 0x08027108);
}
Expand Down Expand Up @@ -501,7 +490,7 @@ static int cdv_chip_setup(struct drm_device *dev)
struct drm_psb_private *dev_priv = dev->dev_private;
INIT_WORK(&dev_priv->hotplug_work, cdv_hotplug_work_func);
cdv_get_core_freq(dev);
gma_intel_opregion_init(dev);
psb_intel_opregion_init(dev);
psb_intel_init_bios(dev);
cdv_hotplug_enable(dev, false);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/gpu/drm/gma500/cdv_intel_lvds.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ static void cdv_intel_lvds_enc_destroy(struct drm_encoder *encoder)
drm_encoder_cleanup(encoder);
}

const struct drm_encoder_funcs cdv_intel_lvds_enc_funcs = {
static const struct drm_encoder_funcs cdv_intel_lvds_enc_funcs = {
.destroy = cdv_intel_lvds_enc_destroy,
};

Expand Down
7 changes: 4 additions & 3 deletions trunk/drivers/gpu/drm/gma500/framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ static int psbfb_create(struct psb_fbdev *fbdev,
return -ENOMEM;
}

memset(dev_priv->vram_addr + backing->offset, 0, size);

mutex_lock(&dev->struct_mutex);

info = framebuffer_alloc(0, device);
Expand Down Expand Up @@ -453,8 +455,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
info->fix.ypanstep = 0;

/* Accessed stolen memory directly */
info->screen_base = (char *)dev_priv->vram_addr +
backing->offset;
info->screen_base = dev_priv->vram_addr + backing->offset;
info->screen_size = size;

if (dev_priv->gtt.stolen_size) {
Expand Down Expand Up @@ -571,7 +572,7 @@ static int psbfb_probe(struct drm_fb_helper *helper,
return new_fb;
}

struct drm_fb_helper_funcs psb_fb_helper_funcs = {
static struct drm_fb_helper_funcs psb_fb_helper_funcs = {
.gamma_set = psbfb_gamma_set,
.gamma_get = psbfb_gamma_get,
.fb_probe = psbfb_probe,
Expand Down
14 changes: 8 additions & 6 deletions trunk/drivers/gpu/drm/gma500/gtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static inline uint32_t psb_gtt_mask_pte(uint32_t pfn, int type)
* Given a gtt_range object return the GTT offset of the page table
* entries for this gtt_range
*/
static u32 *psb_gtt_entry(struct drm_device *dev, struct gtt_range *r)
static u32 __iomem *psb_gtt_entry(struct drm_device *dev, struct gtt_range *r)
{
struct drm_psb_private *dev_priv = dev->dev_private;
unsigned long offset;
Expand All @@ -82,7 +82,8 @@ static u32 *psb_gtt_entry(struct drm_device *dev, struct gtt_range *r)
*/
static int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r)
{
u32 *gtt_slot, pte;
u32 __iomem *gtt_slot;
u32 pte;
struct page **pages;
int i;

Expand Down Expand Up @@ -126,7 +127,8 @@ static int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r)
static void psb_gtt_remove(struct drm_device *dev, struct gtt_range *r)
{
struct drm_psb_private *dev_priv = dev->dev_private;
u32 *gtt_slot, pte;
u32 __iomem *gtt_slot;
u32 pte;
int i;

WARN_ON(r->stolen);
Expand All @@ -152,7 +154,8 @@ static void psb_gtt_remove(struct drm_device *dev, struct gtt_range *r)
*/
void psb_gtt_roll(struct drm_device *dev, struct gtt_range *r, int roll)
{
u32 *gtt_slot, pte;
u32 __iomem *gtt_slot;
u32 pte;
int i;

if (roll >= r->npage) {
Expand Down Expand Up @@ -413,7 +416,6 @@ int psb_gtt_init(struct drm_device *dev, int resume)
unsigned long stolen_size, vram_stolen_size;
unsigned i, num_pages;
unsigned pfn_base;
uint32_t vram_pages;
uint32_t dvmt_mode = 0;
struct psb_gtt *pg;

Expand Down Expand Up @@ -529,7 +531,7 @@ int psb_gtt_init(struct drm_device *dev, int resume)
*/

pfn_base = dev_priv->stolen_base >> PAGE_SHIFT;
vram_pages = num_pages = vram_stolen_size >> PAGE_SHIFT;
num_pages = vram_stolen_size >> PAGE_SHIFT;
printk(KERN_INFO"Set up %d stolen pages starting at 0x%08x, GTT offset %dK\n",
num_pages, pfn_base << PAGE_SHIFT, 0);
for (i = 0; i < num_pages; ++i) {
Expand Down
Loading

0 comments on commit fb258b6

Please sign in to comment.