Subversion Repositories Kolibri OS

Rev

Rev 1221 | Rev 1268 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1221 Rev 1246
Line 238... Line 238...
238
	drm_fb_helper_crtc_free(helper);
238
	drm_fb_helper_crtc_free(helper);
239
	return -ENOMEM;
239
	return -ENOMEM;
240
}
240
}
241
EXPORT_SYMBOL(drm_fb_helper_init_crtc_count);
241
EXPORT_SYMBOL(drm_fb_helper_init_crtc_count);
Line 242... Line 242...
242
 
242
 
243
static void setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
243
static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
244
		     u16 blue, u16 regno, struct fb_info *info)
244
		     u16 blue, u16 regno, struct fb_info *info)
245
{
245
{
246
	struct drm_fb_helper *fb_helper = info->par;
246
	struct drm_fb_helper *fb_helper = info->par;
247
	struct drm_framebuffer *fb = fb_helper->fb;
247
	struct drm_framebuffer *fb = fb_helper->fb;
Line -... Line 248...
-
 
248
	int pindex;
-
 
249
 
-
 
250
	if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
-
 
251
		u32 *palette;
-
 
252
		u32 value;
-
 
253
		/* place color in psuedopalette */
-
 
254
		if (regno > 16)
-
 
255
			return -EINVAL;
-
 
256
		palette = (u32 *)info->pseudo_palette;
-
 
257
		red >>= (16 - info->var.red.length);
-
 
258
		green >>= (16 - info->var.green.length);
-
 
259
		blue >>= (16 - info->var.blue.length);
-
 
260
		value = (red << info->var.red.offset) |
-
 
261
			(green << info->var.green.offset) |
-
 
262
			(blue << info->var.blue.offset);
-
 
263
		palette[regno] = value;
-
 
264
		return 0;
248
	int pindex;
265
	}
Line 249... Line 266...
249
 
266
 
250
	pindex = regno;
267
	pindex = regno;
Line 251... Line 268...
251
 
268
 
252
	if (fb->bits_per_pixel == 16) {
269
	if (fb->bits_per_pixel == 16) {
253
		pindex = regno << 3;
270
		pindex = regno << 3;
254
 
271
 
Line 255... Line 272...
255
		if (fb->depth == 16 && regno > 63)
272
		if (fb->depth == 16 && regno > 63)
256
			return;
273
			return -EINVAL;
257
		if (fb->depth == 15 && regno > 31)
274
		if (fb->depth == 15 && regno > 31)
258
			return;
275
			return -EINVAL;
Line 277... Line 294...
277
		}
294
		}
278
	}
295
	}
Line 279... Line 296...
279
 
296
 
280
	if (fb->depth != 16)
297
	if (fb->depth != 16)
281
		fb_helper->funcs->gamma_set(crtc, red, green, blue, pindex);
-
 
282
 
-
 
283
	if (regno < 16 && info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
-
 
284
		((u32 *) fb->pseudo_palette)[regno] =
-
 
285
			(regno << info->var.red.offset) |
-
 
286
			(regno << info->var.green.offset) |
-
 
287
			(regno << info->var.blue.offset);
298
		fb_helper->funcs->gamma_set(crtc, red, green, blue, pindex);
288
	}
299
	return 0;
Line 289... Line 300...
289
}
300
}
290
 
301
 
291
int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
302
int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info)
Line 320... Line 331...
320
			hblue = *blue++;
331
			hblue = *blue++;
Line 321... Line 332...
321
 
332
 
322
			if (transp)
333
			if (transp)
Line 323... Line 334...
323
				htransp = *transp++;
334
				htransp = *transp++;
-
 
335
 
-
 
336
			rc = setcolreg(crtc, hred, hgreen, hblue, start++, info);
324
 
337
			if (rc)
325
			setcolreg(crtc, hred, hgreen, hblue, start++, info);
338
				return rc;
326
		}
339
		}
327
		crtc_funcs->load_lut(crtc);
340
		crtc_funcs->load_lut(crtc);
328
	}
341
	}
Line 339... Line 352...
339
{
352
{
340
	struct drm_fb_helper *fb_helper = info->par;
353
	struct drm_fb_helper *fb_helper = info->par;
341
	struct drm_device *dev = fb_helper->dev;
354
	struct drm_device *dev = fb_helper->dev;
342
	struct drm_crtc *crtc;
355
	struct drm_crtc *crtc;
343
	int i;
356
	int i;
-
 
357
	int ret;
Line 344... Line 358...
344
 
358
 
345
	if (regno > 255)
359
	if (regno > 255)
Line 346... Line 360...
346
		return 1;
360
		return 1;
Line 352... Line 366...
352
				break;
366
				break;
353
		}
367
		}
354
		if (i == fb_helper->crtc_count)
368
		if (i == fb_helper->crtc_count)
355
			continue;
369
			continue;
Line -... Line 370...
-
 
370
 
-
 
371
		ret = setcolreg(crtc, red, green, blue, regno, info);
-
 
372
		if (ret)
Line 356... Line -...
356
 
-
 
357
 
373
			return ret;
358
		setcolreg(crtc, red, green, blue, regno, info);
374
 
359
		crtc_funcs->load_lut(crtc);
375
		crtc_funcs->load_lut(crtc);
360
	}
376
	}
361
	return 0;
377
	return 0;
Line 700... Line 716...
700
void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
716
void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
701
			    uint32_t depth)
717
			    uint32_t depth)
702
{
718
{
703
	info->fix.type = FB_TYPE_PACKED_PIXELS;
719
	info->fix.type = FB_TYPE_PACKED_PIXELS;
704
	info->fix.visual = depth == 8 ? FB_VISUAL_PSEUDOCOLOR :
720
	info->fix.visual = depth == 8 ? FB_VISUAL_PSEUDOCOLOR :
705
		FB_VISUAL_DIRECTCOLOR;
721
		FB_VISUAL_TRUECOLOR;
706
	info->fix.type_aux = 0;
722
	info->fix.type_aux = 0;
707
	info->fix.xpanstep = 1; /* doing it in hw */
723
	info->fix.xpanstep = 1; /* doing it in hw */
708
	info->fix.ypanstep = 1; /* doing it in hw */
724
	info->fix.ypanstep = 1; /* doing it in hw */
709
	info->fix.ywrapstep = 0;
725
	info->fix.ywrapstep = 0;
710
	info->fix.accel = FB_ACCEL_NONE;
726
	info->fix.accel = FB_ACCEL_NONE;