i915-4.4 update

git-svn-id: svn://kolibrios.org@6103 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2016-01-27 05:47:59 +00:00
parent cf125b5b49
commit 5d98dda3cf
12 changed files with 124 additions and 102 deletions

View File

@ -22,7 +22,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
//#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/sched.h>

View File

@ -44,7 +44,7 @@
//#include <linux/pnp.h>
//#include <linux/vga_switcheroo.h>
#include <linux/slab.h>
//#include <acpi/video.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen);

View File

@ -2691,10 +2691,10 @@ struct i915_params {
bool verbose_state_checks;
bool nuclear_pageflip;
int edp_vswing;
/* Kolibri related */
int fbsize;
char *log_file;
char *cmdline_mode;
/* Kolibri related */
int fbsize;
char *log_file;
char *cmdline_mode;
};
extern struct i915_params i915 __read_mostly;
@ -3540,7 +3540,7 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms)
if (time_after(target_jiffies, tmp_jiffies)) {
remaining_jiffies = target_jiffies - tmp_jiffies;
delay(remaining_jiffies);
delay(remaining_jiffies);
}
}

View File

@ -1055,7 +1055,7 @@ int __i915_wait_request(struct drm_i915_gem_request *req,
wait.evnt = CreateEvent(NULL, MANUAL_DESTROY);
for (;;) {
unsigned long flags;
unsigned long flags;
/* We need to check whether any gpu reset happened in between
* the caller grabbing the seqno and now ... */

View File

@ -28,6 +28,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/sysrq.h>
#include <linux/slab.h>
#include <linux/circ_buf.h>
#include <drm/drmP.h>

View File

@ -1085,6 +1085,14 @@ intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
name, ret);
return;
}
ret = sysfs_create_link(&connector->base.kdev->kobj,
&intel_dp->aux.ddc.dev.kobj,
intel_dp->aux.ddc.dev.kobj.name);
if (ret < 0) {
DRM_ERROR("sysfs_create_link() for %s failed (%d)\n", name, ret);
drm_dp_aux_unregister(&intel_dp->aux);
}
}
static void
@ -1092,6 +1100,9 @@ intel_dp_connector_unregister(struct intel_connector *intel_connector)
{
struct intel_dp *intel_dp = intel_attached_dp(&intel_connector->base);
if (!intel_connector->mst_port)
sysfs_remove_link(&intel_connector->base.kdev->kobj,
intel_dp->aux.ddc.dev.kobj.name);
intel_connector_unregister(intel_connector);
}

View File

@ -25,8 +25,6 @@
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/acpi.h>
#include <acpi/video.h>

View File

@ -2347,6 +2347,8 @@ intel_sdvo_connector_unregister(struct intel_connector *intel_connector)
drm_connector = &intel_connector->base;
sdvo_encoder = intel_attached_sdvo(&intel_connector->base);
sysfs_remove_link(&drm_connector->kdev->kobj,
sdvo_encoder->ddc.dev.kobj.name);
intel_connector_unregister(intel_connector);
}
@ -2379,6 +2381,12 @@ intel_sdvo_connector_init(struct intel_sdvo_connector *connector,
if (ret < 0)
goto err1;
ret = sysfs_create_link(&drm_connector->kdev->kobj,
&encoder->ddc.dev.kobj,
encoder->ddc.dev.kobj.name);
if (ret < 0)
goto err2;
return 0;
err2:

View File

@ -85,9 +85,8 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
enum pipe pipe = crtc->pipe;
long timeout = msecs_to_jiffies_timeout(1);
int scanline, min, max, vblank_start;
#if 0
// wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
// DEFINE_WAIT(wait);
wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
DEFINE_WAIT(wait);
vblank_start = adjusted_mode->crtc_vblank_start;
if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
@ -97,11 +96,13 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
min = vblank_start - usecs_to_scanlines(adjusted_mode, 100);
max = vblank_start - 1;
local_irq_disable();
if (min <= 0 || max <= 0)
return;
// if (WARN_ON(drm_vblank_get(dev, pipe)))
// return false;
if (WARN_ON(drm_crtc_vblank_get(&crtc->base)))
return;
crtc->debug.min_vbl = min;
crtc->debug.max_vbl = max;
@ -125,15 +126,21 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
break;
}
// local_irq_enable();
local_irq_enable();
schedule_timeout(timeout);
timeout = 0;
// local_irq_disable();
{
unsigned long expire;
expire = timeout + jiffies;
WaitEventTimeout(wait.evnt, timeout);;
timeout = expire - jiffies;
timeout = timeout < 0 ? 0 : timeout;
}
local_irq_disable();
}
finish_wait(wq, &wait);
#endif
drm_crtc_vblank_put(&crtc->base);
crtc->debug.scanline_start = scanline;
crtc->debug.start_vbl_time = ktime_get();
@ -162,7 +169,7 @@ void intel_pipe_update_end(struct intel_crtc *crtc)
trace_i915_pipe_update_end(crtc, end_vbl_count, scanline_end);
// local_irq_enable();
local_irq_enable();
if (crtc->debug.start_vbl_count &&
crtc->debug.start_vbl_count != end_vbl_count) {

View File

@ -74,8 +74,6 @@ static int set_mode(struct drm_device *dev, struct drm_connector *connector,
int stride;
int ret;
ENTER();
drm_modeset_lock_all(dev);
list_for_each_entry(tmpc, &dev->mode_config.connector_list, head)
@ -206,8 +204,6 @@ do_set:
drm_modeset_unlock_all(dev);
LEAVE();
return ret;
}
@ -223,8 +219,6 @@ static int set_mode_ex(struct drm_device *dev,
int stride;
int ret;
ENTER();
drm_modeset_lock_all(dev);
list_for_each_entry(tmpc, &dev->mode_config.connector_list, head)
@ -322,8 +316,6 @@ ENTER();
drm_modeset_unlock_all(dev);
LEAVE();
return ret;
}
@ -422,10 +414,7 @@ static struct drm_connector* get_cmdline_connector(struct drm_device *dev, const
static int choose_config(struct drm_device *dev, struct drm_connector **boot_connector,
struct drm_crtc **boot_crtc)
{
const struct drm_connector_helper_funcs *connector_funcs;
struct drm_connector *connector = NULL;
struct drm_encoder *encoder = NULL;
struct drm_crtc *crtc = NULL;
struct drm_connector *connector;
if((i915.cmdline_mode != NULL) && (*i915.cmdline_mode != 0))
{
@ -451,6 +440,7 @@ static int choose_config(struct drm_device *dev, struct drm_connector **boot_con
return -ENOENT;
};
static int get_boot_mode(struct drm_connector *connector, videomode_t *usermode)
{
struct drm_display_mode *mode;
@ -481,8 +471,6 @@ int init_display_kms(struct drm_device *dev, videomode_t *usermode)
u32 ifl;
int ret;
ENTER();
mutex_lock(&dev->mode_config.mutex);
ret = choose_config(dev, &connector, &crtc);
if(ret)
@ -571,8 +559,6 @@ ENTER();
err = init_bitmaps();
#endif
LEAVE();
return ret;
};
@ -581,13 +567,12 @@ int set_cmdline_mode_ext(struct drm_device *dev, const char *cmdline)
{
struct drm_connector_helper_funcs *connector_funcs;
struct drm_connector *connector;
struct drm_cmdline_mode cmd_mode;
struct drm_cmdline_mode cmd_mode = {0};
struct drm_display_mode *mode;
char *mode_option;
int retval = 0;
char con_edid[128];
ENTER();
if((cmdline == NULL) || (*cmdline == 0))
return EINVAL;
@ -604,8 +589,6 @@ ENTER();
mode_option++;
__builtin_memset(&cmd_mode, 0, sizeof(cmd_mode));
if( !drm_mode_parse_command_line_for_connector(mode_option, connector, &cmd_mode))
return EINVAL;
@ -633,10 +616,69 @@ ENTER();
drm_mode_destroy(dev, mode);
LEAVE();
return retval;
}
void list_connectors(struct drm_device *dev)
{
struct drm_connector *connector;
char con_edid[128];
mutex_lock(&dev->mode_config.mutex);
list_for_each_entry(connector, &dev->mode_config.connector_list, head)
{
if( connector->status != connector_status_connected)
continue;
memcpy(con_edid, connector->edid_blob_ptr->data, 128);
if(connector == os_display->connector)
{
printf("%s mode %dx%d connected %s model %x serial number %u\n",
connector->name, os_display->width, os_display->height,
manufacturer_name(con_edid + 0x08),
(unsigned short)(con_edid[0x0A] + (con_edid[0x0B] << 8)),
(unsigned int)(con_edid[0x0C] + (con_edid[0x0D] << 8)
+ (con_edid[0x0E] << 16) + (con_edid[0x0F] << 24)));
continue;
}
else
{
printf("%s connected: %s model %x serial number %u\n",
connector->name, manufacturer_name(con_edid + 0x08),
(unsigned short)(con_edid[0x0A] + (con_edid[0x0B] << 8)),
(unsigned int)(con_edid[0x0C] + (con_edid[0x0D] << 8)
+ (con_edid[0x0E] << 16) + (con_edid[0x0F] << 24)));
}
};
mutex_unlock(&dev->mode_config.mutex);
}
int list_connector_modes(struct drm_device *dev, const char* name)
{
struct drm_connector *connector;
struct drm_display_mode *drmmode;
mutex_lock(&dev->mode_config.mutex);
connector = get_cmdline_connector(dev, name);
if(connector == NULL)
{
mutex_unlock(&dev->mode_config.mutex);
return EINVAL;
};
printf("connector %s probed modes :\n", connector->name);
list_for_each_entry(drmmode, &connector->modes, head)
{
printf("%dx%d@%d\n", drmmode->hdisplay, drmmode->vdisplay, drm_mode_vrefresh(drmmode));
};
mutex_unlock(&dev->mode_config.mutex);
return 0;
};
int get_videomodes(videomode_t *mode, int *count)
{
int err = -1;

View File

@ -277,6 +277,7 @@ int do_command_line(const char* usercmd)
char *cmdline;
int argc, i, c;
char **argv;
int retval = 0;
if( (usercmd == NULL) || (*usercmd == 0) )
return 1;
@ -295,7 +296,9 @@ int do_command_line(const char* usercmd)
{
static struct option long_options[] =
{
{"video", required_argument, 0, 'v'},
{"list-connectors", no_argument, 0, OPTION_CONNECTORS},
{"list-connector-modes", required_argument, 0, OPTION_CONN_MODES},
{"video", required_argument, 0, 'v'},
{0, 0, 0, 0}
};
@ -311,14 +314,22 @@ int do_command_line(const char* usercmd)
{
case 'v':
printf("cmdline_mode %s\n",optarg);
set_cmdline_mode_ext(main_device, optarg);
retval = set_cmdline_mode_ext(main_device, optarg);
break;
case OPTION_CONNECTORS:
list_connectors(main_device);
break;
case OPTION_CONN_MODES:
retval = list_connector_modes(main_device, optarg);
break;
}
}
__builtin_free(argv);
__builtin_free(cmdline);
return 0;
return retval;
};
#define CURRENT_API 0x0200 /* 2.00 */
@ -856,31 +867,3 @@ static char* parse_mode(char *p, videomode_t *mode)
return p;
};
#include <linux/math64.h>
u64 long_div(u64 dividend, u64 divisor)
{
#if 1
u32 high = divisor >> 32;
u64 quot;
if (high == 0) {
quot = div_u64(dividend, divisor);
} else {
int n = 1 + fls(high);
quot = div_u64(dividend >> n, divisor >> n);
if (quot != 0)
quot--;
if ((dividend - quot * divisor) >= divisor)
quot++;
}
return quot;
#endif
// return dividend / divisor;
};

View File

@ -973,34 +973,6 @@ int split_cmdline(char *cmdline, char **argv)
return argc;
};
char *strstr(const char *cs, const char *ct)
{
int d0, d1;
register char *__res;
__asm__ __volatile__(
"movl %6,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
"movl %%ecx,%%edx\n"
"1:\tmovl %6,%%edi\n\t"
"movl %%esi,%%eax\n\t"
"movl %%edx,%%ecx\n\t"
"repe\n\t"
"cmpsb\n\t"
"je 2f\n\t" /* also works for empty string, see above */
"xchgl %%eax,%%esi\n\t"
"incl %%esi\n\t"
"cmpb $0,-1(%%eax)\n\t"
"jne 1b\n\t"
"xorl %%eax,%%eax\n\t"
"2:"
: "=a" (__res), "=&c" (d0), "=&S" (d1)
: "0" (0), "1" (0xffffffff), "2" (cs), "g" (ct)
: "dx", "di");
return __res;
}
fb_get_options(const char *name, char **option)
{