Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307117
b: refs/heads/master
c: cce66a2
h: refs/heads/master
i:
  307115: 0b740ed
v: v3
  • Loading branch information
Ben Widawsky authored and Daniel Vetter committed Apr 12, 2012
1 parent 161ba70 commit 5ee2c0d
Show file tree
Hide file tree
Showing 67 changed files with 725 additions and 2,834 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: c6543a6e64ad8e456674a1c4a01dd024e38b665f
refs/heads/master: cce66a283e36e7479774de47ae9f33f7db2b8fcf
6 changes: 0 additions & 6 deletions trunk/arch/x86/include/asm/vga.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,4 @@
#define vga_readb(x) (*(x))
#define vga_writeb(x, y) (*(y) = (x))

#ifdef CONFIG_FB_EFI
#define __ARCH_HAS_VGA_DEFAULT_DEVICE
extern struct pci_dev *vga_default_device(void);
extern void vga_set_default_device(struct pci_dev *pdev);
#endif

#endif /* _ASM_X86_VGA_H */
20 changes: 5 additions & 15 deletions trunk/arch/x86/video/fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,24 @@
#include <linux/fb.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <linux/vgaarb.h>

int fb_is_primary_device(struct fb_info *info)
{
struct device *device = info->device;
struct pci_dev *pci_dev = NULL;
struct pci_dev *default_device = vga_default_device();
struct resource *res = NULL;
int retval = 0;

if (device)
pci_dev = to_pci_dev(device);

if (!pci_dev)
return 0;

if (default_device) {
if (pci_dev == default_device)
return 1;
else
return 0;
}

res = &pci_dev->resource[PCI_ROM_RESOURCE];
if (pci_dev)
res = &pci_dev->resource[PCI_ROM_RESOURCE];

if (res && res->flags & IORESOURCE_ROM_SHADOW)
return 1;
retval = 1;

return 0;
return retval;
}
EXPORT_SYMBOL(fb_is_primary_device);
MODULE_LICENSE("GPL");
4 changes: 3 additions & 1 deletion trunk/drivers/char/agp/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
if (set_memory_uc((unsigned long)table, 1 << page_order))
printk(KERN_WARNING "Could not set GATT table memory to UC!\n");

bridge->gatt_table = (u32 __iomem *)table;
bridge->gatt_table = (void *)table;
#else
bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
(PAGE_SIZE * (1 << page_order)));
Expand Down Expand Up @@ -1010,6 +1010,7 @@ int agp_generic_free_gatt_table(struct agp_bridge_data *bridge)
case LVL2_APER_SIZE:
/* The generic routines can't deal with 2 level gatt's */
return -EINVAL;
break;
default:
page_order = 0;
break;
Expand Down Expand Up @@ -1076,6 +1077,7 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
case LVL2_APER_SIZE:
/* The generic routines can't deal with 2 level gatt's */
return -EINVAL;
break;
default:
num_entries = 0;
break;
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/char/agp/sgi-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ static int sgi_tioca_insert_memory(struct agp_memory *mem, off_t pg_start,
break;
case LVL2_APER_SIZE:
return -EINVAL;
break;
default:
num_entries = 0;
break;
Expand Down
9 changes: 4 additions & 5 deletions trunk/drivers/gpu/drm/drm_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,11 @@ static int drm_ctxbitmap_next(struct drm_device * dev)
mutex_lock(&dev->struct_mutex);
ret = idr_get_new_above(&dev->ctx_idr, NULL,
DRM_RESERVED_CONTEXTS, &new_id);
mutex_unlock(&dev->struct_mutex);
if (ret == -EAGAIN)
if (ret == -EAGAIN) {
mutex_unlock(&dev->struct_mutex);
goto again;
else if (ret)
return ret;

}
mutex_unlock(&dev->struct_mutex);
return new_id;
}

Expand Down
188 changes: 5 additions & 183 deletions trunk/drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,14 @@ static int drm_mode_object_get(struct drm_device *dev,
again:
if (idr_pre_get(&dev->mode_config.crtc_idr, GFP_KERNEL) == 0) {
DRM_ERROR("Ran out memory getting a mode number\n");
return -ENOMEM;
return -EINVAL;
}

mutex_lock(&dev->mode_config.idr_mutex);
ret = idr_get_new_above(&dev->mode_config.crtc_idr, obj, 1, &new_id);
mutex_unlock(&dev->mode_config.idr_mutex);
if (ret == -EAGAIN)
goto again;
else if (ret)
return ret;

obj->id = new_id;
obj->type = obj_type;
Expand Down Expand Up @@ -2187,47 +2185,6 @@ static int format_check(struct drm_mode_fb_cmd2 *r)
}
}

static int framebuffer_check(struct drm_mode_fb_cmd2 *r)
{
int ret, hsub, vsub, num_planes, i;

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

hsub = drm_format_horz_chroma_subsampling(r->pixel_format);
vsub = drm_format_vert_chroma_subsampling(r->pixel_format);
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);
return -EINVAL;
}

if (r->height == 0 || r->height % vsub) {
DRM_ERROR("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);
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);
return -EINVAL;
}
}

return 0;
}

/**
* drm_mode_addfb2 - add an FB to the graphics configuration
* @inode: inode from the ioctl
Expand Down Expand Up @@ -2267,9 +2224,11 @@ int drm_mode_addfb2(struct drm_device *dev,
return -EINVAL;
}

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

mutex_lock(&dev->mode_config.mutex);

Expand Down Expand Up @@ -3507,140 +3466,3 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
}
}
EXPORT_SYMBOL(drm_fb_get_bpp_depth);

/**
* drm_format_num_planes - get the number of planes for format
* @format: pixel format (DRM_FORMAT_*)
*
* RETURNS:
* The number of planes used by the specified pixel format.
*/
int drm_format_num_planes(uint32_t format)
{
switch (format) {
case DRM_FORMAT_YUV410:
case DRM_FORMAT_YVU410:
case DRM_FORMAT_YUV411:
case DRM_FORMAT_YVU411:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YUV422:
case DRM_FORMAT_YVU422:
case DRM_FORMAT_YUV444:
case DRM_FORMAT_YVU444:
return 3;
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV61:
return 2;
default:
return 1;
}
}
EXPORT_SYMBOL(drm_format_num_planes);

/**
* drm_format_plane_cpp - determine the bytes per pixel value
* @format: pixel format (DRM_FORMAT_*)
* @plane: plane index
*
* RETURNS:
* The bytes per pixel value for the specified plane.
*/
int drm_format_plane_cpp(uint32_t format, int plane)
{
unsigned int depth;
int bpp;

if (plane >= drm_format_num_planes(format))
return 0;

switch (format) {
case DRM_FORMAT_YUYV:
case DRM_FORMAT_YVYU:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
return 2;
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV61:
return plane ? 2 : 1;
case DRM_FORMAT_YUV410:
case DRM_FORMAT_YVU410:
case DRM_FORMAT_YUV411:
case DRM_FORMAT_YVU411:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YUV422:
case DRM_FORMAT_YVU422:
case DRM_FORMAT_YUV444:
case DRM_FORMAT_YVU444:
return 1;
default:
drm_fb_get_bpp_depth(format, &depth, &bpp);
return bpp >> 3;
}
}
EXPORT_SYMBOL(drm_format_plane_cpp);

/**
* drm_format_horz_chroma_subsampling - get the horizontal chroma subsampling factor
* @format: pixel format (DRM_FORMAT_*)
*
* RETURNS:
* The horizontal chroma subsampling factor for the
* specified pixel format.
*/
int drm_format_horz_chroma_subsampling(uint32_t format)
{
switch (format) {
case DRM_FORMAT_YUV411:
case DRM_FORMAT_YVU411:
case DRM_FORMAT_YUV410:
case DRM_FORMAT_YVU410:
return 4;
case DRM_FORMAT_YUYV:
case DRM_FORMAT_YVYU:
case DRM_FORMAT_UYVY:
case DRM_FORMAT_VYUY:
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV61:
case DRM_FORMAT_YUV422:
case DRM_FORMAT_YVU422:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
return 2;
default:
return 1;
}
}
EXPORT_SYMBOL(drm_format_horz_chroma_subsampling);

/**
* drm_format_vert_chroma_subsampling - get the vertical chroma subsampling factor
* @format: pixel format (DRM_FORMAT_*)
*
* RETURNS:
* The vertical chroma subsampling factor for the
* specified pixel format.
*/
int drm_format_vert_chroma_subsampling(uint32_t format)
{
switch (format) {
case DRM_FORMAT_YUV410:
case DRM_FORMAT_YVU410:
return 4;
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV21:
return 2;
default:
return 1;
}
}
EXPORT_SYMBOL(drm_format_vert_chroma_subsampling);
33 changes: 33 additions & 0 deletions trunk/drivers/gpu/drm/drm_crtc_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,3 +1023,36 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, 0);
}
EXPORT_SYMBOL(drm_helper_hpd_irq_event);


/**
* drm_format_num_planes - get the number of planes for format
* @format: pixel format (DRM_FORMAT_*)
*
* RETURNS:
* The number of planes used by the specified pixel format.
*/
int drm_format_num_planes(uint32_t format)
{
switch (format) {
case DRM_FORMAT_YUV410:
case DRM_FORMAT_YVU410:
case DRM_FORMAT_YUV411:
case DRM_FORMAT_YVU411:
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YUV422:
case DRM_FORMAT_YVU422:
case DRM_FORMAT_YUV444:
case DRM_FORMAT_YVU444:
return 3;
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV61:
return 2;
default:
return 1;
}
}
EXPORT_SYMBOL(drm_format_num_planes);
Loading

0 comments on commit 5ee2c0d

Please sign in to comment.